diff --git a/.gitignore b/.gitignore index 1223d0d..14539ff 100644 --- a/.gitignore +++ b/.gitignore @@ -121,3 +121,6 @@ Desktop.ini # Node **/node_modules *.tgz + +# Rollup +.rollup.cache \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..cf00dc7 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": ["ronnidc.nunjucks"], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index c682248..384cbd2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "cSpell.words": ["caml", "coeff", "rmse"], + "cSpell.words": ["absdev", "caml", "coeff", "datetime", "rmse", "Subtrainee", "targetless", "timedelta"], "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, diff --git a/MIGRATION.md b/MIGRATION.md index f54ed68..7e16b11 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,37 @@ # Migration notes +## 6.x + +This major change refactors the client and types for all Howso Engine operations. + +### Typing Changes + +- Most of all the types are now autogenerated from the Engine API, and will have a different naming schema across + the board. However, most of the type's properties should remain the same. +- `types/shims` have been added as a stop gap for types lost from this migration. These will be transitioned out as + types improve in the Howso Engine API specification. +- The existing `Trainee` type has been renamed to `BaseTrainee` and no longer has a `features` property. Request + features via the method `getFeatureAttributes` instead. + +### Client Changes + +- `BaseClient` has been renamed to `AbstractBaseClient`. +- `WasmClient` has been renamed to `HowsoWorkerClient`. +- `ProblemError` has been renamed to `HowsoError`. +- `ValidationError` has been renamed to `HowsoValidationError`. +- `ApiError`, `TimeoutError`, and `RetriableError` have been removed. +- The client's `ClientOptions.libDir` property has been removed. +- The client constructor now expects an instance of an `AbstractFileSystem` as its second parameter. + A `BrowserFileSystem` and `NodeFileSystem` are provided for use in their respective environments. +- The `train` method no longer batches requests to the Amalgam worker service automatically. Use `batchTrain` instead. +- The `createTrainee` method no longer sets feature attributes. Call `setFeatureAttributes` manually instead + (this also returns the updated object back). +- The `client/capabilities/*` interfaces have been removed. +- The return value of all Trainee operations has been changed to be an object with properties: + `payload` (this matches the previous return value format) and `warnings` (a list of warning messages, if applicable). +- The `react` method now uses `context_values` instead of `context` and `action_values` instead of `actions`. +- `local_*` react features have been removed. Use their unqualified versions instead. + ## 5.x The `inferFeatureAttributes` function now requires a `sourceFormat` argument, and is strongly typed through a union. diff --git a/README.md b/README.md index 8c3c847..b76ffd7 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ This process can be CPU intensive, you are encouraged to use a web `Worker` if r #### Through a web Worker ```ts +// @/workers/AmalgamWorker import { AmalgamWasmService, initRuntime } from "@howso/amalgam-lang"; import wasmDataUri from "@howso/amalgam-lang/lib/amalgam-st.data?url"; import wasmUri from "@howso/amalgam-lang/lib/amalgam-st.wasm?url"; @@ -77,15 +78,16 @@ import wasmUri from "@howso/amalgam-lang/lib/amalgam-st.wasm?url"; You can then create the worker client using a url import: ```ts -import howsoUrl from "@/data/engine/howso.caml?url"; -import migrationsUrl from "@/data/engine/migrations.caml?url"; -import { type ClientOptions, Trainee, WasmClient } from "@howso/engine"; +import howsoUrl from "@howso/engine/lib/howso.caml?url"; +import migrationsUrl from "@howso/engine/lib/migrations.caml?url"; +import { type ClientOptions, HowsoWorkerClient, BrowserFileSystem } from "@howso/engine"; -const getClient = async (): Promise => { +const getClient = async (options?: ClientOptions): Promise => { const worker = new Worker(new URL("@/workers/AmalgamWorker", import.meta.url), { type: "module" }); - const client = new WasmClient(worker, { + const fs = new BrowserFileSystem(worker); + const client = new HowsoWorkerClient(worker, fs, { howsoUrl, - migrationsUrl, + migrationsUrl, // Optional, used for upgrading Trainees saved to disk. ...options, }); return client.setup(); diff --git a/codegen/.gitignore b/codegen/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/codegen/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/codegen/README.md b/codegen/README.md new file mode 100644 index 0000000..ea769bf --- /dev/null +++ b/codegen/README.md @@ -0,0 +1,25 @@ +# Introduction + +This sub project is a utility used for introspecting the current Howso Engine +API documentation and generating types and client code automatically for each +exposed label (method). + +## Getting Started + +Note that by running this utility, files will be added/updated/deleted in the +`src` directory. Once generated, files should then be committed back to the +repository. + +Ensure that the Howso Engine caml file located at `src/assets/howso.caml` is +up to date before generation. + +### Generating the code + +```bash +npm run generate +``` + +### Development Guide + +This sub project uses [nunjucks](https://mozilla.github.io/nunjucks/) for +templating, which is very similar to jinja2. diff --git a/codegen/engine.ts b/codegen/engine.ts new file mode 100644 index 0000000..22d4628 --- /dev/null +++ b/codegen/engine.ts @@ -0,0 +1,115 @@ +import { initRuntime } from "@howso/amalgam-lang"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +const require = createRequire(import.meta.url); + +export type SchemaTypeOption = "any" | "assoc" | "boolean" | "list" | "number" | "string" | "null"; +export type SchemaType = SchemaTypeOption | SchemaTypeOption[]; + +export interface BaseSchema { + description?: string; + required?: boolean; + default?: any; +} + +export interface Ref extends BaseSchema { + ref: string; +} + +export interface Schema extends BaseSchema { + type: SchemaType; + enum?: (number | string)[]; + min?: number; + max?: number; + exclusive_min?: number; + exclusive_max?: number; + min_size?: number; + max_size?: number; + values?: SchemaType | Schema | Ref; + indices?: Record; + dynamic_indices?: Record; + additional_indices?: SchemaType | Schema | Ref | false; +} + +export interface LabelDefinition { + parameters: Record | null; + returns?: SchemaType | Schema | Ref | null; + description?: string | null; + attribute?: boolean; + long_running?: boolean; + read_only?: boolean; + idempotent?: boolean; + statistically_idempotent?: boolean; +} + +export interface EngineApi { + readonly labels: Record; + readonly schemas: Record; + readonly description: string; + readonly version: string; +} + +export async function getEngineApi(): Promise { + const handle = "default"; + const enginePath = require.resolve("../../src/assets/howso.caml"); + const dataPath = require.resolve("@howso/amalgam-lang/lib/amalgam-st.data"); + const wasmPath = require.resolve("@howso/amalgam-lang/lib/amalgam-st.wasm"); + + const amalgam = await initRuntime( + {}, + { + locateFile: (path) => { + // Override file paths to resolved locations + if (path.endsWith("amalgam-st.data")) { + return dataPath; + } else if (path.endsWith("amalgam-st.wasm")) { + return wasmPath; + } + return path; + }, + }, + ); + + try { + // Load the Howso Engine into Amalgam + amalgam.runtime.FS.writeFile("howso.caml", fs.readFileSync(enginePath)); + amalgam.loadEntity(handle, "howso.caml"); + console.log(`Amalgam Version: ${amalgam.getVersion()}`); + + // Initialize the Engine + const initialized = amalgam.executeEntityJson(handle, "initialize", { trainee_id: handle }); + if (!initialized) { + throw new Error("Failed to initialize the Howso Engine."); + } + + // Get the api documentation from the Engine + const response = amalgam.executeEntityJson(handle, "get_api", ""); + if (!Array.isArray(response) || response[0] != 1) { + throw new Error("Failed to retrieve API documentation from the Howso Engine."); + } + const doc: EngineApi = response[1].payload; + console.log(`Howso Engine Version: ${doc.version}`); + return doc; + } finally { + amalgam.destroyEntity(handle); + } +} + +export function isRef(value: SchemaType | Schema | Ref | null | undefined): value is Ref { + if (value == null || Array.isArray(value) || typeof value === "string") { + return false; + } + return "ref" in value && value.ref != null; +} + +export function isSchema(value: SchemaType | Schema | Ref | null | undefined): value is Schema { + if (value == null || Array.isArray(value) || typeof value === "string") { + return false; + } + return !isRef(value) && "type" in value && (typeof value.type === "string" || Array.isArray(value.type)); +} + +export function isSchemaOrRef(value: SchemaType | Schema | Ref | boolean | null | undefined): value is Schema | Ref { + if (typeof value === "boolean") return false; + return isRef(value) || isSchema(value); +} diff --git a/codegen/filters/comments.ts b/codegen/filters/comments.ts new file mode 100644 index 0000000..20190c7 --- /dev/null +++ b/codegen/filters/comments.ts @@ -0,0 +1,37 @@ +/** + * Block commenter filter. + * + * This filter will ensure each line starts with * in a block comment. Assumes + * the template includes * on first line. + */ +export function blockComment(content: any) { + // Ensure the content is a string + const str = typeof content === "string" ? content : String(content); + + return str + .split("\n") + .reduceRight((accumulator, value) => { + // Removing tailing empty lines + if (accumulator.length === 0 && value.trim() === "") { + return accumulator; + } + accumulator.unshift(value); + return accumulator; + }, []) + .map((line, index) => { + let value: string; + if (line.replace(/^\s+$/gm, "")) { + value = " " + line.replace(/\t/g, " "); + } else { + // Render empty lines + value = ""; + } + if (index > 0) { + // Add '*' to the beginning of subsequent lines + return " *" + value; + } + return value.trimStart(); // First line should have no leading spaces + }) + .join("\n") + .trimEnd(); +} diff --git a/codegen/filters/index.ts b/codegen/filters/index.ts new file mode 100644 index 0000000..fedd012 --- /dev/null +++ b/codegen/filters/index.ts @@ -0,0 +1,23 @@ +import { Environment } from "nunjucks"; +import * as engine from "../engine"; +import * as comments from "./comments"; +import * as strings from "./strings"; +import * as types from "./types"; + +/** + * Add all filters to an Environment. + * @param env The environment to register filters in. + */ +export function registerFilters(env: Environment) { + env.addFilter(comments.blockComment.name, comments.blockComment); + env.addFilter(strings.pascalCase.name, strings.pascalCase); + env.addFilter(strings.camelCase.name, strings.camelCase); + env.addFilter(strings.toJson.name, strings.toJson); + env.addFilter(strings.autoQuote.name, strings.autoQuote); + env.addFilter(types.isString.name, types.isString); + env.addFilter(types.isArray.name, types.isArray); + env.addFilter(types.convertType.name, types.convertType); + env.addFilter(engine.isRef.name, engine.isRef); + env.addFilter(engine.isSchema.name, engine.isSchema); + env.addFilter(engine.isSchemaOrRef.name, engine.isSchemaOrRef); +} diff --git a/codegen/filters/strings.ts b/codegen/filters/strings.ts new file mode 100644 index 0000000..3dba812 --- /dev/null +++ b/codegen/filters/strings.ts @@ -0,0 +1,24 @@ +import { toCamelCase, toPascalCase } from "../utils"; + +export function pascalCase(value: any) { + const str = typeof value === "string" ? value : String(value); + return toPascalCase(str); +} + +export function camelCase(value: any) { + const str = typeof value === "string" ? value : String(value); + return toCamelCase(str); +} + +export function toJson(value: any) { + return JSON.stringify(value); +} + +export function autoQuote(value: any) { + // Quote values for safe use as object keys + const str = typeof value === "string" ? value : String(value); + if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str)) { + return str; + } + return this.env.filters.safe(JSON.stringify(str)); +} diff --git a/codegen/filters/types.ts b/codegen/filters/types.ts new file mode 100644 index 0000000..4a3ef1a --- /dev/null +++ b/codegen/filters/types.ts @@ -0,0 +1,41 @@ +import { SchemaType } from "../engine"; + +export function isString(value: any) { + return typeof value === "string"; +} + +export function isArray(value: any) { + return Array.isArray(value); +} + +export function convertType(schema: SchemaType) { + let value: string; + switch (schema) { + case "assoc": + value = "Record"; + break; + case "list": + value = "any[]"; + break; + case "string": + value = "string"; + break; + case "boolean": + value = "boolean"; + break; + case "number": + value = "number"; + break; + case "null": + value = "null"; + break; + case "any": + value = "any"; + break; + default: + console.warn(`Unexpected type received: ${schema}`); + value = "any"; + } + + return this.env.filters.safe(value); +} diff --git a/codegen/generator.ts b/codegen/generator.ts new file mode 100644 index 0000000..9196f06 --- /dev/null +++ b/codegen/generator.ts @@ -0,0 +1,185 @@ +import fs from "node:fs"; +import path from "node:path"; +import nunjucks from "nunjucks"; +import { EngineApi, isRef, isSchemaOrRef, LabelDefinition, Ref, Schema } from "./engine"; +import { registerFilters } from "./filters"; +import { toPascalCase } from "./utils"; + +export class Generator { + doc: EngineApi; + env: nunjucks.Environment; + basePath: string; + schemaDir: string; + clientDir: string; + ignoredLabels: string[]; + responseShims: Record; + + /** + * Construct a new Generator. + * @param doc The Howso Engine API document. + */ + public constructor(doc: EngineApi) { + this.basePath = path.resolve(__dirname, "../../src"); + this.schemaDir = path.resolve(this.basePath, "types/schemas"); + this.clientDir = path.resolve(this.basePath, "client"); + this.doc = doc; + this.ignoredLabels = [ + "root_filepath", + "filename", + "filepath", + "debug_label", + "initialize", + "initialize_for_deployment", + "set_contained_trainee_maps", + "major_version", + "minor_version", + "point_version", + "version", + "get_api", + ]; + + // Temporary shims until return values are defined + this.responseShims = { + analyze: "null", + get_cases: "shims.GetCasesResponse", + get_feature_attributes: "schemas.FeatureAttributesIndex", + set_feature_attributes: "schemas.FeatureAttributesIndex", + get_marginal_stats: "shims.GetMarginalStatsResponse", + get_params: "shims.GetParamsResponse", + react: "shims.ReactResponse", + react_aggregate: "shims.ReactAggregateResponse", + react_into_features: "null", + train: "shims.TrainResponse", + }; + + // Setup template engine + const loader = new nunjucks.FileSystemLoader(path.join(__dirname, "templates")); + this.env = new nunjucks.Environment(loader, { throwOnUndefined: true }); + registerFilters(this.env); + } + + /** + * Render all API code to file. + */ + public render() { + this.renderSchemas(); + this.renderClient(); + } + + /** + * Render all client logic from the API to file. + */ + private renderClient() { + const targetLabels: Record = {}; + for (const [label, definition] of Object.entries(this.doc.labels)) { + if (!this.ignoredLabels.includes(label) || definition.attribute) { + targetLabels[label] = definition; + } + } + this.renderFile(this.clientDir, "AbstractBaseClient.ts", "client/AbstractBaseClient.njk", { + labels: targetLabels, + shims: this.responseShims, + }); + } + + /** + * Render all schemas from the API to file. + */ + private renderSchemas() { + const allNames = []; + + // Clear existing schema files + fs.rmSync(this.schemaDir, { recursive: true, force: true }); + + // Render the shared schemas + for (const [name, schema] of Object.entries(this.doc.schemas)) { + allNames.push(name); + this.renderFile(this.schemaDir, `${name}.ts`, "schemas/schema.njk", { + name, + schema, + imports: this.detectSchemaImports(schema), + }); + } + + // Render label schemas + for (const [label, definition] of Object.entries(this.doc.labels)) { + if (this.ignoredLabels.includes(label) || definition.attribute) continue; + // Add schemas for label parameters and/or return value if it has any + if (definition.parameters != null || definition.returns != null) { + const title = toPascalCase(label); + allNames.push(title); + this.renderFile(this.schemaDir, `${title}.ts`, "schemas/label.njk", { + name: title, + label: label, + description: definition.description, + parameters: definition.parameters, + returns: definition.returns, + imports: this.detectLabelImports(definition), + }); + } + } + + // Render package index + this.renderFile(this.schemaDir, "index.ts", "schemas/index.njk", { items: allNames.sort() }); + } + + /** + * Render a file template. + * @param parent The path to a directory to write the file in. + * @param filename The name of the file to write. + * @param template The template to render into the file. + * @param context Context to pass to template renderer. + */ + private renderFile(parent: string, filename: string, template: string, context: object) { + const output = this.env.render(template, { version: this.doc.version, ...context }); + const filepath = path.join(parent, filename); + if (!fs.existsSync(path.dirname(filepath))) { + fs.mkdirSync(path.dirname(filepath), { recursive: true }); + } + fs.writeFileSync(filepath, output); + } + + /** + * Recursively detect referenced schemas by a label definition. + * @param label The label definition to check. + * @returns The list of referenced schema names. + */ + private detectLabelImports(label: LabelDefinition) { + const imports: string[] = []; + if (label.parameters != null) { + for (const schema of Object.values(label.parameters)) { + imports.push(...this.detectSchemaImports(schema)); + } + } + if (isSchemaOrRef(label.returns)) { + imports.push(...this.detectSchemaImports(label.returns)); + } + return [...new Set(imports)].sort(); + } + + /** + * Recursively detect referenced schemas in provided schema. + * @param schema The schema to check. + * @returns The list of referenced schema names. + */ + private detectSchemaImports(schema: Ref | Schema): string[] { + const imports: string[] = []; + if (isRef(schema)) { + return [schema.ref]; + } + if (isSchemaOrRef(schema.values)) { + imports.push(...this.detectSchemaImports(schema.values)); + } + if (isSchemaOrRef(schema.additional_indices)) { + imports.push(...this.detectSchemaImports(schema.additional_indices)); + } + if (schema.indices != null) { + for (const value of Object.values(schema.indices)) { + if (isSchemaOrRef(value)) { + imports.push(...this.detectSchemaImports(value)); + } + } + } + return [...new Set(imports)].sort(); + } +} diff --git a/codegen/main.ts b/codegen/main.ts new file mode 100644 index 0000000..ca67fd9 --- /dev/null +++ b/codegen/main.ts @@ -0,0 +1,11 @@ +import { getEngineApi } from "./engine"; +import { Generator } from "./generator"; + +export default async function main() { + // Entrypoint for running the code generator + const doc = await getEngineApi(); + const gen = new Generator(doc); + gen.render(); +} + +main(); diff --git a/codegen/rollup.config.js b/codegen/rollup.config.js new file mode 100644 index 0000000..297b5b4 --- /dev/null +++ b/codegen/rollup.config.js @@ -0,0 +1,41 @@ +import typescript from "@rollup/plugin-typescript"; +import copy from "rollup-plugin-copy"; +import pkg from "../package.json" with { type: "json" }; + +/** + * @type {import('rollup').RollupOptions} + */ +export default { + input: "codegen/main.ts", + plugins: [ + typescript({ + noEmitOnError: true, + tsconfig: "./codegen/tsconfig.json", + }), + copy({ + targets: [ + { + src: ["src/assets/howso.caml"], + dest: "./codegen/build", + }, + { + src: ["./codegen/templates"], + dest: "./codegen/build", + }, + ], + }), + ], + external: [ + "node:fs", + "node:module", + "node:path", + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.devDependencies || {}), + ], + output: [ + { + file: "codegen/build/index.cjs", + format: "cjs", + }, + ], +}; diff --git a/codegen/templates/client/AbstractBaseClient.njk b/codegen/templates/client/AbstractBaseClient.njk new file mode 100644 index 0000000..0caf994 --- /dev/null +++ b/codegen/templates/client/AbstractBaseClient.njk @@ -0,0 +1,183 @@ +/** + * WARNING: This file is auto generated, do not modify directly, instead modify the template. + * Generated via Howso Engine {{ version }} + */ +import type { Session, Trainee } from "../engine"; +import type { ClientResponse, FeatureAttributesIndex } from "../types"; +import type * as schemas from "../types/schemas"; +import type * as shims from "../types/shims"; +import { DEFAULT_ERROR_MESSAGE, HowsoError, HowsoValidationError } from "./errors"; +import type { CacheMap } from "./utilities/cache"; +import { type Logger, nullLogger } from "./utilities/logger"; + +export interface ClientCache { + trainee: Trainee; + feature_attributes?: FeatureAttributesIndex; +} + +export type ExecuteResponse = { + payload: R; + errors: HowsoError[]; + warnings: string[]; +}; + +export type AbstractBaseClientOptions = { + /** Enable logging for operations through your own methods */ + logger?: Logger; +}; + +export abstract class AbstractBaseClient { + protected abstract cache: CacheMap; + protected logger: Logger; + + constructor(options?: AbstractBaseClientOptions) { + this.logger = options?.logger || nullLogger; + } + + /** + * Prepare payload for an Engine request. + * @param payload The Engine payload. + * @returns The updated Engine payload. + */ + protected prepareRequest(payload: any) { + if (!payload) { + return payload; + } + + // Remove null properties from payload + const filtered = { ...payload }; + for (const key in filtered) { + if (filtered[key as keyof typeof filtered] == null) { + delete filtered[key as keyof typeof filtered]; + } + } + + return filtered; + } + + /** + * Process payload from an Engine response. + * @param data The Engine response. + * @returns The updated Engine response. + */ + protected processResponse(data: any): ExecuteResponse { + if (!data) { + throw new HowsoError("Null or empty response received from Engine."); + } + + if (Array.isArray(data) && data.length == 2) { + const errors: HowsoError[] = []; + const warnings: string[] = []; + const isSuccess = data[0]; + const value = data[1]; + + if (isSuccess) { + // Collect warnings + if (Array.isArray(value?.warnings)) { + for (const msg of value.warnings) { + if (msg != null) warnings.push(msg); + } + } + } else { + // Collect errors + if (value?.errors) { + errors.push(new HowsoValidationError(value.detail, value.code, value.errors)); + } else { + errors.push(new HowsoError(value.detail, value.code)); + } + if (errors.length == 0) { + errors.push(new HowsoError(DEFAULT_ERROR_MESSAGE)); + } + } + + errors.forEach(this.logger.error); + warnings.forEach(this.logger.warn); + + return { + errors, + warnings, + payload: isSuccess ? value?.payload : undefined, + }; + } else if (["string", "number", "bigint", "boolean"].indexOf(typeof data) != -1) { + return { errors: [], warnings: [], payload: data }; + } + + throw new HowsoError("Malformed response received from Engine."); + } + + /** Setup the client instance for interacting with the Howso Engine. */ + public abstract setup(): Promise; + + /** + * Execute a label of an Engine entity. + * @param handle The identifier of the entity. + * @param label The name of the method to execute. + * @param data The data to pass to the method. + * @param throwErrors If errors should be thrown automatically. + */ + public abstract execute( + handle: string, + label: string, + data: D, + throwErrors?: boolean, + ): Promise>; + + /** Create a new Trainee. */ + public abstract createTrainee(properties: Omit): Promise; + + /** Update an existing Trainee. */ + public abstract updateTrainee(trainee: Trainee): Promise; + + /** Copy an existing Trainee. */ + public abstract copyTrainee(traineeId: string, name?: string): Promise; + + /** Get an existing Trainee by Id. */ + public abstract getTrainee(traineeId: string): Promise; + + /** Search existing Trainees. */ + public abstract queryTrainees(keywords: string | string[]): Promise; + + /** Delete a Trainee. */ + public abstract deleteTrainee(traineeId: string): Promise; + + /** Acquire the resources for a Trainee. */ + public abstract acquireTraineeResources(traineeId: string): Promise; + + /** Release the resources for a Trainee. */ + public abstract releaseTraineeResources(traineeId: string): Promise; + + /** Persist a Trainee to storage. **/ + public abstract persistTrainee(traineeId: string): Promise; + + /** Automatically resolve a Trainee and ensure it is loaded. */ + protected abstract autoResolveTrainee(traineeId: string): Promise; + + /** Automatically persist Trainee object when appropriate based on persistence level. */ + protected abstract autoPersistTrainee(traineeId: string): Promise; + + /** Get active Session. */ + public abstract getActiveSession(): Promise>; + + /** Begin a new Session. */ + public abstract beginSession(name?: string, metadata?: Record): Promise; +{% for label, def in labels | dictsort %} +{% set requestName = "schemas." + label | pascalCase + "Request" %} +{% set responseName = "schemas." + label | pascalCase + "Response" %} + /** + * {{ def.description | capitalize | blockComment | safe | indent(2) }} + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async {{ label | camelCase }}(traineeId: string{% if def.parameters %}, request: {{ requestName }}{% endif %}): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute<{% if def.returns %}{{ responseName }}{% elif label in shims %}{{ shims[label] }}{% else %}any{% endif %}>(trainee.id, "{{ label }}", {% if def.parameters %}request{% else %}{}{% endif %}); + {%- if not def.read_only %} + this.autoPersistTrainee(trainee.id); + {%- endif %} + return { payload: response.payload, warnings: response.warnings }; + } +{%- if not loop.last %} +{% endif %} +{%- endfor %} +} \ No newline at end of file diff --git a/codegen/templates/schemas/_header.njk b/codegen/templates/schemas/_header.njk new file mode 100644 index 0000000..e528a68 --- /dev/null +++ b/codegen/templates/schemas/_header.njk @@ -0,0 +1,12 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * {{ name }} +{%- if description %} + * + * {{ description | capitalize | blockComment | safe }} +{%- endif %} + */ +{%- for item in imports %} +import type { {{ item }} } from "./{{ item }}"; +{%- endfor %} \ No newline at end of file diff --git a/codegen/templates/schemas/_macros.njk b/codegen/templates/schemas/_macros.njk new file mode 100644 index 0000000..35d0e80 --- /dev/null +++ b/codegen/templates/schemas/_macros.njk @@ -0,0 +1,48 @@ +{%- macro field(schema, type=null) %} +{%- if not type %} + {%- if schema | isString or schema | isArray %} + {%- set type = schema %} + {%- else %} + {%- set type = schema.type %} + {%- endif %} +{%- endif %} +{%- if type | isArray %} + {%- for item in type -%} +{{ field(schema, item) }}{% if not loop.last %} | {% endif %} + {%- endfor %} +{%- else %} + {%- if schema | isRef -%} +{{ schema.ref }} + {%- elif schema | isSchema -%} + {%- if type == "assoc" -%} +{% include "schemas/types/_assoc.njk" %} + {%- elif type == "list" -%} +{% include "schemas/types/_list.njk" %} + {%- elif type == "string" -%} +{% include "schemas/types/_string.njk" %} + {%- elif type == "number" -%} +{% include "schemas/types/_number.njk" %} + {%- elif type == "boolean" -%} +boolean + {%- elif type == "null" -%} +null + {%- else -%} +any + {%- endif -%} + {%- else -%} +{{ type | convertType }} + {%- endif -%} +{%- endif -%} +{%- endmacro %} + + +{%- macro comment(schema) %} +{%- if schema.description %} +/** + * {{ schema.description | capitalize | blockComment | safe }} +{%- if schema.default != null %} + * @default {{ schema.default | toJson | safe }} +{%- endif %} + */ +{%- endif %} +{%- endmacro %} diff --git a/codegen/templates/schemas/index.njk b/codegen/templates/schemas/index.njk new file mode 100644 index 0000000..1a7e0b4 --- /dev/null +++ b/codegen/templates/schemas/index.njk @@ -0,0 +1,6 @@ +/** + * NOTE: This file is auto generated, do not modify manually. + */ +{% for item in items -%} +export * from "./{{ item }}"; +{% endfor -%} \ No newline at end of file diff --git a/codegen/templates/schemas/label.njk b/codegen/templates/schemas/label.njk new file mode 100644 index 0000000..7f40cbe --- /dev/null +++ b/codegen/templates/schemas/label.njk @@ -0,0 +1,17 @@ +{%- include "schemas/_header.njk" %} +{%- from "schemas/_macros.njk" import field, comment %} +{% if parameters %} +export type {{ name }}Request = { +{%- for key, schema in parameters | dictsort -%} + {{ comment(schema) | indent(2) }} + {{ key | autoQuote }}{% if schema.required != true %}?{% endif %}: {{ field(schema) }}; +{%- if not loop.last %} +{% endif %} +{%- endfor %} +}; +{% endif -%} + +{%- if returns %} +export type {{ name }}Response = {{ field(returns) }}; + +{%- endif %} \ No newline at end of file diff --git a/codegen/templates/schemas/schema.njk b/codegen/templates/schemas/schema.njk new file mode 100644 index 0000000..102caa4 --- /dev/null +++ b/codegen/templates/schemas/schema.njk @@ -0,0 +1,5 @@ +{%- include "schemas/_header.njk" %} +{%- from "schemas/_macros.njk" import field, comment %} + +{{ comment(schema) }} +export type {{ name | pascalCase }} = {{ field(schema) }}; diff --git a/codegen/templates/schemas/types/_assoc.njk b/codegen/templates/schemas/types/_assoc.njk new file mode 100644 index 0000000..6765408 --- /dev/null +++ b/codegen/templates/schemas/types/_assoc.njk @@ -0,0 +1,21 @@ +{%- from "schemas/_macros.njk" import field %} +{%- if schema.indices -%} +{ + {%- for key, value in schema.indices | dictsort -%} + {{ comment(value) | indent(2) }} + {{ key | autoQuote }}{% if not value | isSchemaOrRef or value.required != true %}?{% endif %}: {{ field(value) | indent(2) }}; + {%- endfor %} +} + {%- if schema.additional_indices %} + & Record + {%- endif %} + {%- if schema.dynamic_indices %} + {%- for dynamic_key, dynamic_value in schema.dynamic_indices | dictsort %} + & Record<`{{ dynamic_key }}`, {{ field(dynamic_value) }}> + {%- endfor %} + {%- endif %} +{%- elif schema.additional_indices -%} +Record +{%- else -%} +Record +{%- endif %} \ No newline at end of file diff --git a/codegen/templates/schemas/types/_list.njk b/codegen/templates/schemas/types/_list.njk new file mode 100644 index 0000000..dd15669 --- /dev/null +++ b/codegen/templates/schemas/types/_list.njk @@ -0,0 +1,12 @@ +{%- from "schemas/_macros.njk" import field %} +{%- if schema.values -%} + {%- if schema.values | isArray -%}( + {%- for item in schema.values -%} +{{ field(item) }}{% if not loop.last %} | {% endif %} + {%- endfor -%})[] + {%- else -%} +({{ field(schema.values) }})[] + {%- endif -%} +{%- else -%} +any[] +{%- endif %} \ No newline at end of file diff --git a/codegen/templates/schemas/types/_number.njk b/codegen/templates/schemas/types/_number.njk new file mode 100644 index 0000000..449a49c --- /dev/null +++ b/codegen/templates/schemas/types/_number.njk @@ -0,0 +1,7 @@ +{%- if schema.enum -%} + {%- for item in schema.enum -%} +{{ item }}{% if not loop.last %} | {% endif %} + {%- endfor -%} +{%- else -%} +number +{%- endif -%} \ No newline at end of file diff --git a/codegen/templates/schemas/types/_string.njk b/codegen/templates/schemas/types/_string.njk new file mode 100644 index 0000000..a8117fe --- /dev/null +++ b/codegen/templates/schemas/types/_string.njk @@ -0,0 +1,7 @@ +{%- if schema.enum -%} + {%- for item in schema.enum -%} +"{{ item }}"{% if not loop.last %} | {% endif %} + {%- endfor -%} +{%- else -%} +string +{%- endif -%} \ No newline at end of file diff --git a/codegen/tsconfig.json b/codegen/tsconfig.json new file mode 100644 index 0000000..5a272eb --- /dev/null +++ b/codegen/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true, + "outDir": "./build", + "target": "ES2020" + }, + "include": ["."] +} diff --git a/codegen/utils.ts b/codegen/utils.ts new file mode 100644 index 0000000..d5d4603 --- /dev/null +++ b/codegen/utils.ts @@ -0,0 +1,19 @@ +export function capitalize(value: string): string { + return value.charAt(0).toUpperCase() + value.slice(1); +} + +export function toPascalCase(value: string) { + return value + .replace(/_+/g, " ") + .replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => word.toUpperCase()) + .replace(/\s+/g, ""); +} + +export function toCamelCase(value: string) { + return value + .replace(/_+/g, " ") + .replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => { + return index === 0 ? word.toLowerCase() : word.toUpperCase(); + }) + .replace(/\s+/g, ""); +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 525d23c..daf5c5a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,11 +2,11 @@ import eslint from "@eslint/js"; import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; -import tseslint from "typescript-eslint"; +import tsEslint from "typescript-eslint"; -export default tseslint.config( +export default tsEslint.config( eslint.configs.recommended, - ...tseslint.configs.recommended, + ...tsEslint.configs.recommended, eslintPluginPrettierRecommended, { languageOptions: { @@ -18,7 +18,21 @@ export default tseslint.config( rules: { "@typescript-eslint/no-empty-object-type": "warn", "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": "warn", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], }, }, + { + files: ["**/*.js"], + ...tsEslint.configs.disableTypeChecked, + }, + { + ignores: ["codegen/build/**/*"], + }, ); diff --git a/package-lock.json b/package-lock.json index 945c417..06a5328 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "license": "AGPL-3.0-only", "dependencies": { - "@howso/amalgam-lang": "^54.3.18", + "@howso/amalgam-lang": "^55.0.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -17,10 +17,11 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@types/d3-dsv": "^3.0.7", - "@types/emscripten": "^1.39.10", + "@types/emscripten": "^1.39.13", "@types/eslint__js": "^8.42.3", "@types/jest": "^29.5.13", - "@types/node": "^18.15.2", + "@types/node": "^20.16.5", + "@types/nunjucks": "^3.2.6", "@types/uuid": "^9.0.1", "@typescript-eslint/parser": "^8.5.0", "d3-dsv": "^3.0.1", @@ -29,9 +30,11 @@ "eslint-plugin-prettier": "^5.2.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "nunjucks": "^3.2.4", "prettier": "^3.3.3", "rimraf": "^5.0.5", "rollup": "^4.12.1", + "rollup-plugin-copy": "^3.5.0", "ts-jest": "^29.2.5", "typescript": "^5.6.2", "typescript-eslint": "^8.5.0", @@ -39,7 +42,7 @@ "vite-plugin-eslint": "^1.8.1" }, "engines": { - "node": ">=18" + "node": ">=20" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -1143,9 +1146,9 @@ } }, "node_modules/@howso/amalgam-lang": { - "version": "54.3.18", - "resolved": "https://registry.npmjs.org/@howso/amalgam-lang/-/amalgam-lang-54.3.18.tgz", - "integrity": "sha512-RbBj7YXhuWjRKNqF3k53n2FAnDtvhlFYLvN+LWHhpQobbJXBQX7qNOjyFvGtszI3Bo0oqorVYU+QmsUGVIc0OA==" + "version": "55.0.0", + "resolved": "https://registry.npmjs.org/@howso/amalgam-lang/-/amalgam-lang-55.0.0.tgz", + "integrity": "sha512-PG8cewFUShq5altkF1Zt28/PFILgieC/wI1wCmTibwyeWB4M80CUCeRTpJnBLXJmXrgTalc19cKhBV3aTgEsQg==" }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", @@ -1810,9 +1813,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.3.tgz", - "integrity": "sha512-MmKSfaB9GX+zXl6E8z4koOr/xU63AMVleLEa64v7R0QF/ZloMs5vcD1sHgM64GXXS1csaJutG+ddtzcueI/BLg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.5.tgz", + "integrity": "sha512-SU5cvamg0Eyu/F+kLeMXS7GoahL+OoizlclVFX3l5Ql6yNlywJJ0OuqTzUx0v+aHhPHEB/56CT06GQrRrGNYww==", "cpu": [ "arm" ], @@ -1823,9 +1826,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.3.tgz", - "integrity": "sha512-zrt8ecH07PE3sB4jPOggweBjJMzI1JG5xI2DIsUbkA+7K+Gkjys6eV7i9pOenNSDJH3eOr/jLb/PzqtmdwDq5g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.5.tgz", + "integrity": "sha512-S4pit5BP6E5R5C8S6tgU/drvgjtYW76FBuG6+ibG3tMvlD1h9LHVF9KmlmaUBQ8Obou7hEyS+0w+IR/VtxwNMQ==", "cpu": [ "arm64" ], @@ -1836,9 +1839,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.3.tgz", - "integrity": "sha512-P0UxIOrKNBFTQaXTxOH4RxuEBVCgEA5UTNV6Yz7z9QHnUJ7eLX9reOd/NYMO3+XZO2cco19mXTxDMXxit4R/eQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.5.tgz", + "integrity": "sha512-250ZGg4ipTL0TGvLlfACkIxS9+KLtIbn7BCZjsZj88zSg2Lvu3Xdw6dhAhfe/FjjXPVNCtcSp+WZjVsD3a/Zlw==", "cpu": [ "arm64" ], @@ -1849,9 +1852,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.3.tgz", - "integrity": "sha512-L1M0vKGO5ASKntqtsFEjTq/fD91vAqnzeaF6sfNAy55aD+Hi2pBI5DKwCO+UNDQHWsDViJLqshxOahXyLSh3EA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.5.tgz", + "integrity": "sha512-D8brJEFg5D+QxFcW6jYANu+Rr9SlKtTenmsX5hOSzNYVrK5oLAEMTUgKWYJP+wdKyCdeSwnapLsn+OVRFycuQg==", "cpu": [ "x64" ], @@ -1862,9 +1865,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.3.tgz", - "integrity": "sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.5.tgz", + "integrity": "sha512-PNqXYmdNFyWNg0ma5LdY8wP+eQfdvyaBAojAXgO7/gs0Q/6TQJVXAXe8gwW9URjbS0YAammur0fynYGiWsKlXw==", "cpu": [ "arm" ], @@ -1875,9 +1878,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.3.tgz", - "integrity": "sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.5.tgz", + "integrity": "sha512-kSSCZOKz3HqlrEuwKd9TYv7vxPYD77vHSUvM2y0YaTGnFc8AdI5TTQRrM1yIp3tXCKrSL9A7JLoILjtad5t8pQ==", "cpu": [ "arm" ], @@ -1888,9 +1891,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.3.tgz", - "integrity": "sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.5.tgz", + "integrity": "sha512-oTXQeJHRbOnwRnRffb6bmqmUugz0glXaPyspp4gbQOPVApdpRrY/j7KP3lr7M8kTfQTyrBUzFjj5EuHAhqH4/w==", "cpu": [ "arm64" ], @@ -1901,9 +1904,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.3.tgz", - "integrity": "sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.5.tgz", + "integrity": "sha512-qnOTIIs6tIGFKCHdhYitgC2XQ2X25InIbZFor5wh+mALH84qnFHvc+vmWUpyX97B0hNvwNUL4B+MB8vJvH65Fw==", "cpu": [ "arm64" ], @@ -1914,9 +1917,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.3.tgz", - "integrity": "sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.5.tgz", + "integrity": "sha512-TMYu+DUdNlgBXING13rHSfUc3Ky5nLPbWs4bFnT+R6Vu3OvXkTkixvvBKk8uO4MT5Ab6lC3U7x8S8El2q5o56w==", "cpu": [ "ppc64" ], @@ -1927,9 +1930,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.3.tgz", - "integrity": "sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.5.tgz", + "integrity": "sha512-PTQq1Kz22ZRvuhr3uURH+U/Q/a0pbxJoICGSprNLAoBEkyD3Sh9qP5I0Asn0y0wejXQBbsVMRZRxlbGFD9OK4A==", "cpu": [ "riscv64" ], @@ -1940,9 +1943,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.3.tgz", - "integrity": "sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.5.tgz", + "integrity": "sha512-bR5nCojtpuMss6TDEmf/jnBnzlo+6n1UhgwqUvRoe4VIotC7FG1IKkyJbwsT7JDsF2jxR+NTnuOwiGv0hLyDoQ==", "cpu": [ "s390x" ], @@ -1953,9 +1956,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.3.tgz", - "integrity": "sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.5.tgz", + "integrity": "sha512-N0jPPhHjGShcB9/XXZQWuWBKZQnC1F36Ce3sDqWpujsGjDz/CQtOL9LgTrJ+rJC8MJeesMWrMWVLKKNR/tMOCA==", "cpu": [ "x64" ], @@ -1966,9 +1969,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.3.tgz", - "integrity": "sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.5.tgz", + "integrity": "sha512-uBa2e28ohzNNwjr6Uxm4XyaA1M/8aTgfF2T7UIlElLaeXkgpmIJ2EitVNQxjO9xLLLy60YqAgKn/AqSpCUkE9g==", "cpu": [ "x64" ], @@ -1979,9 +1982,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.3.tgz", - "integrity": "sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.5.tgz", + "integrity": "sha512-RXT8S1HP8AFN/Kr3tg4fuYrNxZ/pZf1HemC5Tsddc6HzgGnJm0+Lh5rAHJkDuW3StI0ynNXukidROMXYl6ew8w==", "cpu": [ "arm64" ], @@ -1992,9 +1995,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.3.tgz", - "integrity": "sha512-nMIdKnfZfzn1Vsk+RuOvl43ONTZXoAPUUxgcU0tXooqg4YrAqzfKzVenqqk2g5efWh46/D28cKFrOzDSW28gTA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.5.tgz", + "integrity": "sha512-ElTYOh50InL8kzyUD6XsnPit7jYCKrphmddKAe1/Ytt74apOxDq5YEcbsiKs0fR3vff3jEneMM+3I7jbqaMyBg==", "cpu": [ "ia32" ], @@ -2005,9 +2008,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.3.tgz", - "integrity": "sha512-fOvu7PCQjAj4eWDEuD8Xz5gpzFqXzGlxHZozHP4b9Jxv9APtdxL6STqztDzMLuRXEc4UpXGGhx029Xgm91QBeA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.5.tgz", + "integrity": "sha512-+lvL/4mQxSV8MukpkKyyvfwhH266COcWlXE/1qxwN08ajovta3459zrjLghYMgDerlzNwLAcFpvU+WWE5y6nAQ==", "cpu": [ "x64" ], @@ -2130,9 +2133,9 @@ "dev": true }, "node_modules/@types/emscripten": { - "version": "1.39.10", - "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.10.tgz", - "integrity": "sha512-TB/6hBkYQJxsZHSqyeuO1Jt0AB/bW6G7rHt9g7lML7SOF6lbgcHvw/Lr+69iqN0qxgXLhWKScAon73JNnptuDw==", + "version": "1.39.13", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.13.tgz", + "integrity": "sha512-cFq+fO/isvhvmuP/+Sl4K4jtU6E23DoivtbO4r50e3odaxAiVdbfSYRDdJ4gCdxx+3aRjhphS5ZMwIH4hFy/Cw==", "dev": true }, "node_modules/@types/eslint": { @@ -2155,11 +2158,30 @@ } }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, + "node_modules/@types/fs-extra": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.5.tgz", + "integrity": "sha512-0dzKcwO+S8s2kuF5Z9oUWatQJj5Uq/iqphEtE3GQJVRRYm/tD1LglU2UnXi2A8jLq5umkGouOXOR9y0n613ZwQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -2220,10 +2242,25 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, "node_modules/@types/node": { - "version": "18.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.17.tgz", - "integrity": "sha512-cOxcXsQ2sxiwkykdJqvyFS+MLQPLvIdwh5l6gNg8qF6s+C7XSkEWOZjK+XhUZd+mYvHV/180g2cnCcIl4l06Pw==", + "version": "20.16.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", + "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/nunjucks": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/@types/nunjucks/-/nunjucks-3.2.6.tgz", + "integrity": "sha512-pHiGtf83na1nCzliuAdq8GowYiXvH5l931xZ0YEHaLMNFgynpEqx+IPStlu7UaDkehfvl01e4x/9Tpwhy7Ue3w==", "dev": true }, "node_modules/@types/stack-utils": { @@ -2293,15 +2330,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.5.0.tgz", - "integrity": "sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.7.0.tgz", + "integrity": "sha512-lN0btVpj2unxHlNYLI//BQ7nzbMJYBVQX5+pbNXvGYazdlgYonMn4AhhHifQ+J4fGRYA/m1DjaQjx+fDetqBOQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.5.0", - "@typescript-eslint/types": "8.5.0", - "@typescript-eslint/typescript-estree": "8.5.0", - "@typescript-eslint/visitor-keys": "8.5.0", + "@typescript-eslint/scope-manager": "8.7.0", + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/typescript-estree": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0", "debug": "^4.3.4" }, "engines": { @@ -2320,6 +2357,105 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.7.0.tgz", + "integrity": "sha512-87rC0k3ZlDOuz82zzXRtQ7Akv3GKhHs0ti4YcbAJtaomllXoSO8hi7Ix3ccEvCd824dy9aIX+j3d2UMAfCtVpg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.7.0.tgz", + "integrity": "sha512-LLt4BLHFwSfASHSF2K29SZ+ZCsbQOM+LuarPjRUuHm+Qd09hSe3GCeaQbcCr+Mik+0QFRmep/FyZBO6fJ64U3w==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.7.0.tgz", + "integrity": "sha512-MC8nmcGHsmfAKxwnluTQpNqceniT8SteVwd2voYlmiSWGOtjvGXdPl17dYu2797GVscK30Z04WRM28CrKS9WOg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.7.0.tgz", + "integrity": "sha512-b1tx0orFCCh/THWPQa2ZwWzvOeyzzp36vkJYOpVg0u8UVOIsfVrnuC9FqAw9gRKn+rG2VmWQ/zDJZzkxUnj/XQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.7.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "8.5.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.5.0.tgz", @@ -2465,6 +2601,12 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "dev": true + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -2609,6 +2751,21 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -2996,6 +3153,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3199,6 +3362,18 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/domexception": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", @@ -3832,6 +4007,29 @@ "node": ">= 6" } }, + "node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs-extra/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3970,6 +4168,46 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "dependencies": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/globby/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -4177,6 +4415,15 @@ "node": ">=8" } }, + "node_modules/is-plain-object": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", + "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -5199,6 +5446,15 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -5453,6 +5709,40 @@ "node": ">=8" } }, + "node_modules/nunjucks": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz", + "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==", + "dev": true, + "dependencies": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + }, + "bin": { + "nunjucks-precompile": "bin/precompile" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "chokidar": "^3.3.0" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/nunjucks/node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/nwsapi": { "version": "2.2.12", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz", @@ -5630,6 +5920,15 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", @@ -5996,12 +6295,12 @@ } }, "node_modules/rollup": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.3.tgz", - "integrity": "sha512-7sqRtBNnEbcBtMeRVc6VRsJMmpI+JU1z9VTvW8D4gXIYQFz0aLcsE6rRkyghZkLfEgUZgVvOG7A5CVz/VW5GIA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.5.tgz", + "integrity": "sha512-WoinX7GeQOFMGznEcWA1WrTQCd/tpEbMkc3nuMs9BT0CPjMdSjPMTVClwWd4pgSQwJdP65SK9mTCNvItlr5o7w==", "dev": true, "dependencies": { - "@types/estree": "1.0.5" + "@types/estree": "1.0.6" }, "bin": { "rollup": "dist/bin/rollup" @@ -6011,25 +6310,41 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.21.3", - "@rollup/rollup-android-arm64": "4.21.3", - "@rollup/rollup-darwin-arm64": "4.21.3", - "@rollup/rollup-darwin-x64": "4.21.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.3", - "@rollup/rollup-linux-arm-musleabihf": "4.21.3", - "@rollup/rollup-linux-arm64-gnu": "4.21.3", - "@rollup/rollup-linux-arm64-musl": "4.21.3", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.3", - "@rollup/rollup-linux-riscv64-gnu": "4.21.3", - "@rollup/rollup-linux-s390x-gnu": "4.21.3", - "@rollup/rollup-linux-x64-gnu": "4.21.3", - "@rollup/rollup-linux-x64-musl": "4.21.3", - "@rollup/rollup-win32-arm64-msvc": "4.21.3", - "@rollup/rollup-win32-ia32-msvc": "4.21.3", - "@rollup/rollup-win32-x64-msvc": "4.21.3", + "@rollup/rollup-android-arm-eabi": "4.22.5", + "@rollup/rollup-android-arm64": "4.22.5", + "@rollup/rollup-darwin-arm64": "4.22.5", + "@rollup/rollup-darwin-x64": "4.22.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.5", + "@rollup/rollup-linux-arm-musleabihf": "4.22.5", + "@rollup/rollup-linux-arm64-gnu": "4.22.5", + "@rollup/rollup-linux-arm64-musl": "4.22.5", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.5", + "@rollup/rollup-linux-riscv64-gnu": "4.22.5", + "@rollup/rollup-linux-s390x-gnu": "4.22.5", + "@rollup/rollup-linux-x64-gnu": "4.22.5", + "@rollup/rollup-linux-x64-musl": "4.22.5", + "@rollup/rollup-win32-arm64-msvc": "4.22.5", + "@rollup/rollup-win32-ia32-msvc": "4.22.5", + "@rollup/rollup-win32-x64-msvc": "4.22.5", "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-copy": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.5.0.tgz", + "integrity": "sha512-wI8D5dvYovRMx/YYKtUNt3Yxaw4ORC9xo6Gt9t22kveWz1enG9QrhVlagzwrxSC455xD1dHMKhIJkbsQ7d48BA==", + "dev": true, + "dependencies": { + "@types/fs-extra": "^8.0.1", + "colorette": "^1.1.0", + "fs-extra": "^8.1.0", + "globby": "10.0.1", + "is-plain-object": "^3.0.0" + }, + "engines": { + "node": ">=8.3" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -6685,6 +7000,40 @@ } } }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/parser": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.5.0.tgz", + "integrity": "sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.5.0", + "@typescript-eslint/types": "8.5.0", + "@typescript-eslint/typescript-estree": "8.5.0", + "@typescript-eslint/visitor-keys": "8.5.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", @@ -6865,9 +7214,9 @@ } }, "node_modules/vite-plugin-eslint/node_modules/rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "version": "2.79.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -7850,9 +8199,9 @@ } }, "@howso/amalgam-lang": { - "version": "54.3.18", - "resolved": "https://registry.npmjs.org/@howso/amalgam-lang/-/amalgam-lang-54.3.18.tgz", - "integrity": "sha512-RbBj7YXhuWjRKNqF3k53n2FAnDtvhlFYLvN+LWHhpQobbJXBQX7qNOjyFvGtszI3Bo0oqorVYU+QmsUGVIc0OA==" + "version": "55.0.0", + "resolved": "https://registry.npmjs.org/@howso/amalgam-lang/-/amalgam-lang-55.0.0.tgz", + "integrity": "sha512-PG8cewFUShq5altkF1Zt28/PFILgieC/wI1wCmTibwyeWB4M80CUCeRTpJnBLXJmXrgTalc19cKhBV3aTgEsQg==" }, "@humanwhocodes/module-importer": { "version": "1.0.1", @@ -8337,114 +8686,114 @@ } }, "@rollup/rollup-android-arm-eabi": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.3.tgz", - "integrity": "sha512-MmKSfaB9GX+zXl6E8z4koOr/xU63AMVleLEa64v7R0QF/ZloMs5vcD1sHgM64GXXS1csaJutG+ddtzcueI/BLg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.5.tgz", + "integrity": "sha512-SU5cvamg0Eyu/F+kLeMXS7GoahL+OoizlclVFX3l5Ql6yNlywJJ0OuqTzUx0v+aHhPHEB/56CT06GQrRrGNYww==", "dev": true, "optional": true }, "@rollup/rollup-android-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.3.tgz", - "integrity": "sha512-zrt8ecH07PE3sB4jPOggweBjJMzI1JG5xI2DIsUbkA+7K+Gkjys6eV7i9pOenNSDJH3eOr/jLb/PzqtmdwDq5g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.5.tgz", + "integrity": "sha512-S4pit5BP6E5R5C8S6tgU/drvgjtYW76FBuG6+ibG3tMvlD1h9LHVF9KmlmaUBQ8Obou7hEyS+0w+IR/VtxwNMQ==", "dev": true, "optional": true }, "@rollup/rollup-darwin-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.3.tgz", - "integrity": "sha512-P0UxIOrKNBFTQaXTxOH4RxuEBVCgEA5UTNV6Yz7z9QHnUJ7eLX9reOd/NYMO3+XZO2cco19mXTxDMXxit4R/eQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.5.tgz", + "integrity": "sha512-250ZGg4ipTL0TGvLlfACkIxS9+KLtIbn7BCZjsZj88zSg2Lvu3Xdw6dhAhfe/FjjXPVNCtcSp+WZjVsD3a/Zlw==", "dev": true, "optional": true }, "@rollup/rollup-darwin-x64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.3.tgz", - "integrity": "sha512-L1M0vKGO5ASKntqtsFEjTq/fD91vAqnzeaF6sfNAy55aD+Hi2pBI5DKwCO+UNDQHWsDViJLqshxOahXyLSh3EA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.5.tgz", + "integrity": "sha512-D8brJEFg5D+QxFcW6jYANu+Rr9SlKtTenmsX5hOSzNYVrK5oLAEMTUgKWYJP+wdKyCdeSwnapLsn+OVRFycuQg==", "dev": true, "optional": true }, "@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.3.tgz", - "integrity": "sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.5.tgz", + "integrity": "sha512-PNqXYmdNFyWNg0ma5LdY8wP+eQfdvyaBAojAXgO7/gs0Q/6TQJVXAXe8gwW9URjbS0YAammur0fynYGiWsKlXw==", "dev": true, "optional": true }, "@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.3.tgz", - "integrity": "sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.5.tgz", + "integrity": "sha512-kSSCZOKz3HqlrEuwKd9TYv7vxPYD77vHSUvM2y0YaTGnFc8AdI5TTQRrM1yIp3tXCKrSL9A7JLoILjtad5t8pQ==", "dev": true, "optional": true }, "@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.3.tgz", - "integrity": "sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.5.tgz", + "integrity": "sha512-oTXQeJHRbOnwRnRffb6bmqmUugz0glXaPyspp4gbQOPVApdpRrY/j7KP3lr7M8kTfQTyrBUzFjj5EuHAhqH4/w==", "dev": true, "optional": true }, "@rollup/rollup-linux-arm64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.3.tgz", - "integrity": "sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.5.tgz", + "integrity": "sha512-qnOTIIs6tIGFKCHdhYitgC2XQ2X25InIbZFor5wh+mALH84qnFHvc+vmWUpyX97B0hNvwNUL4B+MB8vJvH65Fw==", "dev": true, "optional": true }, "@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.3.tgz", - "integrity": "sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.5.tgz", + "integrity": "sha512-TMYu+DUdNlgBXING13rHSfUc3Ky5nLPbWs4bFnT+R6Vu3OvXkTkixvvBKk8uO4MT5Ab6lC3U7x8S8El2q5o56w==", "dev": true, "optional": true }, "@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.3.tgz", - "integrity": "sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.5.tgz", + "integrity": "sha512-PTQq1Kz22ZRvuhr3uURH+U/Q/a0pbxJoICGSprNLAoBEkyD3Sh9qP5I0Asn0y0wejXQBbsVMRZRxlbGFD9OK4A==", "dev": true, "optional": true }, "@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.3.tgz", - "integrity": "sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.5.tgz", + "integrity": "sha512-bR5nCojtpuMss6TDEmf/jnBnzlo+6n1UhgwqUvRoe4VIotC7FG1IKkyJbwsT7JDsF2jxR+NTnuOwiGv0hLyDoQ==", "dev": true, "optional": true }, "@rollup/rollup-linux-x64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.3.tgz", - "integrity": "sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.5.tgz", + "integrity": "sha512-N0jPPhHjGShcB9/XXZQWuWBKZQnC1F36Ce3sDqWpujsGjDz/CQtOL9LgTrJ+rJC8MJeesMWrMWVLKKNR/tMOCA==", "dev": true, "optional": true }, "@rollup/rollup-linux-x64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.3.tgz", - "integrity": "sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.5.tgz", + "integrity": "sha512-uBa2e28ohzNNwjr6Uxm4XyaA1M/8aTgfF2T7UIlElLaeXkgpmIJ2EitVNQxjO9xLLLy60YqAgKn/AqSpCUkE9g==", "dev": true, "optional": true }, "@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.3.tgz", - "integrity": "sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.5.tgz", + "integrity": "sha512-RXT8S1HP8AFN/Kr3tg4fuYrNxZ/pZf1HemC5Tsddc6HzgGnJm0+Lh5rAHJkDuW3StI0ynNXukidROMXYl6ew8w==", "dev": true, "optional": true }, "@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.3.tgz", - "integrity": "sha512-nMIdKnfZfzn1Vsk+RuOvl43ONTZXoAPUUxgcU0tXooqg4YrAqzfKzVenqqk2g5efWh46/D28cKFrOzDSW28gTA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.5.tgz", + "integrity": "sha512-ElTYOh50InL8kzyUD6XsnPit7jYCKrphmddKAe1/Ytt74apOxDq5YEcbsiKs0fR3vff3jEneMM+3I7jbqaMyBg==", "dev": true, "optional": true }, "@rollup/rollup-win32-x64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.3.tgz", - "integrity": "sha512-fOvu7PCQjAj4eWDEuD8Xz5gpzFqXzGlxHZozHP4b9Jxv9APtdxL6STqztDzMLuRXEc4UpXGGhx029Xgm91QBeA==", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.5.tgz", + "integrity": "sha512-+lvL/4mQxSV8MukpkKyyvfwhH266COcWlXE/1qxwN08ajovta3459zrjLghYMgDerlzNwLAcFpvU+WWE5y6nAQ==", "dev": true, "optional": true }, @@ -8558,9 +8907,9 @@ "dev": true }, "@types/emscripten": { - "version": "1.39.10", - "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.10.tgz", - "integrity": "sha512-TB/6hBkYQJxsZHSqyeuO1Jt0AB/bW6G7rHt9g7lML7SOF6lbgcHvw/Lr+69iqN0qxgXLhWKScAon73JNnptuDw==", + "version": "1.39.13", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.13.tgz", + "integrity": "sha512-cFq+fO/isvhvmuP/+Sl4K4jtU6E23DoivtbO4r50e3odaxAiVdbfSYRDdJ4gCdxx+3aRjhphS5ZMwIH4hFy/Cw==", "dev": true }, "@types/eslint": { @@ -8583,11 +8932,30 @@ } }, "@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, + "@types/fs-extra": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.5.tgz", + "integrity": "sha512-0dzKcwO+S8s2kuF5Z9oUWatQJj5Uq/iqphEtE3GQJVRRYm/tD1LglU2UnXi2A8jLq5umkGouOXOR9y0n613ZwQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -8648,10 +9016,25 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, "@types/node": { - "version": "18.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.17.tgz", - "integrity": "sha512-cOxcXsQ2sxiwkykdJqvyFS+MLQPLvIdwh5l6gNg8qF6s+C7XSkEWOZjK+XhUZd+mYvHV/180g2cnCcIl4l06Pw==", + "version": "20.16.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", + "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", + "dev": true, + "requires": { + "undici-types": "~6.19.2" + } + }, + "@types/nunjucks": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/@types/nunjucks/-/nunjucks-3.2.6.tgz", + "integrity": "sha512-pHiGtf83na1nCzliuAdq8GowYiXvH5l931xZ0YEHaLMNFgynpEqx+IPStlu7UaDkehfvl01e4x/9Tpwhy7Ue3w==", "dev": true }, "@types/stack-utils": { @@ -8705,16 +9088,78 @@ } }, "@typescript-eslint/parser": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.5.0.tgz", - "integrity": "sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.7.0.tgz", + "integrity": "sha512-lN0btVpj2unxHlNYLI//BQ7nzbMJYBVQX5+pbNXvGYazdlgYonMn4AhhHifQ+J4fGRYA/m1DjaQjx+fDetqBOQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "8.5.0", - "@typescript-eslint/types": "8.5.0", - "@typescript-eslint/typescript-estree": "8.5.0", - "@typescript-eslint/visitor-keys": "8.5.0", + "@typescript-eslint/scope-manager": "8.7.0", + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/typescript-estree": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0", "debug": "^4.3.4" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.7.0.tgz", + "integrity": "sha512-87rC0k3ZlDOuz82zzXRtQ7Akv3GKhHs0ti4YcbAJtaomllXoSO8hi7Ix3ccEvCd824dy9aIX+j3d2UMAfCtVpg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0" + } + }, + "@typescript-eslint/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.7.0.tgz", + "integrity": "sha512-LLt4BLHFwSfASHSF2K29SZ+ZCsbQOM+LuarPjRUuHm+Qd09hSe3GCeaQbcCr+Mik+0QFRmep/FyZBO6fJ64U3w==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.7.0.tgz", + "integrity": "sha512-MC8nmcGHsmfAKxwnluTQpNqceniT8SteVwd2voYlmiSWGOtjvGXdPl17dYu2797GVscK30Z04WRM28CrKS9WOg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.7.0", + "@typescript-eslint/visitor-keys": "8.7.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.7.0.tgz", + "integrity": "sha512-b1tx0orFCCh/THWPQa2ZwWzvOeyzzp36vkJYOpVg0u8UVOIsfVrnuC9FqAw9gRKn+rG2VmWQ/zDJZzkxUnj/XQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.7.0", + "eslint-visitor-keys": "^3.4.3" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@typescript-eslint/scope-manager": { @@ -8803,6 +9248,12 @@ "eslint-visitor-keys": "^3.4.3" } }, + "a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "dev": true + }, "abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -8909,6 +9360,18 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, "async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -9190,6 +9653,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -9336,6 +9805,15 @@ "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "domexception": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", @@ -9796,6 +10274,25 @@ "mime-types": "^2.1.12" } }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dependencies": { + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + } + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -9887,6 +10384,38 @@ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true }, + "globby": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -10037,6 +10566,12 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, + "is-plain-object": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", + "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "dev": true + }, "is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -10813,6 +11348,15 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -11004,6 +11548,25 @@ "path-key": "^3.0.0" } }, + "nunjucks": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz", + "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==", + "dev": true, + "requires": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + }, + "dependencies": { + "commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true + } + } + }, "nwsapi": { "version": "2.2.12", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz", @@ -11130,6 +11693,12 @@ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "picocolors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", @@ -11370,31 +11939,44 @@ } }, "rollup": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.3.tgz", - "integrity": "sha512-7sqRtBNnEbcBtMeRVc6VRsJMmpI+JU1z9VTvW8D4gXIYQFz0aLcsE6rRkyghZkLfEgUZgVvOG7A5CVz/VW5GIA==", - "dev": true, - "requires": { - "@rollup/rollup-android-arm-eabi": "4.21.3", - "@rollup/rollup-android-arm64": "4.21.3", - "@rollup/rollup-darwin-arm64": "4.21.3", - "@rollup/rollup-darwin-x64": "4.21.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.3", - "@rollup/rollup-linux-arm-musleabihf": "4.21.3", - "@rollup/rollup-linux-arm64-gnu": "4.21.3", - "@rollup/rollup-linux-arm64-musl": "4.21.3", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.3", - "@rollup/rollup-linux-riscv64-gnu": "4.21.3", - "@rollup/rollup-linux-s390x-gnu": "4.21.3", - "@rollup/rollup-linux-x64-gnu": "4.21.3", - "@rollup/rollup-linux-x64-musl": "4.21.3", - "@rollup/rollup-win32-arm64-msvc": "4.21.3", - "@rollup/rollup-win32-ia32-msvc": "4.21.3", - "@rollup/rollup-win32-x64-msvc": "4.21.3", - "@types/estree": "1.0.5", + "version": "4.22.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.5.tgz", + "integrity": "sha512-WoinX7GeQOFMGznEcWA1WrTQCd/tpEbMkc3nuMs9BT0CPjMdSjPMTVClwWd4pgSQwJdP65SK9mTCNvItlr5o7w==", + "dev": true, + "requires": { + "@rollup/rollup-android-arm-eabi": "4.22.5", + "@rollup/rollup-android-arm64": "4.22.5", + "@rollup/rollup-darwin-arm64": "4.22.5", + "@rollup/rollup-darwin-x64": "4.22.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.5", + "@rollup/rollup-linux-arm-musleabihf": "4.22.5", + "@rollup/rollup-linux-arm64-gnu": "4.22.5", + "@rollup/rollup-linux-arm64-musl": "4.22.5", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.5", + "@rollup/rollup-linux-riscv64-gnu": "4.22.5", + "@rollup/rollup-linux-s390x-gnu": "4.22.5", + "@rollup/rollup-linux-x64-gnu": "4.22.5", + "@rollup/rollup-linux-x64-musl": "4.22.5", + "@rollup/rollup-win32-arm64-msvc": "4.22.5", + "@rollup/rollup-win32-ia32-msvc": "4.22.5", + "@rollup/rollup-win32-x64-msvc": "4.22.5", + "@types/estree": "1.0.6", "fsevents": "~2.3.2" } }, + "rollup-plugin-copy": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.5.0.tgz", + "integrity": "sha512-wI8D5dvYovRMx/YYKtUNt3Yxaw4ORC9xo6Gt9t22kveWz1enG9QrhVlagzwrxSC455xD1dHMKhIJkbsQ7d48BA==", + "dev": true, + "requires": { + "@types/fs-extra": "^8.0.1", + "colorette": "^1.1.0", + "fs-extra": "^8.1.0", + "globby": "10.0.1", + "is-plain-object": "^3.0.0" + } + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -11827,8 +12409,29 @@ "@typescript-eslint/eslint-plugin": "8.5.0", "@typescript-eslint/parser": "8.5.0", "@typescript-eslint/utils": "8.5.0" + }, + "dependencies": { + "@typescript-eslint/parser": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.5.0.tgz", + "integrity": "sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "8.5.0", + "@typescript-eslint/types": "8.5.0", + "@typescript-eslint/typescript-estree": "8.5.0", + "@typescript-eslint/visitor-keys": "8.5.0", + "debug": "^4.3.4" + } + } } }, + "undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", @@ -11922,9 +12525,9 @@ } }, "rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "version": "2.79.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/package.json b/package.json index b87a527..f34a970 100644 --- a/package.json +++ b/package.json @@ -13,15 +13,18 @@ "url": "git+https://github.com/howsoai/howso-engine-ts.git" }, "engines": { - "node": ">=18" + "node": ">=20" }, "scripts": { "prebuild": "rimraf ./lib", "build": "rollup --config", - "lint": "tsc --noEmit && eslint 'src/**'", + "lint": "tsc --noEmit && eslint 'src/**' 'codegen/**'", "lint:fix": "eslint --fix 'src/**'", "prepack": "npm run build", - "test": "jest --passWithNoTests" + "test": "jest --passWithNoTests", + "pregenerate": "rimraf ./codegen/build && rollup --config ./codegen/rollup.config.js", + "generate": "node ./codegen/build/index.cjs", + "postgenerate": "npm run lint:fix" }, "files": [ "LICENSE.txt", @@ -30,7 +33,7 @@ "lib" ], "dependencies": { - "@howso/amalgam-lang": "^54.3.18", + "@howso/amalgam-lang": "^55.0.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -38,10 +41,11 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@types/d3-dsv": "^3.0.7", - "@types/emscripten": "^1.39.10", + "@types/emscripten": "^1.39.13", "@types/eslint__js": "^8.42.3", "@types/jest": "^29.5.13", - "@types/node": "^18.15.2", + "@types/node": "^20.16.5", + "@types/nunjucks": "^3.2.6", "@types/uuid": "^9.0.1", "@typescript-eslint/parser": "^8.5.0", "d3-dsv": "^3.0.1", @@ -50,9 +54,11 @@ "eslint-plugin-prettier": "^5.2.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "nunjucks": "^3.2.4", "prettier": "^3.3.3", "rimraf": "^5.0.5", "rollup": "^4.12.1", + "rollup-plugin-copy": "^3.5.0", "ts-jest": "^29.2.5", "typescript": "^5.6.2", "typescript-eslint": "^8.5.0", diff --git a/rollup.config.js b/rollup.config.js index c451a48..d29bfcf 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,6 @@ import terser from "@rollup/plugin-terser"; import typescript from "@rollup/plugin-typescript"; +import copy from "rollup-plugin-copy"; import pkg from "./package.json" with { type: "json" }; /** @@ -13,9 +14,18 @@ export default { noEmitOnError: true, tsconfig: "./tsconfig.build.json", }), + copy({ + targets: [ + { + src: ["src/assets/howso.caml", "src/assets/migrations.caml"], + dest: "lib", + }, + ], + }), terser(), // minifies generated bundles ], external: [ + "node:fs/promises", ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {}), ...Object.keys(pkg.optionalDependencies || {}), diff --git a/src/assets/howso.caml b/src/assets/howso.caml new file mode 100644 index 0000000..0029a57 Binary files /dev/null and b/src/assets/howso.caml differ diff --git a/src/assets/migrations.caml b/src/assets/migrations.caml new file mode 100644 index 0000000..58a4ae7 Binary files /dev/null and b/src/assets/migrations.caml differ diff --git a/src/client/AbstractBaseClient.ts b/src/client/AbstractBaseClient.ts new file mode 100644 index 0000000..6cab25b --- /dev/null +++ b/src/client/AbstractBaseClient.ts @@ -0,0 +1,1128 @@ +/** + * WARNING: This file is auto generated, do not modify directly, instead modify the template. + * Generated via Howso Engine 86.1.0+alpha + */ +import type { Session, Trainee } from "../engine"; +import type { ClientResponse, FeatureAttributesIndex } from "../types"; +import type * as schemas from "../types/schemas"; +import type * as shims from "../types/shims"; +import { DEFAULT_ERROR_MESSAGE, HowsoError, HowsoValidationError } from "./errors"; +import type { CacheMap } from "./utilities/cache"; +import { type Logger, nullLogger } from "./utilities/logger"; + +export interface ClientCache { + trainee: Trainee; + feature_attributes?: FeatureAttributesIndex; +} + +export type ExecuteResponse = { + payload: R; + errors: HowsoError[]; + warnings: string[]; +}; + +export type AbstractBaseClientOptions = { + /** Enable logging for operations through your own methods */ + logger?: Logger; +}; + +export abstract class AbstractBaseClient { + protected abstract cache: CacheMap; + protected logger: Logger; + + constructor(options?: AbstractBaseClientOptions) { + this.logger = options?.logger || nullLogger; + } + + /** + * Prepare payload for an Engine request. + * @param payload The Engine payload. + * @returns The updated Engine payload. + */ + protected prepareRequest(payload: any) { + if (!payload) { + return payload; + } + + // Remove null properties from payload + const filtered = { ...payload }; + for (const key in filtered) { + if (filtered[key as keyof typeof filtered] == null) { + delete filtered[key as keyof typeof filtered]; + } + } + + return filtered; + } + + /** + * Process payload from an Engine response. + * @param data The Engine response. + * @returns The updated Engine response. + */ + protected processResponse(data: any): ExecuteResponse { + if (!data) { + throw new HowsoError("Null or empty response received from Engine."); + } + + if (Array.isArray(data) && data.length == 2) { + const errors: HowsoError[] = []; + const warnings: string[] = []; + const isSuccess = data[0]; + const value = data[1]; + + if (isSuccess) { + // Collect warnings + if (Array.isArray(value?.warnings)) { + for (const msg of value.warnings) { + if (msg != null) warnings.push(msg); + } + } + } else { + // Collect errors + if (value?.errors) { + errors.push(new HowsoValidationError(value.detail, value.code, value.errors)); + } else { + errors.push(new HowsoError(value.detail, value.code)); + } + if (errors.length == 0) { + errors.push(new HowsoError(DEFAULT_ERROR_MESSAGE)); + } + } + + errors.forEach(this.logger.error); + warnings.forEach(this.logger.warn); + + return { + errors, + warnings, + payload: isSuccess ? value?.payload : undefined, + }; + } else if (["string", "number", "bigint", "boolean"].indexOf(typeof data) != -1) { + return { errors: [], warnings: [], payload: data }; + } + + throw new HowsoError("Malformed response received from Engine."); + } + + /** Setup the client instance for interacting with the Howso Engine. */ + public abstract setup(): Promise; + + /** + * Execute a label of an Engine entity. + * @param handle The identifier of the entity. + * @param label The name of the method to execute. + * @param data The data to pass to the method. + * @param throwErrors If errors should be thrown automatically. + */ + public abstract execute( + handle: string, + label: string, + data: D, + throwErrors?: boolean, + ): Promise>; + + /** Create a new Trainee. */ + public abstract createTrainee(properties: Omit): Promise; + + /** Update an existing Trainee. */ + public abstract updateTrainee(trainee: Trainee): Promise; + + /** Copy an existing Trainee. */ + public abstract copyTrainee(traineeId: string, name?: string): Promise; + + /** Get an existing Trainee by Id. */ + public abstract getTrainee(traineeId: string): Promise; + + /** Search existing Trainees. */ + public abstract queryTrainees(keywords: string | string[]): Promise; + + /** Delete a Trainee. */ + public abstract deleteTrainee(traineeId: string): Promise; + + /** Acquire the resources for a Trainee. */ + public abstract acquireTraineeResources(traineeId: string): Promise; + + /** Release the resources for a Trainee. */ + public abstract releaseTraineeResources(traineeId: string): Promise; + + /** Persist a Trainee to storage. **/ + public abstract persistTrainee(traineeId: string): Promise; + + /** Automatically resolve a Trainee and ensure it is loaded. */ + protected abstract autoResolveTrainee(traineeId: string): Promise; + + /** Automatically persist Trainee object when appropriate based on persistence level. */ + protected abstract autoPersistTrainee(traineeId: string): Promise; + + /** Get active Session. */ + public abstract getActiveSession(): Promise>; + + /** Begin a new Session. */ + public abstract beginSession(name?: string, metadata?: Record): Promise; + + /** + * Adds the specified feature on all cases for a trainee that match the specified condition. overwrites features that + * if condition are not specified, adds feature for all cases and to the model. if condition is an empty assoc, will not modify feature metadata in the model. + * if feature attributes are passed in, will also set the model's feature attributes. + * updates the accumulated data mass for the model proportional to the number of cases modified. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async addFeature(traineeId: string, request: schemas.AddFeatureRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "add_feature", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Analyzes the data to compute the appropriate statistics, uncertainties, and select parameters as appropriate. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async analyze(traineeId: string, request: schemas.AnalyzeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "analyze", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Append cases to a series + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async appendToSeriesStore( + traineeId: string, + request: schemas.AppendToSeriesStoreRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "append_to_series_store", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Automatically analyze the model using stored parameters from previous analyze calls + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async autoAnalyze(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "auto_analyze", {}); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Clear values that were imputed during a specified session, but won't clear values that were manually set by user after the impute + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async clearImputedData( + traineeId: string, + request: schemas.ClearImputedDataRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "clear_imputed_data", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Creates a copy of a trainee and stores it a subtrainee, returns the name of the copied trainee on success + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async copySubtrainee(traineeId: string, request: schemas.CopySubtraineeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "copy_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Creates a new instance of a contained trainee as specified by the entity label "trainee". + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async createSubtrainee( + traineeId: string, + request: schemas.CreateSubtraineeRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "create_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Removes replay specified by session and any references within cases + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async deleteSession(traineeId: string, request: schemas.DeleteSessionRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "delete_session", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Destroys the instance of the trainee specified by the parameter "trainee". + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async deleteSubtrainee( + traineeId: string, + request: schemas.DeleteSubtraineeRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "delete_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Edit feature values for the specified cases. + * cases are specified by either case_indices or by the condition. if neither is provided, edits all cases. + * updates the accumulated data mass for the model proportional to the number of cases and features modified. + * returns null if invalid features specified or an assoc with "count" + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async editCases(traineeId: string, request: schemas.EditCasesRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "edit_cases", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Evaluate custom amalgam code for feature values of every case in the model and returns + * a list of the custom code's return values for each feature specified. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async evaluate(traineeId: string, request: schemas.EvaluateRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "evaluate", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Execute any method in the api directly on any child trainee of this trainee, used for hierarchy operations. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async executeOnSubtrainee( + traineeId: string, + request: schemas.ExecuteOnSubtraineeRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "execute_on_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Export trainee's metadata, case and session data into json files. + * this method should be run by a script from the ./migrations folder + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async exportTrainee(traineeId: string, request: schemas.ExportTraineeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "export_trainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Get auto-ablation parameters set by #set_auto_ablation_params + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getAutoAblationParams(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_auto_ablation_params", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns assoc with features and cases - a list of lists of all feature values. retrieves all feature values for cases for + * all (unordered) sessions in the order they were trained within each session. if a session is specified, only that session's + * cases wil be output. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getCases( + traineeId: string, + request: schemas.GetCasesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_cases", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns an assoc with case distances, containing a list of case session indices and a list of lists (matrix) of the computed distances. + * in the following format: + * { + * 'column_case_indices' : [ session-indices ], + * 'row_case_indices' : [ session-indices ], + * 'distances': [ [ pairwise distances ] ] + * } + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getDistances(traineeId: string, request: schemas.GetDistancesRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_distances", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns the full entity path to a child trainee provided its unique trainee id if it is contained in the hierarchy. + * iterates down the hierarchy searching for a trainee that matches the specified id, returns null if not found or + * a string error if found but trainee is stored externally as an independent trainee. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getEntityPathById( + traineeId: string, + request: schemas.GetEntityPathByIdRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_entity_path_by_id", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Method to return the list of all model attributes that can be exported/imported + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getExportAttributes(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_export_attributes", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Retrieve the top or bottom number of cases for a specified feature, sorted top to bottom for top, and bottom to top for bottom + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getExtremeCases( + traineeId: string, + request: schemas.GetExtremeCasesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_extreme_cases", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Output all feature attributes + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getFeatureAttributes(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_feature_attributes", {}); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Computes the conviction for each feature and returns an assoc of feature -> conviction value + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getFeatureConviction( + traineeId: string, + request: schemas.GetFeatureConvictionRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_feature_conviction", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Pull the hierarchy for a trainee, returns an assoc of: + * the currently contained hierarchy as a nested assoc with (false) for trainees that are stored independently. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getHierarchy(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_hierarchy", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Outputs all marginal stats (min, max, median, mean, mode, count, uniques, mean_absdev, variance, stddev, skew, kurtosis, entropy) + * for all features in the format of feature -> assoc stat -> value. the marginal stats can be computed for a subset of the data using condition, precision, and num_cases + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getMarginalStats( + traineeId: string, + request: schemas.GetMarginalStatsRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_marginal_stats", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Get metadata for model + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getMetadata(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_metadata", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns the total number of training cases for trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getNumTrainingCases(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_num_training_cases", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns a list of computed distances between respective cases specified in either from_values or from_case_indices to to_values or to_case_indices. + * if one case is specified in any of the lists, all respective distances are computed to/from that one case. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getPairwiseDistances( + traineeId: string, + request: schemas.GetPairwiseDistancesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_pairwise_distances", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Return the full internal parameters map if no parameters are specified. + * if any of the parameters are specified, then gethyperparameters is called, which uses the specified parameters to find the most suitable set of hyperparameters to return + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getParams( + traineeId: string, + request: schemas.GetParamsRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_params", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns the trainee's !revision + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getRevision(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_revision", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns a list of all of the training sessions, assoc of id->session, and whatever other attributes specified. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getSessions(traineeId: string, request: schemas.GetSessionsRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_sessions", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Return list of all session indices for a specified session. + * session indices are 0-based index of number of the case for the session used for replays; may change if cases are removed + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getSessionIndices( + traineeId: string, + request: schemas.GetSessionIndicesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_session_indices", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns all the metadata for a specified session + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getSessionMetadata( + traineeId: string, + request: schemas.GetSessionMetadataRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_session_metadata", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Return list of all session training indices for a specified session. + * session training indices are 0-based index of the case, ordered by training during the session; is not changed + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getSessionTrainingIndices( + traineeId: string, + request: schemas.GetSessionTrainingIndicesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_session_training_indices", request); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns the substitution map + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getSubstituteFeatureValues(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_substitute_feature_values", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Returns the trainee's unique id + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getTraineeId(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_trainee_id", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * The version stored in trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async getTraineeVersion(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "get_trainee_version", {}); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Imputes the model, filling in all the (null) feature values + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async impute(traineeId: string, request: schemas.ImputeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "impute", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Attempts to load a subtrainee with the following optional parameters. + * if a parameter is not specified, it will look to this entity's own label of the same name. + * if the saved instance does not exist the existing trainee will remain unmodified and the function will return null. + * assumes loaded trainee filenames need to be escaped + * returns the trainee name if successful, null if not + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async loadSubtrainee(traineeId: string, request: schemas.LoadSubtraineeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "load_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Moves all cases that match the specified conditions in the hierarchy of the specified trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async moveCases(traineeId: string, request: schemas.MoveCasesRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "move_cases", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Run reacts in a batch, output a an assoc of list of outputs from each individual react. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async react(traineeId: string, request: schemas.ReactRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "react", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Computes, caches, and returns specified details and feature prediction statistics such as mean decrease in accuracy (mda), residuals (accuracy, mean absolute error), + * precision, recall, etc. returns details and feature prediction stats for all features in the format of feature -> assoc stat -> value + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async reactAggregate( + traineeId: string, + request: schemas.ReactAggregateRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "react_aggregate", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Computes the convictions of an average case for each given hypothetical set of cases specified + * output an assoc react key -> list of corresponding values from each individual group. + * example output for 2 groups: + * (assoc + * "base_model_average_distance_contribution" (list 4.0 4.1) + * "combined_model_average_distance_contribution" (list 4.05 3.9) + * "distance_contributions" (list 4.5 3.2) + * ) + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async reactGroup(traineeId: string, request: schemas.ReactGroupRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "react_group", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Computes various data, such as familiarity convictions and distance contribution for each case in the model and stores them into specified features. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async reactIntoFeatures( + traineeId: string, + request: schemas.ReactIntoFeaturesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "react_into_features", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * React in a series until a series_stop_map condition is met. aggregates rows of data corresponding to the specified context, action, + * derived_context and derived_action features, utilizing previous rows to derive values as necessary. outputs an assoc of "action_features" and + * corresponding "series" where "series" is the completed 'matrix' for the corresponding action_features and derived_action_features. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async reactSeries(traineeId: string, request: schemas.ReactSeriesRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "react_series", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Reduce the trained data by removing cases which have an influence weight entropy that falls above + * a threshold. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async reduceData(traineeId: string, request: schemas.ReduceDataRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "reduce_data", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Removes all cases that match the specified conditions from trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async removeCases(traineeId: string, request: schemas.RemoveCasesRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "remove_cases", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Removes the specified feature on all cases for a trainee that match the specified condition + * if conditions are not specified, removes feature for all cases and from the model, if condition is an empty assoc, leaves the feature metadata in the model. + * updates the accumulated data mass for the model proportional to the number of cases modified. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async removeFeature(traineeId: string, request: schemas.RemoveFeatureRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "remove_feature", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Clears stored series + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async removeSeriesStore( + traineeId: string, + request: schemas.RemoveSeriesStoreRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "remove_series_store", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Rename a contained trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async renameSubtrainee( + traineeId: string, + request: schemas.RenameSubtraineeRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "rename_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Resets all hyperparameters and thresholds back to original values, while leaving feature definitions alone + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async resetParams(traineeId: string): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "reset_params", {}); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Saves a subtrainee with the following optional parameters, escapes trainee filenames on save + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async saveSubtrainee(traineeId: string, request: schemas.SaveSubtraineeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "save_subtrainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Sets the model to auto-ablate by tracking its size and training certain cases as weights + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setAutoAblationParams( + traineeId: string, + request: schemas.SetAutoAblationParamsRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_auto_ablation_params", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Sets the model to auto-analyze by tracking its size and notifying the clients in train responses when it should be analyzed + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setAutoAnalyzeParams( + traineeId: string, + request: schemas.SetAutoAnalyzeParamsRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_auto_analyze_params", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set all features and their attributes for the trainee, and returns the updated feature attributes + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setFeatureAttributes( + traineeId: string, + request: schemas.SetFeatureAttributesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_feature_attributes", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set the influence weight threshold for outputting only the k neighbors whose influence weight is <= to this threshold + * default value is 0.99 + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setInfluenceWeightThreshold( + traineeId: string, + request: schemas.SetInfluenceWeightThresholdRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_influence_weight_threshold", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set metadata for model + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setMetadata(traineeId: string, request: schemas.SetMetadataRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_metadata", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Sets internal hyperparameters + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setParams(traineeId: string, request: schemas.SetParamsRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_params", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set trainee's unique parent id + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setParentId(traineeId: string, request: schemas.SetParentIdRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_parent_id", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set the random seed on a trainee + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setRandomSeed(traineeId: string, request: schemas.SetRandomSeedRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_random_seed", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set session metadata for a specified session. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setSessionMetadata( + traineeId: string, + request: schemas.SetSessionMetadataRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_session_metadata", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Sets substitution feature values used in case generation + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setSubstituteFeatureValues( + traineeId: string, + request: schemas.SetSubstituteFeatureValuesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_substitute_feature_values", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Set trainee's unique id + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async setTraineeId(traineeId: string, request: schemas.SetTraineeIdRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "set_trainee_id", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * React to a provided context. if desired_conviction is provided, it does a generative react. + * + * output: + * default output of this method is a react object in the format of + * , where all_action_values is a list of all action + * values, reacted/generated and derived, in the same order as all_action_features, e.g., [2, "a", .75384] to match ['width','name','height'] + * if details is specified, the react object will contain appropriate additional details properties and values, + * details example: { 'action_values': [2, "a", .75384], 'action_features' : ['width','name','height'], 'residual_conviction': 1.3, + * 'influential_cases' : etc... } + * see api docs for documentation of all output properties + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async singleReact(traineeId: string, request: schemas.SingleReactRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "single_react", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * React in a series until a series_stop_map condition is met. aggregates rows of data corresponding to the specified context, action, + * derived_context and derived_action features, utilizing previous rows to derive values as necessary. outputs an assoc of "action_features" and + * corresponding "series" where "series" is the completed 'matrix' for the corresponding action_features and derived_action_features. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async singleReactSeries( + traineeId: string, + request: schemas.SingleReactSeriesRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "single_react_series", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Train the passed in cases, filtering out cases that match optionally passed in ablation parameters + * returns a response object in the following format: + * (associate + * "num_trained" num_trained_cases + * "ablated_indices" (list of session training indices for the ablated cases) + * "status" "status output message" + * ) + * list of 'status' values: + * (null) - default output, no status output + * "analyzed" - if auto analysis is enabled and model has grown large enough to be analyzed again and was analyzed + * "analyze" - if auto analysis is enabled and model has grown large enough to be analyzed again but was not analyzed + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async train(traineeId: string, request: schemas.TrainRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "train", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } + + /** + * Update version to latest, auto importing any exported data. + * @param traineeId The Trainee identifier. + * @param request The operation parameters. + * @returns The response of the operation, including any warnings. + */ + public async upgradeTrainee(traineeId: string, request: schemas.UpgradeTraineeRequest): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const response = await this.execute(trainee.id, "upgrade_trainee", request); + this.autoPersistTrainee(trainee.id); + return { payload: response.payload, warnings: response.warnings }; + } +} diff --git a/src/client/capabilities/base.ts b/src/client/capabilities/base.ts deleted file mode 100644 index f6e0085..0000000 --- a/src/client/capabilities/base.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Trainee } from "../../types"; -import type { CacheMap } from "../utilities/cache"; - -export interface Capabilities { - supportsTrainees?: boolean; - supportsProjects?: boolean; - supportsAccounts?: boolean; - supportsSessions?: boolean; - supportsSessionManagement?: boolean; - supportsAuthentication?: boolean; - supportsFileSystem?: boolean; - supportsTrace?: boolean; -} - -export interface TraineeBaseCache { - trainee: Trainee; -} - -export abstract class BaseClient { - protected abstract readonly traineeCache: CacheMap; - public static readonly capabilities: Readonly = {}; - public abstract setup(): Promise; -} diff --git a/src/client/capabilities/index.ts b/src/client/capabilities/index.ts deleted file mode 100644 index b4a9efe..0000000 --- a/src/client/capabilities/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./base"; -export * from "./sessions"; -export * from "./traces"; -export * from "./trainees"; diff --git a/src/client/capabilities/sessions.ts b/src/client/capabilities/sessions.ts deleted file mode 100644 index 8782557..0000000 --- a/src/client/capabilities/sessions.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Session, SessionIdentity } from "../../types"; - -export interface ISessionManagementClient { - updateSession(session: Required>): Promise; - getSession(id: string): Promise; - listSessions(keywords: string | string[]): Promise; -} - -export interface ISessionClient { - getActiveSession(): Promise>; - getTraineeSessions(traineeId: string): Promise[]>; - beginSession(name?: string, metadata?: Record): Promise; -} diff --git a/src/client/capabilities/traces.ts b/src/client/capabilities/traces.ts deleted file mode 100644 index e9e398d..0000000 --- a/src/client/capabilities/traces.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface ITraceClient { - getTraineeTrace(traineeId: string): Promise; -} diff --git a/src/client/capabilities/trainees.ts b/src/client/capabilities/trainees.ts deleted file mode 100644 index 84c0b1c..0000000 --- a/src/client/capabilities/trainees.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { - AnalyzeRequest, - Cases, - CasesRequest, - FeatureAttributes, - FeatureConviction, - FeatureConvictionRequest, - FeatureMarginalStats, - FeatureMarginalStatsRequest, - ReactIntoFeaturesRequest, - ReactIntoFeaturesResponse, - ReactRequest, - ReactResponse, - ReactSeriesRequest, - ReactSeriesResponse, - SetAutoAnalyzeParamsRequest, - Trainee, - TraineeIdentity, - TraineeWorkflowAttributes, - TraineeWorkflowAttributesRequest, - TrainRequest, -} from "../../types"; - -export interface ITraineeClient { - acquireTraineeResources(traineeId: string): Promise; - releaseTraineeResources(traineeId: string): Promise; - createTrainee(trainee: Omit): Promise; - updateTrainee(trainee: Trainee): Promise; - getTrainee(traineeId: string): Promise; - deleteTrainee(traineeId: string): Promise; - listTrainees(keywords: string | string[]): Promise; - train(traineeId: string, request: TrainRequest): Promise; - analyze(traineeId: string, request: AnalyzeRequest): Promise; - autoAnalyze(traineeId: string): Promise; - setAutoAnalyzeParams(traineeId: string, request: SetAutoAnalyzeParamsRequest): Promise; - react(traineeId: string, request: ReactRequest): Promise; - reactSeries(traineeId: string, request: ReactSeriesRequest): Promise; - reactIntoFeatures(traineeId: string, request: ReactIntoFeaturesRequest): Promise; - getCases(traineeId: string, request?: CasesRequest): Promise; - getInternalParams(traineeId: string, request: TraineeWorkflowAttributesRequest): Promise; - getNumTrainingCases(traineeId: string): Promise; - setFeatureAttributes(traineeId: string, attributes: Record): Promise; - getFeatureAttributes(traineeId: string): Promise>; - getFeatureConviction(traineeId: string, request: FeatureConvictionRequest): Promise; - getMarginalStats(traineeId: string, request: FeatureMarginalStatsRequest): Promise; -} diff --git a/src/client/errors.ts b/src/client/errors.ts index 6fe8b5f..1519c23 100644 --- a/src/client/errors.ts +++ b/src/client/errors.ts @@ -1,43 +1,89 @@ -import { ModelError, ModelErrorFromJSON } from "../types"; +export const DEFAULT_ERROR_MESSAGE = "An unknown error ocurred."; -export class ProblemError extends Error { - public readonly code?: string; - - constructor(message?: string, code?: string) { - super(message); - this.code = code; - } +export interface ValidationErrorDetail { + message: string; + field?: string[]; + code?: string | null; } -export class ApiError extends ProblemError implements ModelError { - constructor(private readonly problem: ModelError) { - super(problem?.detail, problem?.code); - } +export interface ValidationErrorCollection { + [key: string]: ValidationErrorCollection | ValidationErrorDetail[]; +} - get status() { - return this.problem.status; - } +export class HowsoError extends Error { + override name = "HowsoError"; + readonly code: string | null; + readonly detail: string[]; - get type() { - return this.problem.type; + constructor(message: string | string[] = DEFAULT_ERROR_MESSAGE, code?: string | null) { + if (Array.isArray(message)) { + super(message[0]); + this.detail = message; + } else { + super(message); + this.detail = message ? [message] : []; + } + this.code = code || null; + // Set the prototype explicitly + Object.setPrototypeOf(this, new.target.prototype); } +} - get title() { - return this.problem.title; - } +export class HowsoValidationError extends HowsoError { + override name = "HowsoValidationError"; - get detail() { - return this.problem.detail; + constructor( + message?: string | string[], + code?: string | null, + public readonly errors?: ValidationErrorCollection, + ) { + super(message, code); + // Set the prototype explicitly + Object.setPrototypeOf(this, new.target.prototype); } - static fromJson(json: unknown): ApiError { - const error = ModelErrorFromJSON(json); - return new ApiError(error); + /** + * Iterator for all validation error messages. + */ + public *errorMessages() { + function* traverse( + path: string[], + errors: ValidationErrorCollection | ValidationErrorDetail[], + ): Generator { + if (Array.isArray(errors)) { + for (const item of errors) { + const detail: ValidationErrorDetail = { + message: item.message || DEFAULT_ERROR_MESSAGE, + field: path, + }; + if (item.code) { + detail.code = item.code; + } + yield detail; + } + } else { + for (const [key, value] of Object.entries(errors)) { + yield* traverse([...path, key], value); + } + } + } + if (this.errors != null) { + for (const item of traverse([], this.errors)) { + yield item; + } + } } } -export class ValidationError extends ProblemError {} - -export class TimeoutError extends ProblemError {} +export class RequiredError extends Error { + override name = "RequiredError"; -export class RetriableError extends ProblemError {} + constructor( + public field: string, + msg?: string, + ) { + super(msg); + // Set the prototype explicitly + Object.setPrototypeOf(this, new.target.prototype); + } +} diff --git a/src/client/index.ts b/src/client/index.ts index a932304..4d25636 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -1,3 +1,3 @@ export * from "./errors"; export * from "./utilities"; -export * from "./wasm"; +export * from "./worker"; diff --git a/src/client/utilities/logger.ts b/src/client/utilities/logger.ts new file mode 100644 index 0000000..7c5babc --- /dev/null +++ b/src/client/utilities/logger.ts @@ -0,0 +1,15 @@ +export type Args = (...args: any[]) => void; + +export type Logger = { + error: Args; + warn: Args; + info: Args; + debug: Args; +}; + +export const nullLogger: Logger = { + error: () => {}, + warn: () => {}, + info: () => {}, + debug: () => {}, +}; diff --git a/src/client/wasm/client.ts b/src/client/wasm/client.ts deleted file mode 100644 index e73fbc6..0000000 --- a/src/client/wasm/client.ts +++ /dev/null @@ -1,850 +0,0 @@ -import { - AmalgamError, - type AmalgamCommand, - type AmalgamOptions, - type AmalgamRequest, - type AmalgamResponseBody, -} from "@howso/amalgam-lang"; -import { v4 as uuid } from "uuid"; -import { - AnalyzeRequest, - AnalyzeRequestToJSON, - AutoAblationParams, - CaseCountResponse, - Cases, - CasesRequest, - CasesRequestToJSON, - FeatureAttributes, - FeatureAttributesFromJSON, - FeatureAttributesToJSON, - FeatureConviction, - FeatureConvictionRequest, - FeatureConvictionRequestToJSON, - FeatureMarginalStats, - FeatureMarginalStatsFromJSON, - FeatureMarginalStatsRequest, - FeatureMarginalStatsRequestToJSON, - ReactAggregateRequest, - ReactAggregateRequestToJSON, - ReactAggregateResponse, - ReactAggregateResponseContent, - ReactAggregateResponseFromJSON, - ReactIntoFeaturesRequest, - ReactIntoFeaturesRequestToJSON, - ReactIntoFeaturesResponse, - ReactIntoFeaturesResponseFromJSON, - ReactRequest, - ReactRequestToJSON, - ReactResponse, - ReactResponseContent, - ReactResponseFromJSON, - ReactSeriesRequest, - ReactSeriesRequestToJSON, - ReactSeriesResponse, - ReactSeriesResponseContent, - ReactSeriesResponseFromJSON, - Session, - SessionIdentity, - SessionToJSON, - SetAutoAnalyzeParamsRequest, - SetAutoAnalyzeParamsRequestToJSON, - Trainee, - TraineeFromJSON, - TraineeIdentity, - TraineeToJSON, - TraineeWorkflowAttributesFromJSON, - TraineeWorkflowAttributesRequest, - TraineeWorkflowAttributesRequestToJSON, - TrainRequest, - TrainRequestToJSON, - TrainResponse, -} from "../../types"; -import { mapValues, RequiredError } from "../../types/runtime"; -import type { Capabilities, ISessionClient, ITraineeClient } from "../capabilities/index"; -import { BaseClient, TraineeBaseCache } from "../capabilities/index"; -import { ProblemError } from "../errors"; -import { batcher, BatchOptions, CacheMap, isNode } from "../utilities/index"; -import { AmalgamCoreResponse, prepareCoreRequest, prepareCoreResponse } from "./core"; -import { FileSystemClient } from "./files"; - -/* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ -export interface TraineeCache extends TraineeBaseCache {} - -export interface ClientOptions { - trace?: boolean; - // Browser only - migrationsUrl?: string | URL; - /** Generic howso.caml file. This will not be loaded unless a function requires it such as `createTrainee` */ - howsoUrl?: string | URL; - // Node only - libPath?: string; -} - -export class WasmClient extends BaseClient implements ITraineeClient, ISessionClient { - public static readonly capabilities: Readonly = { - supportsTrainees: true, - supportsSessions: true, - supportsTrace: true, - supportsFileSystem: true, - }; - public readonly fs: FileSystemClient; - - protected readonly traineeCache: CacheMap; - protected activeSession?: Session; - - constructor( - protected readonly worker: Worker, - protected readonly options: ClientOptions, - ) { - super(); - if (worker == null) { - throw new RequiredError("worker", "A worker is required to instantiate a client."); - } - if (options == null) { - throw new RequiredError("options", "Client options are required."); - } - this.traineeCache = new CacheMap(); - this.fs = new FileSystemClient(this.worker, options?.libPath); - } - - /** - * Execute a core entity request. - * @param label The core label. - * @param data The request data. - * @param throwErrors If core errors should be thrown or returned. - * @returns The core response object. - */ - protected async execute( - traineeId: string, - label: string, - data: D, - throwErrors = true, - ): Promise> { - const response = await this.dispatch({ - type: "request", - command: "executeEntityJson", - parameters: [traineeId, label, prepareCoreRequest(data)], - }); - try { - const result = prepareCoreResponse(response); - if (throwErrors) { - for (const err of result.errors) { - throw new ProblemError(err?.message || "An unknown error occurred.", err?.code); - } - } - return result; - } catch (reason) { - if (reason instanceof AmalgamError || reason instanceof ProblemError) { - throw reason; - } - - const message = reason instanceof Error ? reason.message : `${reason}`; - throw new Error(`${message} Label: ${label} Data: ${JSON.stringify(data)}`); - } - } - - /** - * Dispatch an Amalgam operation. - * @param request The operation request. - * @returns The operation response. - */ - protected dispatch( - request: AmalgamRequest, - ): Promise> { - return new Promise((resolve, reject) => { - const channel = new MessageChannel(); - channel.port1.onmessage = (ev: MessageEvent) => { - if (ev.data?.success) { - resolve(ev.data.body); - } else if (ev.data) { - const error = ev.data.error; - if (error instanceof Error && ev.data.body?.name) { - error.name = ev.data.body.name; - } - reject(error); - } else { - reject(); - } - }; - if (isNode) { - this.worker.postMessage({ data: request, ports: [channel.port2] }, [channel.port2]); - } else { - this.worker.postMessage(request, [channel.port2]); - } - }); - } - - /** - * Automatically resolve a trainee and ensure it is loaded given an identifier. - * TODO need to break out autoLoad and autoResolve - * - * @param traineeId The trainee identifier. - * @returns The trainee object. - */ - protected async autoResolveTrainee(traineeId: string): Promise { - if (traineeId == null) { - throw new TypeError("A trainee identifier is required."); - } - if (!this.traineeCache.has(traineeId)) { - await this.acquireTraineeResources(traineeId); - } - const cached = this.traineeCache.get(traineeId); - if (cached == null) { - throw new ProblemError(`Trainee "${traineeId}" not found.`); - } - return cached.trainee; - } - - /** - * Automatically persist trainee object when appropriate based on persistence level. - * @param traineeId The trainee identifier. - */ - protected async autoPersistTrainee(traineeId: string): Promise { - const cached = this.traineeCache.get(traineeId); - if (cached?.trainee?.persistence === "always") { - await this.persistTrainee(traineeId); - } - } - - /** - * Persist trainee object - * @param traineeId The trainee identifier. - */ - protected async persistTrainee(traineeId: string): Promise { - const fileUri = this.fs.join(this.fs.traineeDir, this.fs.sanitizeFilename(traineeId)); - await this.dispatch({ - type: "request", - command: "storeEntity", - parameters: [traineeId, fileUri], - }); - } - /** - * Retrieve the trainees that are currently loaded in core. - * @returns List of trainee identifiers. - */ - protected async getEntities(): Promise { - const entities = await this.dispatch({ - type: "request", - command: "getEntities", - parameters: [], - }); - return entities; - } - - /** - * Constructs trainee object from it's core metadata after attempting automatic resolution. - * - * @param traineeId The trainee identifier. - * @returns The trainee object. - */ - protected async getTraineeFromCore(traineeId: string): Promise { - await this.autoResolveTrainee(traineeId); - return this._getTraineeFromCore(traineeId); - } - - /** - * Constructs trainee object from it's core metadata without attempting automatic resolution. - * - * @param traineeId The trainee identifier. - * @returns The trainee object. - */ - protected async _getTraineeFromCore(traineeId: string): Promise { - const [metadata, features] = await Promise.all([ - this._getMetadata(traineeId), - this._getFeatureAttributes(traineeId), - ]); - - return TraineeFromJSON({ - features, - id: traineeId, - name: metadata.name, - persistence: metadata.persistence, - metadata: metadata.metadata, - }) as Trainee; - } - - /** - * Setup client. - * Prepares the file system and initializes the worker. - * No trainee is loaded automatically during this process. - */ - public async setup(): Promise { - // Initialize the Amalgam runtime - const options: AmalgamOptions = { trace: this.options.trace }; - const ready = await this.dispatch({ - type: "request", - command: "initialize", - parameters: [options], - }); - - if (ready) { - // Initialize the session - await this.beginSession(); - return; - } - - // Prepare the core files - if (isNode) { - // NodeJS - if (this.options.libPath == null) { - throw new ProblemError("Setup Failed - The client requires a file path to the library files."); - } - } else { - // Browsers - if (!this.options.howsoUrl) { - throw new ProblemError("Setup Failed - The client requires a URL for the howso.caml."); - } - - await this.fs.mkdir(this.fs.libDir); - await this.fs.mkdir(this.fs.traineeDir); - - if (this.options.migrationsUrl != null) { - await this.fs.mkdir(this.fs.migrationsDir); - await this.fs.createLazyFile( - this.fs.migrationsDir, - `migrations.${this.fs.entityExt}`, - String(this.options.migrationsUrl), - true, - false, - ); - } - await this.fs.createLazyFile( - this.fs.libDir, - `howso.${this.fs.entityExt}`, - String(this.options.howsoUrl), - true, - false, - ); - } - } - - /** - * Retrieves the active session. - * @returns The session object. - */ - public async getActiveSession(): Promise> { - if (this.activeSession == null) { - return await this.beginSession(); - } else { - return this.activeSession; - } - } - - /** - * Begins a new session. - * @param name A name for the new session. - * @param metadata Arbitrary metadata to include in the new session. - * @returns The session object. - */ - public async beginSession(name = "default", metadata: Record = {}): Promise { - this.activeSession = { id: uuid(), name, metadata, created_date: new Date(), modified_date: new Date() }; - return this.activeSession; - } - - /** - * Get all sessions in use by trainee. - * @param traineeId The trainee identifier. - * @returns The list of session identities. - */ - public async getTraineeSessions(traineeId: string): Promise[]> { - await this.autoResolveTrainee(traineeId); - - const { content } = await this.execute[]>(traineeId, "get_sessions", { - attributes: ["id", "name"], - }); - return content ?? []; - } - - /** - * Acquire resources for a trainee. - * @param traineeId The trainee identifier. - * @param url A URL to the trainee file. - */ - public async acquireTraineeResources(traineeId: string, url?: string): Promise { - if (this.traineeCache.has(traineeId)) { - // Already acquired - return; - } - - const filename = `${this.fs.sanitizeFilename(traineeId)}.${this.fs.entityExt}`; - if (url) { - // Prepare the file on the virtual file system - await this.fs.createLazyFile(this.fs.traineeDir, filename, url, true, false); - } - - // Load trainee only if entity not already in core - const loaded = await this.getEntities(); - if (loaded.indexOf(traineeId) == -1) { - // Only call load if not already loaded - await this.dispatch({ - type: "request", - command: "loadEntity", - parameters: [traineeId, this.fs.join(this.fs.traineeDir, filename)], - }); - } - - // Get trainee details. Use the internal method to prevent auto resolution loops. - const trainee = await this._getTraineeFromCore(traineeId); - // Cache the trainee - this.traineeCache.set(traineeId, { trainee }); - } - - /** - * Releases resources for a trainee. - * @param traineeId The trainee identifier. - */ - public async releaseTraineeResources(traineeId: string): Promise { - if (traineeId == null) { - throw new ProblemError("A trainee id is required."); - } - - // Check if trainee already loaded - const trainee = await this.autoResolveTrainee(traineeId); - const cached = this.traineeCache.get(trainee.id); - if (cached) { - if (["allow", "always"].indexOf(String(cached.trainee.persistence)) != -1) { - // Auto persist the trainee - await this.persistTrainee(traineeId); - } else if (cached.trainee.persistence == "never") { - throw new ProblemError( - "Trainees set to never persist may not have their resources released. Delete the trainee instead.", - ); - } - this.traineeCache.discard(traineeId); - } - - await this.dispatch({ - type: "request", - command: "destroyEntity", - parameters: [traineeId], - }); - } - - /** - * Create a new trainee. - * @param trainee The trainee identifier. - * @returns The new trainee object. - */ - public async createTrainee(trainee: Omit): Promise { - const traineeId = trainee.name || uuid(); - // Load the core entity - const howsoPath = this.fs.join(this.fs.libDir, `howso.${this.fs.entityExt}`); - const loaded = await this.dispatch({ - type: "request", - command: "loadEntity", - parameters: [traineeId, howsoPath], - }); - if (!loaded) { - throw new ProblemError("Failed to load the amalgam entities."); - } - - // Create the trainee entity - const created = await this.execute(traineeId, "initialize", { - trainee_id: traineeId, - filepath: howsoPath, - }); - if (!created) { - throw new ProblemError( - `Could not create a trainee with id '${traineeId}'. Either the trainee template file was not found or the trainee already exists.`, - ); - } - const { features = {}, ...props } = TraineeToJSON({ ...trainee, id: traineeId }); - - // Set trainee metadata - const metadata = { - name: props.name, - metadata: props.metadata, - persistence: props.persistence || "allow", - }; - await this.execute(traineeId, "set_metadata", { metadata }); - - // Set the feature attributes - await this.execute(traineeId, "set_feature_attributes", { features }); - const allFeatures = await this._getFeatureAttributes(traineeId); - - // Build, cache and return new trainee object - const newTrainee: Trainee = TraineeFromJSON({ ...metadata, id: traineeId, features: allFeatures }) as Trainee; - this.traineeCache.set(traineeId, { trainee: newTrainee }); - return newTrainee; - } - - /** - * Update a trainee's properties. - * @param trainee The trainee identifier. - */ - public async updateTrainee( - /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ - trainee: Trainee, - ): Promise { - throw new Error("Method not implemented."); - } - - /** - * Retrieve a trainee. - * @param traineeId The trainee identifier. - * @returns The trainee object. - */ - public async getTrainee(traineeId: string): Promise { - await this.autoResolveTrainee(traineeId); - return await this.getTraineeFromCore(traineeId); - } - - /** - * Deletes a trainee. - * @param traineeId The trainee identifier. - */ - public async deleteTrainee(traineeId: string): Promise { - // TODO need to use a someday function of autoResolve that doesn't call autoLoad here - // const trainee = await this.autoResolveTrainee(traineeId); - - await this.dispatch({ - type: "request", - command: "destroyEntity", - parameters: [traineeId], - }); - this.traineeCache.discard(traineeId); - const filename = this.fs.sanitizeFilename(traineeId); - this.fs.unlink(this.fs.join(this.fs.traineeDir, `${filename}.${this.fs.entityExt}`)); - } - - /** - * List existing trainees. - * @param keywords Keywords to filter the list of trainees by. - */ - public async listTrainees( - /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ - keywords: string | string[], - ): Promise { - throw new Error("Method not implemented."); - } - - /** - * Set the trainee's feature attributes. - * @param traineeId The trainee identifier. - * @param attributes The trainee's new feature attributes. - */ - public async setFeatureAttributes(traineeId: string, attributes: Record): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - if (attributes == null) { - throw new TypeError("Cannot set feature attributes to null."); - } - - const features = mapValues(attributes, FeatureAttributesToJSON); - await this.execute(traineeId, "set_feature_attributes", { features }); - trainee.features = await this._getFeatureAttributes(traineeId); - } - - /** - * Retrieve the trainee's metadata, without attempting automatic resolution. - * - * @param traineeId The trainee identifier. - * @returns The feature metadata object. - */ - protected async _getMetadata(traineeId: string): Promise> { - const { content } = await this.execute>>(traineeId, "get_metadata", {}); - if (content == null) { - throw new ProblemError(`Trainee ${traineeId} not found.`); - } - return content; - } - - /** - * Retrieve the trainee's feature attributes after attempting automatic resolution. - * - * @param traineeId The trainee identifier. - * @returns The feature attributes object. - */ - public async getFeatureAttributes(traineeId: string): Promise> { - await this.autoResolveTrainee(traineeId); - return this._getFeatureAttributes(traineeId); - } - - /** - * Retrieve the trainee's feature attributes without attempting automatic resolution. - * - * @param traineeId The trainee identifier. - * @returns The feature attributes object. - */ - protected async _getFeatureAttributes(traineeId: string): Promise> { - const { content } = await this.execute>(traineeId, "get_feature_attributes", {}); - return mapValues(content, FeatureAttributesFromJSON); - } - - /** - * Train data into the trainee. - * @param traineeId The trainee identifier. - * @param request The train parameters. - */ - public async train(traineeId: string, request: TrainRequest): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - if (!trainee.id) { - throw new Error(`trainee.id is undefined`); - } - const session = await this.getActiveSession(); - let autoAnalyze = false; - - const { cases = [], ...rest } = TrainRequestToJSON(request); - - // Add session metadata to trainee - await this.execute(traineeId, "set_session_metadata", { - session: session.id, - metadata: SessionToJSON(session), - }); - - const batchOptions: BatchOptions = { startSize: 100 }; - if (!isNode) { - // WASM builds are currently sensitive to large request sizes and may throw memory errors - batchOptions.startSize = 50; - batchOptions.limits = [1, 50]; - } - - // Batch scale the requests - await batcher( - async function* (this: WasmClient, size: number) { - let offset = 0; - while (offset < cases.length) { - const response = await this.execute(traineeId, "train", { - input_cases: cases.slice(offset, offset + size), - session: session.id, - ...rest, - }); - if (response.content?.status === "analyze") { - autoAnalyze = true; - } - offset += size; - size = yield; - } - }.bind(this), - batchOptions, - ); - - await this.autoPersistTrainee(trainee.id); - if (autoAnalyze) { - this.autoAnalyze(trainee.id); - } - } - - /** - * Run an auto analyze on the trainee. - * @param traineeId The trainee identifier. - */ - public async autoAnalyze(traineeId: string): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - if (!trainee.id) { - throw new Error(`trainee.id is undefined`); - } - await this.execute(traineeId, "auto_analyze", {}); - await this.autoPersistTrainee(trainee.id); - } - - /** - * Set the parameters use by auto analyze. - */ - public async getInternalParams(traineeId: string, request: TraineeWorkflowAttributesRequest = {}) { - await this.autoResolveTrainee(traineeId); - - const response = this.execute( - traineeId, - "get_internal_parameters", - TraineeWorkflowAttributesRequestToJSON(request), - ); - return TraineeWorkflowAttributesFromJSON(response); - } - - /** - * Set the parameters use by auto analyze. - * @param traineeId The trainee identifier. - * @param params The analysis parameters. - */ - public async setAutoAblationParams(traineeId: string, params: AutoAblationParams): Promise { - await this.autoResolveTrainee(traineeId); - - await this.execute( - traineeId, - "set_auto_ablation_params", - JSON.stringify({ - trainee_id: traineeId, - ...params, - }), - ); - await this.autoPersistTrainee(traineeId); - } - - /** - * Set the parameters use by auto analyze. - * @param traineeId The trainee identifier. - * @param request The analysis parameters. - */ - public async setAutoAnalyzeParams(traineeId: string, request: SetAutoAnalyzeParamsRequest = {}): Promise { - const { experimental_options, ...rest } = request; - await this.autoResolveTrainee(traineeId); - - await this.execute(traineeId, "set_auto_analyze_params", { - ...SetAutoAnalyzeParamsRequestToJSON(rest), - ...experimental_options, - }); - await this.autoPersistTrainee(traineeId); - } - - /** - * Analyze the trainee. - * @param traineeId The trainee identifier. - * @param request The analysis parameters. - */ - public async analyze(traineeId: string, request: AnalyzeRequest = {}): Promise { - const { experimental_options, ...rest } = request; - await this.autoResolveTrainee(traineeId); - - await this.execute(traineeId, "analyze", { - ...AnalyzeRequestToJSON(rest), - ...experimental_options, - }); - } - - /** - * Retrieve cases from a trainee. - * @param traineeId The trainee identifier. - * @param request The get parameters. - * @returns The cases response. - */ - public async getCases(traineeId: string, request?: CasesRequest): Promise { - await this.autoResolveTrainee(traineeId); - - const { content } = await this.execute(traineeId, "get_cases", { - ...CasesRequestToJSON(request), - }); - return content; - } - - /** - * Retrieve the number of trained cases in a trainee. - * @param traineeId The trainee identifier. - * @returns The number of trained cases. - */ - public async getNumTrainingCases(traineeId: string): Promise { - await this.autoResolveTrainee(traineeId); - - const { content } = await this.execute(traineeId, "get_num_training_cases", {}); - return content?.count || 0; - } - - /** - * React to a trainee. - * @param traineeId The trainee identifier. - * @param request The react parameters. - * @returns The react response. - */ - public async react(traineeId: string, request: ReactRequest): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - - this.preprocessReactRequest(trainee, request); - const { actions, contexts, ...rest } = ReactRequestToJSON(request); - const { warnings = [], content } = await this.execute(traineeId, "batch_react", { - action_values: actions, - context_values: contexts, - ...rest, - }); - return ReactResponseFromJSON({ warnings, content }); - } - - /** - * React to a trainee. - * @param traineeId The trainee identifier. - * @param request The react parameters. - * @returns The react response. - */ - public async reactAggregate(traineeId: string, request: ReactAggregateRequest): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - this.preprocessReactRequest(trainee, request); - const { warnings = [], content } = await this.execute( - traineeId, - "react_aggregate", - ReactAggregateRequestToJSON(request), - ); - return ReactAggregateResponseFromJSON({ warnings, content }); - } - - /** - * React in series to a trainee. - * @param traineeId The trainee identifier. - * @param request The react series parameters. - * @returns The react series response. - */ - public async reactSeries(traineeId: string, request: ReactSeriesRequest): Promise { - const trainee = await this.autoResolveTrainee(traineeId); - - this.preprocessReactRequest(trainee, request); - const { actions, contexts, ...rest } = ReactSeriesRequestToJSON(request); - const { warnings = [], content } = await this.execute(traineeId, "batch_react_series", { - action_values: actions, - context_values: contexts, - ...rest, - }); - return ReactSeriesResponseFromJSON({ warnings, content }); - } - - /** - * Calculate metrics and store them into the model to the specified features. - * @param traineeId The trainee identifier. - * @param request The react into features request. - * @returns The react into features response. - */ - public async reactIntoFeatures( - traineeId: string, - request: ReactIntoFeaturesRequest, - ): Promise { - await this.autoResolveTrainee(traineeId); - - const { warnings = [] } = await this.execute(traineeId, "react_into_features", { - ...ReactIntoFeaturesRequestToJSON(request), - }); - return ReactIntoFeaturesResponseFromJSON({ warnings }); - } - - /** - * Get marginal stats of a trainee. - * @param traineeId The trainee identifier. - * @param request The marginal stats request. - * @returns The marginal stats. - */ - public async getMarginalStats( - traineeId: string, - request: FeatureMarginalStatsRequest, - ): Promise { - await this.autoResolveTrainee(traineeId); - - const { content, warnings = [] } = await this.execute(traineeId, "get_marginal_stats", { - ...FeatureMarginalStatsRequestToJSON(request), - }); - return FeatureMarginalStatsFromJSON({ content, warnings }); - } - - /** - * Get familiarity conviction for features. - * @param traineeId The trainee identifier. - * @param request The feature conviction request. - * @returns A map of metric name to value. - */ - public async getFeatureConviction(traineeId: string, request: FeatureConvictionRequest): Promise { - await this.autoResolveTrainee(traineeId); - - const { content } = await this.execute>(traineeId, "compute_conviction_of_features", { - ...FeatureConvictionRequestToJSON(request), - }); - return content; - } - - /** - * Preprocess a request for react or react series. - * @param trainee The trainee identifier. - * @param request The react request. - */ - private preprocessReactRequest(trainee: Trainee, request: ReactRequest | ReactSeriesRequest): void { - if (!trainee) { - throw new Error("trainee is undefined"); - } - if (!request) { - throw new Error("request is undefined"); - } - } -} diff --git a/src/client/wasm/core.ts b/src/client/wasm/core.ts deleted file mode 100644 index 3275617..0000000 --- a/src/client/wasm/core.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { AmalgamError } from "@howso/amalgam-lang"; - -export class AmalgamCoreError extends AmalgamError { - constructor(message?: string, code?: string) { - super(message, code); - // Set the prototype explicitly - Object.setPrototypeOf(this, new.target.prototype); - this.name = "AmalgamCoreError"; - } -} - -export interface AmalgamCoreResponse { - content: R; - errors: AmalgamCoreError[]; - warnings: string[]; -} - -/** - * Prepare payload for a core request. - * @param payload The core payload. - * @returns The updated core payload. - */ -export function prepareCoreRequest(payload: any) { - if (!payload) { - return payload; - } - - // Remove null properties from payload - const filtered = { ...payload }; - for (const key in filtered) { - if (filtered[key as keyof typeof filtered] == null) { - delete filtered[key as keyof typeof filtered]; - } - } - - return filtered; -} - -/** - * Prepare payload from a core response. - * @param data The core response. - * @returns The updated core response. - */ -export function prepareCoreResponse(data: any): AmalgamCoreResponse { - if (!data) { - throw new AmalgamError("Null or empty response received from core."); - } - - if (Array.isArray(data) && data.length == 2) { - const errors: AmalgamCoreError[] = []; - const warnings: string[] = []; - const isSuccess = data[0]; - const value = data[1]; - - if (isSuccess) { - // Collect warnings - if (Array.isArray(value?.warnings)) { - for (const msg of value.warnings) { - if (msg != null) warnings.push(msg); - } - } - } else { - // Collect errors - if (value?.detail) { - if (Array.isArray(value.detail)) { - for (const msg of value.detail) { - errors.push(new AmalgamCoreError(msg, value.code)); - } - } else { - errors.push(new AmalgamCoreError(value.detail, value.code)); - } - } - if (errors.length == 0) { - errors.push(new AmalgamCoreError("An unknown error occurred.")); - } - } - - return { - errors, - warnings, - content: isSuccess ? value?.payload : undefined, - }; - } else if (["string", "number", "bigint", "boolean"].indexOf(typeof data) != -1) { - return { errors: [], warnings: [], content: data }; - } - - throw new AmalgamError("Malformed response received from core."); -} diff --git a/src/client/wasm/index.ts b/src/client/wasm/index.ts deleted file mode 100644 index d44e2e2..0000000 --- a/src/client/wasm/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./client"; -export * from "./core"; -export * from "./files"; diff --git a/src/client/worker/HowsoWorkerClient.node.test.ts b/src/client/worker/HowsoWorkerClient.node.test.ts new file mode 100644 index 0000000..75b9682 --- /dev/null +++ b/src/client/worker/HowsoWorkerClient.node.test.ts @@ -0,0 +1,67 @@ +/** + * @jest-environment node + */ + +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { Worker } from "node:worker_threads"; +import { inferFeatureAttributes } from "../../features"; +import { Logger } from "../utilities/logger"; +import { HowsoWorkerClient } from "./HowsoWorkerClient"; +import { NodeFileSystem } from "./filesystem"; + +describe("Node HowsoWorkerClient", () => { + let worker: Worker; + let client: TestHowsoWorkerClient; + + beforeAll(async () => { + worker = new Worker(resolve(__dirname, "../../tests/assets/NodeWorker.js")); + const fs = new NodeFileSystem(worker); + client = new TestHowsoWorkerClient(worker, fs, { + trace: false, + howsoUrl: resolve(__dirname, "../../assets/howso.caml"), + logger, + }); + await client.setup(); + const dataPath = resolve(__dirname, "../../tests/assets/iris.json"); + const data = JSON.parse(readFileSync(dataPath, { encoding: "utf8" })); + const feature_attributes = await inferFeatureAttributes(data, "array", {}); + const trainee = await client.createTrainee({ name: "My Trainee" }); + await client.setFeatureAttributes(trainee.id, { feature_attributes }); + }); + + afterAll(() => { + worker?.terminate(); + }); + + it("should queryTrainees", async () => { + const trainees = await client.queryTrainees(); + expect(trainees.length).toBe(1); + expect(trainees[0].name).toBe("My Trainee"); + }); + + it("should call logging methods", async () => { + const value = [Math.random(), Math.random()]; + client.callLogs(value); + + expect(error).toHaveBeenLastCalledWith(value); + expect(warn).toHaveBeenLastCalledWith(value); + expect(info).toHaveBeenLastCalledWith(value); + expect(debug).toHaveBeenLastCalledWith(value); + }); +}); + +class TestHowsoWorkerClient extends HowsoWorkerClient { + public callLogs(...args: any) { + this.logger.error(...args); + this.logger.warn(...args); + this.logger.info(...args); + this.logger.debug(...args); + } +} + +const error = jest.fn(); +const warn = jest.fn(); +const info = jest.fn(); +const debug = jest.fn(); +const logger: Logger = { error, warn, info, debug }; diff --git a/src/client/worker/HowsoWorkerClient.ts b/src/client/worker/HowsoWorkerClient.ts new file mode 100644 index 0000000..17fdd8a --- /dev/null +++ b/src/client/worker/HowsoWorkerClient.ts @@ -0,0 +1,587 @@ +import { + AmalgamError, + type AmalgamCommand, + type AmalgamOptions, + type AmalgamRequest, + type AmalgamResponseBody, +} from "@howso/amalgam-lang"; +import type { Worker as NodeWorker } from "node:worker_threads"; +import { v4 as uuid } from "uuid"; +import { Session, Trainee } from "../../engine"; +import type { BaseTrainee, ClientBatchResponse, TrainResponse } from "../../types"; +import type * as schemas from "../../types/schemas"; +import { + AbstractBaseClient, + type AbstractBaseClientOptions, + type ClientCache, + type ExecuteResponse, +} from "../AbstractBaseClient"; +import { HowsoError, RequiredError } from "../errors"; +import { batcher, BatchOptions, CacheMap } from "../utilities"; +import { AbstractFileSystem } from "./filesystem"; + +export type ClientOptions = AbstractBaseClientOptions & { + /** The Howso Engine caml file. This will not be loaded unless a function requires it, such as `createTrainee` */ + howsoUrl: string | URL; + /** Trainee migrations caml file. This will not be loaded unless a function request it, such as `upgradeTrainee` */ + migrationsUrl?: string | URL; + /** Enable tracing all Trainee operations for debugging. */ + trace?: boolean; +}; + +export class HowsoWorkerClient extends AbstractBaseClient { + protected activeSession?: Session; + protected cache: CacheMap; + + constructor( + protected readonly worker: Worker | NodeWorker, + public readonly fs: AbstractFileSystem, + protected readonly options: ClientOptions, + ) { + super(options); + if (worker == null) { + throw new RequiredError("worker", "A worker is required to instantiate a client."); + } + if (options == null) { + throw new RequiredError("options", "Client options are required."); + } + this.cache = new CacheMap(); + } + + /** + * Create a new client instance and run the required client setup process. + */ + public static async create( + worker: Worker | NodeWorker, + fs: AbstractFileSystem, + options: ClientOptions, + ): Promise { + const client = new HowsoWorkerClient(worker, fs, options); + await client.setup(); + return client; + } + + /** + * Execute an Engine entity request. + * @param handle The identifier of the entity. + * @param label The name of the method to execute. + * @param data The data to pass to the method. + * @param throwErrors If errors should be thrown automatically. + * @returns The Engine response object. + */ + public async execute( + handle: string, + label: string, + data: D, + throwErrors = true, + ): Promise> { + const response = await this.dispatch({ + type: "request", + command: "executeEntityJson", + parameters: [handle, label, this.prepareRequest(data)], + }); + try { + const result = this.processResponse(response); + if (throwErrors && Array.isArray(result.errors)) { + for (const err of result.errors) { + throw new HowsoError(err?.message, err?.code); + } + } + return result; + } catch (reason) { + if (reason instanceof AmalgamError || reason instanceof HowsoError) { + throw reason; + } + + const message = reason instanceof Error ? reason.message : `${reason}`; + throw new Error(`${message} Label: ${label} Data: ${JSON.stringify(data)}`); + } + } + + /** + * Dispatch an Amalgam operation. + * @param request The operation request. + * @returns The operation response. + */ + protected dispatch( + request: AmalgamRequest, + ): Promise> { + return new Promise((resolve, reject) => { + const channel = new MessageChannel(); + channel.port1.onmessage = (ev: MessageEvent) => { + if (ev.data?.success) { + resolve(ev.data.body); + } else if (ev.data) { + const error = ev.data.error; + if (error instanceof Error && ev.data.body?.name) { + error.name = ev.data.body.name; + } + reject(error); + } else { + reject(); + } + }; + this.worker.postMessage(request, [ + // @ts-expect-error The port will match browser/nodejs depending on the context + channel.port2, + ]); + }); + } + + /** + * Retrieve the entities that are currently loaded in Engine. + * @returns List of entity identifiers. + */ + protected async getEntities(): Promise { + const entities = await this.dispatch({ + type: "request", + command: "getEntities", + parameters: [], + }); + return entities; + } + + /** + * Automatically resolve a Trainee and ensure it is loaded given an identifier. + * + * @param traineeId The Trainee identifier. + * @returns The Trainee object. + */ + protected async autoResolveTrainee(traineeId: string): Promise { + if (traineeId == null) { + throw new TypeError("A Trainee identifier is required."); + } + await this.acquireTraineeResources(traineeId); // does nothing if already cached + const cached = this.cache.get(traineeId); + if (cached == null) { + throw new HowsoError(`Trainee "${traineeId}" not found.`, "not_found"); + } + return cached.trainee; + } + + /** + * Automatically persist Trainee object when appropriate based on persistence level. + * @param traineeId The Trainee identifier. + */ + protected async autoPersistTrainee(traineeId: string): Promise { + const cached = this.cache.get(traineeId); + if (cached?.trainee?.persistence === "always") { + await this.persistTrainee(traineeId); + } + } + + /** + * Constructs Trainee object from it's Engine metadata. + * + * @param traineeId The Trainee identifier. + * @returns The Trainee object and its feature attributes. + */ + protected async getTraineeFromEngine(traineeId: string): Promise { + const { payload } = await this.execute>(traineeId, "get_metadata", {}); + if (!payload) { + throw new HowsoError(`Trainee "${traineeId}" not found.`, "not_found"); + } + return new Trainee(this, { + id: traineeId, + name: payload?.name, + persistence: payload?.persistence ?? "allow", + metadata: payload?.metadata, + }); + } + + /** + * Include the active session in a request if not defined. + * @param request The Trainee request object. + * @returns The Trainee request object with a session. + */ + protected async includeSession>(request: T): Promise { + if (!request.session) { + // Include the active session + const session = await this.getActiveSession(); + return { ...request, session: session.id }; + } + return request; + } + + /** + * Setup client. + * Prepares the file system and initializes the worker. + * No Trainee is loaded automatically during this process. + */ + public async setup(): Promise { + // Initialize the Amalgam runtime + const options: AmalgamOptions = { trace: this.options.trace }; + await this.dispatch({ + type: "request", + command: "initialize", + parameters: [options], + }); + + // Create a default initial session + await this.beginSession(); + + // Prepare the Engine files + if (!this.options.howsoUrl) { + throw new HowsoError("The Howso client requires a URL for the howso.caml.", "setup_failed"); + } + + await this.fs.mkdir(this.fs.libDir); + await this.fs.mkdir(this.fs.traineeDir); + + if (this.options.migrationsUrl != null) { + await this.fs.mkdir(this.fs.migrationsDir); + await this.fs.prepareFile( + this.fs.migrationsDir, + `migrations.${this.fs.entityExt}`, + String(this.options.migrationsUrl), + ); + } + await this.fs.prepareFile(this.fs.libDir, `howso.${this.fs.entityExt}`, String(this.options.howsoUrl)); + } + + /** + * Retrieves the active session. + * @returns The session object. + */ + public async getActiveSession(): Promise> { + if (this.activeSession == null) { + return await this.beginSession(); + } else { + return this.activeSession; + } + } + + /** + * Begins a new session. + * @param name A name for the new session. + * @param metadata Arbitrary metadata to include in the new session. + * @returns The session object. + */ + public async beginSession(name = "default", metadata: Record = {}): Promise { + this.activeSession = new Session(this, { + id: uuid(), + name, + metadata, + created_date: new Date(), + modified_date: new Date(), + }); + return this.activeSession; + } + + /** + * Persist Trainee object + * @param traineeId The Trainee identifier. + */ + public async persistTrainee(traineeId: string): Promise { + const fileUri = this.fs.join(this.fs.traineeDir, this.fs.traineeFilename(traineeId)); + await this.dispatch({ + type: "request", + command: "storeEntity", + parameters: [traineeId, fileUri], + }); + } + + /** + * Acquire resources for a Trainee. + * @param traineeId The Trainee identifier. + * @param url A URL to the Trainee file. + */ + public async acquireTraineeResources(traineeId: string, url?: string): Promise { + if (this.cache.has(traineeId)) { + // Already acquired + return; + } + + const filename = this.fs.traineeFilename(traineeId); + const filePath = this.fs.join(this.fs.traineeDir, filename); + if (url) { + // Prepare the file on the virtual file system + await this.fs.prepareFile(this.fs.traineeDir, filename, url); + } + + const existingTrainees = await this.fs.readdir(this.fs.traineeDir); + if (!existingTrainees.includes(filename)) { + throw new HowsoError(`Trainee "${traineeId}" not found.`, "not_found"); + } + + // Load Trainee only if entity not already loaded + const loaded = await this.getEntities(); + if (loaded.indexOf(traineeId) == -1) { + // Only call load if not already loaded + const status = await this.dispatch({ + type: "request", + command: "loadEntity", + parameters: [traineeId, filePath], + }); + if (!status.loaded) { + throw new HowsoError(`Failed to acquire the Trainee "${traineeId}": ${status.message}`); + } + } + + // Get Trainee details. Use the internal method to prevent auto resolution loops. + const trainee = await this.getTraineeFromEngine(traineeId); + // Cache the Trainee + this.cache.set(traineeId, { trainee }); + } + + /** + * Releases resources for a Trainee. + * @param traineeId The Trainee identifier. + */ + public async releaseTraineeResources(traineeId: string): Promise { + if (traineeId == null) { + throw new HowsoError("A Trainee id is required."); + } + + // Check if Trainee already loaded + const cached = this.cache.get(traineeId); + if (cached) { + if (["allow", "always"].indexOf(String(cached.trainee.persistence)) != -1) { + // Auto persist the trainee + await this.persistTrainee(traineeId); + } else if (cached.trainee.persistence == "never") { + throw new HowsoError( + "Trainees set to never persist may not have their resources released. Delete the Trainee instead.", + ); + } + this.cache.discard(traineeId); + } + + await this.dispatch({ + type: "request", + command: "destroyEntity", + parameters: [traineeId], + }); + } + + /** + * Create a new Trainee. + * @param properties The Trainee properties. + * @returns The new Trainee object. + */ + public async createTrainee(properties: Omit): Promise { + const traineeId = properties.name || uuid(); + // Load the Engine entity + const howsoPath = this.fs.join(this.fs.libDir, `howso.${this.fs.entityExt}`); + const status = await this.dispatch({ + type: "request", + command: "loadEntity", + parameters: [traineeId, howsoPath], + }); + if (!status.loaded) { + throw new HowsoError(`Failed to initialize the Trainee "${traineeId}": ${status.message}`); + } + + // Create the Trainee entity + await this.execute(traineeId, "initialize", { + trainee_id: traineeId, + filepath: howsoPath, + }); + + // Set Trainee metadata + const metadata = { + name: properties.name, + metadata: properties.metadata || {}, + persistence: properties.persistence || "allow", + }; + await this.execute(traineeId, "set_metadata", { metadata }); + + // Build, cache and return new trainee object + const newTrainee = new Trainee(this, { id: traineeId, ...metadata }); + this.cache.set(traineeId, { trainee: newTrainee }); + return newTrainee; + } + + /** + * Update a Trainee's properties. + * @param trainee The Trainee to update. + * @returns The updated Trainee object. + */ + public async updateTrainee(trainee: BaseTrainee): Promise { + await this.autoResolveTrainee(trainee.id); + + // Set Trainee metadata + const metadata = { + name: trainee.name, + metadata: trainee.metadata || {}, + persistence: trainee.persistence || "allow", + }; + await this.execute(trainee.id, "set_metadata", { metadata }); + + const updatedTrainee = await this.getTraineeFromEngine(trainee.id); + this.cache.set(trainee.id, { trainee: updatedTrainee }); + return updatedTrainee; + } + + /** + * Retrieve a Trainee. + * @param traineeId The Trainee identifier. + * @returns The Trainee object. + */ + public async getTrainee(traineeId: string): Promise { + await this.autoResolveTrainee(traineeId); + return await this.getTraineeFromEngine(traineeId); // Get latest Trainee from Engine + } + + /** + * Copy a Trainee. + * @param traineeId The Trainee identifier. + * @param name The new Trainee name. + * @returns The new Trainee object. + */ + public async copyTrainee(traineeId: string, name?: string): Promise { + await this.autoResolveTrainee(traineeId); + const newTraineeId = name || uuid(); + const cloned = await this.dispatch({ + type: "request", + command: "cloneEntity", + parameters: [traineeId, newTraineeId], + }); + if (!cloned) { + throw new HowsoError( + `Failed to copy the Trainee "${traineeId}". This may be due to incorrect filepaths to the Howso binaries, or a Trainee "${newTraineeId}" already exists.`, + ); + } + // Update the trainee metadata + const { payload: metadata } = await this.execute(newTraineeId, "get_metadata", {}); + metadata.name = name; + await this.execute(newTraineeId, "set_metadata", { metadata }); + + // Get fresh copy of the trainee object + const newTrainee = await this.getTraineeFromEngine(newTraineeId); + this.cache.set(newTraineeId, { trainee: newTrainee }); + return newTrainee; + } + + /** + * Deletes a Trainee. + * @param traineeId The Trainee identifier. + */ + public async deleteTrainee(traineeId: string): Promise { + await this.dispatch({ + type: "request", + command: "destroyEntity", + parameters: [traineeId], + }); + this.cache.discard(traineeId); + const filename = this.fs.traineeFilename(traineeId); + this.fs.unlink(this.fs.join(this.fs.traineeDir, filename)); + } + + /** + * Search existing Trainees. + * @param keywords Keywords to filter the list of Trainees by. + * @returns A list of Trainee objects. + */ + public async queryTrainees(keywords?: string | string[]): Promise { + const cache = this.cache.values(); + // Normalize keywords to array + let search: string[]; + if (!keywords) { + search = []; + } else if (typeof keywords === "string") { + search = keywords.split(/\s/g); + } else { + search = keywords; + } + + function isMatch(value: string | null | undefined) { + if (value == null) return false; + if (search!.length) { + return search.some((keyword) => value.toLowerCase().includes(keyword.toLowerCase())); + } + return true; + } + + return cache.reduce((accumulator, value) => { + if (isMatch(value.trainee.name) || isMatch(value.trainee.id)) { + accumulator.push(value.trainee); + } + return accumulator; + }, []); + } + + public async impute(traineeId: string, request: schemas.ImputeRequest) { + request = await this.includeSession(request); + return await super.impute(traineeId, request); + } + + public async clearImputedData(traineeId: string, request: schemas.ClearImputedDataRequest) { + request = await this.includeSession(request); + return await super.clearImputedData(traineeId, request); + } + + public async moveCases(traineeId: string, request: schemas.MoveCasesRequest) { + request = await this.includeSession(request); + return await super.moveCases(traineeId, request); + } + + public async editCases(traineeId: string, request: schemas.EditCasesRequest) { + request = await this.includeSession(request); + return await super.editCases(traineeId, request); + } + + public async addFeature(traineeId: string, request: schemas.AddFeatureRequest) { + request = await this.includeSession(request); + return await super.addFeature(traineeId, request); + } + + public async removeFeature(traineeId: string, request: schemas.RemoveFeatureRequest) { + request = await this.includeSession(request); + return await super.removeFeature(traineeId, request); + } + + public async train(traineeId: string, request: schemas.TrainRequest) { + request = await this.includeSession(request); + return await super.train(traineeId, request); + } + + /** + * Train data into the Trainee using batched requests to the Engine. + * @param traineeId The Trainee identifier. + * @param request The train parameters. + * @returns The train result. + */ + public async batchTrain( + traineeId: string, + request: schemas.TrainRequest, + ): Promise> { + const trainee = await this.autoResolveTrainee(traineeId); + const { cases = [], ...rest } = request; + + // Limit to 10,000 cases at once maximum + const batchOptions: BatchOptions = { startSize: 100, limits: [1, 10000] }; + + let num_trained = 0; + let status = null; + const ablated_indices: number[] = []; + const warnings: string[][] = []; + + // Batch scale the requests + await batcher( + async function* (this: HowsoWorkerClient, size: number) { + let offset = 0; + while (offset < cases.length) { + const response = await this.train(trainee.id, { + ...rest, + cases: cases.slice(offset, offset + size), + }); + offset += size; + if (response.payload.status) status = response.payload.status; + if (response.payload.num_trained) num_trained += response.payload.num_trained; + if (response.payload.ablated_indices) ablated_indices.push(...response.payload.ablated_indices); + + // Warnings will be already output to the provided Logger in prepareResponse. Just aggregate. + if (response.warnings.length > 0) { + warnings.push(response.warnings); + } + size = yield; + } + }.bind(this), + batchOptions, + ); + + await this.autoPersistTrainee(trainee.id); + return { payload: { num_trained, status, ablated_indices }, warnings }; + } +} diff --git a/src/client/wasm/files.ts b/src/client/worker/filesystem/AbstractFileSystem.ts similarity index 75% rename from src/client/wasm/files.ts rename to src/client/worker/filesystem/AbstractFileSystem.ts index 83c0cb7..690d2a4 100644 --- a/src/client/wasm/files.ts +++ b/src/client/worker/filesystem/AbstractFileSystem.ts @@ -5,19 +5,13 @@ import type { FileSystemResponseBody, IFileSystem, } from "@howso/amalgam-lang"; -import { isNode } from "../utilities/detectors"; +import type { Worker as NodeWorker } from "node:worker_threads"; -export class FileSystemClient implements IFileSystem { - protected readonly baseDir: string; +export abstract class AbstractFileSystem implements IFileSystem { + protected abstract readonly baseDir: string; + protected abstract readonly worker: T; public readonly entityExt = "caml"; - constructor( - private readonly worker: Worker, - baseDir?: string, - ) { - this.baseDir = baseDir || "/app/"; - } - public get libDir(): string { return this.baseDir; } @@ -30,6 +24,8 @@ export class FileSystemClient implements IFileSystem { return this.join(this.libDir, "migrations", "/"); } + public abstract prepareFile(parent: string, name: string, url: string): Promise; + public join(...parts: string[]): string { const segments = []; if (parts?.[0]?.startsWith("/")) { @@ -59,11 +55,18 @@ export class FileSystemClient implements IFileSystem { reject(ev.data?.error); } }; - if (isNode) { - this.worker.postMessage({ data: request, ports: [channel.port2] }, [channel.port2]); - } else { - this.worker.postMessage(request, [channel.port2]); - } + this.worker.postMessage(request, [ + // @ts-expect-error The port will match browser/nodejs depending on the context + channel.port2, + ]); + }); + } + + public async analyzePath(path: string, dontResolveLastLink?: boolean): Promise { + return await this.dispatch({ + type: "request", + command: "analyzePath", + parameters: [path, dontResolveLastLink], }); } @@ -81,11 +84,15 @@ export class FileSystemClient implements IFileSystem { }); } - public async writeFile(path: string, data: string | DataView): Promise { + public async writeFile( + path: string, + data: string | ArrayBufferView, + opts?: { flags?: string | undefined }, + ): Promise { await this.dispatch({ type: "request", command: "writeFile", - parameters: [path, data], + parameters: [path, data, opts], }); } @@ -133,7 +140,9 @@ export class FileSystemClient implements IFileSystem { } private isSafeChar(code: number) { - // UTF-8 chars below zero (U+0030) are unsafe + // Space and dash are ok + if (code == 32 || code == 45) return true; + // Other UTF-8 chars below zero (U+0030) are unsafe if (code < 48) return false; // Chars between 0 and 9 are ok if (code <= 57) return true; @@ -162,4 +171,9 @@ export class FileSystemClient implements IFileSystem { } return escaped; } + + public traineeFilename(traineeId: string): string { + const sanitized = this.sanitizeFilename(traineeId); + return `${sanitized}.${this.entityExt}`; + } } diff --git a/src/client/worker/filesystem/BrowserFileSystem.ts b/src/client/worker/filesystem/BrowserFileSystem.ts new file mode 100644 index 0000000..1cfc70b --- /dev/null +++ b/src/client/worker/filesystem/BrowserFileSystem.ts @@ -0,0 +1,16 @@ +import { AbstractFileSystem } from "./AbstractFileSystem"; + +export class BrowserFileSystem extends AbstractFileSystem { + protected readonly baseDir: string; + protected readonly worker: Worker; + + constructor(worker: Worker, baseDir?: string) { + super(); + this.worker = worker; + this.baseDir = baseDir ?? "/app/"; + } + + public async prepareFile(parent: string, name: string, url: string): Promise { + await this.createLazyFile(parent, name, url); + } +} diff --git a/src/client/worker/filesystem/NodeFileSystem.ts b/src/client/worker/filesystem/NodeFileSystem.ts new file mode 100644 index 0000000..22704cb --- /dev/null +++ b/src/client/worker/filesystem/NodeFileSystem.ts @@ -0,0 +1,23 @@ +import type { Worker } from "node:worker_threads"; +import { isNode } from "../../utilities"; +import { AbstractFileSystem } from "./AbstractFileSystem"; + +export class NodeFileSystem extends AbstractFileSystem { + protected readonly baseDir: string; + protected readonly worker: Worker; + + constructor(worker: Worker, baseDir?: string) { + super(); + if (!isNode) { + throw new Error("NodeFileSystem is only valid in Node contexts."); + } + this.worker = worker; + this.baseDir = baseDir ?? "/app/"; + } + + public async prepareFile(parent: string, name: string, url: string): Promise { + const { readFile } = await import("node:fs/promises"); + const data = await readFile(url); + await this.writeFile(this.join(parent, name), data); + } +} diff --git a/src/client/worker/filesystem/index.ts b/src/client/worker/filesystem/index.ts new file mode 100644 index 0000000..f1553d1 --- /dev/null +++ b/src/client/worker/filesystem/index.ts @@ -0,0 +1,3 @@ +export * from "./AbstractFileSystem"; +export * from "./BrowserFileSystem"; +export * from "./NodeFileSystem"; diff --git a/src/client/worker/index.ts b/src/client/worker/index.ts new file mode 100644 index 0000000..a01568f --- /dev/null +++ b/src/client/worker/index.ts @@ -0,0 +1,2 @@ +export * from "./filesystem"; +export * from "./HowsoWorkerClient"; diff --git a/src/engine/Session.ts b/src/engine/Session.ts new file mode 100644 index 0000000..d97fc92 --- /dev/null +++ b/src/engine/Session.ts @@ -0,0 +1,36 @@ +import { AbstractBaseClient } from "../client/AbstractBaseClient"; +import type { BaseSession } from "../types"; + +export class Session implements BaseSession { + public readonly id: string; + protected readonly client: AbstractBaseClient; + protected _name: BaseSession["name"]; + protected _metadata: BaseSession["metadata"]; + protected _created_date: BaseSession["created_date"]; + protected _modified_date: BaseSession["modified_date"]; + + constructor(client: AbstractBaseClient, obj: BaseSession) { + this.client = client; + this.id = obj.id; + this._name = obj.name; + this._metadata = obj.metadata; + this._created_date = obj.created_date; + this._modified_date = obj.modified_date; + } + + public get name() { + return this._name ?? null; + } + + public get metadata(): Readonly<{ [key: string]: any }> { + return this._metadata || {}; + } + + public get modified_date() { + return this._modified_date; + } + + public get created_date() { + return this._created_date; + } +} diff --git a/src/engine/Trainee.ts b/src/engine/Trainee.ts new file mode 100644 index 0000000..5917034 --- /dev/null +++ b/src/engine/Trainee.ts @@ -0,0 +1,30 @@ +import { AbstractBaseClient } from "../client/AbstractBaseClient"; +import type { BaseTrainee } from "../types"; + +export class Trainee implements BaseTrainee { + public readonly id: string; + protected readonly client: AbstractBaseClient; + protected _name: BaseTrainee["name"]; + protected _persistence: BaseTrainee["persistence"]; + protected _metadata: BaseTrainee["metadata"]; + + constructor(client: AbstractBaseClient, obj: BaseTrainee) { + this.client = client; + this.id = obj.id; + this._name = obj.name; + this._metadata = obj.metadata; + this._persistence = obj.persistence; + } + + public get name() { + return this._name ?? null; + } + + public get persistence() { + return this._persistence || "allow"; + } + + public get metadata(): Readonly<{ [key: string]: any }> { + return this._metadata || {}; + } +} diff --git a/src/engine/index.ts b/src/engine/index.ts new file mode 100644 index 0000000..6c22f8a --- /dev/null +++ b/src/engine/index.ts @@ -0,0 +1,2 @@ +export * from "./Session"; +export * from "./Trainee"; diff --git a/src/features/infer.test.ts b/src/features/infer.test.ts index b03a987..6d2a9b4 100644 --- a/src/features/infer.test.ts +++ b/src/features/infer.test.ts @@ -31,7 +31,7 @@ const expectFeatureAttributeBounds = (attributes: FeatureAttributes) => { expect(typeof attributes.bounds.allow_null).toBe("boolean"); if (attributes.bounds.min && attributes.bounds.max) { if (typeof attributes.bounds.min === "number") { - expect(attributes.bounds.min).toBeLessThan(attributes.bounds.max); + expect(attributes.bounds.min).toBeLessThan(attributes.bounds.max as number); } if (attributes.data_type === "formatted_date_time") { expect(new Date(attributes.bounds.min).getTime()).toBeLessThan(new Date(attributes.bounds.max).getTime()); diff --git a/src/features/infer.ts b/src/features/infer.ts index 79dcfa6..3ca923f 100644 --- a/src/features/infer.ts +++ b/src/features/infer.ts @@ -1,4 +1,4 @@ -import { ProblemError } from "../client/errors"; +import { HowsoError } from "../client/errors"; import type { FeatureAttributesIndex } from "../types"; import { AbstractDataType, @@ -25,7 +25,7 @@ export const getFeatureAttributesInferrer = ( case "parsed_array": return new InferFeatureAttributesFromParsedArray(data as ParsedArrayData); default: - throw new ProblemError("Unexpected data format."); + throw new HowsoError("Unexpected data format."); } }; diff --git a/src/features/serializer.ts b/src/features/serializer.ts index 700589b..ee094a9 100644 --- a/src/features/serializer.ts +++ b/src/features/serializer.ts @@ -1,4 +1,4 @@ -import { ProblemError } from "../client/errors"; +import { HowsoError } from "../client/errors"; import type { FeatureAttributes } from "../types"; import { AbstractDataType, @@ -38,7 +38,7 @@ export function getFeatureSerializer(format: FeatureSourceFormat): FeatureSerial svc = new FeatureSerializerParsedArrayData(); break; default: - throw new ProblemError("Unexpected data format."); + throw new HowsoError("Unexpected data format."); } return svc; } diff --git a/src/features/sources/Array.ts b/src/features/sources/Array.ts index 7821817..5df94cb 100644 --- a/src/features/sources/Array.ts +++ b/src/features/sources/Array.ts @@ -196,13 +196,13 @@ export class InferFeatureAttributesFromArray extends InferFeatureAttributesBase } } - const getBoundValue = (value: number | undefined): number | string | Date | undefined => { + const getBoundValue = (value: number | undefined): number | string | undefined => { if (value === undefined) { return undefined; } if (isDate) { - return new Date(value); + return new Date(value).toISOString(); } if (coercedDate) { diff --git a/src/index.ts b/src/index.ts index cebf3a3..077bd1f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export * from "./client"; +export * from "./engine"; export * from "./features"; export * from "./types"; diff --git a/src/tests/assets/NodeWorker.js b/src/tests/assets/NodeWorker.js new file mode 100644 index 0000000..be4bd13 --- /dev/null +++ b/src/tests/assets/NodeWorker.js @@ -0,0 +1,25 @@ +import { AmalgamWasmService, initRuntime } from "@howso/amalgam-lang"; +import { createRequire } from "node:module"; +import { parentPort } from "node:worker_threads"; +const require = createRequire(import.meta.url); +const wasmDataUri = require.resolve("@howso/amalgam-lang/lib/amalgam-st.data"); +const wasmUri = require.resolve("@howso/amalgam-lang/lib/amalgam-st.wasm"); + +(async function () { + const svc = new AmalgamWasmService((options) => { + return initRuntime(options, { + locateFile: (path) => { + if (path.endsWith("amalgam-st.wasm")) { + return wasmUri; + } else if (path.endsWith("amalgam-st.data")) { + return wasmDataUri; + } + return globalThis.location.href + path; + }, + }); + }); + parentPort.onmessage = async (ev) => { + svc.dispatch(ev); + }; + parentPort.postMessage({ type: "event", event: "ready" }); +})(); diff --git a/src/tests/assets/citations.md b/src/tests/assets/citations.md new file mode 100644 index 0000000..7d85156 --- /dev/null +++ b/src/tests/assets/citations.md @@ -0,0 +1,13 @@ +# Dataset Citations + + +### Iris + +[UCI Machine Learning Database - uci.edu](https://archive.ics.uci.edu/ml/datasets/iris) + +> Fisher,R.A. “The use of multiple measurements in taxonomic problems” Annual Eugenics, 7, Part II, 179-188 (1936); also in “Contributions to Mathematical Statistics” (John Wiley, NY, 1950). + + +### Asteroid + +[Jet Propulsion Laboratory of California Institute of Technology - nasa.gov](https://ssd.jpl.nasa.gov/tools/sbdb_query.html) \ No newline at end of file diff --git a/src/tests/assets/iris.json b/src/tests/assets/iris.json new file mode 100644 index 0000000..208057f --- /dev/null +++ b/src/tests/assets/iris.json @@ -0,0 +1 @@ +{"columns":["sepal_length","sepal_width","petal_length","petal_width","class"],"data":[[5.1,3.5,1.4,0.2,"Iris-setosa"],[4.9,3.0,1.4,0.2,"Iris-setosa"],[4.7,3.2,1.3,0.2,"Iris-setosa"],[4.6,3.1,1.5,0.2,"Iris-setosa"],[5.0,3.6,1.4,0.2,"Iris-setosa"],[5.4,3.9,1.7,0.4,"Iris-setosa"],[4.6,3.4,1.4,0.3,"Iris-setosa"],[5.0,3.4,1.5,0.2,"Iris-setosa"],[4.4,2.9,1.4,0.2,"Iris-setosa"],[4.9,3.1,1.5,0.1,"Iris-setosa"],[5.4,3.7,1.5,0.2,"Iris-setosa"],[4.8,3.4,1.6,0.2,"Iris-setosa"],[4.8,3.0,1.4,0.1,"Iris-setosa"],[4.3,3.0,1.1,0.1,"Iris-setosa"],[5.8,4.0,1.2,0.2,"Iris-setosa"],[5.7,4.4,1.5,0.4,"Iris-setosa"],[5.4,3.9,1.3,0.4,"Iris-setosa"],[5.1,3.5,1.4,0.3,"Iris-setosa"],[5.7,3.8,1.7,0.3,"Iris-setosa"],[5.1,3.8,1.5,0.3,"Iris-setosa"],[5.4,3.4,1.7,0.2,"Iris-setosa"],[5.1,3.7,1.5,0.4,"Iris-setosa"],[4.6,3.6,1.0,0.2,"Iris-setosa"],[5.1,3.3,1.7,0.5,"Iris-setosa"],[4.8,3.4,1.9,0.2,"Iris-setosa"],[5.0,3.0,1.6,0.2,"Iris-setosa"],[5.0,3.4,1.6,0.4,"Iris-setosa"],[5.2,3.5,1.5,0.2,"Iris-setosa"],[5.2,3.4,1.4,0.2,"Iris-setosa"],[4.7,3.2,1.6,0.2,"Iris-setosa"],[4.8,3.1,1.6,0.2,"Iris-setosa"],[5.4,3.4,1.5,0.4,"Iris-setosa"],[5.2,4.1,1.5,0.1,"Iris-setosa"],[5.5,4.2,1.4,0.2,"Iris-setosa"],[4.9,3.1,1.5,0.1,"Iris-setosa"],[5.0,3.2,1.2,0.2,"Iris-setosa"],[5.5,3.5,1.3,0.2,"Iris-setosa"],[4.9,3.1,1.5,0.1,"Iris-setosa"],[4.4,3.0,1.3,0.2,"Iris-setosa"],[5.1,3.4,1.5,0.2,"Iris-setosa"],[5.0,3.5,1.3,0.3,"Iris-setosa"],[4.5,2.3,1.3,0.3,"Iris-setosa"],[4.4,3.2,1.3,0.2,"Iris-setosa"],[5.0,3.5,1.6,0.6,"Iris-setosa"],[5.1,3.8,1.9,0.4,"Iris-setosa"],[4.8,3.0,1.4,0.3,"Iris-setosa"],[5.1,3.8,1.6,0.2,"Iris-setosa"],[4.6,3.2,1.4,0.2,"Iris-setosa"],[5.3,3.7,1.5,0.2,"Iris-setosa"],[5.0,3.3,1.4,0.2,"Iris-setosa"],[7.0,3.2,4.7,1.4,"Iris-versicolor"],[6.4,3.2,4.5,1.5,"Iris-versicolor"],[6.9,3.1,4.9,1.5,"Iris-versicolor"],[5.5,2.3,4.0,1.3,"Iris-versicolor"],[6.5,2.8,4.6,1.5,"Iris-versicolor"],[5.7,2.8,4.5,1.3,"Iris-versicolor"],[6.3,3.3,4.7,1.6,"Iris-versicolor"],[4.9,2.4,3.3,1.0,"Iris-versicolor"],[6.6,2.9,4.6,1.3,"Iris-versicolor"],[5.2,2.7,3.9,1.4,"Iris-versicolor"],[5.0,2.0,3.5,1.0,"Iris-versicolor"],[5.9,3.0,4.2,1.5,"Iris-versicolor"],[6.0,2.2,4.0,1.0,"Iris-versicolor"],[6.1,2.9,4.7,1.4,"Iris-versicolor"],[5.6,2.9,3.6,1.3,"Iris-versicolor"],[6.7,3.1,4.4,1.4,"Iris-versicolor"],[5.6,3.0,4.5,1.5,"Iris-versicolor"],[5.8,2.7,4.1,1.0,"Iris-versicolor"],[6.2,2.2,4.5,1.5,"Iris-versicolor"],[5.6,2.5,3.9,1.1,"Iris-versicolor"],[5.9,3.2,4.8,1.8,"Iris-versicolor"],[6.1,2.8,4.0,1.3,"Iris-versicolor"],[6.3,2.5,4.9,1.5,"Iris-versicolor"],[6.1,2.8,4.7,1.2,"Iris-versicolor"],[6.4,2.9,4.3,1.3,"Iris-versicolor"],[6.6,3.0,4.4,1.4,"Iris-versicolor"],[6.8,2.8,4.8,1.4,"Iris-versicolor"],[6.7,3.0,5.0,1.7,"Iris-versicolor"],[6.0,2.9,4.5,1.5,"Iris-versicolor"],[5.7,2.6,3.5,1.0,"Iris-versicolor"],[5.5,2.4,3.8,1.1,"Iris-versicolor"],[5.5,2.4,3.7,1.0,"Iris-versicolor"],[5.8,2.7,3.9,1.2,"Iris-versicolor"],[6.0,2.7,5.1,1.6,"Iris-versicolor"],[5.4,3.0,4.5,1.5,"Iris-versicolor"],[6.0,3.4,4.5,1.6,"Iris-versicolor"],[6.7,3.1,4.7,1.5,"Iris-versicolor"],[6.3,2.3,4.4,1.3,"Iris-versicolor"],[5.6,3.0,4.1,1.3,"Iris-versicolor"],[5.5,2.5,4.0,1.3,"Iris-versicolor"],[5.5,2.6,4.4,1.2,"Iris-versicolor"],[6.1,3.0,4.6,1.4,"Iris-versicolor"],[5.8,2.6,4.0,1.2,"Iris-versicolor"],[5.0,2.3,3.3,1.0,"Iris-versicolor"],[5.6,2.7,4.2,1.3,"Iris-versicolor"],[5.7,3.0,4.2,1.2,"Iris-versicolor"],[5.7,2.9,4.2,1.3,"Iris-versicolor"],[6.2,2.9,4.3,1.3,"Iris-versicolor"],[5.1,2.5,3.0,1.1,"Iris-versicolor"],[5.7,2.8,4.1,1.3,"Iris-versicolor"],[6.3,3.3,6.0,2.5,"Iris-virginica"],[5.8,2.7,5.1,1.9,"Iris-virginica"],[7.1,3.0,5.9,2.1,"Iris-virginica"],[6.3,2.9,5.6,1.8,"Iris-virginica"],[6.5,3.0,5.8,2.2,"Iris-virginica"],[7.6,3.0,6.6,2.1,"Iris-virginica"],[4.9,2.5,4.5,1.7,"Iris-virginica"],[7.3,2.9,6.3,1.8,"Iris-virginica"],[6.7,2.5,5.8,1.8,"Iris-virginica"],[7.2,3.6,6.1,2.5,"Iris-virginica"],[6.5,3.2,5.1,2.0,"Iris-virginica"],[6.4,2.7,5.3,1.9,"Iris-virginica"],[6.8,3.0,5.5,2.1,"Iris-virginica"],[5.7,2.5,5.0,2.0,"Iris-virginica"],[5.8,2.8,5.1,2.4,"Iris-virginica"],[6.4,3.2,5.3,2.3,"Iris-virginica"],[6.5,3.0,5.5,1.8,"Iris-virginica"],[7.7,3.8,6.7,2.2,"Iris-virginica"],[7.7,2.6,6.9,2.3,"Iris-virginica"],[6.0,2.2,5.0,1.5,"Iris-virginica"],[6.9,3.2,5.7,2.3,"Iris-virginica"],[5.6,2.8,4.9,2.0,"Iris-virginica"],[7.7,2.8,6.7,2.0,"Iris-virginica"],[6.3,2.7,4.9,1.8,"Iris-virginica"],[6.7,3.3,5.7,2.1,"Iris-virginica"],[7.2,3.2,6.0,1.8,"Iris-virginica"],[6.2,2.8,4.8,1.8,"Iris-virginica"],[6.1,3.0,4.9,1.8,"Iris-virginica"],[6.4,2.8,5.6,2.1,"Iris-virginica"],[7.2,3.0,5.8,1.6,"Iris-virginica"],[7.4,2.8,6.1,1.9,"Iris-virginica"],[7.9,3.8,6.4,2.0,"Iris-virginica"],[6.4,2.8,5.6,2.2,"Iris-virginica"],[6.3,2.8,5.1,1.5,"Iris-virginica"],[6.1,2.6,5.6,1.4,"Iris-virginica"],[7.7,3.0,6.1,2.3,"Iris-virginica"],[6.3,3.4,5.6,2.4,"Iris-virginica"],[6.4,3.1,5.5,1.8,"Iris-virginica"],[6.0,3.0,4.8,1.8,"Iris-virginica"],[6.9,3.1,5.4,2.1,"Iris-virginica"],[6.7,3.1,5.6,2.4,"Iris-virginica"],[6.9,3.1,5.1,2.3,"Iris-virginica"],[5.8,2.7,5.1,1.9,"Iris-virginica"],[6.8,3.2,5.9,2.3,"Iris-virginica"],[6.7,3.3,5.7,2.5,"Iris-virginica"],[6.7,3.0,5.2,2.3,"Iris-virginica"],[6.3,2.5,5.0,1.9,"Iris-virginica"],[6.5,3.0,5.2,2.0,"Iris-virginica"],[6.2,3.4,5.4,2.3,"Iris-virginica"],[5.9,3.0,5.1,1.8,"Iris-virginica"]]} \ No newline at end of file diff --git a/src/types/client.ts b/src/types/client.ts new file mode 100644 index 0000000..b555478 --- /dev/null +++ b/src/types/client.ts @@ -0,0 +1,9 @@ +export type ClientResponse = { + payload: R; + warnings: string[]; +}; + +export type ClientBatchResponse = { + payload: R; + warnings: string[][]; +}; diff --git a/src/types/index.ts b/src/types/index.ts index 609c2bb..75bc95a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1 +1,5 @@ -export * from "./models"; +export * from "./client"; +export * from "./schemas"; +export * from "./session"; +export * from "./shims"; +export * from "./trainee"; diff --git a/src/types/json.ts b/src/types/json.ts new file mode 100644 index 0000000..9ff8c14 --- /dev/null +++ b/src/types/json.ts @@ -0,0 +1,4 @@ +export type JSONPrimitive = string | number | boolean | null; +export type JSONObject = { [key: string]: JSONValue }; +export type JSONArray = Array; +export type JSONValue = JSONPrimitive | JSONObject | JSONArray; diff --git a/src/types/models/AccountIdentity.ts b/src/types/models/AccountIdentity.ts deleted file mode 100644 index 747d82c..0000000 --- a/src/types/models/AccountIdentity.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface AccountIdentity - */ -export interface AccountIdentity { - /** - * The user's UUID. - * @type {string} - * @memberof AccountIdentity - */ - uuid?: string; - /** - * The user's username. - * @type {string} - * @memberof AccountIdentity - */ - username?: string; - /** - * The user's full name. - * @type {string} - * @memberof AccountIdentity - */ - full_name?: string; -} - -/** - * Check if a given object implements the AccountIdentity interface. - */ -export function instanceOfAccountIdentity(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function AccountIdentityFromJSON(json: any): AccountIdentity { - return AccountIdentityFromJSONTyped(json, false); -} - -export function AccountIdentityFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountIdentity { - if (json === undefined || json === null) { - return json; - } - return { - uuid: !exists(json, "uuid") ? undefined : json["uuid"], - username: !exists(json, "username") ? undefined : json["username"], - full_name: !exists(json, "full_name") ? undefined : json["full_name"], - }; -} - -export function AccountIdentityToJSON(value?: AccountIdentity | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - uuid: value.uuid, - username: value.username, - full_name: value.full_name, - }; -} diff --git a/src/types/models/AnalyzeRequest.ts b/src/types/models/AnalyzeRequest.ts deleted file mode 100644 index 90cb156..0000000 --- a/src/types/models/AnalyzeRequest.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface AnalyzeRequest - */ -export interface AnalyzeRequest { - /** - * A list of action feature names. - * @type {Array} - * @memberof AnalyzeRequest - */ - action_features?: Array; - /** - * A list of context feature names. - * @type {Array} - * @memberof AnalyzeRequest - */ - context_features?: Array; - /** - * Number of cross validation folds to do. Value of 1 does hold-one-out instead of k-fold. - * @type {number} - * @memberof AnalyzeRequest - */ - k_folds?: number; - /** - * Number of samples used in calculating feature residuals. - * @type {number} - * @memberof AnalyzeRequest - */ - num_samples?: number; - /** - * Optional list of distance transform value hyperparameters to analyze with. - * @type {Array} - * @memberof AnalyzeRequest - */ - dt_values?: Array; - /** - * Optional list of k value hyperparameters to analyze with. - * @type {Array} - * @memberof AnalyzeRequest - */ - k_values?: Array; - /** - * Optional list of p value hyperparameters to analyze with. - * @type {Array} - * @memberof AnalyzeRequest - */ - p_values?: Array; - /** - * If true, bypass hyperparameter analysis. - * @type {boolean} - * @memberof AnalyzeRequest - */ - bypass_hyperparameter_analysis?: boolean; - /** - * If true, bypass calculation of feature residuals. - * @type {boolean} - * @memberof AnalyzeRequest - */ - bypass_calculate_feature_residuals?: boolean; - /** - * If true, bypass calculation of feature weights. - * @type {boolean} - * @memberof AnalyzeRequest - */ - bypass_calculate_feature_weights?: boolean; - /** - * Optional value, defaults to single_targeted - * single_targeted: analyze hyperparameters for the specified action_features - * omni_targeted: analyze hyperparameters for each context feature as an action feature, ignores action_features parameter - * targetless: analyze hyperparameters for all context features as possible action features, ignores action_features parameter - * @type {string} - * @memberof AnalyzeRequest - */ - targeted_model?: AnalyzeRequestTargetedModelEnum; - /** - * Optional. Number of cases to sample during analysis. Only applies for k_folds = 1. - * @type {number} - * @memberof AnalyzeRequest - */ - num_analysis_samples?: number; - /** - * Optional. Number of samples to use for analysis. The rest will be randomly held-out and not included in calculations. - * @type {number} - * @memberof AnalyzeRequest - */ - analysis_sub_model_size?: number; - /** - * Optional flag, when true uses deviations for LK metric in queries. - * @type {boolean} - * @memberof AnalyzeRequest - */ - use_deviations?: boolean; - /** - * Compute and use inverse of residuals as feature weights. - * @type {boolean} - * @memberof AnalyzeRequest - */ - inverse_residuals_as_weights?: boolean; - /** - * Optional. When True, will scale influence weights by each case's `weight_feature` weight. - * @type {boolean} - * @memberof AnalyzeRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof AnalyzeRequest - */ - weight_feature?: string; - /** - * Additional experimental analyze parameters. - * @type {{ [key: string]: any; }} - * @memberof AnalyzeRequest - */ - experimental_options?: { [key: string]: any }; -} - -/** - * @export - * @enum {string} - */ -export type AnalyzeRequestTargetedModelEnum = "single_targeted" | "omni_targeted" | "targetless"; - -/** - * Check if a given object implements the AnalyzeRequest interface. - */ -export function instanceOfAnalyzeRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function AnalyzeRequestFromJSON(json: any): AnalyzeRequest { - return AnalyzeRequestFromJSONTyped(json, false); -} - -export function AnalyzeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AnalyzeRequest { - if (json === undefined || json === null) { - return json; - } - return { - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - k_folds: !exists(json, "k_folds") ? undefined : json["k_folds"], - num_samples: !exists(json, "num_samples") ? undefined : json["num_samples"], - dt_values: !exists(json, "dt_values") ? undefined : json["dt_values"], - k_values: !exists(json, "k_values") ? undefined : json["k_values"], - p_values: !exists(json, "p_values") ? undefined : json["p_values"], - bypass_hyperparameter_analysis: !exists(json, "bypass_hyperparameter_analysis") - ? undefined - : json["bypass_hyperparameter_analysis"], - bypass_calculate_feature_residuals: !exists(json, "bypass_calculate_feature_residuals") - ? undefined - : json["bypass_calculate_feature_residuals"], - bypass_calculate_feature_weights: !exists(json, "bypass_calculate_feature_weights") - ? undefined - : json["bypass_calculate_feature_weights"], - targeted_model: !exists(json, "targeted_model") ? undefined : json["targeted_model"], - num_analysis_samples: !exists(json, "num_analysis_samples") ? undefined : json["num_analysis_samples"], - analysis_sub_model_size: !exists(json, "analysis_sub_model_size") ? undefined : json["analysis_sub_model_size"], - use_deviations: !exists(json, "use_deviations") ? undefined : json["use_deviations"], - inverse_residuals_as_weights: !exists(json, "inverse_residuals_as_weights") - ? undefined - : json["inverse_residuals_as_weights"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - experimental_options: !exists(json, "experimental_options") ? undefined : json["experimental_options"], - }; -} - -export function AnalyzeRequestToJSON(value?: AnalyzeRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_features: value.action_features, - context_features: value.context_features, - k_folds: value.k_folds, - num_samples: value.num_samples, - dt_values: value.dt_values, - k_values: value.k_values, - p_values: value.p_values, - bypass_hyperparameter_analysis: value.bypass_hyperparameter_analysis, - bypass_calculate_feature_residuals: value.bypass_calculate_feature_residuals, - bypass_calculate_feature_weights: value.bypass_calculate_feature_weights, - targeted_model: value.targeted_model, - num_analysis_samples: value.num_analysis_samples, - analysis_sub_model_size: value.analysis_sub_model_size, - use_deviations: value.use_deviations, - inverse_residuals_as_weights: value.inverse_residuals_as_weights, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - experimental_options: value.experimental_options, - }; -} diff --git a/src/types/models/ApiVersion.ts b/src/types/models/ApiVersion.ts deleted file mode 100644 index cccd4a5..0000000 --- a/src/types/models/ApiVersion.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * API version information. - * @export - * @interface ApiVersion - */ -export interface ApiVersion { - /** - * The API version. - * @type {string} - * @memberof ApiVersion - */ - api?: string; - /** - * The version of the locally installed client. - * @type {string} - * @memberof ApiVersion - */ - client?: string; -} - -/** - * Check if a given object implements the ApiVersion interface. - */ -export function instanceOfApiVersion(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ApiVersionFromJSON(json: any): ApiVersion { - return ApiVersionFromJSONTyped(json, false); -} - -export function ApiVersionFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiVersion { - if (json === undefined || json === null) { - return json; - } - return { - api: !exists(json, "api") ? undefined : json["api"], - client: !exists(json, "client") ? undefined : json["client"], - }; -} - -export function ApiVersionToJSON(value?: ApiVersion | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - api: value.api, - client: value.client, - }; -} diff --git a/src/types/models/AppendToSeriesStoreRequest.ts b/src/types/models/AppendToSeriesStoreRequest.ts deleted file mode 100644 index 2af41a4..0000000 --- a/src/types/models/AppendToSeriesStoreRequest.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -/** - * The body of an append to series store request. - * @export - * @interface AppendToSeriesStoreRequest - */ -export interface AppendToSeriesStoreRequest { - /** - * The name of the series store to append to. - * @type {string} - * @memberof AppendToSeriesStoreRequest - */ - series: string; - /** - * A 2D array of context values. - * @type {Array>} - * @memberof AppendToSeriesStoreRequest - */ - contexts: Array>; - /** - * The context feature names. - * @type {Array} - * @memberof AppendToSeriesStoreRequest - */ - context_features: Array; -} - -/** - * Check if a given object implements the AppendToSeriesStoreRequest interface. - */ -export function instanceOfAppendToSeriesStoreRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "series" in value; - isInstance = isInstance && "contexts" in value; - isInstance = isInstance && "context_features" in value; - - return isInstance; -} - -export function AppendToSeriesStoreRequestFromJSON(json: any): AppendToSeriesStoreRequest { - return AppendToSeriesStoreRequestFromJSONTyped(json, false); -} - -export function AppendToSeriesStoreRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): AppendToSeriesStoreRequest { - if (json === undefined || json === null) { - return json; - } - return { - series: json["series"], - contexts: json["contexts"], - context_features: json["context_features"], - }; -} - -export function AppendToSeriesStoreRequestToJSON(value?: AppendToSeriesStoreRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - series: value.series, - contexts: value.contexts, - context_features: value.context_features, - }; -} diff --git a/src/types/models/AutoAblationParams.ts b/src/types/models/AutoAblationParams.ts deleted file mode 100644 index 16ebfd8..0000000 --- a/src/types/models/AutoAblationParams.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface AutoAblationParams - */ -export interface AutoAblationParams { - /** - * When true, auto ablation is enabled. - * @type {boolean} - * @memberof AutoAblationParams - */ - auto_ablation_enabled?: boolean; - /** - * The name of the weight feature used when ablating. - * @type {string} - * @memberof AutoAblationParams - */ - auto_ablation_weight_feature?: string; - /** - * The minimum number of cases at which the model should. - * @type {number} - * @memberof AutoAblationParams - */ - minimum_model_size?: number; - /** - * The influence weight entropy quantile that a case must be beneath in order to be trained. - * @type {number} - * @memberof AutoAblationParams - */ - influence_weight_entropy_threshold?: number; - /** - * A list of feature names for which cases will be ablated if the feature prediction equals the case value. - * @type {Array} - * @memberof AutoAblationParams - */ - exact_prediction_features?: Array; - /** - * A map of feature names to tuples of [MIN, MAX] for which cases will be ablated if the feature prediction is within (case value - MIN, case_value + MAX). - * @type {{ [key: string]: Array; }} - * @memberof AutoAblationParams - */ - tolerance_prediction_threshold_map?: { [key: string]: Array }; - /** - * A map of feature names to relative percentages for which cases will be ablated if the feature prediction is within the relative error of the case value. - * @type {{ [key: string]: number; }} - * @memberof AutoAblationParams - */ - relative_prediction_threshold_map?: { [key: string]: number }; - /** - * A list of feature names for which cases will be ablated if the feature prediction is within the residual of the case value. - * @type {Array} - * @memberof AutoAblationParams - */ - residual_prediction_features?: Array; - /** - * The conviction value below which cases will be ablated. - * @type {number} - * @memberof AutoAblationParams - */ - conviction_upper_threshold?: number; - /** - * The conviction value above which cases will be ablated. - * @type {number} - * @memberof AutoAblationParams - */ - conviction_lower_threshold?: number; -} - -/** - * Check if a given object implements the AutoAblationParams interface. - */ -export function instanceOfAutoAblationParams(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function AutoAblationParamsFromJSON(json: any): AutoAblationParams { - return AutoAblationParamsFromJSONTyped(json, false); -} - -export function AutoAblationParamsFromJSONTyped(json: any, ignoreDiscriminator: boolean): AutoAblationParams { - if (json === undefined || json === null) { - return json; - } - return { - auto_ablation_enabled: !exists(json, "auto_ablation_enabled") ? undefined : json["auto_ablation_enabled"], - auto_ablation_weight_feature: !exists(json, "auto_ablation_weight_feature") - ? undefined - : json["auto_ablation_weight_feature"], - minimum_model_size: !exists(json, "minimum_model_size") ? undefined : json["minimum_model_size"], - influence_weight_entropy_threshold: !exists(json, "influence_weight_entropy_threshold") - ? undefined - : json["influence_weight_entropy_threshold"], - exact_prediction_features: !exists(json, "exact_prediction_features") - ? undefined - : json["exact_prediction_features"], - tolerance_prediction_threshold_map: !exists(json, "tolerance_prediction_threshold_map") - ? undefined - : json["tolerance_prediction_threshold_map"], - relative_prediction_threshold_map: !exists(json, "relative_prediction_threshold_map") - ? undefined - : json["relative_prediction_threshold_map"], - residual_prediction_features: !exists(json, "residual_prediction_features") - ? undefined - : json["residual_prediction_features"], - conviction_upper_threshold: !exists(json, "conviction_upper_threshold") - ? undefined - : json["conviction_upper_threshold"], - conviction_lower_threshold: !exists(json, "conviction_lower_threshold") - ? undefined - : json["conviction_lower_threshold"], - }; -} - -export function AutoAblationParamsToJSON(value?: AutoAblationParams | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - auto_ablation_enabled: value.auto_ablation_enabled, - auto_ablation_weight_feature: value.auto_ablation_weight_feature, - minimum_model_size: value.minimum_model_size, - influence_weight_entropy_threshold: value.influence_weight_entropy_threshold, - exact_prediction_features: value.exact_prediction_features, - tolerance_prediction_threshold_map: value.tolerance_prediction_threshold_map, - relative_prediction_threshold_map: value.relative_prediction_threshold_map, - residual_prediction_features: value.residual_prediction_features, - conviction_upper_threshold: value.conviction_upper_threshold, - conviction_lower_threshold: value.conviction_lower_threshold, - }; -} diff --git a/src/types/models/BaseReactRequest.ts b/src/types/models/BaseReactRequest.ts deleted file mode 100644 index c500231..0000000 --- a/src/types/models/BaseReactRequest.ts +++ /dev/null @@ -1,246 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { FeatureBounds } from "./FeatureBounds"; -import { FeatureBoundsFromJSON, FeatureBoundsToJSON } from "./FeatureBounds"; -import type { ReactDetails } from "./ReactDetails"; -import { ReactDetailsFromJSON, ReactDetailsToJSON } from "./ReactDetails"; - -/** - * Base parameters that apply to react and react series operations. - * @export - * @interface BaseReactRequest - */ -export interface BaseReactRequest { - /** - * A 2D array of context values. - * @type {Array>} - * @memberof BaseReactRequest - */ - contexts?: Array>; - /** - * One or more values for action features, if specified will only return the specified explanation - * details for the given actions. - * @type {Array>} - * @memberof BaseReactRequest - */ - actions?: Array>; - /** - * If set to true, assumes provided categorical (nominal or ordinal) feature values have already been substituted. - * @type {boolean} - * @memberof BaseReactRequest - */ - input_is_substituted?: boolean; - /** - * Only applicable if a substitution value map has been set. If set to false, will not substitute categorical feature values. - * @type {boolean} - * @memberof BaseReactRequest - */ - substitute_output?: boolean; - /** - * - * @type {ReactDetails} - * @memberof BaseReactRequest - */ - details?: ReactDetails; - /** - * The context features to use for this reaction. - * @type {Array} - * @memberof BaseReactRequest - */ - context_features?: Array; - /** - * The action features to use for this reaction. - * @type {Array} - * @memberof BaseReactRequest - */ - action_features?: Array; - /** - * A list of feature names whose values should be computed from the provided context in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof BaseReactRequest - */ - derived_context_features?: Array; - /** - * A list of feature names whose values should be computed after reaction from the resulting case prior to output, in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof BaseReactRequest - */ - derived_action_features?: Array; - /** - * If specified will execute a generative react. If not specified will executed a discriminative react. Conviction is the ratio of expected surprisal to generated surprisal for each feature generated, values are in the range of (0,infinity]. - * @type {number} - * @memberof BaseReactRequest - */ - desired_conviction?: number; - /** - * For generative reacts only. If true, excludes features which have a subtype in their feature attributes from the uniqueness check performed when generate_new_cases is "always". - * @type {boolean} - * @memberof BaseReactRequest - */ - exclude_novel_nominals_from_uniqueness_check?: boolean; - /** - * For generative reacts only. If false uses model feature residuals, if true recalculates regional model residuals. - * @type {boolean} - * @memberof BaseReactRequest - */ - use_regional_model_residuals?: boolean; - /** - * For generative reacts only. - * @type {{ [key: string]: FeatureBounds; }} - * @memberof BaseReactRequest - */ - feature_bounds_map?: { [key: string]: FeatureBounds }; - /** - * Control whether generated cases can be those that already exist in the model. This parameter takes in a string that could be one of the following: - * a. "attempt": attempts to generate new cases and if its not possible to generate a new case, it might generate cases in "no" mode (see point c.) - * b. "always": always generates new cases and if its not possible to generate a new case, it returns nulls. - * c. "no": generates data based on the `desired_conviction` specified and the generated data is not guaranteed to be a new case (that is, a case not found in original dataset.) - * @type {string} - * @memberof BaseReactRequest - */ - generate_new_cases?: BaseReactRequestGenerateNewCasesEnum; - /** - * List of features that will preserve their values from the case specified by `case_indices`, appending and overwriting the specified contexts as necessary. For generative reacts, if `case_indices` isn't specified will preserve feature values of a random case. - * @type {Array} - * @memberof BaseReactRequest - */ - preserve_feature_values?: Array; - /** - * The privacy distance criteria for generated new cases. - * @type {string} - * @memberof BaseReactRequest - */ - new_case_threshold?: BaseReactRequestNewCaseThresholdEnum; - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was trained into the session. If this case does not exist, discriminative react outputs null, generative react ignores it. - * @type {Array>} - * @memberof BaseReactRequest - */ - case_indices?: Array>; - /** - * If set to True and specified along with case_indices, each individual react will respectively ignore the corresponding case specified by case_indices by leaving it out. - * @type {boolean} - * @memberof BaseReactRequest - */ - leave_case_out?: boolean; - /** - * For generative reacts only. Features will be generated in the same order as provided in the 'action_features' parameter. - * @type {boolean} - * @memberof BaseReactRequest - */ - ordered_by_specified_features?: boolean; - /** - * If set to True will scale influence weights by each case's weight_feature weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof BaseReactRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof BaseReactRequest - */ - weight_feature?: string; -} - -/** - * @export - * @enum {string} - */ -export type BaseReactRequestGenerateNewCasesEnum = "attempt" | "always" | "no"; -/** - * @export - * @enum {string} - */ -export type BaseReactRequestNewCaseThresholdEnum = "min" | "max" | "most_similar"; - -/** - * Check if a given object implements the BaseReactRequest interface. - */ -export function instanceOfBaseReactRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function BaseReactRequestFromJSON(json: any): BaseReactRequest { - return BaseReactRequestFromJSONTyped(json, false); -} - -export function BaseReactRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): BaseReactRequest { - if (json === undefined || json === null) { - return json; - } - return { - contexts: !exists(json, "contexts") ? undefined : json["contexts"], - actions: !exists(json, "actions") ? undefined : json["actions"], - input_is_substituted: !exists(json, "input_is_substituted") ? undefined : json["input_is_substituted"], - substitute_output: !exists(json, "substitute_output") ? undefined : json["substitute_output"], - details: !exists(json, "details") ? undefined : ReactDetailsFromJSON(json["details"]), - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - derived_context_features: !exists(json, "derived_context_features") ? undefined : json["derived_context_features"], - derived_action_features: !exists(json, "derived_action_features") ? undefined : json["derived_action_features"], - desired_conviction: !exists(json, "desired_conviction") ? undefined : json["desired_conviction"], - exclude_novel_nominals_from_uniqueness_check: !exists(json, "exclude_novel_nominals_from_uniqueness_check") - ? undefined - : json["exclude_novel_nominals_from_uniqueness_check"], - use_regional_model_residuals: !exists(json, "use_regional_model_residuals") - ? undefined - : json["use_regional_model_residuals"], - feature_bounds_map: !exists(json, "feature_bounds_map") - ? undefined - : mapValues(json["feature_bounds_map"], FeatureBoundsFromJSON), - generate_new_cases: !exists(json, "generate_new_cases") ? undefined : json["generate_new_cases"], - preserve_feature_values: !exists(json, "preserve_feature_values") ? undefined : json["preserve_feature_values"], - new_case_threshold: !exists(json, "new_case_threshold") ? undefined : json["new_case_threshold"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - leave_case_out: !exists(json, "leave_case_out") ? undefined : json["leave_case_out"], - ordered_by_specified_features: !exists(json, "ordered_by_specified_features") - ? undefined - : json["ordered_by_specified_features"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function BaseReactRequestToJSON(value?: BaseReactRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - contexts: value.contexts, - actions: value.actions, - input_is_substituted: value.input_is_substituted, - substitute_output: value.substitute_output, - details: ReactDetailsToJSON(value.details), - context_features: value.context_features, - action_features: value.action_features, - derived_context_features: value.derived_context_features, - derived_action_features: value.derived_action_features, - desired_conviction: value.desired_conviction, - exclude_novel_nominals_from_uniqueness_check: value.exclude_novel_nominals_from_uniqueness_check, - use_regional_model_residuals: value.use_regional_model_residuals, - feature_bounds_map: - value.feature_bounds_map === undefined ? undefined : mapValues(value.feature_bounds_map, FeatureBoundsToJSON), - generate_new_cases: value.generate_new_cases, - preserve_feature_values: value.preserve_feature_values, - new_case_threshold: value.new_case_threshold, - case_indices: value.case_indices, - leave_case_out: value.leave_case_out, - ordered_by_specified_features: value.ordered_by_specified_features, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/BeginSessionRequest.ts b/src/types/models/BeginSessionRequest.ts deleted file mode 100644 index 7b11e3d..0000000 --- a/src/types/models/BeginSessionRequest.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface BeginSessionRequest - */ -export interface BeginSessionRequest { - /** - * The name given to the session. - * @type {string} - * @memberof BeginSessionRequest - */ - name: string; - /** - * Any key-value pair to store custom metadata for the session. - * @type {{ [key: string]: any; }} - * @memberof BeginSessionRequest - */ - metadata?: { [key: string]: any }; -} - -/** - * Check if a given object implements the BeginSessionRequest interface. - */ -export function instanceOfBeginSessionRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - - return isInstance; -} - -export function BeginSessionRequestFromJSON(json: any): BeginSessionRequest { - return BeginSessionRequestFromJSONTyped(json, false); -} - -export function BeginSessionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): BeginSessionRequest { - if (json === undefined || json === null) { - return json; - } - return { - name: json["name"], - metadata: !exists(json, "metadata") ? undefined : json["metadata"], - }; -} - -export function BeginSessionRequestToJSON(value?: BeginSessionRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - name: value.name, - metadata: value.metadata, - }; -} diff --git a/src/types/models/BooleanType.ts b/src/types/models/BooleanType.ts deleted file mode 100644 index 27e0e4e..0000000 --- a/src/types/models/BooleanType.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -/** - * - * @export - * @interface BooleanType - */ -export interface BooleanType { - /** - * The name of the data type. - * @type {string} - * @memberof BooleanType - */ - data_type: string; -} - -/** - * Check if a given object implements the BooleanType interface. - */ -export function instanceOfBooleanType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function BooleanTypeFromJSON(json: any): BooleanType { - return BooleanTypeFromJSONTyped(json, false); -} - -export function BooleanTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): BooleanType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - }; -} - -export function BooleanTypeToJSON(value?: BooleanType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - }; -} diff --git a/src/types/models/CaseCountResponse.ts b/src/types/models/CaseCountResponse.ts deleted file mode 100644 index 8842ad0..0000000 --- a/src/types/models/CaseCountResponse.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface CaseCountResponse - */ -export interface CaseCountResponse { - /** - * The number of cases. - * @type {number} - * @memberof CaseCountResponse - */ - count?: number; -} - -/** - * Check if a given object implements the CaseCountResponse interface. - */ -export function instanceOfCaseCountResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function CaseCountResponseFromJSON(json: any): CaseCountResponse { - return CaseCountResponseFromJSONTyped(json, false); -} - -export function CaseCountResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CaseCountResponse { - if (json === undefined || json === null) { - return json; - } - return { - count: !exists(json, "count") ? undefined : json["count"], - }; -} - -export function CaseCountResponseToJSON(value?: CaseCountResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - count: value.count, - }; -} diff --git a/src/types/models/CaseEditRequest.ts b/src/types/models/CaseEditRequest.ts deleted file mode 100644 index a8764fd..0000000 --- a/src/types/models/CaseEditRequest.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface CaseEditRequest - */ -export interface CaseEditRequest { - /** - * The names of the features to edit. - * @type {Array} - * @memberof CaseEditRequest - */ - features?: Array; - /** - * The feature values to edit the case with. - * @type {Array} - * @memberof CaseEditRequest - */ - feature_values?: Array; - /** - * List of tuples containing the session id and index, where index is the original 0-based index of the case as - * it was trained into the session. This explicitly specifies the cases to edit. When specified, `condition` - * and `condition_session` are ignored. - * @type {Array>} - * @memberof CaseEditRequest - */ - case_indices?: Array>; - /** - * A condition map to select which cases to edit. The dictionary keys are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {{ [key: string]: any; }} - * @memberof CaseEditRequest - */ - condition?: { [key: string]: any }; - /** - * If specified, ignores the condition and operates on cases for the specified session id. - * @type {string} - * @memberof CaseEditRequest - */ - condition_session?: string; - /** - * The maximum number of cases to edit. If not specified, the limit will be k cases if precision is - * "similar", or no limit if precision is "exact". - * @type {number} - * @memberof CaseEditRequest - */ - num_cases?: number; - /** - * Exact matching or fuzzy matching. - * @type {string} - * @memberof CaseEditRequest - */ - precision?: CaseEditRequestPrecisionEnum; -} - -/** - * @export - * @enum {string} - */ -export type CaseEditRequestPrecisionEnum = "exact" | "similar"; - -/** - * Check if a given object implements the CaseEditRequest interface. - */ -export function instanceOfCaseEditRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function CaseEditRequestFromJSON(json: any): CaseEditRequest { - return CaseEditRequestFromJSONTyped(json, false); -} - -export function CaseEditRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CaseEditRequest { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - feature_values: !exists(json, "feature_values") ? undefined : json["feature_values"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - condition: !exists(json, "condition") ? undefined : json["condition"], - condition_session: !exists(json, "condition_session") ? undefined : json["condition_session"], - num_cases: !exists(json, "num_cases") ? undefined : json["num_cases"], - precision: !exists(json, "precision") ? undefined : json["precision"], - }; -} - -export function CaseEditRequestToJSON(value?: CaseEditRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - feature_values: value.feature_values, - case_indices: value.case_indices, - condition: value.condition, - condition_session: value.condition_session, - num_cases: value.num_cases, - precision: value.precision, - }; -} diff --git a/src/types/models/CaseRemoveRequest.ts b/src/types/models/CaseRemoveRequest.ts deleted file mode 100644 index fa0212c..0000000 --- a/src/types/models/CaseRemoveRequest.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface CaseRemoveRequest - */ -export interface CaseRemoveRequest { - /** - * The number of cases to move or remove. This is ignored if case_indices is specified. - * @type {number} - * @memberof CaseRemoveRequest - */ - num_cases: number; - /** - * List of tuples containing the session id and index, where index is the original 0-based index of the case as - * it was trained into the session. This explicitly specifies the cases to retrieve. - * @type {Array>} - * @memberof CaseRemoveRequest - */ - case_indices?: Array>; - /** - * The condition map to select the cases to remove that meet all the provided conditions. The dictionary keys - * are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * This is ignored if case_indices is specified. - * @type {{ [key: string]: any; }} - * @memberof CaseRemoveRequest - */ - condition?: { [key: string]: any }; - /** - * If specified, ignores the condition and operates on cases for the specified session id. This is ignored if case_indices is specified. - * @type {string} - * @memberof CaseRemoveRequest - */ - condition_session?: string; - /** - * When specified, will distribute the removed cases' weights from this feature into their neighbors. - * @type {string} - * @memberof CaseRemoveRequest - */ - distribute_weight_feature?: string; - /** - * Exact matching or fuzzy matching. This is ignored if case_indices is specified. - * @type {string} - * @memberof CaseRemoveRequest - */ - precision?: CaseRemoveRequestPrecisionEnum; -} - -/** - * @export - * @enum {string} - */ -export type CaseRemoveRequestPrecisionEnum = "exact" | "similar"; - -/** - * Check if a given object implements the CaseRemoveRequest interface. - */ -export function instanceOfCaseRemoveRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "num_cases" in value; - - return isInstance; -} - -export function CaseRemoveRequestFromJSON(json: any): CaseRemoveRequest { - return CaseRemoveRequestFromJSONTyped(json, false); -} - -export function CaseRemoveRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CaseRemoveRequest { - if (json === undefined || json === null) { - return json; - } - return { - num_cases: json["num_cases"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - condition: !exists(json, "condition") ? undefined : json["condition"], - condition_session: !exists(json, "condition_session") ? undefined : json["condition_session"], - distribute_weight_feature: !exists(json, "distribute_weight_feature") - ? undefined - : json["distribute_weight_feature"], - precision: !exists(json, "precision") ? undefined : json["precision"], - }; -} - -export function CaseRemoveRequestToJSON(value?: CaseRemoveRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - num_cases: value.num_cases, - case_indices: value.case_indices, - condition: value.condition, - condition_session: value.condition_session, - distribute_weight_feature: value.distribute_weight_feature, - precision: value.precision, - }; -} diff --git a/src/types/models/Cases.ts b/src/types/models/Cases.ts deleted file mode 100644 index e51c89f..0000000 --- a/src/types/models/Cases.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * A matrix of data. - * @export - * @interface Cases - */ -export interface Cases { - /** - * The feature names that correspond to the case columns. - * @type {Array} - * @memberof Cases - */ - features?: Array; - /** - * A 2D array of case values. - * @type {Array>} - * @memberof Cases - */ - cases?: Array>; -} - -/** - * Check if a given object implements the Cases interface. - */ -export function instanceOfCases(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function CasesFromJSON(json: any): Cases { - return CasesFromJSONTyped(json, false); -} - -export function CasesFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cases { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - cases: !exists(json, "cases") ? undefined : json["cases"], - }; -} - -export function CasesToJSON(value?: Cases | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - cases: value.cases, - }; -} diff --git a/src/types/models/CasesRequest.ts b/src/types/models/CasesRequest.ts deleted file mode 100644 index 26a3165..0000000 --- a/src/types/models/CasesRequest.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a case request. - * @export - * @interface CasesRequest - */ -export interface CasesRequest { - /** - * Features to return. If not specified, the trainee's default feature - * set will be used. - * @type {Array} - * @memberof CasesRequest - */ - features?: Array; - /** - * If specified, cases for this specific session will be returned in - * the order they were trained. - * @type {string} - * @memberof CasesRequest - */ - session?: string; - /** - * If true, the response will include the list of imputed features. - * @type {boolean} - * @memberof CasesRequest - */ - indicate_imputed?: boolean; - /** - * List of tuples containing the session id and index, where index is the original 0-based index of the case as - * it was trained into the session. This explicitly specifies the cases to retrieve. - * @type {Array>} - * @memberof CasesRequest - */ - case_indices?: Array>; - /** - * The condition map to select the cases to remove that meet all the provided conditions. The dictionary keys - * are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {{ [key: string]: any; }} - * @memberof CasesRequest - */ - condition?: { [key: string]: any }; - /** - * The maximum number of cases to retrieve. If not specified, the limit will be k cases if precision is "similar", or - * no limit if precision is "exact". - * @type {number} - * @memberof CasesRequest - */ - num_cases?: number; - /** - * Exact matching or fuzzy matching. - * @type {string} - * @memberof CasesRequest - */ - precision?: CasesRequestPrecisionEnum; -} - -/** - * @export - * @enum {string} - */ -export type CasesRequestPrecisionEnum = "exact" | "similar"; - -/** - * Check if a given object implements the CasesRequest interface. - */ -export function instanceOfCasesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function CasesRequestFromJSON(json: any): CasesRequest { - return CasesRequestFromJSONTyped(json, false); -} - -export function CasesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CasesRequest { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - session: !exists(json, "session") ? undefined : json["session"], - indicate_imputed: !exists(json, "indicate_imputed") ? undefined : json["indicate_imputed"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - condition: !exists(json, "condition") ? undefined : json["condition"], - num_cases: !exists(json, "num_cases") ? undefined : json["num_cases"], - precision: !exists(json, "precision") ? undefined : json["precision"], - }; -} - -export function CasesRequestToJSON(value?: CasesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - session: value.session, - indicate_imputed: value.indicate_imputed, - case_indices: value.case_indices, - condition: value.condition, - num_cases: value.num_cases, - precision: value.precision, - }; -} diff --git a/src/types/models/DateType.ts b/src/types/models/DateType.ts deleted file mode 100644 index 13db251..0000000 --- a/src/types/models/DateType.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -/** - * - * @export - * @interface DateType - */ -export interface DateType { - /** - * The name of the data type. - * @type {string} - * @memberof DateType - */ - data_type: string; -} - -/** - * Check if a given object implements the DateType interface. - */ -export function instanceOfDateType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function DateTypeFromJSON(json: any): DateType { - return DateTypeFromJSONTyped(json, false); -} - -export function DateTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DateType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - }; -} - -export function DateTypeToJSON(value?: DateType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - }; -} diff --git a/src/types/models/DatetimeType.ts b/src/types/models/DatetimeType.ts deleted file mode 100644 index 7c3da3f..0000000 --- a/src/types/models/DatetimeType.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface DatetimeType - */ -export interface DatetimeType { - /** - * The name of the data type. - * @type {string} - * @memberof DatetimeType - */ - data_type: string; - /** - * The standardized timezone name. - * @type {string} - * @memberof DatetimeType - */ - timezone?: string | null; -} - -/** - * Check if a given object implements the DatetimeType interface. - */ -export function instanceOfDatetimeType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function DatetimeTypeFromJSON(json: any): DatetimeType { - return DatetimeTypeFromJSONTyped(json, false); -} - -export function DatetimeTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): DatetimeType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - timezone: !exists(json, "timezone") ? undefined : json["timezone"], - }; -} - -export function DatetimeTypeToJSON(value?: DatetimeType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - timezone: value.timezone, - }; -} diff --git a/src/types/models/DerivationParameters.ts b/src/types/models/DerivationParameters.ts deleted file mode 100644 index 63dc5b8..0000000 --- a/src/types/models/DerivationParameters.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface DerivationParameters - */ -export interface DerivationParameters { - /** - * The number of cases used for the local model. - * @type {number} - * @memberof DerivationParameters - */ - k?: number; - /** - * The parameter for the Lebesgue space. - * @type {number} - * @memberof DerivationParameters - */ - p?: number; - /** - * The value used as an exponent to convert distances to raw influence weights. - * @type {number} - * @memberof DerivationParameters - */ - distance_transform?: number; - /** - * The weights for each feature used in the distance metric. - * @type {{ [key: string]: number; }} - * @memberof DerivationParameters - */ - feature_weights?: { [key: string]: number }; - /** - * The deviations for each feature used in the distance metric. - * @type {{ [key: string]: number; }} - * @memberof DerivationParameters - */ - feature_deviations?: { [key: string]: number }; - /** - * The number of unique values for each nominal feature. - * @type {{ [key: string]: number; }} - * @memberof DerivationParameters - */ - nominal_class_counts?: { [key: string]: number }; - /** - * A flag indicating if feature weights were derived using inverse residual weighting. - * @type {boolean} - * @memberof DerivationParameters - */ - use_irw?: boolean; -} - -/** - * Check if a given object implements the DerivationParameters interface. - */ -export function instanceOfDerivationParameters(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DerivationParametersFromJSON(json: any): DerivationParameters { - return DerivationParametersFromJSONTyped(json, false); -} - -export function DerivationParametersFromJSONTyped(json: any, ignoreDiscriminator: boolean): DerivationParameters { - if (json === undefined || json === null) { - return json; - } - return { - k: !exists(json, "k") ? undefined : json["k"], - p: !exists(json, "p") ? undefined : json["p"], - distance_transform: !exists(json, "distance_transform") ? undefined : json["distance_transform"], - feature_weights: !exists(json, "feature_weights") ? undefined : json["feature_weights"], - feature_deviations: !exists(json, "feature_deviations") ? undefined : json["feature_deviations"], - nominal_class_counts: !exists(json, "nominal_class_counts") ? undefined : json["nominal_class_counts"], - use_irw: !exists(json, "use_irw") ? undefined : json["use_irw"], - }; -} - -export function DerivationParametersToJSON(value?: DerivationParameters | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - k: value.k, - p: value.p, - distance_transform: value.distance_transform, - feature_weights: value.feature_weights, - feature_deviations: value.feature_deviations, - nominal_class_counts: value.nominal_class_counts, - use_irw: value.use_irw, - }; -} diff --git a/src/types/models/DestructTraineeResponse.ts b/src/types/models/DestructTraineeResponse.ts deleted file mode 100644 index f5ef3e5..0000000 --- a/src/types/models/DestructTraineeResponse.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Result of a destruct trainee operation. - * @export - * @interface DestructTraineeResponse - */ -export interface DestructTraineeResponse { - /** - * - * @type {string} - * @memberof DestructTraineeResponse - */ - message?: string; -} - -/** - * Check if a given object implements the DestructTraineeResponse interface. - */ -export function instanceOfDestructTraineeResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DestructTraineeResponseFromJSON(json: any): DestructTraineeResponse { - return DestructTraineeResponseFromJSONTyped(json, false); -} - -export function DestructTraineeResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DestructTraineeResponse { - if (json === undefined || json === null) { - return json; - } - return { - message: !exists(json, "message") ? undefined : json["message"], - }; -} - -export function DestructTraineeResponseToJSON(value?: DestructTraineeResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - message: value.message, - }; -} diff --git a/src/types/models/DetailsResponse.ts b/src/types/models/DetailsResponse.ts deleted file mode 100644 index 01f3ed0..0000000 --- a/src/types/models/DetailsResponse.ts +++ /dev/null @@ -1,417 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { DerivationParameters } from "./DerivationParameters"; -import { DerivationParametersFromJSON, DerivationParametersToJSON } from "./DerivationParameters"; -import type { DetailsResponseDistanceRatioPartsInner } from "./DetailsResponseDistanceRatioPartsInner"; -import { - DetailsResponseDistanceRatioPartsInnerFromJSON, - DetailsResponseDistanceRatioPartsInnerToJSON, -} from "./DetailsResponseDistanceRatioPartsInner"; -import type { DetailsResponseOutlyingFeatureValuesInnerValue } from "./DetailsResponseOutlyingFeatureValuesInnerValue"; - -/** - * - * @export - * @interface DetailsResponse - */ -export interface DetailsResponse { - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - boundary_cases?: Array>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof DetailsResponse - */ - categorical_action_probabilities?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - derivation_parameters?: Array; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof DetailsResponse - */ - feature_residuals_full?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof DetailsResponse - */ - feature_residuals_robust?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof DetailsResponse - */ - prediction_stats?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue; }>} - * @memberof DetailsResponse - */ - outlying_feature_values?: Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue }>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - influential_cases?: Array>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - most_similar_cases?: Array>; - /** - * Observational errors for all features as defined in feature attributes. - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - observational_errors?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_mda_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_mda_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_mda_ex_post_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_mda_ex_post_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - case_mda_full?: Array>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - case_mda_robust?: Array>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - case_contributions_full?: Array>; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - case_contributions_robust?: Array>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_feature_residuals_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - case_feature_residuals_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - local_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - local_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - global_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof DetailsResponse - */ - global_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof DetailsResponse - */ - hypothetical_values?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - distance_ratio?: Array; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - distance_ratio_parts?: Array; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - distance_contribution?: Array; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - similarity_conviction?: Array; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - most_similar_case_indices?: Array>; - /** - * - * @type {Array} - * @memberof DetailsResponse - */ - generate_attempts?: Array; - /** - * - * @type {Array>} - * @memberof DetailsResponse - */ - series_generate_attempts?: Array>; -} - -/** - * Check if a given object implements the DetailsResponse interface. - */ -export function instanceOfDetailsResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DetailsResponseFromJSON(json: any): DetailsResponse { - return DetailsResponseFromJSONTyped(json, false); -} - -export function DetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DetailsResponse { - if (json === undefined || json === null) { - return json; - } - return { - boundary_cases: !exists(json, "boundary_cases") ? undefined : json["boundary_cases"], - categorical_action_probabilities: !exists(json, "categorical_action_probabilities") - ? undefined - : json["categorical_action_probabilities"], - derivation_parameters: !exists(json, "derivation_parameters") - ? undefined - : (json["derivation_parameters"] as Array).map(DerivationParametersFromJSON), - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - prediction_stats: !exists(json, "prediction_stats") ? undefined : json["prediction_stats"], - outlying_feature_values: !exists(json, "outlying_feature_values") ? undefined : json["outlying_feature_values"], - influential_cases: !exists(json, "influential_cases") ? undefined : json["influential_cases"], - most_similar_cases: !exists(json, "most_similar_cases") ? undefined : json["most_similar_cases"], - observational_errors: !exists(json, "observational_errors") ? undefined : json["observational_errors"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_ex_post_full: !exists(json, "feature_mda_ex_post_full") ? undefined : json["feature_mda_ex_post_full"], - feature_mda_ex_post_robust: !exists(json, "feature_mda_ex_post_robust") - ? undefined - : json["feature_mda_ex_post_robust"], - directional_feature_contributions_full: !exists(json, "directional_feature_contributions_full") - ? undefined - : json["directional_feature_contributions_full"], - directional_feature_contributions_robust: !exists(json, "directional_feature_contributions_robust") - ? undefined - : json["directional_feature_contributions_robust"], - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - case_directional_feature_contributions_full: !exists(json, "case_directional_feature_contributions_full") - ? undefined - : json["case_directional_feature_contributions_full"], - case_directional_feature_contributions_robust: !exists(json, "case_directional_feature_contributions_robust") - ? undefined - : json["case_directional_feature_contributions_robust"], - case_feature_contributions_full: !exists(json, "case_feature_contributions_full") - ? undefined - : json["case_feature_contributions_full"], - case_feature_contributions_robust: !exists(json, "case_feature_contributions_robust") - ? undefined - : json["case_feature_contributions_robust"], - case_mda_full: !exists(json, "case_mda_full") ? undefined : json["case_mda_full"], - case_mda_robust: !exists(json, "case_mda_robust") ? undefined : json["case_mda_robust"], - case_contributions_full: !exists(json, "case_contributions_full") ? undefined : json["case_contributions_full"], - case_contributions_robust: !exists(json, "case_contributions_robust") - ? undefined - : json["case_contributions_robust"], - case_feature_residuals_full: !exists(json, "case_feature_residuals_full") - ? undefined - : json["case_feature_residuals_full"], - case_feature_residuals_robust: !exists(json, "case_feature_residuals_robust") - ? undefined - : json["case_feature_residuals_robust"], - local_case_feature_residual_convictions_full: !exists(json, "local_case_feature_residual_convictions_full") - ? undefined - : json["local_case_feature_residual_convictions_full"], - local_case_feature_residual_convictions_robust: !exists(json, "local_case_feature_residual_convictions_robust") - ? undefined - : json["local_case_feature_residual_convictions_robust"], - global_case_feature_residual_convictions_full: !exists(json, "global_case_feature_residual_convictions_full") - ? undefined - : json["global_case_feature_residual_convictions_full"], - global_case_feature_residual_convictions_robust: !exists(json, "global_case_feature_residual_convictions_robust") - ? undefined - : json["global_case_feature_residual_convictions_robust"], - hypothetical_values: !exists(json, "hypothetical_values") ? undefined : json["hypothetical_values"], - distance_ratio: !exists(json, "distance_ratio") ? undefined : json["distance_ratio"], - distance_ratio_parts: !exists(json, "distance_ratio_parts") - ? undefined - : (json["distance_ratio_parts"] as Array).map(DetailsResponseDistanceRatioPartsInnerFromJSON), - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - similarity_conviction: !exists(json, "similarity_conviction") ? undefined : json["similarity_conviction"], - most_similar_case_indices: !exists(json, "most_similar_case_indices") - ? undefined - : json["most_similar_case_indices"], - generate_attempts: !exists(json, "generate_attempts") ? undefined : json["generate_attempts"], - series_generate_attempts: !exists(json, "series_generate_attempts") ? undefined : json["series_generate_attempts"], - }; -} - -export function DetailsResponseToJSON(value?: DetailsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - boundary_cases: value.boundary_cases, - categorical_action_probabilities: value.categorical_action_probabilities, - derivation_parameters: - value.derivation_parameters === undefined - ? undefined - : (value.derivation_parameters as Array).map(DerivationParametersToJSON), - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - prediction_stats: value.prediction_stats, - outlying_feature_values: value.outlying_feature_values, - influential_cases: value.influential_cases, - most_similar_cases: value.most_similar_cases, - observational_errors: value.observational_errors, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_ex_post_full: value.feature_mda_ex_post_full, - feature_mda_ex_post_robust: value.feature_mda_ex_post_robust, - directional_feature_contributions_full: value.directional_feature_contributions_full, - directional_feature_contributions_robust: value.directional_feature_contributions_robust, - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - case_directional_feature_contributions_full: value.case_directional_feature_contributions_full, - case_directional_feature_contributions_robust: value.case_directional_feature_contributions_robust, - case_feature_contributions_full: value.case_feature_contributions_full, - case_feature_contributions_robust: value.case_feature_contributions_robust, - case_mda_full: value.case_mda_full, - case_mda_robust: value.case_mda_robust, - case_contributions_full: value.case_contributions_full, - case_contributions_robust: value.case_contributions_robust, - case_feature_residuals_full: value.case_feature_residuals_full, - case_feature_residuals_robust: value.case_feature_residuals_robust, - local_case_feature_residual_convictions_full: value.local_case_feature_residual_convictions_full, - local_case_feature_residual_convictions_robust: value.local_case_feature_residual_convictions_robust, - global_case_feature_residual_convictions_full: value.global_case_feature_residual_convictions_full, - global_case_feature_residual_convictions_robust: value.global_case_feature_residual_convictions_robust, - hypothetical_values: value.hypothetical_values, - distance_ratio: value.distance_ratio, - distance_ratio_parts: - value.distance_ratio_parts === undefined - ? undefined - : (value.distance_ratio_parts as Array).map(DetailsResponseDistanceRatioPartsInnerToJSON), - distance_contribution: value.distance_contribution, - similarity_conviction: value.similarity_conviction, - most_similar_case_indices: value.most_similar_case_indices, - generate_attempts: value.generate_attempts, - series_generate_attempts: value.series_generate_attempts, - }; -} diff --git a/src/types/models/DetailsResponseDistanceRatioPartsInner.ts b/src/types/models/DetailsResponseDistanceRatioPartsInner.ts deleted file mode 100644 index b8959c4..0000000 --- a/src/types/models/DetailsResponseDistanceRatioPartsInner.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface DetailsResponseDistanceRatioPartsInner - */ -export interface DetailsResponseDistanceRatioPartsInner { - /** - * - * @type {number} - * @memberof DetailsResponseDistanceRatioPartsInner - */ - local_distance_contribution?: number | null; - /** - * - * @type {number} - * @memberof DetailsResponseDistanceRatioPartsInner - */ - nearest_distance?: number | null; -} - -/** - * Check if a given object implements the DetailsResponseDistanceRatioPartsInner interface. - */ -export function instanceOfDetailsResponseDistanceRatioPartsInner(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DetailsResponseDistanceRatioPartsInnerFromJSON(json: any): DetailsResponseDistanceRatioPartsInner { - return DetailsResponseDistanceRatioPartsInnerFromJSONTyped(json, false); -} - -export function DetailsResponseDistanceRatioPartsInnerFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): DetailsResponseDistanceRatioPartsInner { - if (json === undefined || json === null) { - return json; - } - return { - local_distance_contribution: !exists(json, "local_distance_contribution") - ? undefined - : json["local_distance_contribution"], - nearest_distance: !exists(json, "nearest_distance") ? undefined : json["nearest_distance"], - }; -} - -export function DetailsResponseDistanceRatioPartsInnerToJSON( - value?: DetailsResponseDistanceRatioPartsInner | null, -): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - local_distance_contribution: value.local_distance_contribution, - nearest_distance: value.nearest_distance, - }; -} diff --git a/src/types/models/DetailsResponseOutlyingFeatureValuesInnerValue.ts b/src/types/models/DetailsResponseOutlyingFeatureValuesInnerValue.ts deleted file mode 100644 index 662e1b9..0000000 --- a/src/types/models/DetailsResponseOutlyingFeatureValuesInnerValue.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Feature values from the reaction case that are below the min or above the max value of similar cases that were identified during a prediction. - * @export - * @interface DetailsResponseOutlyingFeatureValuesInnerValue - */ -export interface DetailsResponseOutlyingFeatureValuesInnerValue { - /** - * - * @type {number} - * @memberof DetailsResponseOutlyingFeatureValuesInnerValue - */ - input_case_value?: number; - /** - * - * @type {number} - * @memberof DetailsResponseOutlyingFeatureValuesInnerValue - */ - local_max?: number; -} - -/** - * Check if a given object implements the DetailsResponseOutlyingFeatureValuesInnerValue interface. - */ -export function instanceOfDetailsResponseOutlyingFeatureValuesInnerValue(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DetailsResponseOutlyingFeatureValuesInnerValueFromJSON( - json: any, -): DetailsResponseOutlyingFeatureValuesInnerValue { - return DetailsResponseOutlyingFeatureValuesInnerValueFromJSONTyped(json, false); -} - -export function DetailsResponseOutlyingFeatureValuesInnerValueFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): DetailsResponseOutlyingFeatureValuesInnerValue { - if (json === undefined || json === null) { - return json; - } - return { - input_case_value: !exists(json, "input_case_value") ? undefined : json["input_case_value"], - local_max: !exists(json, "local_max") ? undefined : json["local_max"], - }; -} - -export function DetailsResponseOutlyingFeatureValuesInnerValueToJSON( - value?: DetailsResponseOutlyingFeatureValuesInnerValue | null, -): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - input_case_value: value.input_case_value, - local_max: value.local_max, - }; -} diff --git a/src/types/models/DistancesRequest.ts b/src/types/models/DistancesRequest.ts deleted file mode 100644 index 9839d63..0000000 --- a/src/types/models/DistancesRequest.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of the distances metric request. - * @export - * @interface DistancesRequest - */ -export interface DistancesRequest { - /** - * List of feature names to use when computing distances. If unspecified uses all features. - * @type {Array} - * @memberof DistancesRequest - */ - features?: Array; - /** - * The action feature. If specified, uses targeted hyperparameters used to predict this `action_feature`, - * otherwise uses targetless hyperparameters. - * @type {string} - * @memberof DistancesRequest - */ - action_feature?: string; - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was - * trained into the session. If specified, returns distances for all of these cases. Ignored if `feature_values` - * is provided. If neither `feature_values` nor `case_indices` is specified, uses full dataset. - * @type {Array>} - * @memberof DistancesRequest - */ - case_indices?: Array>; - /** - * List of values, if specified, returns distances of the local model relative to these values, ignores - * `case_indices` parameter. - * @type {Array} - * @memberof DistancesRequest - */ - feature_values?: Array; - /** - * If set to True, will scale influence weights by each case's `weight_feature` weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof DistancesRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof DistancesRequest - */ - weight_feature?: string; - /** - * The row starting offset. Used for paging of results. - * @type {number} - * @memberof DistancesRequest - */ - row_offset: number; - /** - * The number of rows to include in the page. - * @type {number} - * @memberof DistancesRequest - */ - row_count: number; - /** - * The column starting offset. Used for paging of results. - * @type {number} - * @memberof DistancesRequest - */ - column_offset: number; - /** - * The number of columns to include in the page. - * @type {number} - * @memberof DistancesRequest - */ - column_count: number; -} - -/** - * Check if a given object implements the DistancesRequest interface. - */ -export function instanceOfDistancesRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "row_offset" in value; - isInstance = isInstance && "row_count" in value; - isInstance = isInstance && "column_offset" in value; - isInstance = isInstance && "column_count" in value; - - return isInstance; -} - -export function DistancesRequestFromJSON(json: any): DistancesRequest { - return DistancesRequestFromJSONTyped(json, false); -} - -export function DistancesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DistancesRequest { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - action_feature: !exists(json, "action_feature") ? undefined : json["action_feature"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - feature_values: !exists(json, "feature_values") ? undefined : json["feature_values"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - row_offset: json["row_offset"], - row_count: json["row_count"], - column_offset: json["column_offset"], - column_count: json["column_count"], - }; -} - -export function DistancesRequestToJSON(value?: DistancesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - action_feature: value.action_feature, - case_indices: value.case_indices, - feature_values: value.feature_values, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - row_offset: value.row_offset, - row_count: value.row_count, - column_offset: value.column_offset, - column_count: value.column_count, - }; -} diff --git a/src/types/models/DistancesResponse.ts b/src/types/models/DistancesResponse.ts deleted file mode 100644 index 3e9f666..0000000 --- a/src/types/models/DistancesResponse.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of the distances metric response. - * @export - * @interface DistancesResponse - */ -export interface DistancesResponse { - /** - * The list of case identifiers corresponding to the distances matrix rows. List of tuples, of session id and - * index, where index is the original 0-based index of the case as it was trained into the session. - * @type {Array>} - * @memberof DistancesResponse - */ - row_case_indices?: Array>; - /** - * The list of case identifiers corresponding to the distances matrix columns. List of tuples, of session id and - * index, where index is the original 0-based index of the case as it was trained into the session. - * @type {Array>} - * @memberof DistancesResponse - */ - column_case_indices?: Array>; - /** - * The distance values matrix. - * @type {Array>} - * @memberof DistancesResponse - */ - distances?: Array>; -} - -/** - * Check if a given object implements the DistancesResponse interface. - */ -export function instanceOfDistancesResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function DistancesResponseFromJSON(json: any): DistancesResponse { - return DistancesResponseFromJSONTyped(json, false); -} - -export function DistancesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DistancesResponse { - if (json === undefined || json === null) { - return json; - } - return { - row_case_indices: !exists(json, "row_case_indices") ? undefined : json["row_case_indices"], - column_case_indices: !exists(json, "column_case_indices") ? undefined : json["column_case_indices"], - distances: !exists(json, "distances") ? undefined : json["distances"], - }; -} - -export function DistancesResponseToJSON(value?: DistancesResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - row_case_indices: value.row_case_indices, - column_case_indices: value.column_case_indices, - distances: value.distances, - }; -} diff --git a/src/types/models/EvaluateActionOutput.ts b/src/types/models/EvaluateActionOutput.ts deleted file mode 100644 index 4593ba1..0000000 --- a/src/types/models/EvaluateActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { EvaluateResponse } from "./EvaluateResponse"; -import { EvaluateResponseFromJSON, EvaluateResponseToJSON } from "./EvaluateResponse"; - -/** - * - * @export - * @interface EvaluateActionOutput - */ -export interface EvaluateActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof EvaluateActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof EvaluateActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof EvaluateActionOutput - */ - operation_type: string; - /** - * - * @type {EvaluateResponse} - * @memberof EvaluateActionOutput - */ - output?: EvaluateResponse | null; -} - -/** - * Check if a given object implements the EvaluateActionOutput interface. - */ -export function instanceOfEvaluateActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function EvaluateActionOutputFromJSON(json: any): EvaluateActionOutput { - return EvaluateActionOutputFromJSONTyped(json, false); -} - -export function EvaluateActionOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvaluateActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : EvaluateResponseFromJSON(json["output"]), - }; -} - -export function EvaluateActionOutputToJSON(value?: EvaluateActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: EvaluateResponseToJSON(value.output), - }; -} diff --git a/src/types/models/EvaluateRequest.ts b/src/types/models/EvaluateRequest.ts deleted file mode 100644 index 9a04885..0000000 --- a/src/types/models/EvaluateRequest.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Request body for evaluate - * @export - * @interface EvaluateRequest - */ -export interface EvaluateRequest { - /** - * Map of feature name to custom code string - * @type {{ [key: string]: string; }} - * @memberof EvaluateRequest - */ - features_to_code_map: { [key: string]: string }; - /** - * - * @type {string} - * @memberof EvaluateRequest - */ - aggregation_code?: string; -} - -/** - * Check if a given object implements the EvaluateRequest interface. - */ -export function instanceOfEvaluateRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "features_to_code_map" in value; - - return isInstance; -} - -export function EvaluateRequestFromJSON(json: any): EvaluateRequest { - return EvaluateRequestFromJSONTyped(json, false); -} - -export function EvaluateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvaluateRequest { - if (json === undefined || json === null) { - return json; - } - return { - features_to_code_map: json["features_to_code_map"], - aggregation_code: !exists(json, "aggregation_code") ? undefined : json["aggregation_code"], - }; -} - -export function EvaluateRequestToJSON(value?: EvaluateRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features_to_code_map: value.features_to_code_map, - aggregation_code: value.aggregation_code, - }; -} diff --git a/src/types/models/EvaluateResponse.ts b/src/types/models/EvaluateResponse.ts deleted file mode 100644 index 61fb707..0000000 --- a/src/types/models/EvaluateResponse.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The response body for evaluate - * @export - * @interface EvaluateResponse - */ -export interface EvaluateResponse { - /** - * - * @type {any} - * @memberof EvaluateResponse - */ - aggregated?: any | null; - /** - * Map of feature name to list of values derived from custom code - * @type {{ [key: string]: Array; }} - * @memberof EvaluateResponse - */ - evaluated?: { [key: string]: Array }; -} - -/** - * Check if a given object implements the EvaluateResponse interface. - */ -export function instanceOfEvaluateResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function EvaluateResponseFromJSON(json: any): EvaluateResponse { - return EvaluateResponseFromJSONTyped(json, false); -} - -export function EvaluateResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvaluateResponse { - if (json === undefined || json === null) { - return json; - } - return { - aggregated: !exists(json, "aggregated") ? undefined : json["aggregated"], - evaluated: !exists(json, "evaluated") ? undefined : json["evaluated"], - }; -} - -export function EvaluateResponseToJSON(value?: EvaluateResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - aggregated: value.aggregated, - evaluated: value.evaluated, - }; -} diff --git a/src/types/models/ExtremeCasesRequest.ts b/src/types/models/ExtremeCasesRequest.ts deleted file mode 100644 index 081846b..0000000 --- a/src/types/models/ExtremeCasesRequest.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of an extreme cases request. - * @export - * @interface ExtremeCasesRequest - */ -export interface ExtremeCasesRequest { - /** - * The number of cases to return. If num is positive, this will return the top (largest value) cases. If num is negative, this will return smallest cases. - * @type {number} - * @memberof ExtremeCasesRequest - */ - num: number; - /** - * The feature to sort by. - * @type {string} - * @memberof ExtremeCasesRequest - */ - sort_feature: string; - /** - * The features to return values for. - * @type {Array} - * @memberof ExtremeCasesRequest - */ - features?: Array; -} - -/** - * Check if a given object implements the ExtremeCasesRequest interface. - */ -export function instanceOfExtremeCasesRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "num" in value; - isInstance = isInstance && "sort_feature" in value; - - return isInstance; -} - -export function ExtremeCasesRequestFromJSON(json: any): ExtremeCasesRequest { - return ExtremeCasesRequestFromJSONTyped(json, false); -} - -export function ExtremeCasesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtremeCasesRequest { - if (json === undefined || json === null) { - return json; - } - return { - num: json["num"], - sort_feature: json["sort_feature"], - features: !exists(json, "features") ? undefined : json["features"], - }; -} - -export function ExtremeCasesRequestToJSON(value?: ExtremeCasesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - num: value.num, - sort_feature: value.sort_feature, - features: value.features, - }; -} diff --git a/src/types/models/FeatureAddRequest.ts b/src/types/models/FeatureAddRequest.ts deleted file mode 100644 index db541cf..0000000 --- a/src/types/models/FeatureAddRequest.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { FeatureAttributes } from "./FeatureAttributes"; -import { FeatureAttributesFromJSON, FeatureAttributesToJSON } from "./FeatureAttributes"; - -/** - * The body of an add feature request. - * @export - * @interface FeatureAddRequest - */ -export interface FeatureAddRequest { - /** - * The name of the feature. - * @type {string} - * @memberof FeatureAddRequest - */ - feature: string; - /** - * A condition map where features will only be modified when certain criteria is met. If no value is provided, - * the feature will be modified in all cases of the model and feature metadata will be updated. If an empty - * object is provided, the feature will be modified in all cases of the model but the feature metadata will not - * be updated. The object keys are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {object} - * @memberof FeatureAddRequest - */ - condition?: object; - /** - * If specified, ignores the condition and operates on cases for the specified session id. - * @type {string} - * @memberof FeatureAddRequest - */ - condition_session?: string; - /** - * A value to apply to the feature for all cases trained the session/trainee. - * @type {any} - * @memberof FeatureAddRequest - */ - feature_value?: any | null; - /** - * - * @type {FeatureAttributes} - * @memberof FeatureAddRequest - */ - feature_attributes?: FeatureAttributes; - /** - * Whether to overwrite the feature if it exists. - * @type {boolean} - * @memberof FeatureAddRequest - */ - overwrite?: boolean; -} - -/** - * Check if a given object implements the FeatureAddRequest interface. - */ -export function instanceOfFeatureAddRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "feature" in value; - - return isInstance; -} - -export function FeatureAddRequestFromJSON(json: any): FeatureAddRequest { - return FeatureAddRequestFromJSONTyped(json, false); -} - -export function FeatureAddRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureAddRequest { - if (json === undefined || json === null) { - return json; - } - return { - feature: json["feature"], - condition: !exists(json, "condition") ? undefined : json["condition"], - condition_session: !exists(json, "condition_session") ? undefined : json["condition_session"], - feature_value: !exists(json, "feature_value") ? undefined : json["feature_value"], - feature_attributes: !exists(json, "feature_attributes") - ? undefined - : FeatureAttributesFromJSON(json["feature_attributes"]), - overwrite: !exists(json, "overwrite") ? undefined : json["overwrite"], - }; -} - -export function FeatureAddRequestToJSON(value?: FeatureAddRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - feature: value.feature, - condition: value.condition, - condition_session: value.condition_session, - feature_value: value.feature_value, - feature_attributes: FeatureAttributesToJSON(value.feature_attributes), - overwrite: value.overwrite, - }; -} diff --git a/src/types/models/FeatureAttributes.ts b/src/types/models/FeatureAttributes.ts deleted file mode 100644 index b833651..0000000 --- a/src/types/models/FeatureAttributes.ts +++ /dev/null @@ -1,274 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { FeatureAutoDeriveOnTrain } from "./FeatureAutoDeriveOnTrain"; -import { FeatureAutoDeriveOnTrainFromJSON, FeatureAutoDeriveOnTrainToJSON } from "./FeatureAutoDeriveOnTrain"; -import type { FeatureBounds } from "./FeatureBounds"; -import { FeatureBoundsFromJSON, FeatureBoundsToJSON } from "./FeatureBounds"; -import type { FeatureOriginalType } from "./FeatureOriginalType"; -import { FeatureOriginalTypeFromJSON, FeatureOriginalTypeToJSON } from "./FeatureOriginalType"; -import type { FeatureTimeSeries } from "./FeatureTimeSeries"; -import { FeatureTimeSeriesFromJSON, FeatureTimeSeriesToJSON } from "./FeatureTimeSeries"; - -export type FeatureAttributesIndex = { [key: string]: FeatureAttributes }; - -/** - * The mapping of attributes for a single feature. - * @export - * @interface FeatureAttributes - */ -export interface FeatureAttributes { - /** - * The type of the feature. - * - * - continuous: A continuous numeric value. (e.g. Temperature or humidity) - * - nominal: A numeric or string value with no ordering. (e.g. The name of a fruit) - * - ordinal: A nominal numeric value with ordering. (e.g. Rating scale, 1-5 stars) - * @type {string} - * @memberof FeatureAttributes - */ - type: FeatureAttributesTypeEnum; - /** - * - * @type {FeatureAutoDeriveOnTrain} - * @memberof FeatureAttributes - */ - auto_derive_on_train?: FeatureAutoDeriveOnTrain; - /** - * - * @type {FeatureBounds} - * @memberof FeatureAttributes - */ - bounds?: FeatureBounds; - /** - * Cyclic features are set by specifying a `cycle_length` value in the feature attributes. `cycle_length` requires a single value, which is the upper bound of the difference for the cycle range. For example, if `cycle_length` is 360, then a value of 1 and 359 will have a difference of 2. Cyclic features have no restrictions in the input dataset, however, cyclic features will be output on a scale from 0 to `cycle_length`. To constrain the output to a different range, modify the `min` and `max` `bounds` feature attribute. - * Examples: - * - degrees: values should be 0-359, cycle_length = 360 - * - days: values should be 0-6, cycle_length = 7 - * - hours: values should be 0-23, cycle_length = 24 - * @type {number} - * @memberof FeatureAttributes - */ - cycle_length?: number; - /** - * Specify the data type for features with a type of nominal or continuous. Default is `string` for nominals and - * `number` for continuous. - * - * Valid values include: - * - * - `string`, `number`, `formatted_date_time`, `json`, `amalgam`, `yaml`: Valid for both nominal and continuous. - * - * - `string_mixable`: Valid only when type is continuous (predicted values may result in interpolated strings - * containing a combination of characters from multiple original values). - * - * - `boolean`: Valid only for nominals. - * @type {string} - * @memberof FeatureAttributes - */ - data_type?: FeatureAttributesDataTypeEnum; - /** - * If specified, feature values should match the date format specified by this string. Only applicable to continuous features. - * @type {string} - * @memberof FeatureAttributes - */ - date_time_format?: string; - /** - * Decimal places to round to, default is no rounding. If `significant_digits` is also specified, the number will be rounded to the specified number of significant digits first, then rounded to the number of decimal points as specified by this parameter. - * @type {number} - * @memberof FeatureAttributes - */ - decimal_places?: number; - /** - * A list of other feature names that this feature either depends on or features that depend on this feature. Should be used when there are multi-type value features that tightly depend on values based on other multi-type value features. - * @type {Array} - * @memberof FeatureAttributes - */ - dependent_features?: Array; - /** - * Code defining how the value for this feature could be derived if this feature is specified as a `derived_context_feature` or a `derived_action_feature` during react flows. For `react_series`, the data referenced is the accumulated series data (as a list of rows), and for non-series reacts, the data is the one single row. Each row is comprised of all the combined context and action features. Referencing data in these rows uses 0-based indexing, where the current row index is 0, the previous row's is 1, etc. The specified code may do simple logic and numeric operations on feature values referenced via feature name and row offset. - * - * Examples: - * - ``"#x 1"``: Use the value for feature 'x' from the previously processed row (offset of 1, one lag value). - * - ``"(- #y 0 #x 1)"``: Feature 'y' value from current (offset 0) row minus feature 'x' value from previous (offset 1) row. - * @type {string} - * @memberof FeatureAttributes - */ - derived_feature_code?: string; - /** - * Set to true for nominal features containing nominal IDs, specifying that his feature should be used to compute case weights for id based privacy. For time series, this feature will be used as the id for each time series generation. - * @type {boolean} - * @memberof FeatureAttributes - */ - id_feature?: boolean; - /** - * The date time format locale. If unspecified, uses platform default locale. - * @type {string} - * @memberof FeatureAttributes - */ - locale?: string; - /** - * Flag a categorical nominal feature as non-sensitive. It is recommended that all nominal features be represented with either an `int-id` subtype or another available nominal subtype using the `subtype` attribute. However, if the nominal feature is non-sensitive, setting this parameter to true will bypass the `subtype` requirement. Only applicable to nominal features. - * @type {boolean} - * @memberof FeatureAttributes - */ - non_sensitive?: boolean; - /** - * Modify how dependent features with nulls are treated during a react, specifically when they use null as a context value. Only applicable to dependent features. - * When false (default), the feature will be treated as a non-dependent context feature. When true for nominal types, treats null as an individual dependent class value, only cases that also have nulls as this feature's value will be considered. When true for continuous types, only the cases with the same dependent feature values as the cases that also have nulls as this feature's value will be considered. - * @type {boolean} - * @memberof FeatureAttributes - */ - null_is_dependent?: boolean; - /** - * Specifies the observational mean absolute error for this feature. Use when the error value is already known. Defaults to 0. - * @type {number} - * @memberof FeatureAttributes - */ - observational_error?: number; - /** - * - * @type {FeatureOriginalType} - * @memberof FeatureAttributes - */ - original_type?: FeatureOriginalType; - /** - * Original data formats used by clients. Automatically populated by clients to store client language specific context about features. - * @type {{ [key: string]: any; }} - * @memberof FeatureAttributes - */ - original_format?: { [key: string]: any }; - /** - * Custom Amalgam code that is called on resulting values of this feature during react operations. - * @type {string} - * @memberof FeatureAttributes - */ - post_process?: string; - /** - * A stringified sample of non-null data from the feature if available. The `include_sample` parameter must be specified during infer feature attributes for this property to be returned. - * @type {string} - * @memberof FeatureAttributes - */ - sample?: string | null; - /** - * Round to the specified significant digits, default is no rounding. - * @type {number} - * @memberof FeatureAttributes - */ - significant_digits?: number; - /** - * The type used in novel nominal substitution. - * @type {string} - * @memberof FeatureAttributes - */ - subtype?: string; - /** - * - * @type {FeatureTimeSeries} - * @memberof FeatureAttributes - */ - time_series?: FeatureTimeSeries; - /** - * Flag feature as only having unique values. Only applicable to nominals features. - * @type {boolean} - * @memberof FeatureAttributes - */ - unique?: boolean; -} - -/** - * @export - * @enum {string} - */ -export type FeatureAttributesTypeEnum = "continuous" | "nominal" | "ordinal"; -/** - * @export - * @enum {string} - */ -export type FeatureAttributesDataTypeEnum = - | "string" - | "number" - | "boolean" - | "formatted_date_time" - | "string_mixable" - | "json" - | "yaml" - | "amalgam"; - -/** - * Check if a given object implements the FeatureAttributes interface. - */ -export function instanceOfFeatureAttributes(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "type" in value; - - return isInstance; -} - -export function FeatureAttributesFromJSON(json: any): FeatureAttributes { - return FeatureAttributesFromJSONTyped(json, false); -} - -export function FeatureAttributesFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureAttributes { - if (json === undefined || json === null) { - return json; - } - return { - type: json["type"], - auto_derive_on_train: !exists(json, "auto_derive_on_train") - ? undefined - : FeatureAutoDeriveOnTrainFromJSON(json["auto_derive_on_train"]), - bounds: !exists(json, "bounds") ? undefined : FeatureBoundsFromJSON(json["bounds"]), - cycle_length: !exists(json, "cycle_length") ? undefined : json["cycle_length"], - data_type: !exists(json, "data_type") ? undefined : json["data_type"], - date_time_format: !exists(json, "date_time_format") ? undefined : json["date_time_format"], - decimal_places: !exists(json, "decimal_places") ? undefined : json["decimal_places"], - dependent_features: !exists(json, "dependent_features") ? undefined : json["dependent_features"], - derived_feature_code: !exists(json, "derived_feature_code") ? undefined : json["derived_feature_code"], - id_feature: !exists(json, "id_feature") ? undefined : json["id_feature"], - locale: !exists(json, "locale") ? undefined : json["locale"], - non_sensitive: !exists(json, "non_sensitive") ? undefined : json["non_sensitive"], - null_is_dependent: !exists(json, "null_is_dependent") ? undefined : json["null_is_dependent"], - observational_error: !exists(json, "observational_error") ? undefined : json["observational_error"], - original_type: !exists(json, "original_type") ? undefined : FeatureOriginalTypeFromJSON(json["original_type"]), - original_format: !exists(json, "original_format") ? undefined : json["original_format"], - post_process: !exists(json, "post_process") ? undefined : json["post_process"], - sample: !exists(json, "sample") ? undefined : json["sample"], - significant_digits: !exists(json, "significant_digits") ? undefined : json["significant_digits"], - subtype: !exists(json, "subtype") ? undefined : json["subtype"], - time_series: !exists(json, "time_series") ? undefined : FeatureTimeSeriesFromJSON(json["time_series"]), - unique: !exists(json, "unique") ? undefined : json["unique"], - }; -} - -export function FeatureAttributesToJSON(value?: FeatureAttributes | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - type: value.type, - auto_derive_on_train: FeatureAutoDeriveOnTrainToJSON(value.auto_derive_on_train), - bounds: FeatureBoundsToJSON(value.bounds), - cycle_length: value.cycle_length, - data_type: value.data_type, - date_time_format: value.date_time_format, - decimal_places: value.decimal_places, - dependent_features: value.dependent_features, - derived_feature_code: value.derived_feature_code, - id_feature: value.id_feature, - locale: value.locale, - non_sensitive: value.non_sensitive, - null_is_dependent: value.null_is_dependent, - observational_error: value.observational_error, - original_type: FeatureOriginalTypeToJSON(value.original_type), - original_format: value.original_format, - post_process: value.post_process, - sample: value.sample, - significant_digits: value.significant_digits, - subtype: value.subtype, - time_series: FeatureTimeSeriesToJSON(value.time_series), - unique: value.unique, - }; -} diff --git a/src/types/models/FeatureAutoDeriveOnTrain.ts b/src/types/models/FeatureAutoDeriveOnTrain.ts deleted file mode 100644 index dd3acdf..0000000 --- a/src/types/models/FeatureAutoDeriveOnTrain.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { - FeatureAutoDeriveOnTrainCustom, - FeatureAutoDeriveOnTrainCustomFromJSONTyped, - FeatureAutoDeriveOnTrainCustomToJSON, -} from "./FeatureAutoDeriveOnTrainCustom"; -import { - FeatureAutoDeriveOnTrainProgress, - FeatureAutoDeriveOnTrainProgressFromJSONTyped, - FeatureAutoDeriveOnTrainProgressToJSON, -} from "./FeatureAutoDeriveOnTrainProgress"; - -/** - * @type FeatureAutoDeriveOnTrain - * Define how to create and derive all the values for this feature from the trained dataset. - * @export - */ -export type FeatureAutoDeriveOnTrain = - | ({ derive_type: "custom" } & FeatureAutoDeriveOnTrainCustom) - | ({ derive_type: "progress" } & FeatureAutoDeriveOnTrainProgress); - -export function FeatureAutoDeriveOnTrainFromJSON(json: any): FeatureAutoDeriveOnTrain { - return FeatureAutoDeriveOnTrainFromJSONTyped(json, false); -} - -export function FeatureAutoDeriveOnTrainFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureAutoDeriveOnTrain { - if (json === undefined || json === null) { - return json; - } - switch (json["derive_type"]) { - case "custom": - return { ...FeatureAutoDeriveOnTrainCustomFromJSONTyped(json, true), derive_type: "custom" }; - case "progress": - return { ...FeatureAutoDeriveOnTrainProgressFromJSONTyped(json, true), derive_type: "progress" }; - default: - throw new Error(`No variant of FeatureAutoDeriveOnTrain exists with 'derive_type=${json["derive_type"]}'`); - } -} - -export function FeatureAutoDeriveOnTrainToJSON(value?: FeatureAutoDeriveOnTrain | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - switch (value["derive_type"]) { - case "custom": - return FeatureAutoDeriveOnTrainCustomToJSON(value); - case "progress": - return FeatureAutoDeriveOnTrainProgressToJSON(value); - default: - throw new Error(`No variant of FeatureAutoDeriveOnTrain exists with 'derive_type=${value["derive_type"]}'`); - } -} diff --git a/src/types/models/FeatureAutoDeriveOnTrainCustom.ts b/src/types/models/FeatureAutoDeriveOnTrainCustom.ts deleted file mode 100644 index 5668aa8..0000000 --- a/src/types/models/FeatureAutoDeriveOnTrainCustom.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Derive feature using the specified `code`. For each series, where each series is defined by `series_id_features`, the rows are processed in order, after being sorted by `ordered_by_features`. If series is not specified, processes the entire dataset. Referencing data in rows uses 0-based indexing, where the current row index is 0, the previous row's is 1, etc. Specified code may do simple logic and numeric operations on feature values referenced via feature name and row offset. - * - * Examples: - * - ``"#x 1"`` : Use the value for feature 'x' from the previously processed row (offset of 1, one lag value). - * - ``"(- #y 0 #x 1)"`` : Feature 'y' value from current (offset 0) row minus feature 'x' value from previous (offset 1) row. - * @export - * @interface FeatureAutoDeriveOnTrainCustom - */ -export interface FeatureAutoDeriveOnTrainCustom { - /** - * The train derive operation type. - * @type {string} - * @memberof FeatureAutoDeriveOnTrainCustom - */ - derive_type: string; - /** - * Amalgam code describing how feature could be derived. - * @type {string} - * @memberof FeatureAutoDeriveOnTrainCustom - */ - code: string; - /** - * Feature name(s) of series for which to derive this feature. A series is the conjunction of all the features specified by this attribute. - * @type {Array} - * @memberof FeatureAutoDeriveOnTrainCustom - */ - series_id_features?: Array; - /** - * Feature name(s) by which to order the series specified by `series_id_features`. Series values are order by the order of feature names specified by this attribute. - * @type {Array} - * @memberof FeatureAutoDeriveOnTrainCustom - */ - ordered_by_features?: Array; -} - -/** - * Check if a given object implements the FeatureAutoDeriveOnTrainCustom interface. - */ -export function instanceOfFeatureAutoDeriveOnTrainCustom(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "derive_type" in value; - isInstance = isInstance && "code" in value; - - return isInstance; -} - -export function FeatureAutoDeriveOnTrainCustomFromJSON(json: any): FeatureAutoDeriveOnTrainCustom { - return FeatureAutoDeriveOnTrainCustomFromJSONTyped(json, false); -} - -export function FeatureAutoDeriveOnTrainCustomFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureAutoDeriveOnTrainCustom { - if (json === undefined || json === null) { - return json; - } - return { - derive_type: json["derive_type"], - code: json["code"], - series_id_features: !exists(json, "series_id_features") ? undefined : json["series_id_features"], - ordered_by_features: !exists(json, "ordered_by_features") ? undefined : json["ordered_by_features"], - }; -} - -export function FeatureAutoDeriveOnTrainCustomToJSON(value?: FeatureAutoDeriveOnTrainCustom | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - derive_type: value.derive_type, - code: value.code, - series_id_features: value.series_id_features, - ordered_by_features: value.ordered_by_features, - }; -} diff --git a/src/types/models/FeatureAutoDeriveOnTrainProgress.ts b/src/types/models/FeatureAutoDeriveOnTrainProgress.ts deleted file mode 100644 index d7e2ca4..0000000 --- a/src/types/models/FeatureAutoDeriveOnTrainProgress.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -/** - * Derive feature by creating two new continuous features: `.series_progress` and `.series_progress_delta`. Series progress values range from 0 to 1.0 for each case in the series. Series progress delta values are the delta value of the progress for each case. Both of these features are used to determine when to stop series synthesis. - * @export - * @interface FeatureAutoDeriveOnTrainProgress - */ -export interface FeatureAutoDeriveOnTrainProgress { - /** - * The train derive operation type. - * @type {string} - * @memberof FeatureAutoDeriveOnTrainProgress - */ - derive_type: string; - /** - * Feature name(s) of series for which to derive this feature. A series is the conjunction of all the features specified by this attribute. - * @type {Array} - * @memberof FeatureAutoDeriveOnTrainProgress - */ - series_id_features: Array; -} - -/** - * Check if a given object implements the FeatureAutoDeriveOnTrainProgress interface. - */ -export function instanceOfFeatureAutoDeriveOnTrainProgress(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "derive_type" in value; - isInstance = isInstance && "series_id_features" in value; - - return isInstance; -} - -export function FeatureAutoDeriveOnTrainProgressFromJSON(json: any): FeatureAutoDeriveOnTrainProgress { - return FeatureAutoDeriveOnTrainProgressFromJSONTyped(json, false); -} - -export function FeatureAutoDeriveOnTrainProgressFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureAutoDeriveOnTrainProgress { - if (json === undefined || json === null) { - return json; - } - return { - derive_type: json["derive_type"], - series_id_features: json["series_id_features"], - }; -} - -export function FeatureAutoDeriveOnTrainProgressToJSON(value?: FeatureAutoDeriveOnTrainProgress | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - derive_type: value.derive_type, - series_id_features: value.series_id_features, - }; -} diff --git a/src/types/models/FeatureBounds.ts b/src/types/models/FeatureBounds.ts deleted file mode 100644 index 93e2cf0..0000000 --- a/src/types/models/FeatureBounds.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Bounds for feature value generation. - * @export - * @interface FeatureBounds - */ -export interface FeatureBounds { - /** - * The minimum value to be output. May be a number or date string. - * @type {any} - * @memberof FeatureBounds - */ - min?: any | null; - /** - * The maximum value to be output. May be a number or date string. - * @type {any} - * @memberof FeatureBounds - */ - max?: any | null; - /** - * Explicitly allowed values to be output. - * @type {Array} - * @memberof FeatureBounds - */ - allowed?: Array; - /** - * Allow nulls to be output, per their distribution in the data. Defaults to true. - * @type {boolean} - * @memberof FeatureBounds - */ - allow_null?: boolean; - /** - * Amalgam code, whose logic has to evaluate to true for value to be considered valid when this feature is being generated. Same format as 'derived_feature_code'. - * - * Examples: - * - ``"(> #f1 0 #f2 0)"``: Feature 'f1' value from current (offset 0) data must be bigger than feature 'f2' value from current (offset 0) data. - * @type {string} - * @memberof FeatureBounds - */ - constraint?: string; -} - -/** - * Check if a given object implements the FeatureBounds interface. - */ -export function instanceOfFeatureBounds(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function FeatureBoundsFromJSON(json: any): FeatureBounds { - return FeatureBoundsFromJSONTyped(json, false); -} - -export function FeatureBoundsFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureBounds { - if (json === undefined || json === null) { - return json; - } - return { - min: !exists(json, "min") ? undefined : json["min"], - max: !exists(json, "max") ? undefined : json["max"], - allowed: !exists(json, "allowed") ? undefined : json["allowed"], - allow_null: !exists(json, "allow_null") ? undefined : json["allow_null"], - constraint: !exists(json, "constraint") ? undefined : json["constraint"], - }; -} - -export function FeatureBoundsToJSON(value?: FeatureBounds | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - min: value.min, - max: value.max, - allowed: value.allowed, - allow_null: value.allow_null, - constraint: value.constraint, - }; -} diff --git a/src/types/models/FeatureConviction.ts b/src/types/models/FeatureConviction.ts deleted file mode 100644 index c6eabb4..0000000 --- a/src/types/models/FeatureConviction.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The feature familiarity conviction values. - * @export - * @interface FeatureConviction - */ -export interface FeatureConviction { - /** - * A dictionary of feature name to conviction value where each value is the familiarity conviction of adding the feature to the Model. - * @type {{ [key: string]: number; }} - * @memberof FeatureConviction - */ - familiarity_conviction_addition?: { [key: string]: number }; - /** - * A dictionary of feature name to conviction value where each value is the familiarity conviction of removing the feature from the Model. - * @type {{ [key: string]: number; }} - * @memberof FeatureConviction - */ - familiarity_conviction_removal?: { [key: string]: number }; -} - -/** - * Check if a given object implements the FeatureConviction interface. - */ -export function instanceOfFeatureConviction(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function FeatureConvictionFromJSON(json: any): FeatureConviction { - return FeatureConvictionFromJSONTyped(json, false); -} - -export function FeatureConvictionFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureConviction { - if (json === undefined || json === null) { - return json; - } - return { - familiarity_conviction_addition: !exists(json, "familiarity_conviction_addition") - ? undefined - : json["familiarity_conviction_addition"], - familiarity_conviction_removal: !exists(json, "familiarity_conviction_removal") - ? undefined - : json["familiarity_conviction_removal"], - }; -} - -export function FeatureConvictionToJSON(value?: FeatureConviction | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - familiarity_conviction_addition: value.familiarity_conviction_addition, - familiarity_conviction_removal: value.familiarity_conviction_removal, - }; -} diff --git a/src/types/models/FeatureConvictionActionOutput.ts b/src/types/models/FeatureConvictionActionOutput.ts deleted file mode 100644 index a4244fe..0000000 --- a/src/types/models/FeatureConvictionActionOutput.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { FeatureConviction } from "./FeatureConviction"; -import { FeatureConvictionFromJSON, FeatureConvictionToJSON } from "./FeatureConviction"; - -/** - * - * @export - * @interface FeatureConvictionActionOutput - */ -export interface FeatureConvictionActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof FeatureConvictionActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof FeatureConvictionActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof FeatureConvictionActionOutput - */ - operation_type: string; - /** - * - * @type {FeatureConviction} - * @memberof FeatureConvictionActionOutput - */ - output?: FeatureConviction | null; -} - -/** - * Check if a given object implements the FeatureConvictionActionOutput interface. - */ -export function instanceOfFeatureConvictionActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function FeatureConvictionActionOutputFromJSON(json: any): FeatureConvictionActionOutput { - return FeatureConvictionActionOutputFromJSONTyped(json, false); -} - -export function FeatureConvictionActionOutputFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureConvictionActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : FeatureConvictionFromJSON(json["output"]), - }; -} - -export function FeatureConvictionActionOutputToJSON(value?: FeatureConvictionActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: FeatureConvictionToJSON(value.output), - }; -} diff --git a/src/types/models/FeatureConvictionRequest.ts b/src/types/models/FeatureConvictionRequest.ts deleted file mode 100644 index 6a19629..0000000 --- a/src/types/models/FeatureConvictionRequest.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a feature conviction request. - * @export - * @interface FeatureConvictionRequest - */ -export interface FeatureConvictionRequest { - /** - * A list of feature names to calculate convictions. At least 2 features are required to get familiarity conviction and at least 3 features to get prediction conviction and prediction contribution. If not specified all features will be used. - * @type {Array} - * @memberof FeatureConvictionRequest - */ - features?: Array; - /** - * A list of feature names to be treated as action features during conviction calculation in order to determine the conviction of each feature against the set of action_features. If not specified, conviction is computed for each feature against the rest of the features as a whole. - * @type {Array} - * @memberof FeatureConvictionRequest - */ - action_features?: Array; - /** - * When true, calculate and output the familiarity conviction of adding the features. - * @type {boolean} - * @memberof FeatureConvictionRequest - */ - familiarity_conviction_addition?: boolean; - /** - * When true, calculate and output the familiarity conviction of removing the features. - * @type {boolean} - * @memberof FeatureConvictionRequest - */ - familiarity_conviction_removal?: boolean; - /** - * If set to True will scale influence weights by each case's `weight_feature` weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof FeatureConvictionRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally managed case weight. - * @type {string} - * @memberof FeatureConvictionRequest - */ - weight_feature?: string; -} - -/** - * Check if a given object implements the FeatureConvictionRequest interface. - */ -export function instanceOfFeatureConvictionRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function FeatureConvictionRequestFromJSON(json: any): FeatureConvictionRequest { - return FeatureConvictionRequestFromJSONTyped(json, false); -} - -export function FeatureConvictionRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureConvictionRequest { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - familiarity_conviction_addition: !exists(json, "familiarity_conviction_addition") - ? undefined - : json["familiarity_conviction_addition"], - familiarity_conviction_removal: !exists(json, "familiarity_conviction_removal") - ? undefined - : json["familiarity_conviction_removal"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function FeatureConvictionRequestToJSON(value?: FeatureConvictionRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - action_features: value.action_features, - familiarity_conviction_addition: value.familiarity_conviction_addition, - familiarity_conviction_removal: value.familiarity_conviction_removal, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/FeatureMarginalStats.ts b/src/types/models/FeatureMarginalStats.ts deleted file mode 100644 index d4a3e59..0000000 --- a/src/types/models/FeatureMarginalStats.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { MarginalStats } from "./MarginalStats"; -import { MarginalStatsFromJSON, MarginalStatsToJSON } from "./MarginalStats"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * The response body of get_marginal_stats - * @export - * @interface FeatureMarginalStats - */ -export interface FeatureMarginalStats { - /** - * - * @type {Array} - * @memberof FeatureMarginalStats - */ - warnings?: Array; - /** - * - * @type {{ [key: string]: MarginalStats; }} - * @memberof FeatureMarginalStats - */ - content?: { [key: string]: MarginalStats }; -} - -/** - * Check if a given object implements the FeatureMarginalStats interface. - */ -export function instanceOfFeatureMarginalStats(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function FeatureMarginalStatsFromJSON(json: any): FeatureMarginalStats { - return FeatureMarginalStatsFromJSONTyped(json, false); -} - -export function FeatureMarginalStatsFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureMarginalStats { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - content: !exists(json, "content") ? undefined : mapValues(json["content"], MarginalStatsFromJSON), - }; -} - -export function FeatureMarginalStatsToJSON(value?: FeatureMarginalStats | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - content: value.content === undefined ? undefined : mapValues(value.content, MarginalStatsToJSON), - }; -} diff --git a/src/types/models/FeatureMarginalStatsRequest.ts b/src/types/models/FeatureMarginalStatsRequest.ts deleted file mode 100644 index 1466fc4..0000000 --- a/src/types/models/FeatureMarginalStatsRequest.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a feature marginal stats request. - * @export - * @interface FeatureMarginalStatsRequest - */ -export interface FeatureMarginalStatsRequest { - /** - * When specified, will attempt to return stats that were computed using this weight_feature. - * @type {string} - * @memberof FeatureMarginalStatsRequest - */ - weight_feature?: string; - /** - * The condition map to select the cases that meet all the provided conditions. The dictionary keys - * are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {{ [key: string]: any; }} - * @memberof FeatureMarginalStatsRequest - */ - condition?: { [key: string]: any }; - /** - * The maximum number of cases to use. If not specified, the limit will be k cases if precision is "similar", or - * no limit if precision is "exact". - * @type {number} - * @memberof FeatureMarginalStatsRequest - */ - num_cases?: number; - /** - * Exact matching or fuzzy matching. - * @type {string} - * @memberof FeatureMarginalStatsRequest - */ - precision?: FeatureMarginalStatsRequestPrecisionEnum; -} - -/** - * @export - * @enum {string} - */ -export type FeatureMarginalStatsRequestPrecisionEnum = "exact" | "similar"; - -/** - * Check if a given object implements the FeatureMarginalStatsRequest interface. - */ -export function instanceOfFeatureMarginalStatsRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function FeatureMarginalStatsRequestFromJSON(json: any): FeatureMarginalStatsRequest { - return FeatureMarginalStatsRequestFromJSONTyped(json, false); -} - -export function FeatureMarginalStatsRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): FeatureMarginalStatsRequest { - if (json === undefined || json === null) { - return json; - } - return { - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - condition: !exists(json, "condition") ? undefined : json["condition"], - num_cases: !exists(json, "num_cases") ? undefined : json["num_cases"], - precision: !exists(json, "precision") ? undefined : json["precision"], - }; -} - -export function FeatureMarginalStatsRequestToJSON(value?: FeatureMarginalStatsRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - weight_feature: value.weight_feature, - condition: value.condition, - num_cases: value.num_cases, - precision: value.precision, - }; -} diff --git a/src/types/models/FeatureOriginalType.ts b/src/types/models/FeatureOriginalType.ts deleted file mode 100644 index c9eed60..0000000 --- a/src/types/models/FeatureOriginalType.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { BooleanType, BooleanTypeFromJSONTyped, BooleanTypeToJSON } from "./BooleanType"; -import { DateType, DateTypeFromJSONTyped, DateTypeToJSON } from "./DateType"; -import { DatetimeType, DatetimeTypeFromJSONTyped, DatetimeTypeToJSON } from "./DatetimeType"; -import { IntegerType, IntegerTypeFromJSONTyped, IntegerTypeToJSON } from "./IntegerType"; -import { NumericType, NumericTypeFromJSONTyped, NumericTypeToJSON } from "./NumericType"; -import { ObjectType, ObjectTypeFromJSONTyped, ObjectTypeToJSON } from "./ObjectType"; -import { StringType, StringTypeFromJSONTyped, StringTypeToJSON } from "./StringType"; -import { TimeType, TimeTypeFromJSONTyped, TimeTypeToJSON } from "./TimeType"; -import { TimedeltaType, TimedeltaTypeFromJSONTyped, TimedeltaTypeToJSON } from "./TimedeltaType"; - -/** - * @type FeatureOriginalType - * Original data type details. Used by clients to determine how to serialize and deserialize feature data. - * @export - */ -export type FeatureOriginalType = - | ({ data_type: "boolean" } & BooleanType) - | ({ data_type: "date" } & DateType) - | ({ data_type: "datetime" } & DatetimeType) - | ({ data_type: "integer" } & IntegerType) - | ({ data_type: "numeric" } & NumericType) - | ({ data_type: "object" } & ObjectType) - | ({ data_type: "string" } & StringType) - | ({ data_type: "time" } & TimeType) - | ({ data_type: "timedelta" } & TimedeltaType); - -export function FeatureOriginalTypeFromJSON(json: any): FeatureOriginalType { - return FeatureOriginalTypeFromJSONTyped(json, false); -} - -export function FeatureOriginalTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureOriginalType { - if (json === undefined || json === null) { - return json; - } - switch (json["data_type"]) { - case "boolean": - return { ...BooleanTypeFromJSONTyped(json, true), data_type: "boolean" }; - case "date": - return { ...DateTypeFromJSONTyped(json, true), data_type: "date" }; - case "datetime": - return { ...DatetimeTypeFromJSONTyped(json, true), data_type: "datetime" }; - case "integer": - return { ...IntegerTypeFromJSONTyped(json, true), data_type: "integer" }; - case "numeric": - return { ...NumericTypeFromJSONTyped(json, true), data_type: "numeric" }; - case "object": - return { ...ObjectTypeFromJSONTyped(json, true), data_type: "object" }; - case "string": - return { ...StringTypeFromJSONTyped(json, true), data_type: "string" }; - case "time": - return { ...TimeTypeFromJSONTyped(json, true), data_type: "time" }; - case "timedelta": - return { ...TimedeltaTypeFromJSONTyped(json, true), data_type: "timedelta" }; - default: - throw new Error(`No variant of FeatureOriginalType exists with 'data_type=${json["data_type"]}'`); - } -} - -export function FeatureOriginalTypeToJSON(value?: FeatureOriginalType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - switch (value["data_type"]) { - case "boolean": - return BooleanTypeToJSON(value); - case "date": - return DateTypeToJSON(value); - case "datetime": - return DatetimeTypeToJSON(value); - case "integer": - return IntegerTypeToJSON(value); - case "numeric": - return NumericTypeToJSON(value); - case "object": - return ObjectTypeToJSON(value); - case "string": - return StringTypeToJSON(value); - case "time": - return TimeTypeToJSON(value); - case "timedelta": - return TimedeltaTypeToJSON(value); - default: - throw new Error(`No variant of FeatureOriginalType exists with 'data_type=${value["data_type"]}'`); - } -} diff --git a/src/types/models/FeatureRemoveRequest.ts b/src/types/models/FeatureRemoveRequest.ts deleted file mode 100644 index 81b1690..0000000 --- a/src/types/models/FeatureRemoveRequest.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a feature removal request. - * @export - * @interface FeatureRemoveRequest - */ -export interface FeatureRemoveRequest { - /** - * The name of the feature. - * @type {string} - * @memberof FeatureRemoveRequest - */ - feature: string; - /** - * A condition map where features will only be modified when certain criteria is met. If no value is provided, - * the feature will be modified in all cases of the model and feature metadata will be updated. If an empty - * object is provided, the feature will be modified in all cases of the model but the feature metadata will not - * be updated. The object keys are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {object} - * @memberof FeatureRemoveRequest - */ - condition?: object; - /** - * If specified, ignores the condition and operates on cases for the specified session id. - * @type {string} - * @memberof FeatureRemoveRequest - */ - condition_session?: string; -} - -/** - * Check if a given object implements the FeatureRemoveRequest interface. - */ -export function instanceOfFeatureRemoveRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "feature" in value; - - return isInstance; -} - -export function FeatureRemoveRequestFromJSON(json: any): FeatureRemoveRequest { - return FeatureRemoveRequestFromJSONTyped(json, false); -} - -export function FeatureRemoveRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureRemoveRequest { - if (json === undefined || json === null) { - return json; - } - return { - feature: json["feature"], - condition: !exists(json, "condition") ? undefined : json["condition"], - condition_session: !exists(json, "condition_session") ? undefined : json["condition_session"], - }; -} - -export function FeatureRemoveRequestToJSON(value?: FeatureRemoveRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - feature: value.feature, - condition: value.condition, - condition_session: value.condition_session, - }; -} diff --git a/src/types/models/FeatureTimeSeries.ts b/src/types/models/FeatureTimeSeries.ts deleted file mode 100644 index 743c448..0000000 --- a/src/types/models/FeatureTimeSeries.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Time series options for a feature. - * @export - * @interface FeatureTimeSeries - */ -export interface FeatureTimeSeries { - /** - * When `rate` is specified, uses the difference of the current value from its previous value divided by the change in time since the previous value. When `delta` is specified, uses the difference of the current value from its previous value regardless of the elapsed time. Set to `delta` if feature has `time_feature` set to true. - * @type {string} - * @memberof FeatureTimeSeries - */ - type: FeatureTimeSeriesTypeEnum; - /** - * If provided, will generate the specified number of derivatives and boundary values. - * @type {number} - * @memberof FeatureTimeSeries - */ - order?: number; - /** - * The number of orders of derivatives that should be derived instead of synthesized. Ignored if order is not provided. - * @type {number} - * @memberof FeatureTimeSeries - */ - derived_orders?: number; - /** - * If specified, ensures that the smallest difference between features values is not smaller than this specified value. A null value means no min boundary. The length of the list must match the number of derivatives as specified by `order`. Only applicable when time series type is set to `delta`. - * @type {Array} - * @memberof FeatureTimeSeries - */ - delta_min?: Array; - /** - * If specified, ensures that the largest difference between feature values is not larger than this specified value. A null value means no max boundary. The length of the list must match the number of derivatives as specified by `order`. Only applicable when time series type is set to `delta`. - * @type {Array} - * @memberof FeatureTimeSeries - */ - delta_max?: Array; - /** - * If specified, generates lag features containing previous values using the enumerated lag offsets. Takes precedence over `num_lags`. If neither `num_lags` nor `lags` is specified for a feature, then a single lag feature is generated. - * @type {Array} - * @memberof FeatureTimeSeries - */ - lags?: Array; - /** - * If specified, generates the specified amount of lag features containing previous values. If `lags` is specified, then this parameter will be ignored. If neither `num_lags` nor `lags` is specified for a feature, then a single lag feature is generated. - * @type {number} - * @memberof FeatureTimeSeries - */ - num_lags?: number; - /** - * If specified, ensures that the rate (the difference quotient, the discrete version of derivative) for this feature won't be less than the value provided. A null value means no min boundary. The value must be in epoch format for the time feature. The length of the list must match the number of derivatives as specified by `order`. Only applicable when time series type is set to `rate`. - * @type {Array} - * @memberof FeatureTimeSeries - */ - rate_min?: Array; - /** - * If specified, ensures that the rate (the difference quotient, the discrete version of derivative) for this feature won't be more than the value provided. A null value means no max boundary. The value must be in epoch format for the time feature. The length of the list must match the number of derivatives as specified by `order`. Only applicable when time series type is set to `rate`. - * @type {Array} - * @memberof FeatureTimeSeries - */ - rate_max?: Array; - /** - * When true, requires that the model identify and learn values that explicitly denote the end of a series. Only applicable to id features for a series. - * @type {boolean} - * @memberof FeatureTimeSeries - */ - series_has_terminators?: boolean; - /** - * When true, requires that a series ends on a terminator value. Only applicable to id features for a series. - * @type {boolean} - * @memberof FeatureTimeSeries - */ - stop_on_terminator?: boolean; - /** - * When true, the feature will be treated as the time feature for time series modeling. Additionally, time features must use type `delta`. - * @type {boolean} - * @memberof FeatureTimeSeries - */ - time_feature?: boolean; - /** - * Controls whether future values of independent time series are considered. Applicable only to the time feature. When false, the time feature is not universal and allows using future data from other series in decisions; this is applicable when the time is not globally relevant and is independent for each time series. When true, universally excludes using any data with from the future from all series; this is applicable when time is globally relevant and there are events that may affect all time series. If there is any possibility of global relevancy of time, it is generally recommended to set this value to true, which is the default. - * @type {boolean} - * @memberof FeatureTimeSeries - */ - universal?: boolean; -} - -/** - * @export - * @enum {string} - */ -export type FeatureTimeSeriesTypeEnum = "rate" | "delta"; - -/** - * Check if a given object implements the FeatureTimeSeries interface. - */ -export function instanceOfFeatureTimeSeries(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "type" in value; - - return isInstance; -} - -export function FeatureTimeSeriesFromJSON(json: any): FeatureTimeSeries { - return FeatureTimeSeriesFromJSONTyped(json, false); -} - -export function FeatureTimeSeriesFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureTimeSeries { - if (json === undefined || json === null) { - return json; - } - return { - type: json["type"], - order: !exists(json, "order") ? undefined : json["order"], - derived_orders: !exists(json, "derived_orders") ? undefined : json["derived_orders"], - delta_min: !exists(json, "delta_min") ? undefined : json["delta_min"], - delta_max: !exists(json, "delta_max") ? undefined : json["delta_max"], - lags: !exists(json, "lags") ? undefined : json["lags"], - num_lags: !exists(json, "num_lags") ? undefined : json["num_lags"], - rate_min: !exists(json, "rate_min") ? undefined : json["rate_min"], - rate_max: !exists(json, "rate_max") ? undefined : json["rate_max"], - series_has_terminators: !exists(json, "series_has_terminators") ? undefined : json["series_has_terminators"], - stop_on_terminator: !exists(json, "stop_on_terminator") ? undefined : json["stop_on_terminator"], - time_feature: !exists(json, "time_feature") ? undefined : json["time_feature"], - universal: !exists(json, "universal") ? undefined : json["universal"], - }; -} - -export function FeatureTimeSeriesToJSON(value?: FeatureTimeSeries | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - type: value.type, - order: value.order, - derived_orders: value.derived_orders, - delta_min: value.delta_min, - delta_max: value.delta_max, - lags: value.lags, - num_lags: value.num_lags, - rate_min: value.rate_min, - rate_max: value.rate_max, - series_has_terminators: value.series_has_terminators, - stop_on_terminator: value.stop_on_terminator, - time_feature: value.time_feature, - universal: value.universal, - }; -} diff --git a/src/types/models/ImputeRequest.ts b/src/types/models/ImputeRequest.ts deleted file mode 100644 index 347adac..0000000 --- a/src/types/models/ImputeRequest.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface ImputeRequest - */ -export interface ImputeRequest { - /** - * Larger batch size will increase speed but decrease accuracy. - * Batch size indicates how many rows to fill before recomputing conviction. - * The default value (which is 1) should return the best accuracy but might be slower. - * Higher values should improve performance but may decrease accuracy of results. - * @type {number} - * @memberof ImputeRequest - */ - batch_size?: number; - /** - * - * @type {Array} - * @memberof ImputeRequest - */ - features?: Array; - /** - * - * @type {Array} - * @memberof ImputeRequest - */ - features_to_impute?: Array; -} - -/** - * Check if a given object implements the ImputeRequest interface. - */ -export function instanceOfImputeRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ImputeRequestFromJSON(json: any): ImputeRequest { - return ImputeRequestFromJSONTyped(json, false); -} - -export function ImputeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ImputeRequest { - if (json === undefined || json === null) { - return json; - } - return { - batch_size: !exists(json, "batch_size") ? undefined : json["batch_size"], - features: !exists(json, "features") ? undefined : json["features"], - features_to_impute: !exists(json, "features_to_impute") ? undefined : json["features_to_impute"], - }; -} - -export function ImputeRequestToJSON(value?: ImputeRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - batch_size: value.batch_size, - features: value.features, - features_to_impute: value.features_to_impute, - }; -} diff --git a/src/types/models/IntegerType.ts b/src/types/models/IntegerType.ts deleted file mode 100644 index f722079..0000000 --- a/src/types/models/IntegerType.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface IntegerType - */ -export interface IntegerType { - /** - * The name of the data type. - * @type {string} - * @memberof IntegerType - */ - data_type: string; - /** - * The size of the integer (in bytes). - * @type {number} - * @memberof IntegerType - */ - size?: number; - /** - * If the integer is unsigned. - * @type {boolean} - * @memberof IntegerType - */ - unsigned?: boolean; -} - -/** - * Check if a given object implements the IntegerType interface. - */ -export function instanceOfIntegerType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function IntegerTypeFromJSON(json: any): IntegerType { - return IntegerTypeFromJSONTyped(json, false); -} - -export function IntegerTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): IntegerType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - size: !exists(json, "size") ? undefined : json["size"], - unsigned: !exists(json, "unsigned") ? undefined : json["unsigned"], - }; -} - -export function IntegerTypeToJSON(value?: IntegerType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - size: value.size, - unsigned: value.unsigned, - }; -} diff --git a/src/types/models/MarginalStats.ts b/src/types/models/MarginalStats.ts deleted file mode 100644 index ec27b57..0000000 --- a/src/types/models/MarginalStats.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Marginal feature statistics. - * @export - * @interface MarginalStats - */ -export interface MarginalStats { - /** - * - * @type {number} - * @memberof MarginalStats - */ - count?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - kurtosis?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - mean?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - mean_absdev?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - median?: number | null; - /** - * - * @type {any} - * @memberof MarginalStats - */ - mode?: any | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - min?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - max?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - percentile_25?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - percentile_75?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - skew?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - stddev?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - uniques?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - variance?: number | null; - /** - * - * @type {number} - * @memberof MarginalStats - */ - entropy?: number | null; -} - -/** - * Check if a given object implements the MarginalStats interface. - */ -export function instanceOfMarginalStats(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function MarginalStatsFromJSON(json: any): MarginalStats { - return MarginalStatsFromJSONTyped(json, false); -} - -export function MarginalStatsFromJSONTyped(json: any, ignoreDiscriminator: boolean): MarginalStats { - if (json === undefined || json === null) { - return json; - } - return { - count: !exists(json, "count") ? undefined : json["count"], - kurtosis: !exists(json, "kurtosis") ? undefined : json["kurtosis"], - mean: !exists(json, "mean") ? undefined : json["mean"], - mean_absdev: !exists(json, "mean_absdev") ? undefined : json["mean_absdev"], - median: !exists(json, "median") ? undefined : json["median"], - mode: !exists(json, "mode") ? undefined : json["mode"], - min: !exists(json, "min") ? undefined : json["min"], - max: !exists(json, "max") ? undefined : json["max"], - percentile_25: !exists(json, "percentile_25") ? undefined : json["percentile_25"], - percentile_75: !exists(json, "percentile_75") ? undefined : json["percentile_75"], - skew: !exists(json, "skew") ? undefined : json["skew"], - stddev: !exists(json, "stddev") ? undefined : json["stddev"], - uniques: !exists(json, "uniques") ? undefined : json["uniques"], - variance: !exists(json, "variance") ? undefined : json["variance"], - entropy: !exists(json, "entropy") ? undefined : json["entropy"], - }; -} - -export function MarginalStatsToJSON(value?: MarginalStats | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - count: value.count, - kurtosis: value.kurtosis, - mean: value.mean, - mean_absdev: value.mean_absdev, - median: value.median, - mode: value.mode, - min: value.min, - max: value.max, - percentile_25: value.percentile_25, - percentile_75: value.percentile_75, - skew: value.skew, - stddev: value.stddev, - uniques: value.uniques, - variance: value.variance, - entropy: value.entropy, - }; -} diff --git a/src/types/models/Metrics.ts b/src/types/models/Metrics.ts deleted file mode 100644 index 9bf3001..0000000 --- a/src/types/models/Metrics.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface Metrics - */ -export interface Metrics { - /** - * The current cpu usage of the trainee container includes units (usually nano-cpus) - * @type {string} - * @memberof Metrics - */ - cpu?: string | null; - /** - * The current memory usage of the trainee container includes units (usually Kilobytes) - * @type {string} - * @memberof Metrics - */ - memory?: string | null; -} - -/** - * Check if a given object implements the Metrics interface. - */ -export function instanceOfMetrics(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function MetricsFromJSON(json: any): Metrics { - return MetricsFromJSONTyped(json, false); -} - -export function MetricsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Metrics { - if (json === undefined || json === null) { - return json; - } - return { - cpu: !exists(json, "cpu") ? undefined : json["cpu"], - memory: !exists(json, "memory") ? undefined : json["memory"], - }; -} - -export function MetricsToJSON(value?: Metrics | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - cpu: value.cpu, - memory: value.memory, - }; -} diff --git a/src/types/models/ModelError.ts b/src/types/models/ModelError.ts deleted file mode 100644 index 6524e03..0000000 --- a/src/types/models/ModelError.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface ModelError - */ -export interface ModelError { - [key: string]: any | any; - /** - * - * @type {number} - * @memberof ModelError - */ - status?: number; - /** - * - * @type {string} - * @memberof ModelError - */ - title?: string; - /** - * - * @type {string} - * @memberof ModelError - */ - detail?: string; - /** - * - * @type {string} - * @memberof ModelError - */ - code?: string; - /** - * - * @type {string} - * @memberof ModelError - */ - type?: string; -} - -/** - * Check if a given object implements the ModelError interface. - */ -export function instanceOfModelError(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ModelErrorFromJSON(json: any): ModelError { - return ModelErrorFromJSONTyped(json, false); -} - -export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelError { - if (json === undefined || json === null) { - return json; - } - return { - ...json, - status: !exists(json, "status") ? undefined : json["status"], - title: !exists(json, "title") ? undefined : json["title"], - detail: !exists(json, "detail") ? undefined : json["detail"], - code: !exists(json, "code") ? undefined : json["code"], - type: !exists(json, "type") ? undefined : json["type"], - }; -} - -export function ModelErrorToJSON(value?: ModelError | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - ...value, - status: value.status, - title: value.title, - detail: value.detail, - code: value.code, - type: value.type, - }; -} diff --git a/src/types/models/NumericType.ts b/src/types/models/NumericType.ts deleted file mode 100644 index 0203938..0000000 --- a/src/types/models/NumericType.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface NumericType - */ -export interface NumericType { - /** - * The name of the data type. - * @type {string} - * @memberof NumericType - */ - data_type: string; - /** - * The format of the number. - * @type {string} - * @memberof NumericType - */ - format?: NumericTypeFormatEnum; - /** - * The size of the number (in bytes). - * @type {number} - * @memberof NumericType - */ - size?: number; -} - -/** - * @export - * @enum {string} - */ -export type NumericTypeFormatEnum = "decimal"; - -/** - * Check if a given object implements the NumericType interface. - */ -export function instanceOfNumericType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function NumericTypeFromJSON(json: any): NumericType { - return NumericTypeFromJSONTyped(json, false); -} - -export function NumericTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): NumericType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - format: !exists(json, "format") ? undefined : json["format"], - size: !exists(json, "size") ? undefined : json["size"], - }; -} - -export function NumericTypeToJSON(value?: NumericType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - format: value.format, - size: value.size, - }; -} diff --git a/src/types/models/ObjectType.ts b/src/types/models/ObjectType.ts deleted file mode 100644 index 38eaeff..0000000 --- a/src/types/models/ObjectType.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -/** - * - * @export - * @interface ObjectType - */ -export interface ObjectType { - /** - * The name of the data type. - * @type {string} - * @memberof ObjectType - */ - data_type: string; -} - -/** - * Check if a given object implements the ObjectType interface. - */ -export function instanceOfObjectType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function ObjectTypeFromJSON(json: any): ObjectType { - return ObjectTypeFromJSONTyped(json, false); -} - -export function ObjectTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ObjectType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - }; -} - -export function ObjectTypeToJSON(value?: ObjectType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - }; -} diff --git a/src/types/models/PairwiseDistancesActionOutput.ts b/src/types/models/PairwiseDistancesActionOutput.ts deleted file mode 100644 index 96b3115..0000000 --- a/src/types/models/PairwiseDistancesActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface PairwiseDistancesActionOutput - */ -export interface PairwiseDistancesActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof PairwiseDistancesActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof PairwiseDistancesActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof PairwiseDistancesActionOutput - */ - operation_type: string; - /** - * The pairwise distance values. - * @type {Array} - * @memberof PairwiseDistancesActionOutput - */ - output?: Array | null; -} - -/** - * Check if a given object implements the PairwiseDistancesActionOutput interface. - */ -export function instanceOfPairwiseDistancesActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function PairwiseDistancesActionOutputFromJSON(json: any): PairwiseDistancesActionOutput { - return PairwiseDistancesActionOutputFromJSONTyped(json, false); -} - -export function PairwiseDistancesActionOutputFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): PairwiseDistancesActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : json["output"], - }; -} - -export function PairwiseDistancesActionOutputToJSON(value?: PairwiseDistancesActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: value.output, - }; -} diff --git a/src/types/models/PairwiseDistancesRequest.ts b/src/types/models/PairwiseDistancesRequest.ts deleted file mode 100644 index 7348f2c..0000000 --- a/src/types/models/PairwiseDistancesRequest.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of the pairwise distances metric request. - * @export - * @interface PairwiseDistancesRequest - */ -export interface PairwiseDistancesRequest { - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was - * trained into the session. If specified must be either length of 1 or match length of `to_values` or `to_case_indices`. - * @type {Array>} - * @memberof PairwiseDistancesRequest - */ - from_case_indices?: Array>; - /** - * A 2d-list of case values. If specified must be either length of 1 or match length of `to_values` or `to_case_indices`. - * @type {Array>} - * @memberof PairwiseDistancesRequest - */ - from_values?: Array>; - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was - * trained into the session. If specified must be either length of 1 or match length of `from_values` or `from_case_indices`. - * @type {Array>} - * @memberof PairwiseDistancesRequest - */ - to_case_indices?: Array>; - /** - * A 2d-list of case values. If specified must be either length of 1 or match length of `from_values` or `from_case_indices`. - * @type {Array>} - * @memberof PairwiseDistancesRequest - */ - to_values?: Array>; - /** - * List of feature names to use when computing pairwise distances. If unspecified uses all features. - * @type {Array} - * @memberof PairwiseDistancesRequest - */ - features?: Array; - /** - * The action feature. If specified, uses targeted hyperparameters used to predict this `action_feature`, - * otherwise uses targetless hyperparameters. - * @type {string} - * @memberof PairwiseDistancesRequest - */ - action_feature?: string; - /** - * If set to True, will scale influence weights by each case's `weight_feature` weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof PairwiseDistancesRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof PairwiseDistancesRequest - */ - weight_feature?: string; -} - -/** - * Check if a given object implements the PairwiseDistancesRequest interface. - */ -export function instanceOfPairwiseDistancesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function PairwiseDistancesRequestFromJSON(json: any): PairwiseDistancesRequest { - return PairwiseDistancesRequestFromJSONTyped(json, false); -} - -export function PairwiseDistancesRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): PairwiseDistancesRequest { - if (json === undefined || json === null) { - return json; - } - return { - from_case_indices: !exists(json, "from_case_indices") ? undefined : json["from_case_indices"], - from_values: !exists(json, "from_values") ? undefined : json["from_values"], - to_case_indices: !exists(json, "to_case_indices") ? undefined : json["to_case_indices"], - to_values: !exists(json, "to_values") ? undefined : json["to_values"], - features: !exists(json, "features") ? undefined : json["features"], - action_feature: !exists(json, "action_feature") ? undefined : json["action_feature"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function PairwiseDistancesRequestToJSON(value?: PairwiseDistancesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - from_case_indices: value.from_case_indices, - from_values: value.from_values, - to_case_indices: value.to_case_indices, - to_values: value.to_values, - features: value.features, - action_feature: value.action_feature, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/RandomSeedRequest.ts b/src/types/models/RandomSeedRequest.ts deleted file mode 100644 index 33e87ce..0000000 --- a/src/types/models/RandomSeedRequest.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface RandomSeedRequest - */ -export interface RandomSeedRequest { - /** - * The random seed string. - * @type {string} - * @memberof RandomSeedRequest - */ - seed?: string | null; -} - -/** - * Check if a given object implements the RandomSeedRequest interface. - */ -export function instanceOfRandomSeedRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function RandomSeedRequestFromJSON(json: any): RandomSeedRequest { - return RandomSeedRequestFromJSONTyped(json, false); -} - -export function RandomSeedRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RandomSeedRequest { - if (json === undefined || json === null) { - return json; - } - return { - seed: !exists(json, "seed") ? undefined : json["seed"], - }; -} - -export function RandomSeedRequestToJSON(value?: RandomSeedRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - seed: value.seed, - }; -} diff --git a/src/types/models/ReactActionOutput.ts b/src/types/models/ReactActionOutput.ts deleted file mode 100644 index 864f448..0000000 --- a/src/types/models/ReactActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactResponse } from "./ReactResponse"; -import { ReactResponseFromJSON, ReactResponseToJSON } from "./ReactResponse"; - -/** - * - * @export - * @interface ReactActionOutput - */ -export interface ReactActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof ReactActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof ReactActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof ReactActionOutput - */ - operation_type: string; - /** - * - * @type {ReactResponse} - * @memberof ReactActionOutput - */ - output?: ReactResponse | null; -} - -/** - * Check if a given object implements the ReactActionOutput interface. - */ -export function instanceOfReactActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function ReactActionOutputFromJSON(json: any): ReactActionOutput { - return ReactActionOutputFromJSONTyped(json, false); -} - -export function ReactActionOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : ReactResponseFromJSON(json["output"]), - }; -} - -export function ReactActionOutputToJSON(value?: ReactActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: ReactResponseToJSON(value.output), - }; -} diff --git a/src/types/models/ReactAggregateActionOutput.ts b/src/types/models/ReactAggregateActionOutput.ts deleted file mode 100644 index c97e3da..0000000 --- a/src/types/models/ReactAggregateActionOutput.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactAggregateResponse } from "./ReactAggregateResponse"; -import { ReactAggregateResponseFromJSON, ReactAggregateResponseToJSON } from "./ReactAggregateResponse"; - -/** - * - * @export - * @interface ReactAggregateActionOutput - */ -export interface ReactAggregateActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof ReactAggregateActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof ReactAggregateActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof ReactAggregateActionOutput - */ - operation_type: string; - /** - * - * @type {ReactAggregateResponse} - * @memberof ReactAggregateActionOutput - */ - output?: ReactAggregateResponse | null; -} - -/** - * Check if a given object implements the ReactAggregateActionOutput interface. - */ -export function instanceOfReactAggregateActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function ReactAggregateActionOutputFromJSON(json: any): ReactAggregateActionOutput { - return ReactAggregateActionOutputFromJSONTyped(json, false); -} - -export function ReactAggregateActionOutputFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactAggregateActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : ReactAggregateResponseFromJSON(json["output"]), - }; -} - -export function ReactAggregateActionOutputToJSON(value?: ReactAggregateActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: ReactAggregateResponseToJSON(value.output), - }; -} diff --git a/src/types/models/ReactAggregateDetails.ts b/src/types/models/ReactAggregateDetails.ts deleted file mode 100644 index 118e2ee..0000000 --- a/src/types/models/ReactAggregateDetails.ts +++ /dev/null @@ -1,268 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Returns details and prediction stats data for a given reaction for the specified flags. - * @export - * @interface ReactAggregateDetails - */ -export interface ReactAggregateDetails { - /** - * If true outputs full feature prediction stats for all (context and action) features. The prediction stats returned are set by the "selected_prediction_stats" parameter in the 'details' parameter. Uses full calculations, which uses leave-one-out for features for computations. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - prediction_stats?: boolean; - /** - * For each context_feature, use the full set of all other context_features to predict the feature. False removes cached values. When "prediction_stats" in the "details" parameter is true, the Trainee will also calculate and cache the full feature residuals. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_residuals_full?: boolean; - /** - * For each context_feature, use the robust (power set/permutations) set of all other context_features to predict the feature. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_residuals_robust?: boolean; - /** - * For each context_feature, use the full set of all other context_features to compute the mean absolute delta between prediction of the action feature with and without the context features in the model. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_contributions_full?: boolean; - /** - * For each context_feature, use the robust (power set/permutation) set of all other context features to compute the mean absolute delta between prediction of the action feature with and without the context features in the model. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_contributions_robust?: boolean; - /** - * When True will compute Mean Decrease in Accuracy (MDA) for each context feature at predicting the action feature. Drop each feature and use the full set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_mda_full?: boolean; - /** - * Compute Mean Decrease in Accuracy (MDA) by dropping each feature and using the robust (power set/permutations) set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_mda_robust?: boolean; - /** - * Compute Mean Decrease in Accuracy (MDA) by scrambling each feature and using the full set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_mda_permutation_full?: boolean; - /** - * Compute MDA by scrambling each feature and using the robust (power set/permutations) set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactAggregateDetails - */ - feature_mda_permutation_robust?: boolean; - /** - * A condition map to select the action set, which is the dataset for which - * the prediction stats are for. If both action_condition and context_condition - * are provided, then all of the action cases selected by the action_condition - * will be excluded from the context set, which is the set being queried to - * make predictions on the action set, effectively holding them out. - * If only action_condition is specified, then only the single predicted case - * will be left out. - * - * The dictionary keys are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {{ [key: string]: any; }} - * @memberof ReactAggregateDetails - */ - action_condition?: { [key: string]: any }; - /** - * Exact matching or fuzzy matching. Only used if action_condition is not not null. - * @type {string} - * @memberof ReactAggregateDetails - */ - action_condition_precision?: ReactAggregateDetailsActionConditionPrecisionEnum; - /** - * The maximum amount of cases to use to calculate prediction stats. - * If not specified, the limit will be k cases if precision is - * "similar", or 1000 cases if precision is "exact". Works with or - * without action_condition. - * If action_condition is set: - * - If None, will be set to k if precision is "similar" or no limit if precision is "exact". - * If action_condition is not set: - * - If None, will be set to the Howso default limit of 2000. - * @type {number} - * @memberof ReactAggregateDetails - */ - action_num_cases?: number; - /** - * A condition map to select the context set, which is the set being queried to make - * predictions on the action set. If both action_condition and context_condition - * are provided, then all of the cases from the action set, which is the dataset for which the - * prediction stats are for, will be excluded from the context set, effectively holding them out. - * If only action_condition is specified, then only the single predicted case will be left out. - * - * The dictionary keys are the feature name and values are one of: - * - None - * - A value, must match exactly. - * - An array of two numeric values, specifying an inclusive range. Only applicable to continuous and numeric ordinal features. - * - An array of string values, must match any of these values exactly. Only applicable to nominal and string ordinal features. - * @type {{ [key: string]: any; }} - * @memberof ReactAggregateDetails - */ - context_condition?: { [key: string]: any }; - /** - * Exact matching or fuzzy matching. Only used if context_condition is not not null. - * @type {string} - * @memberof ReactAggregateDetails - */ - context_condition_precision?: ReactAggregateDetailsContextConditionPrecisionEnum; - /** - * Limit on the number of context cases when context_condition_precision is set to "similar". - * If None, will be set to k. - * @type {number} - * @memberof ReactAggregateDetails - */ - context_precision_num_cases?: number; - /** - * List of features to use when calculating conditional prediction stats. Should contain all action and - * context features desired. If ``action_feature`` is also provided, that feature will automatically be - * appended to this list if it is not already in the list. - * @type {Array} - * @memberof ReactAggregateDetails - */ - prediction_stats_features?: Array; - /** - * Types of stats to output. When unspecified, returns all except the confusion_matrix. If all, then returns all including the confusion_matrix. - * @type {Array} - * @memberof ReactAggregateDetails - */ - selected_prediction_stats?: Array; -} - -/** - * @export - * @enum {string} - */ -export type ReactAggregateDetailsActionConditionPrecisionEnum = "exact" | "similar"; -/** - * @export - * @enum {string} - */ -export type ReactAggregateDetailsContextConditionPrecisionEnum = "exact" | "similar"; -/** - * @export - * @enum {string} - */ -export type ReactAggregateDetailsSelectedPredictionStatsEnum = - // Returns all the the available prediction stats, including the confusion matrix. - | "all" - // The number of correct predictions divided by the total number of predictions. - | "accuracy" - // A sparse map of actual feature value to a map of predicted feature value to counts. - | "confusion_matrix" - // Mean absolute error. For continuous features, this is calculated as the mean of absolute values of the difference between the actual and predicted values. For nominal features, this is 1 - the average categorical action probability of each case’s correct classes. Categorical action probabilities are the probabilities for each class for the action feature. - | "mae" - // Mean decrease in accuracy when each feature is dropped from the model, applies to all features. - | "mda" - // Mean decrease in accuracy that used scrambling of feature values instead of dropping each feature, applies to all features. - | "feature_mda_permutation_full" - // Precision (positive predictive) value for nominal features only. - | "precision" - // The r-squared coefficient of determination, for continuous features only. - | "r2" - // Recall (sensitivity) value for nominal features only. - | "recall" - // Root mean squared error, for continuous features only. - | "rmse" - // Spearman’s rank correlation coefficient, for continuous features only. - | "spearman_coeff" - // Matthews correlation coefficient, for nominal features only. - | "mcc"; - -/** - * Check if a given object implements the ReactAggregateDetails interface. - */ -export function instanceOfReactAggregateDetails(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactAggregateDetailsFromJSON(json: any): ReactAggregateDetails { - return ReactAggregateDetailsFromJSONTyped(json, false); -} - -export function ReactAggregateDetailsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactAggregateDetails { - if (json === undefined || json === null) { - return json; - } - return { - prediction_stats: !exists(json, "prediction_stats") ? undefined : json["prediction_stats"], - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_permutation_full: !exists(json, "feature_mda_permutation_full") - ? undefined - : json["feature_mda_permutation_full"], - feature_mda_permutation_robust: !exists(json, "feature_mda_permutation_robust") - ? undefined - : json["feature_mda_permutation_robust"], - action_condition: !exists(json, "action_condition") ? undefined : json["action_condition"], - action_condition_precision: !exists(json, "action_condition_precision") - ? undefined - : json["action_condition_precision"], - action_num_cases: !exists(json, "action_num_cases") ? undefined : json["action_num_cases"], - context_condition: !exists(json, "context_condition") ? undefined : json["context_condition"], - context_condition_precision: !exists(json, "context_condition_precision") - ? undefined - : json["context_condition_precision"], - context_precision_num_cases: !exists(json, "context_precision_num_cases") - ? undefined - : json["context_precision_num_cases"], - prediction_stats_features: !exists(json, "prediction_stats_features") - ? undefined - : json["prediction_stats_features"], - selected_prediction_stats: !exists(json, "selected_prediction_stats") - ? undefined - : json["selected_prediction_stats"], - }; -} - -export function ReactAggregateDetailsToJSON(value?: ReactAggregateDetails | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - prediction_stats: value.prediction_stats, - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_permutation_full: value.feature_mda_permutation_full, - feature_mda_permutation_robust: value.feature_mda_permutation_robust, - action_condition: value.action_condition, - action_condition_precision: value.action_condition_precision, - action_num_cases: value.action_num_cases, - context_condition: value.context_condition, - context_condition_precision: value.context_condition_precision, - context_precision_num_cases: value.context_precision_num_cases, - prediction_stats_features: value.prediction_stats_features, - selected_prediction_stats: value.selected_prediction_stats, - }; -} diff --git a/src/types/models/ReactAggregateRequest.ts b/src/types/models/ReactAggregateRequest.ts deleted file mode 100644 index 32fd1a3..0000000 --- a/src/types/models/ReactAggregateRequest.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactAggregateDetails } from "./ReactAggregateDetails"; -import { ReactAggregateDetailsFromJSON, ReactAggregateDetailsToJSON } from "./ReactAggregateDetails"; - -/** - * Request body for react aggregate. - * @export - * @interface ReactAggregateRequest - */ -export interface ReactAggregateRequest { - /** - * - * @type {ReactAggregateDetails} - * @memberof ReactAggregateRequest - */ - details?: ReactAggregateDetails; - /** - * Name of target feature for which to do computations. If "prediction_stats_action_feature" and "feature_influences_action_feature" are not provided, they will default to this value. If "feature_influences_action_feature" is not provided and feature influences "details" are selected, this feature must be provided. - * @type {string} - * @memberof ReactAggregateRequest - */ - action_feature?: string; - /** - * When feature influences such as contributions and mda, use this feature as the action feature. If not provided, will default to the "action_feature" if provided. If "action_feature" is not provided and feature influences "details" are selected, this feature must be provided. - * @type {string} - * @memberof ReactAggregateRequest - */ - feature_influences_action_feature?: string; - /** - * When calculating residuals and prediction stats, uses this target features's hyperparameters. The trainee must have been analyzed with this feature as the action feature first. If both "prediction_stats_action_feature" and "action_feature" are not provided, by default residuals and prediction stats uses ".targetless" hyperparameters. If "action_feature" is provided, and this value is not provided, will default to "action_feature". - * @type {string} - * @memberof ReactAggregateRequest - */ - prediction_stats_action_feature?: string; - /** - * List of features names to use as contexts for computations. Defaults to all non-unique features if not specified. - * @type {Array} - * @memberof ReactAggregateRequest - */ - context_features?: Array; - /** - * Full path for hyperparameters to use for computation. If specified for any residual computations, takes precedence over action_feature parameter. - * @type {Array} - * @memberof ReactAggregateRequest - */ - hyperparameter_param_path?: Array; - /** - * Total sample size of model to use (using sampling with replacement) for robust contribution computation. Defaults to 300. - * @type {number} - * @memberof ReactAggregateRequest - */ - num_robust_influence_samples?: number; - /** - * Specifies the number of robust samples to use for each case for robust contribution computations. Defaults to 300 + 2 * (number of features). - * @type {number} - * @memberof ReactAggregateRequest - */ - num_robust_influence_samples_per_case?: number; - /** - * Total sample size of model to use (using sampling with replacement) for robust mda and residual computation. Defaults to 1000 * (1 + log(number of features)). Note: robust mda will be updated to use num_robust_influence_samples in a future release. - * @type {number} - * @memberof ReactAggregateRequest - */ - num_robust_residual_samples?: number; - /** - * Total sample size of model to use (using sampling with replacement) for all non-robust computation. Defaults to 1000. If specified overrides sample_model_fraction. - * @type {number} - * @memberof ReactAggregateRequest - */ - num_samples?: number; - /** - * When specified, will attempt to return residuals that were computed using hyperparameters with the specified robust or non-robust type. - * @type {boolean} - * @memberof ReactAggregateRequest - */ - robust_hyperparameters?: boolean; - /** - * A value between 0.0 - 1.0, percent of model to use in sampling (using sampling without replacement). Applicable only to non-robust computation. Ignored if num_samples is specified. Higher values provide better accuracy at the cost of compute time. - * @type {number} - * @memberof ReactAggregateRequest - */ - sample_model_fraction?: number; - /** - * If specified will calculate residuals only on a sub model of the specified size from the full model. Applicable only to models > 1000 cases. - * @type {number} - * @memberof ReactAggregateRequest - */ - sub_model_size?: number; - /** - * The number of predictions a class should have (value of a cell in the matrix) for it to remain in the confusion matrix. If the count is less than this value, it will be accumulated into a single value of all insignificant predictions for the class and removed from the confusion matrix. Defaults to 10, applicable only to confusion matrices when computing residuals. - * @type {number} - * @memberof ReactAggregateRequest - */ - confusion_matrix_min_count?: number; - /** - * When calculating residuals and prediction stats, uses this target features's hyperparameters. The trainee must have been analyzed with this feature as the action feature first. If not provided, by default residuals and prediction stats uses .targetless hyperparameters. - * @type {string} - * @memberof ReactAggregateRequest - */ - residuals_hyperparameter_feature?: string; - /** - * When True, will scale influence weights by each case's weight_feature weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof ReactAggregateRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified uses the internally managed case weight. - * @type {string} - * @memberof ReactAggregateRequest - */ - weight_feature?: string; -} - -/** - * Check if a given object implements the ReactAggregateRequest interface. - */ -export function instanceOfReactAggregateRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactAggregateRequestFromJSON(json: any): ReactAggregateRequest { - return ReactAggregateRequestFromJSONTyped(json, false); -} - -export function ReactAggregateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactAggregateRequest { - if (json === undefined || json === null) { - return json; - } - return { - details: !exists(json, "details") ? undefined : ReactAggregateDetailsFromJSON(json["details"]), - action_feature: !exists(json, "action_feature") ? undefined : json["action_feature"], - feature_influences_action_feature: !exists(json, "feature_influences_action_feature") - ? undefined - : json["feature_influences_action_feature"], - prediction_stats_action_feature: !exists(json, "prediction_stats_action_feature") - ? undefined - : json["prediction_stats_action_feature"], - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - hyperparameter_param_path: !exists(json, "hyperparameter_param_path") - ? undefined - : json["hyperparameter_param_path"], - num_robust_influence_samples: !exists(json, "num_robust_influence_samples") - ? undefined - : json["num_robust_influence_samples"], - num_robust_influence_samples_per_case: !exists(json, "num_robust_influence_samples_per_case") - ? undefined - : json["num_robust_influence_samples_per_case"], - num_robust_residual_samples: !exists(json, "num_robust_residual_samples") - ? undefined - : json["num_robust_residual_samples"], - num_samples: !exists(json, "num_samples") ? undefined : json["num_samples"], - robust_hyperparameters: !exists(json, "robust_hyperparameters") ? undefined : json["robust_hyperparameters"], - sample_model_fraction: !exists(json, "sample_model_fraction") ? undefined : json["sample_model_fraction"], - sub_model_size: !exists(json, "sub_model_size") ? undefined : json["sub_model_size"], - confusion_matrix_min_count: !exists(json, "confusion_matrix_min_count") - ? undefined - : json["confusion_matrix_min_count"], - residuals_hyperparameter_feature: !exists(json, "residuals_hyperparameter_feature") - ? undefined - : json["residuals_hyperparameter_feature"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function ReactAggregateRequestToJSON(value?: ReactAggregateRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - details: ReactAggregateDetailsToJSON(value.details), - action_feature: value.action_feature, - feature_influences_action_feature: value.feature_influences_action_feature, - prediction_stats_action_feature: value.prediction_stats_action_feature, - context_features: value.context_features, - hyperparameter_param_path: value.hyperparameter_param_path, - num_robust_influence_samples: value.num_robust_influence_samples, - num_robust_influence_samples_per_case: value.num_robust_influence_samples_per_case, - num_robust_residual_samples: value.num_robust_residual_samples, - num_samples: value.num_samples, - robust_hyperparameters: value.robust_hyperparameters, - sample_model_fraction: value.sample_model_fraction, - sub_model_size: value.sub_model_size, - confusion_matrix_min_count: value.confusion_matrix_min_count, - residuals_hyperparameter_feature: value.residuals_hyperparameter_feature, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/ReactAggregateResponse.ts b/src/types/models/ReactAggregateResponse.ts deleted file mode 100644 index e3cab34..0000000 --- a/src/types/models/ReactAggregateResponse.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { ReactAggregateResponseContent } from "./ReactAggregateResponseContent"; -import { - ReactAggregateResponseContentFromJSON, - ReactAggregateResponseContentToJSON, -} from "./ReactAggregateResponseContent"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * The response body of react_aggregate - * @export - * @interface ReactAggregateResponse - */ -export interface ReactAggregateResponse { - /** - * - * @type {Array} - * @memberof ReactAggregateResponse - */ - warnings?: Array; - /** - * - * @type {{ [key: string]: ReactAggregateResponseContent; }} - * @memberof ReactAggregateResponse - */ - content?: { [key: string]: ReactAggregateResponseContent }; -} - -/** - * Check if a given object implements the ReactAggregateResponse interface. - */ -export function instanceOfReactAggregateResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactAggregateResponseFromJSON(json: any): ReactAggregateResponse { - return ReactAggregateResponseFromJSONTyped(json, false); -} - -export function ReactAggregateResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactAggregateResponse { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - content: !exists(json, "content") ? undefined : mapValues(json["content"], ReactAggregateResponseContentFromJSON), - }; -} - -export function ReactAggregateResponseToJSON(value?: ReactAggregateResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - content: value.content === undefined ? undefined : mapValues(value.content, ReactAggregateResponseContentToJSON), - }; -} diff --git a/src/types/models/ReactAggregateResponseContent.ts b/src/types/models/ReactAggregateResponseContent.ts deleted file mode 100644 index 1289bf9..0000000 --- a/src/types/models/ReactAggregateResponseContent.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactAggregateResponseContentConfusionMatrix } from "./ReactAggregateResponseContentConfusionMatrix"; -import { - ReactAggregateResponseContentConfusionMatrixFromJSON, - ReactAggregateResponseContentConfusionMatrixToJSON, -} from "./ReactAggregateResponseContentConfusionMatrix"; - -/** - * Prediction feature statistics and details. - * @export - * @interface ReactAggregateResponseContent - */ -export interface ReactAggregateResponseContent { - /** - * The accuracy (1 - mean absolute error) value. Applicable only for nominal features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - accuracy?: number | null; - /** - * - * @type {ReactAggregateResponseContentConfusionMatrix} - * @memberof ReactAggregateResponseContent - */ - confusion_matrix?: ReactAggregateResponseContentConfusionMatrix | null; - /** - * The full contribution to the predicted value of an action feature. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_contributions_full?: number | null; - /** - * The robust contribution to the predicted value of an action feature. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_contributions_robust?: number | null; - /** - * The mean absolute error value. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - mae?: number | null; - /** - * The full feature residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_residuals_full?: number | null; - /** - * The robust feature residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_residuals_robust?: number | null; - /** - * The full mean decrease in accuracy value. Computed by dropping each feature and use the full set of remaining context features for each prediction. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_mda_full?: number | null; - /** - * The robust mean decrease in accuracy value. Computed by dropping each feature and use the full set of remaining context features for each prediction. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_mda_robust?: number | null; - /** - * The full mean decrease in accuracy permutation value. Computed by scrambling each feature and using the full set of remaining context features for each prediction. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_mda_permutation_full?: number | null; - /** - * The robust mean decrease in accuracy permutation value. Computed by scrambling each feature and using the full set of remaining context features for each prediction. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - feature_mda_permutation_robust?: number | null; - /** - * The precision (positive predictive) value. Applicable only for nominal features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - precision?: number | null; - /** - * The R-squared (coefficient of determination) value. Applicable only for continuous features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - r2?: number | null; - /** - * The recall (sensitivity) value. Applicable only for nominal features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - recall?: number | null; - /** - * The missing value accuracy. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - missing_value_accuracy?: number | null; - /** - * The root-mean-squared-error value. Applicable only for continuous features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - rmse?: number | null; - /** - * The Spearman's rank correlation coefficient value. Applicable only for continuous features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - spearman_coeff?: number | null; - /** - * The Matthews correlation coefficient value. Applicable only for nominal features, computed by computing residuals. - * @type {number} - * @memberof ReactAggregateResponseContent - */ - mcc?: number | null; -} - -/** - * Check if a given object implements the ReactAggregateResponseContent interface. - */ -export function instanceOfReactAggregateResponseContent(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactAggregateResponseContentFromJSON(json: any): ReactAggregateResponseContent { - return ReactAggregateResponseContentFromJSONTyped(json, false); -} - -export function ReactAggregateResponseContentFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactAggregateResponseContent { - if (json === undefined || json === null) { - return json; - } - return { - accuracy: !exists(json, "accuracy") ? undefined : json["accuracy"], - confusion_matrix: !exists(json, "confusion_matrix") - ? undefined - : ReactAggregateResponseContentConfusionMatrixFromJSON(json["confusion_matrix"]), - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - mae: !exists(json, "mae") ? undefined : json["mae"], - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_permutation_full: !exists(json, "feature_mda_permutation_full") - ? undefined - : json["feature_mda_permutation_full"], - feature_mda_permutation_robust: !exists(json, "feature_mda_permutation_robust") - ? undefined - : json["feature_mda_permutation_robust"], - precision: !exists(json, "precision") ? undefined : json["precision"], - r2: !exists(json, "r2") ? undefined : json["r2"], - recall: !exists(json, "recall") ? undefined : json["recall"], - missing_value_accuracy: !exists(json, "missing_value_accuracy") ? undefined : json["missing_value_accuracy"], - rmse: !exists(json, "rmse") ? undefined : json["rmse"], - spearman_coeff: !exists(json, "spearman_coeff") ? undefined : json["spearman_coeff"], - mcc: !exists(json, "mcc") ? undefined : json["mcc"], - }; -} - -export function ReactAggregateResponseContentToJSON(value?: ReactAggregateResponseContent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - accuracy: value.accuracy, - confusion_matrix: ReactAggregateResponseContentConfusionMatrixToJSON(value.confusion_matrix), - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - mae: value.mae, - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_permutation_full: value.feature_mda_permutation_full, - feature_mda_permutation_robust: value.feature_mda_permutation_robust, - precision: value.precision, - r2: value.r2, - recall: value.recall, - missing_value_accuracy: value.missing_value_accuracy, - rmse: value.rmse, - spearman_coeff: value.spearman_coeff, - mcc: value.mcc, - }; -} diff --git a/src/types/models/ReactAggregateResponseContentConfusionMatrix.ts b/src/types/models/ReactAggregateResponseContentConfusionMatrix.ts deleted file mode 100644 index 8a82da5..0000000 --- a/src/types/models/ReactAggregateResponseContentConfusionMatrix.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface ReactAggregateResponseContentConfusionMatrix - */ -export interface ReactAggregateResponseContentConfusionMatrix { - /** - * The sparse confusion matrix for the predicted values of an action feature. - * @type {{ [key: string]: { [key: string]: number; }; }} - * @memberof ReactAggregateResponseContentConfusionMatrix - */ - matrix?: { [key: string]: { [key: string]: number } }; - /** - * Total count of all correct predictions for classes that did not have a statistically significant amount. - * @type {number} - * @memberof ReactAggregateResponseContentConfusionMatrix - */ - leftover_correct?: number; - /** - * Total count of all incorrect predictions for classes that did not have a statistically significant amount. - * @type {number} - * @memberof ReactAggregateResponseContentConfusionMatrix - */ - leftover_incorrect?: number; - /** - * Total count of all other statistically insignificant predictions for classes that were predicted correctly with significance. - * @type {number} - * @memberof ReactAggregateResponseContentConfusionMatrix - */ - other_counts?: number; -} - -/** - * Check if a given object implements the ReactAggregateResponseContentConfusionMatrix interface. - */ -export function instanceOfReactAggregateResponseContentConfusionMatrix(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactAggregateResponseContentConfusionMatrixFromJSON( - json: any, -): ReactAggregateResponseContentConfusionMatrix { - return ReactAggregateResponseContentConfusionMatrixFromJSONTyped(json, false); -} - -export function ReactAggregateResponseContentConfusionMatrixFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactAggregateResponseContentConfusionMatrix { - if (json === undefined || json === null) { - return json; - } - return { - matrix: !exists(json, "matrix") ? undefined : json["matrix"], - leftover_correct: !exists(json, "leftover_correct") ? undefined : json["leftover_correct"], - leftover_incorrect: !exists(json, "leftover_incorrect") ? undefined : json["leftover_incorrect"], - other_counts: !exists(json, "other_counts") ? undefined : json["other_counts"], - }; -} - -export function ReactAggregateResponseContentConfusionMatrixToJSON( - value?: ReactAggregateResponseContentConfusionMatrix | null, -): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - matrix: value.matrix, - leftover_correct: value.leftover_correct, - leftover_incorrect: value.leftover_incorrect, - other_counts: value.other_counts, - }; -} diff --git a/src/types/models/ReactDetails.ts b/src/types/models/ReactDetails.ts deleted file mode 100644 index bc9cf15..0000000 --- a/src/types/models/ReactDetails.ts +++ /dev/null @@ -1,451 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Returns details and audit data for a given reaction for the specified audit data flags. - * Local and regional models are used to determine details: - * Local model - only the most similar cases used to directly determine the prediction value, used to compute affects of cases directly - * responsible for the predicted output. - * Regional model - the most similar cases to the prediction, represented by the maximum of either 30 or the local model size. Used in - * situations where relying on a small local model may produce noisy results. - * @export - * @interface ReactDetails - */ -export interface ReactDetails { - /** - * When true, outputs the most influential cases and their influence weights based on the surprisal of each case relative to the context being predicted among the cases. Uses only the context features of the reacted case. - * @type {boolean} - * @memberof ReactDetails - */ - influential_cases?: boolean; - /** - * If True, outputs a dictionary of the parameters used in the react call. These include k, p, distance_transform, feature_weights, feature_deviations, nominal_class_counts, and use_irw. - * @type {boolean} - * @memberof ReactDetails - */ - derivation_parameters?: boolean; - /** - * When true, outputs familiarity conviction of addition for each of the influential cases. - * @type {boolean} - * @memberof ReactDetails - */ - influential_cases_familiarity_convictions?: boolean; - /** - * When true, outputs the surprisal for each of the influential cases. - * @type {boolean} - * @memberof ReactDetails - */ - influential_cases_raw_weights?: boolean; - /** - * When true, outputs an automatically determined (when 'num_most_similar_cases' is not specified) relevant number of similar cases, which will first include the influential cases. Uses only the context features of the reacted case. - * @type {boolean} - * @memberof ReactDetails - */ - most_similar_cases?: boolean; - /** - * When defined, outputs this manually specified number of most similar cases, which will first include the influential cases. Takes precedence over 'most_similar_cases' parameter. - * @type {number} - * @memberof ReactDetails - */ - num_most_similar_cases?: number; - /** - * When defined, outputs the specified number of most similar case indices when 'distance_ratio' is also set to true. - * @type {number} - * @memberof ReactDetails - */ - num_most_similar_case_indices?: number; - /** - * Specifies the number of robust samples to use for each case. Applicable only for computing robust feature contributions or robust case feature contributions. Defaults to 2000 when unspecified. Higher values will take longer but provide more stable results. - * @type {number} - * @memberof ReactDetails - */ - num_robust_influence_samples_per_case?: number; - /** - * When true, outputs an automatically determined (when 'num_boundary_cases' is not specified) relevant number of boundary cases. Uses both context and action features of the reacted case to determine the counterfactual boundary based on action features, which maximize the dissimilarity of action features while maximizing the similarity of context features. If action features aren't specified, uses familiarity conviction to determine the boundary instead. - * @type {boolean} - * @memberof ReactDetails - */ - boundary_cases?: boolean; - /** - * When defined, outputs this manually specified number of boundary cases. Takes precedence over 'boundary_cases' parameter. - * @type {number} - * @memberof ReactDetails - */ - num_boundary_cases?: number; - /** - * When true, outputs familiarity conviction of addition for each of the boundary cases. - * @type {boolean} - * @memberof ReactDetails - */ - boundary_cases_familiarity_convictions?: boolean; - /** - * A list of feature names that specifies for what features will per-feature details be computed (residuals, contributions, mda, etc.). This should generally preserve compute, but will not when computing details robustly. Details will be computed for all context and action features if this is not specified. - * @type {Array} - * @memberof ReactDetails - */ - features?: Array; - /** - * If True, outputs feature residuals for all (context and action) features locally around the prediction. Uses only the context features of the reacted case to determine that area. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - feature_residuals_full?: boolean; - /** - * If True, outputs feature residuals for all (context and action) features locally around the prediction. Uses only the context features of the reacted case to determine that area. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. 'selected_prediction_stats' controls the returned prediction stats. - * @type {boolean} - * @memberof ReactDetails - */ - feature_residuals_robust?: boolean; - /** - * When true outputs feature prediction stats for all (context and action) features locally around the prediction. The stats returned are ("r2", "rmse", "spearman_coeff", "precision", "recall", "accuracy", "mcc", "confusion_matrix", "missing_value_accuracy"). Uses only the context features of the reacted case to determine that area. Uses full calculations, which uses leave-one-out context features for computations. 'selected_prediction_stats' controls the returned prediction stats. - * @type {boolean} - * @memberof ReactDetails - */ - prediction_stats?: boolean; - /** - * When True will compute Mean Decrease in Accuracy (MDA) for each context feature at predicting the action feature. Drop each feature and use the full set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactDetails - */ - feature_mda_full?: boolean; - /** - * Compute Mean Decrease in Accuracy MDA by dropping each feature and using the robust (power set/permutations) set of remaining context features for each prediction. False removes cached values. - * @type {boolean} - * @memberof ReactDetails - */ - feature_mda_robust?: boolean; - /** - * If True, outputs each context feature's mean decrease in accuracy of predicting the action feature as an explanation detail given that the specified prediction was already made as specified by the action value. Uses both context and action features of the reacted case to determine that area. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - feature_mda_ex_post_full?: boolean; - /** - * If True, outputs each context feature's mean decrease in accuracy of predicting the action feature as an explanation detail given that the specified prediction was already made as specified by the action value. Uses both context and action features of the reacted case to determine that area. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. - * @type {boolean} - * @memberof ReactDetails - */ - feature_mda_ex_post_robust?: boolean; - /** - * If True outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context were not in the model for all context features in the local model area. Uses full calculations, which uses leave-one-out for cases for computations. Directional feature contributions are returned under the key 'directional_feature_contributions_full'. - * @type {boolean} - * @memberof ReactDetails - */ - feature_contributions_full?: boolean; - /** - * If True outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context were not in the model for all context features in the local model area Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. Directional feature contributions are returned under the key 'directional_feature_contributions_robust'. - * @type {boolean} - * @memberof ReactDetails - */ - feature_contributions_robust?: boolean; - /** - * If True outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context feature were not in the model for all context features in this case, using only the values from this specific case. Uses full calculations, which uses leave-one-out for cases for computations. Directional case feature contributions are returned under the 'case_directional_feature_contributions_full' key. - * @type {boolean} - * @memberof ReactDetails - */ - case_feature_contributions_full?: boolean; - /** - * If True outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context feature were not in the model for all context features in this case, using only the values from this specific case. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. Directional case feature contributions are returned under the 'case_directional_feature_contributions_robust' key. - * @type {boolean} - * @memberof ReactDetails - */ - case_feature_contributions_robust?: boolean; - /** - * If True, outputs feature residuals for all (context and action) features for just the specified case. Uses leave-one-out for each feature, while using the others to predict the left out feature with their corresponding values from this case. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - case_feature_residuals_full?: boolean; - /** - * If True, outputs feature residuals for all (context and action) features for just the specified case. Uses leave-one-out for each feature, while using the others to predict the left out feature with their corresponding values from this case. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. - * @type {boolean} - * @memberof ReactDetails - */ - case_feature_residuals_robust?: boolean; - /** - * If True, outputs each influential case's mean decrease in accuracy of predicting the action feature in the local model area, as if each individual case were included versus not included. Uses only the context features of the reacted case to determine that area. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - case_mda_full?: boolean; - /** - * If True, outputs each influential case's mean decrease in accuracy of predicting the action feature in the local model area, as if each individual case were included versus not included. Uses only the context features of the reacted case to determine that area. Uses robust calculations, which uses uniform sampling from the power set of all combinations of cases. - * @type {boolean} - * @memberof ReactDetails - */ - case_mda_robust?: boolean; - /** - * If true outputs each influential case's differences between the predicted action feature value and the predicted action feature value if each individual case were not included. Uses only the context features of the reacted case to determine that area. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - case_contributions_full?: boolean; - /** - * If true outputs each influential case's differences between the predicted action feature value and the predicted action feature value if each individual case were not included. Uses only the context features of the reacted case to determine that area. Uses robust calculations, which uses uniform sampling from the power set of all combinations of cases. - * @type {boolean} - * @memberof ReactDetails - */ - case_contributions_robust?: boolean; - /** - * If True, outputs this case's feature residual convictions for the global model. Computed as: global model feature residual divided by case feature residual. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - global_case_feature_residual_convictions_full?: boolean; - /** - * If True, outputs this case's feature residual convictions for the global model. Computed as: global model feature residual divided by case feature residual. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. - * @type {boolean} - * @memberof ReactDetails - */ - global_case_feature_residual_convictions_robust?: boolean; - /** - * If True, outputs this case's feature residual convictions for the region around the prediction. Uses only the context features of the reacted case to determine that region. Computed as: region feature residual divided by case feature residual. Uses full calculations, which uses leave-one-out for cases for computations. - * @type {boolean} - * @memberof ReactDetails - */ - local_case_feature_residual_convictions_full?: boolean; - /** - * If True, outputs this case's feature residual convictions for the region around the prediction. Uses only the context features of the reacted case to determine that region. Computed as: region feature residual divided by case feature residual. Uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. - * @type {boolean} - * @memberof ReactDetails - */ - local_case_feature_residual_convictions_robust?: boolean; - /** - * When true, outputs the reacted case's context feature values that are outside the min or max of the corresponding feature values of all the cases in the local model area. Uses only the context features of the reacted case to determine that area. - * @type {boolean} - * @memberof ReactDetails - */ - outlying_feature_values?: boolean; - /** - * When true, outputs probabilities for each class for the action. Applicable only to categorical action features. - * @type {boolean} - * @memberof ReactDetails - */ - categorical_action_probabilities?: boolean; - /** - * A dictionary of feature name to feature value. If specified, shows how a prediction could change in a what-if scenario where the influential cases' context feature values are replaced with the specified values. Iterates over all influential cases, predicting the action features each one using the updated hypothetical values. Outputs the predicted arithmetic over the influential cases for each action feature. - * @type {{ [key: string]: any; }} - * @memberof ReactDetails - */ - hypothetical_values?: { [key: string]: any }; - /** - * When true, outputs the ratio of distance (relative surprisal) between this reacted case and its nearest case to the minimum distance (relative surprisal) in between the closest two cases in the local area. All distances are computed using only the specified context features. - * @type {boolean} - * @memberof ReactDetails - */ - distance_ratio?: boolean; - /** - * When true, outputs the distance contribution (expected total surprisal contribution) for the reacted case. Uses both context and action feature values. - * @type {boolean} - * @memberof ReactDetails - */ - distance_contribution?: boolean; - /** - * When true, outputs similarity conviction for the reacted case. Uses both context and action feature values as the case values for all computations. This is defined as expected (local) distance contribution divided by reacted case distance contribution. - * @type {boolean} - * @memberof ReactDetails - */ - similarity_conviction?: boolean; - /** - * When true, outputs observational errors for all features as defined in feature attributes. - * @type {boolean} - * @memberof ReactDetails - */ - observational_errors?: boolean; - /** - * When true, outputs the number of attempts taken to generate each case. Only applicable when 'generate_new_cases' is "always" or "attempt". When used in react_series, "series_generate_attempts" is also returned. - * @type {boolean} - * @memberof ReactDetails - */ - generate_attempts?: boolean; - /** - * Types of stats to output. When unspecified, returns all except the confusion_matrix. If all, then returns all including the confusion_matrix. - * @type {Array} - * @memberof ReactAggregateDetails - */ - selected_prediction_stats?: Array; -} - -/** - * @export - * @enum {string} - */ -export type ReactDetailsSelectedPredictionStat = - // Returns all the the available prediction stats, including the confusion matrix. - | "all" - // The number of correct predictions divided by the total number of predictions. - | "accuracy" - // A sparse map of actual feature value to a map of predicted feature value to counts. - | "confusion_matrix" - // Mean absolute error. For continuous features, this is calculated as the mean of absolute values of the difference between the actual and predicted values. For nominal features, this is 1 - the average categorical action probability of each case’s correct classes. Categorical action probabilities are the probabilities for each class for the action feature. - | "mae" - // Mean decrease in accuracy when each feature is dropped from the model, applies to all features. - | "mda" - // Mean decrease in accuracy that used scrambling of feature values instead of dropping each feature, applies to all features. - | "feature_mda_permutation_full" - // Precision (positive predictive) value for nominal features only. - | "precision" - // The r-squared coefficient of determination, for continuous features only. - | "r2" - // Recall (sensitivity) value for nominal features only. - | "recall" - // Root mean squared error, for continuous features only. - | "rmse" - // Spearman’s rank correlation coefficient, for continuous features only. - | "spearman_coeff" - // Matthews correlation coefficient, for nominal features only. - | "mcc"; - -/** - * Check if a given object implements the ReactDetails interface. - */ -export function instanceOfReactDetails(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactDetailsFromJSON(json: any): ReactDetails { - return ReactDetailsFromJSONTyped(json, false); -} - -export function ReactDetailsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactDetails { - if (json === undefined || json === null) { - return json; - } - return { - influential_cases: !exists(json, "influential_cases") ? undefined : json["influential_cases"], - derivation_parameters: !exists(json, "derivation_parameters") ? undefined : json["derivation_parameters"], - influential_cases_familiarity_convictions: !exists(json, "influential_cases_familiarity_convictions") - ? undefined - : json["influential_cases_familiarity_convictions"], - influential_cases_raw_weights: !exists(json, "influential_cases_raw_weights") - ? undefined - : json["influential_cases_raw_weights"], - most_similar_cases: !exists(json, "most_similar_cases") ? undefined : json["most_similar_cases"], - num_most_similar_cases: !exists(json, "num_most_similar_cases") ? undefined : json["num_most_similar_cases"], - num_most_similar_case_indices: !exists(json, "num_most_similar_case_indices") - ? undefined - : json["num_most_similar_case_indices"], - num_robust_influence_samples_per_case: !exists(json, "num_robust_influence_samples_per_case") - ? undefined - : json["num_robust_influence_samples_per_case"], - boundary_cases: !exists(json, "boundary_cases") ? undefined : json["boundary_cases"], - num_boundary_cases: !exists(json, "num_boundary_cases") ? undefined : json["num_boundary_cases"], - boundary_cases_familiarity_convictions: !exists(json, "boundary_cases_familiarity_convictions") - ? undefined - : json["boundary_cases_familiarity_convictions"], - features: !exists(json, "features") ? undefined : json["features"], - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - prediction_stats: !exists(json, "prediction_stats") ? undefined : json["prediction_stats"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_ex_post_full: !exists(json, "feature_mda_ex_post_full") ? undefined : json["feature_mda_ex_post_full"], - feature_mda_ex_post_robust: !exists(json, "feature_mda_ex_post_robust") - ? undefined - : json["feature_mda_ex_post_robust"], - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - case_feature_contributions_full: !exists(json, "case_feature_contributions_full") - ? undefined - : json["case_feature_contributions_full"], - case_feature_contributions_robust: !exists(json, "case_feature_contributions_robust") - ? undefined - : json["case_feature_contributions_robust"], - case_feature_residuals_full: !exists(json, "case_feature_residuals_full") - ? undefined - : json["case_feature_residuals_full"], - case_feature_residuals_robust: !exists(json, "case_feature_residuals_robust") - ? undefined - : json["case_feature_residuals_robust"], - case_mda_full: !exists(json, "case_mda_full") ? undefined : json["case_mda_full"], - case_mda_robust: !exists(json, "case_mda_robust") ? undefined : json["case_mda_robust"], - case_contributions_full: !exists(json, "case_contributions_full") ? undefined : json["case_contributions_full"], - case_contributions_robust: !exists(json, "case_contributions_robust") - ? undefined - : json["case_contributions_robust"], - global_case_feature_residual_convictions_full: !exists(json, "global_case_feature_residual_convictions_full") - ? undefined - : json["global_case_feature_residual_convictions_full"], - global_case_feature_residual_convictions_robust: !exists(json, "global_case_feature_residual_convictions_robust") - ? undefined - : json["global_case_feature_residual_convictions_robust"], - local_case_feature_residual_convictions_full: !exists(json, "local_case_feature_residual_convictions_full") - ? undefined - : json["local_case_feature_residual_convictions_full"], - local_case_feature_residual_convictions_robust: !exists(json, "local_case_feature_residual_convictions_robust") - ? undefined - : json["local_case_feature_residual_convictions_robust"], - outlying_feature_values: !exists(json, "outlying_feature_values") ? undefined : json["outlying_feature_values"], - categorical_action_probabilities: !exists(json, "categorical_action_probabilities") - ? undefined - : json["categorical_action_probabilities"], - hypothetical_values: !exists(json, "hypothetical_values") ? undefined : json["hypothetical_values"], - distance_ratio: !exists(json, "distance_ratio") ? undefined : json["distance_ratio"], - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - similarity_conviction: !exists(json, "similarity_conviction") ? undefined : json["similarity_conviction"], - observational_errors: !exists(json, "observational_errors") ? undefined : json["observational_errors"], - generate_attempts: !exists(json, "generate_attempts") ? undefined : json["generate_attempts"], - selected_prediction_stats: !exists(json, "selected_prediction_stats") - ? undefined - : json["selected_prediction_stats"], - }; -} - -export function ReactDetailsToJSON(value?: ReactDetails | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - influential_cases: value.influential_cases, - derivation_parameters: value.derivation_parameters, - influential_cases_familiarity_convictions: value.influential_cases_familiarity_convictions, - influential_cases_raw_weights: value.influential_cases_raw_weights, - most_similar_cases: value.most_similar_cases, - num_most_similar_cases: value.num_most_similar_cases, - num_most_similar_case_indices: value.num_most_similar_case_indices, - num_robust_influence_samples_per_case: value.num_robust_influence_samples_per_case, - boundary_cases: value.boundary_cases, - num_boundary_cases: value.num_boundary_cases, - boundary_cases_familiarity_convictions: value.boundary_cases_familiarity_convictions, - features: value.features, - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - prediction_stats: value.prediction_stats, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_ex_post_full: value.feature_mda_ex_post_full, - feature_mda_ex_post_robust: value.feature_mda_ex_post_robust, - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - case_feature_contributions_full: value.case_feature_contributions_full, - case_feature_contributions_robust: value.case_feature_contributions_robust, - case_feature_residuals_full: value.case_feature_residuals_full, - case_feature_residuals_robust: value.case_feature_residuals_robust, - case_mda_full: value.case_mda_full, - case_mda_robust: value.case_mda_robust, - case_contributions_full: value.case_contributions_full, - case_contributions_robust: value.case_contributions_robust, - global_case_feature_residual_convictions_full: value.global_case_feature_residual_convictions_full, - global_case_feature_residual_convictions_robust: value.global_case_feature_residual_convictions_robust, - local_case_feature_residual_convictions_full: value.local_case_feature_residual_convictions_full, - local_case_feature_residual_convictions_robust: value.local_case_feature_residual_convictions_robust, - outlying_feature_values: value.outlying_feature_values, - categorical_action_probabilities: value.categorical_action_probabilities, - hypothetical_values: value.hypothetical_values, - distance_ratio: value.distance_ratio, - distance_contribution: value.distance_contribution, - similarity_conviction: value.similarity_conviction, - observational_errors: value.observational_errors, - generate_attempts: value.generate_attempts, - selected_prediction_stats: value.selected_prediction_stats, - }; -} diff --git a/src/types/models/ReactGroupActionOutput.ts b/src/types/models/ReactGroupActionOutput.ts deleted file mode 100644 index 12a1b1f..0000000 --- a/src/types/models/ReactGroupActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactGroupResponse } from "./ReactGroupResponse"; -import { ReactGroupResponseFromJSON, ReactGroupResponseToJSON } from "./ReactGroupResponse"; - -/** - * - * @export - * @interface ReactGroupActionOutput - */ -export interface ReactGroupActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof ReactGroupActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof ReactGroupActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof ReactGroupActionOutput - */ - operation_type: string; - /** - * - * @type {ReactGroupResponse} - * @memberof ReactGroupActionOutput - */ - output?: ReactGroupResponse | null; -} - -/** - * Check if a given object implements the ReactGroupActionOutput interface. - */ -export function instanceOfReactGroupActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function ReactGroupActionOutputFromJSON(json: any): ReactGroupActionOutput { - return ReactGroupActionOutputFromJSONTyped(json, false); -} - -export function ReactGroupActionOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactGroupActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : ReactGroupResponseFromJSON(json["output"]), - }; -} - -export function ReactGroupActionOutputToJSON(value?: ReactGroupActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: ReactGroupResponseToJSON(value.output), - }; -} diff --git a/src/types/models/ReactGroupRequest.ts b/src/types/models/ReactGroupRequest.ts deleted file mode 100644 index fae66d0..0000000 --- a/src/types/models/ReactGroupRequest.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Request body for react group. - * @export - * @interface ReactGroupRequest - */ -export interface ReactGroupRequest { - /** - * One or more groupings of cases to compare against. - * @type {Array>>} - * @memberof ReactGroupRequest - */ - new_cases: Array>>; - /** - * The features to use when calculating convictions. - * @type {Array} - * @memberof ReactGroupRequest - */ - features?: Array; - /** - * Calculate and output the familiarity conviction of adding the cases. - * @type {boolean} - * @memberof ReactGroupRequest - */ - familiarity_conviction_addition?: boolean; - /** - * Calculate and output the familiarity conviction of removing the cases. - * @type {boolean} - * @memberof ReactGroupRequest - */ - familiarity_conviction_removal?: boolean; - /** - * Calculate and output the KL divergence of adding the cases. - * @type {boolean} - * @memberof ReactGroupRequest - */ - kl_divergence_addition?: boolean; - /** - * Calculate and output the KL divergence of removing the cases. - * @type {boolean} - * @memberof ReactGroupRequest - */ - kl_divergence_removal?: boolean; - /** - * When true, output p value of addition. - * @type {boolean} - * @memberof ReactGroupRequest - */ - p_value_of_addition?: boolean; - /** - * When true, output p value of removal. - * @type {boolean} - * @memberof ReactGroupRequest - */ - p_value_of_removal?: boolean; - /** - * When true, calculate and output distance contribution ratios for each case. - * @type {boolean} - * @memberof ReactGroupRequest - */ - distance_contributions?: boolean; - /** - * If set to True will scale influence weights by each case's `weight_feature` weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof ReactGroupRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally managed case weight. - * @type {string} - * @memberof ReactGroupRequest - */ - weight_feature?: string; -} - -/** - * Check if a given object implements the ReactGroupRequest interface. - */ -export function instanceOfReactGroupRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "new_cases" in value; - - return isInstance; -} - -export function ReactGroupRequestFromJSON(json: any): ReactGroupRequest { - return ReactGroupRequestFromJSONTyped(json, false); -} - -export function ReactGroupRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactGroupRequest { - if (json === undefined || json === null) { - return json; - } - return { - new_cases: json["new_cases"], - features: !exists(json, "features") ? undefined : json["features"], - familiarity_conviction_addition: !exists(json, "familiarity_conviction_addition") - ? undefined - : json["familiarity_conviction_addition"], - familiarity_conviction_removal: !exists(json, "familiarity_conviction_removal") - ? undefined - : json["familiarity_conviction_removal"], - kl_divergence_addition: !exists(json, "kl_divergence_addition") ? undefined : json["kl_divergence_addition"], - kl_divergence_removal: !exists(json, "kl_divergence_removal") ? undefined : json["kl_divergence_removal"], - p_value_of_addition: !exists(json, "p_value_of_addition") ? undefined : json["p_value_of_addition"], - p_value_of_removal: !exists(json, "p_value_of_removal") ? undefined : json["p_value_of_removal"], - distance_contributions: !exists(json, "distance_contributions") ? undefined : json["distance_contributions"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function ReactGroupRequestToJSON(value?: ReactGroupRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - new_cases: value.new_cases, - features: value.features, - familiarity_conviction_addition: value.familiarity_conviction_addition, - familiarity_conviction_removal: value.familiarity_conviction_removal, - kl_divergence_addition: value.kl_divergence_addition, - kl_divergence_removal: value.kl_divergence_removal, - p_value_of_addition: value.p_value_of_addition, - p_value_of_removal: value.p_value_of_removal, - distance_contributions: value.distance_contributions, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/ReactGroupResponse.ts b/src/types/models/ReactGroupResponse.ts deleted file mode 100644 index 3a04b1f..0000000 --- a/src/types/models/ReactGroupResponse.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactGroupResponseContent } from "./ReactGroupResponseContent"; -import { ReactGroupResponseContentFromJSON, ReactGroupResponseContentToJSON } from "./ReactGroupResponseContent"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * - * @export - * @interface ReactGroupResponse - */ -export interface ReactGroupResponse { - /** - * - * @type {Array} - * @memberof ReactGroupResponse - */ - warnings?: Array; - /** - * - * @type {ReactGroupResponseContent} - * @memberof ReactGroupResponse - */ - content?: ReactGroupResponseContent; -} - -/** - * Check if a given object implements the ReactGroupResponse interface. - */ -export function instanceOfReactGroupResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactGroupResponseFromJSON(json: any): ReactGroupResponse { - return ReactGroupResponseFromJSONTyped(json, false); -} - -export function ReactGroupResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactGroupResponse { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - content: !exists(json, "content") ? undefined : ReactGroupResponseContentFromJSON(json["content"]), - }; -} - -export function ReactGroupResponseToJSON(value?: ReactGroupResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - content: ReactGroupResponseContentToJSON(value.content), - }; -} diff --git a/src/types/models/ReactGroupResponseContent.ts b/src/types/models/ReactGroupResponseContent.ts deleted file mode 100644 index 87a665a..0000000 --- a/src/types/models/ReactGroupResponseContent.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface ReactGroupResponseContent - */ -export interface ReactGroupResponseContent { - /** - * The familiarity conviction of adding the cases to the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - familiarity_conviction_addition?: Array; - /** - * The familiarity conviction of removing the cases from the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - familiarity_conviction_removal?: Array; - /** - * The KL divergence of adding the cases to the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - kl_divergence_addition?: Array; - /** - * The KL divergence of removing the cases from the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - kl_divergence_removal?: Array; - /** - * The p value of adding the cases to the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - p_value_of_addition?: Array; - /** - * The p value of removing the cases from the Model. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - p_value_of_removal?: Array; - /** - * Distance contribution ratios. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - distance_contribution?: Array; - /** - * The base Model average distance contribution. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - base_model_average_distance_contribution?: Array; - /** - * The combined Model average distance contribution. - * @type {Array} - * @memberof ReactGroupResponseContent - */ - combined_model_average_distance_contribution?: Array; -} - -/** - * Check if a given object implements the ReactGroupResponseContent interface. - */ -export function instanceOfReactGroupResponseContent(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactGroupResponseContentFromJSON(json: any): ReactGroupResponseContent { - return ReactGroupResponseContentFromJSONTyped(json, false); -} - -export function ReactGroupResponseContentFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactGroupResponseContent { - if (json === undefined || json === null) { - return json; - } - return { - familiarity_conviction_addition: !exists(json, "familiarity_conviction_addition") - ? undefined - : json["familiarity_conviction_addition"], - familiarity_conviction_removal: !exists(json, "familiarity_conviction_removal") - ? undefined - : json["familiarity_conviction_removal"], - kl_divergence_addition: !exists(json, "kl_divergence_addition") ? undefined : json["kl_divergence_addition"], - kl_divergence_removal: !exists(json, "kl_divergence_removal") ? undefined : json["kl_divergence_removal"], - p_value_of_addition: !exists(json, "p_value_of_addition") ? undefined : json["p_value_of_addition"], - p_value_of_removal: !exists(json, "p_value_of_removal") ? undefined : json["p_value_of_removal"], - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - base_model_average_distance_contribution: !exists(json, "base_model_average_distance_contribution") - ? undefined - : json["base_model_average_distance_contribution"], - combined_model_average_distance_contribution: !exists(json, "combined_model_average_distance_contribution") - ? undefined - : json["combined_model_average_distance_contribution"], - }; -} - -export function ReactGroupResponseContentToJSON(value?: ReactGroupResponseContent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - familiarity_conviction_addition: value.familiarity_conviction_addition, - familiarity_conviction_removal: value.familiarity_conviction_removal, - kl_divergence_addition: value.kl_divergence_addition, - kl_divergence_removal: value.kl_divergence_removal, - p_value_of_addition: value.p_value_of_addition, - p_value_of_removal: value.p_value_of_removal, - distance_contribution: value.distance_contribution, - base_model_average_distance_contribution: value.base_model_average_distance_contribution, - combined_model_average_distance_contribution: value.combined_model_average_distance_contribution, - }; -} diff --git a/src/types/models/ReactIntoFeaturesActionOutput.ts b/src/types/models/ReactIntoFeaturesActionOutput.ts deleted file mode 100644 index b12b1f0..0000000 --- a/src/types/models/ReactIntoFeaturesActionOutput.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactIntoFeaturesResponse } from "./ReactIntoFeaturesResponse"; -import { ReactIntoFeaturesResponseFromJSON, ReactIntoFeaturesResponseToJSON } from "./ReactIntoFeaturesResponse"; - -/** - * - * @export - * @interface ReactIntoFeaturesActionOutput - */ -export interface ReactIntoFeaturesActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof ReactIntoFeaturesActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof ReactIntoFeaturesActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof ReactIntoFeaturesActionOutput - */ - operation_type: string; - /** - * - * @type {ReactIntoFeaturesResponse} - * @memberof ReactIntoFeaturesActionOutput - */ - output?: ReactIntoFeaturesResponse | null; -} - -/** - * Check if a given object implements the ReactIntoFeaturesActionOutput interface. - */ -export function instanceOfReactIntoFeaturesActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function ReactIntoFeaturesActionOutputFromJSON(json: any): ReactIntoFeaturesActionOutput { - return ReactIntoFeaturesActionOutputFromJSONTyped(json, false); -} - -export function ReactIntoFeaturesActionOutputFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactIntoFeaturesActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : ReactIntoFeaturesResponseFromJSON(json["output"]), - }; -} - -export function ReactIntoFeaturesActionOutputToJSON(value?: ReactIntoFeaturesActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: ReactIntoFeaturesResponseToJSON(value.output), - }; -} diff --git a/src/types/models/ReactIntoFeaturesRequest.ts b/src/types/models/ReactIntoFeaturesRequest.ts deleted file mode 100644 index 40923aa..0000000 --- a/src/types/models/ReactIntoFeaturesRequest.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Request body for react into features. - * @export - * @interface ReactIntoFeaturesRequest - */ -export interface ReactIntoFeaturesRequest { - /** - * The features to use when calculating convictions. - * @type {Array} - * @memberof ReactIntoFeaturesRequest - */ - features?: Array; - /** - * The name of the feature to store conviction of addition values. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - familiarity_conviction_addition?: string; - /** - * The name of the feature to store conviction of removal values. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - familiarity_conviction_removal?: string; - /** - * The name of the feature to store influence weight entropy values. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - influence_weight_entropy?: string; - /** - * The name of the feature to store p value of addition values. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - p_value_of_addition?: string; - /** - * The name of the feature to store p value of removal values. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - p_value_of_removal?: string; - /** - * The name of the feature to store distance contribution ratios for each case. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - distance_contribution?: string; - /** - * The name of the feature to store similarity conviction values for each case. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - similarity_conviction?: string; - /** - * If set to True will scale influence weights by each case's `weight_feature` weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof ReactIntoFeaturesRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally managed case weight. - * @type {string} - * @memberof ReactIntoFeaturesRequest - */ - weight_feature?: string; -} - -/** - * Check if a given object implements the ReactIntoFeaturesRequest interface. - */ -export function instanceOfReactIntoFeaturesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactIntoFeaturesRequestFromJSON(json: any): ReactIntoFeaturesRequest { - return ReactIntoFeaturesRequestFromJSONTyped(json, false); -} - -export function ReactIntoFeaturesRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactIntoFeaturesRequest { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - familiarity_conviction_addition: !exists(json, "familiarity_conviction_addition") - ? undefined - : json["familiarity_conviction_addition"], - familiarity_conviction_removal: !exists(json, "familiarity_conviction_removal") - ? undefined - : json["familiarity_conviction_removal"], - influence_weight_entropy: !exists(json, "influence_weight_entropy") ? undefined : json["influence_weight_entropy"], - p_value_of_addition: !exists(json, "p_value_of_addition") ? undefined : json["p_value_of_addition"], - p_value_of_removal: !exists(json, "p_value_of_removal") ? undefined : json["p_value_of_removal"], - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - similarity_conviction: !exists(json, "similarity_conviction") ? undefined : json["similarity_conviction"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function ReactIntoFeaturesRequestToJSON(value?: ReactIntoFeaturesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - familiarity_conviction_addition: value.familiarity_conviction_addition, - familiarity_conviction_removal: value.familiarity_conviction_removal, - influence_weight_entropy: value.influence_weight_entropy, - p_value_of_addition: value.p_value_of_addition, - p_value_of_removal: value.p_value_of_removal, - distance_contribution: value.distance_contribution, - similarity_conviction: value.similarity_conviction, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/ReactIntoFeaturesResponse.ts b/src/types/models/ReactIntoFeaturesResponse.ts deleted file mode 100644 index 2ad1dec..0000000 --- a/src/types/models/ReactIntoFeaturesResponse.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * - * @export - * @interface ReactIntoFeaturesResponse - */ -export interface ReactIntoFeaturesResponse { - /** - * - * @type {Array} - * @memberof ReactIntoFeaturesResponse - */ - warnings?: Array; -} - -/** - * Check if a given object implements the ReactIntoFeaturesResponse interface. - */ -export function instanceOfReactIntoFeaturesResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactIntoFeaturesResponseFromJSON(json: any): ReactIntoFeaturesResponse { - return ReactIntoFeaturesResponseFromJSONTyped(json, false); -} - -export function ReactIntoFeaturesResponseFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactIntoFeaturesResponse { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - }; -} - -export function ReactIntoFeaturesResponseToJSON(value?: ReactIntoFeaturesResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - }; -} diff --git a/src/types/models/ReactRequest.ts b/src/types/models/ReactRequest.ts deleted file mode 100644 index 00d929a..0000000 --- a/src/types/models/ReactRequest.ts +++ /dev/null @@ -1,295 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { FeatureBounds } from "./FeatureBounds"; -import { FeatureBoundsFromJSON, FeatureBoundsToJSON } from "./FeatureBounds"; -import type { ReactDetails } from "./ReactDetails"; -import { ReactDetailsFromJSON, ReactDetailsToJSON } from "./ReactDetails"; - -/** - * - * @export - * @interface ReactRequest - */ -export interface ReactRequest { - /** - * A 2D array of context values. - * @type {Array>} - * @memberof ReactRequest - */ - contexts?: Array>; - /** - * One or more values for action features, if specified will only return the specified explanation - * details for the given actions. - * @type {Array>} - * @memberof ReactRequest - */ - actions?: Array>; - /** - * If set to true, assumes provided categorical (nominal or ordinal) feature values have already been substituted. - * @type {boolean} - * @memberof ReactRequest - */ - input_is_substituted?: boolean; - /** - * Only applicable if a substitution value map has been set. If set to false, will not substitute categorical feature values. - * @type {boolean} - * @memberof ReactRequest - */ - substitute_output?: boolean; - /** - * - * @type {ReactDetails} - * @memberof ReactRequest - */ - details?: ReactDetails; - /** - * The context features to use for this reaction. - * @type {Array} - * @memberof ReactRequest - */ - context_features?: Array; - /** - * The action features to use for this reaction. - * @type {Array} - * @memberof ReactRequest - */ - action_features?: Array; - /** - * A list of feature names whose values should be computed from the provided context in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof ReactRequest - */ - derived_context_features?: Array; - /** - * A list of feature names whose values should be computed after reaction from the resulting case prior to output, in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof ReactRequest - */ - derived_action_features?: Array; - /** - * If specified will execute a generative react. If not specified will executed a discriminative react. Conviction is the ratio of expected surprisal to generated surprisal for each feature generated, values are in the range of (0,infinity]. - * @type {number} - * @memberof ReactRequest - */ - desired_conviction?: number; - /** - * For generative reacts only. If true, excludes features which have a subtype in their feature attributes from the uniqueness check performed when generate_new_cases is "always". - * @type {boolean} - * @memberof ReactRequest - */ - exclude_novel_nominals_from_uniqueness_check?: boolean; - /** - * For generative reacts only. If false uses model feature residuals, if true recalculates regional model residuals. - * @type {boolean} - * @memberof ReactRequest - */ - use_regional_model_residuals?: boolean; - /** - * For generative reacts only. - * @type {{ [key: string]: FeatureBounds; }} - * @memberof ReactRequest - */ - feature_bounds_map?: { [key: string]: FeatureBounds }; - /** - * Control whether generated cases can be those that already exist in the model. This parameter takes in a string that could be one of the following: - * a. "attempt": attempts to generate new cases and if its not possible to generate a new case, it might generate cases in "no" mode (see point c.) - * b. "always": always generates new cases and if its not possible to generate a new case, it returns nulls. - * c. "no": generates data based on the `desired_conviction` specified and the generated data is not guaranteed to be a new case (that is, a case not found in original dataset.) - * @type {string} - * @memberof ReactRequest - */ - generate_new_cases?: ReactRequestGenerateNewCasesEnum; - /** - * List of features that will preserve their values from the case specified by `case_indices`, appending and overwriting the specified contexts as necessary. For generative reacts, if `case_indices` isn't specified will preserve feature values of a random case. - * @type {Array} - * @memberof ReactRequest - */ - preserve_feature_values?: Array; - /** - * The privacy distance criteria for generated new cases. - * @type {string} - * @memberof ReactRequest - */ - new_case_threshold?: ReactRequestNewCaseThresholdEnum; - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was trained into the session. If this case does not exist, discriminative react outputs null, generative react ignores it. - * @type {Array>} - * @memberof ReactRequest - */ - case_indices?: Array>; - /** - * If set to True and specified along with case_indices, each individual react will respectively ignore the corresponding case specified by case_indices by leaving it out. - * @type {boolean} - * @memberof ReactRequest - */ - leave_case_out?: boolean; - /** - * For generative reacts only. Features will be generated in the same order as provided in the 'action_features' parameter. - * @type {boolean} - * @memberof ReactRequest - */ - ordered_by_specified_features?: boolean; - /** - * If set to True will scale influence weights by each case's weight_feature weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof ReactRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof ReactRequest - */ - weight_feature?: string; - /** - * When true, will allow return of null values if there are nulls in the local model for the action features. - * (Only applicable to discriminative reacts) - * @type {boolean} - * @memberof ReactRequest - */ - allow_nulls?: boolean; - /** - * For generative reacts only. The number of cases to generate, default 1. - * @type {number} - * @memberof ReactRequest - */ - num_cases_to_generate?: number; - /** - * The name of a series store. If specified, will store an internal record of all react contexts for this session and series to be used later with train series. - * @type {string} - * @memberof ReactRequest - */ - into_series_store?: string; - /** - * Process the request using the asynchronous Request-Reply flow. Otherwise processes request normally. - * @type {boolean} - * @memberof ReactRequest - */ - run_async?: boolean; - /** - * The list of feature names whose values will be made available during the execution of post_process feature attributes. - * @type {Array} - * @memberof ReactRequest - */ - post_process_features?: Array; - /** - * A 2D array of values corresponding to post_process_features that will be made available during the execution of post_process feature attributes. - * @type {Array>} - * @memberof ReactRequest - */ - post_process_values?: Array>; -} - -/** - * @export - * @enum {string} - */ -export type ReactRequestGenerateNewCasesEnum = "attempt" | "always" | "no"; -/** - * @export - * @enum {string} - */ -export type ReactRequestNewCaseThresholdEnum = "min" | "max" | "most_similar"; - -/** - * Check if a given object implements the ReactRequest interface. - */ -export function instanceOfReactRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactRequestFromJSON(json: any): ReactRequest { - return ReactRequestFromJSONTyped(json, false); -} - -export function ReactRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactRequest { - if (json === undefined || json === null) { - return json; - } - return { - contexts: !exists(json, "contexts") ? undefined : json["contexts"], - actions: !exists(json, "actions") ? undefined : json["actions"], - input_is_substituted: !exists(json, "input_is_substituted") ? undefined : json["input_is_substituted"], - substitute_output: !exists(json, "substitute_output") ? undefined : json["substitute_output"], - details: !exists(json, "details") ? undefined : ReactDetailsFromJSON(json["details"]), - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - derived_context_features: !exists(json, "derived_context_features") ? undefined : json["derived_context_features"], - derived_action_features: !exists(json, "derived_action_features") ? undefined : json["derived_action_features"], - desired_conviction: !exists(json, "desired_conviction") ? undefined : json["desired_conviction"], - exclude_novel_nominals_from_uniqueness_check: !exists(json, "exclude_novel_nominals_from_uniqueness_check") - ? undefined - : json["exclude_novel_nominals_from_uniqueness_check"], - use_regional_model_residuals: !exists(json, "use_regional_model_residuals") - ? undefined - : json["use_regional_model_residuals"], - feature_bounds_map: !exists(json, "feature_bounds_map") - ? undefined - : mapValues(json["feature_bounds_map"], FeatureBoundsFromJSON), - generate_new_cases: !exists(json, "generate_new_cases") ? undefined : json["generate_new_cases"], - preserve_feature_values: !exists(json, "preserve_feature_values") ? undefined : json["preserve_feature_values"], - new_case_threshold: !exists(json, "new_case_threshold") ? undefined : json["new_case_threshold"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - leave_case_out: !exists(json, "leave_case_out") ? undefined : json["leave_case_out"], - ordered_by_specified_features: !exists(json, "ordered_by_specified_features") - ? undefined - : json["ordered_by_specified_features"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - allow_nulls: !exists(json, "allow_nulls") ? undefined : json["allow_nulls"], - num_cases_to_generate: !exists(json, "num_cases_to_generate") ? undefined : json["num_cases_to_generate"], - into_series_store: !exists(json, "into_series_store") ? undefined : json["into_series_store"], - run_async: !exists(json, "run_async") ? undefined : json["run_async"], - post_process_features: !exists(json, "post_process_features") ? undefined : json["post_process_features"], - post_process_values: !exists(json, "post_process_values") ? undefined : json["post_process_values"], - }; -} - -export function ReactRequestToJSON(value?: ReactRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - contexts: value.contexts, - actions: value.actions, - input_is_substituted: value.input_is_substituted, - substitute_output: value.substitute_output, - details: ReactDetailsToJSON(value.details), - context_features: value.context_features, - action_features: value.action_features, - derived_context_features: value.derived_context_features, - derived_action_features: value.derived_action_features, - desired_conviction: value.desired_conviction, - exclude_novel_nominals_from_uniqueness_check: value.exclude_novel_nominals_from_uniqueness_check, - use_regional_model_residuals: value.use_regional_model_residuals, - feature_bounds_map: - value.feature_bounds_map === undefined ? undefined : mapValues(value.feature_bounds_map, FeatureBoundsToJSON), - generate_new_cases: value.generate_new_cases, - preserve_feature_values: value.preserve_feature_values, - new_case_threshold: value.new_case_threshold, - case_indices: value.case_indices, - leave_case_out: value.leave_case_out, - ordered_by_specified_features: value.ordered_by_specified_features, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - allow_nulls: value.allow_nulls, - num_cases_to_generate: value.num_cases_to_generate, - into_series_store: value.into_series_store, - run_async: value.run_async, - post_process_features: value.post_process_features, - post_process_values: value.post_process_values, - }; -} diff --git a/src/types/models/ReactResponse.ts b/src/types/models/ReactResponse.ts deleted file mode 100644 index 6054323..0000000 --- a/src/types/models/ReactResponse.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactResponseContent } from "./ReactResponseContent"; -import { ReactResponseContentFromJSON, ReactResponseContentToJSON } from "./ReactResponseContent"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * - * @export - * @interface ReactResponse - */ -export interface ReactResponse { - /** - * - * @type {Array} - * @memberof ReactResponse - */ - warnings?: Array; - /** - * - * @type {ReactResponseContent} - * @memberof ReactResponse - */ - content?: ReactResponseContent; -} - -/** - * Check if a given object implements the ReactResponse interface. - */ -export function instanceOfReactResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactResponseFromJSON(json: any): ReactResponse { - return ReactResponseFromJSONTyped(json, false); -} - -export function ReactResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactResponse { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - content: !exists(json, "content") ? undefined : ReactResponseContentFromJSON(json["content"]), - }; -} - -export function ReactResponseToJSON(value?: ReactResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - content: ReactResponseContentToJSON(value.content), - }; -} diff --git a/src/types/models/ReactResponseContent.ts b/src/types/models/ReactResponseContent.ts deleted file mode 100644 index e3a7f0a..0000000 --- a/src/types/models/ReactResponseContent.ts +++ /dev/null @@ -1,438 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { DerivationParameters } from "./DerivationParameters"; -import { DerivationParametersFromJSON, DerivationParametersToJSON } from "./DerivationParameters"; -import type { DetailsResponseDistanceRatioPartsInner } from "./DetailsResponseDistanceRatioPartsInner"; -import { - DetailsResponseDistanceRatioPartsInnerFromJSON, - DetailsResponseDistanceRatioPartsInnerToJSON, -} from "./DetailsResponseDistanceRatioPartsInner"; -import type { DetailsResponseOutlyingFeatureValuesInnerValue } from "./DetailsResponseOutlyingFeatureValuesInnerValue"; -import { ReactDetailsSelectedPredictionStat } from "./ReactDetails"; - -/** - * - * @export - * @interface ReactResponseContent - */ -export interface ReactResponseContent { - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - boundary_cases?: Array>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactResponseContent - */ - categorical_action_probabilities?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - derivation_parameters?: Array; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactResponseContent - */ - feature_residuals_full?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactResponseContent - */ - feature_residuals_robust?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactResponseContent - */ - prediction_stats?: Array; - /** - * - * @type {Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue; }>} - * @memberof ReactResponseContent - */ - outlying_feature_values?: Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue }>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - influential_cases?: Array>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - most_similar_cases?: Array>; - /** - * Observational errors for all features as defined in feature attributes. - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - observational_errors?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_mda_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_mda_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_mda_ex_post_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_mda_ex_post_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - case_mda_full?: Array>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - case_mda_robust?: Array>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - case_contributions_full?: Array>; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - case_contributions_robust?: Array>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_feature_residuals_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - case_feature_residuals_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - local_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - local_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - global_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactResponseContent - */ - global_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactResponseContent - */ - hypothetical_values?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - distance_ratio?: Array; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - distance_ratio_parts?: Array; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - distance_contribution?: Array; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - similarity_conviction?: Array; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - most_similar_case_indices?: Array>; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - generate_attempts?: Array; - /** - * - * @type {Array>} - * @memberof ReactResponseContent - */ - series_generate_attempts?: Array>; - /** - * - * @type {Array} - * @memberof ReactResponseContent - */ - action_features?: Array | null; - /** - * Action values for each reaction - * @type {Array>} - * @memberof ReactResponseContent - */ - action_values?: Array> | null; -} - -export type ReactResponseContentPredictionStats = Partial< - Record ->; - -/** - * Check if a given object implements the ReactResponseContent interface. - */ -export function instanceOfReactResponseContent(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactResponseContentFromJSON(json: any): ReactResponseContent { - return ReactResponseContentFromJSONTyped(json, false); -} - -export function ReactResponseContentFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactResponseContent { - if (json === undefined || json === null) { - return json; - } - return { - boundary_cases: !exists(json, "boundary_cases") ? undefined : json["boundary_cases"], - categorical_action_probabilities: !exists(json, "categorical_action_probabilities") - ? undefined - : json["categorical_action_probabilities"], - derivation_parameters: !exists(json, "derivation_parameters") - ? undefined - : (json["derivation_parameters"] as Array).map(DerivationParametersFromJSON), - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - prediction_stats: !exists(json, "prediction_stats") ? undefined : json["prediction_stats"], - outlying_feature_values: !exists(json, "outlying_feature_values") ? undefined : json["outlying_feature_values"], - influential_cases: !exists(json, "influential_cases") ? undefined : json["influential_cases"], - most_similar_cases: !exists(json, "most_similar_cases") ? undefined : json["most_similar_cases"], - observational_errors: !exists(json, "observational_errors") ? undefined : json["observational_errors"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_ex_post_full: !exists(json, "feature_mda_ex_post_full") ? undefined : json["feature_mda_ex_post_full"], - feature_mda_ex_post_robust: !exists(json, "feature_mda_ex_post_robust") - ? undefined - : json["feature_mda_ex_post_robust"], - directional_feature_contributions_full: !exists(json, "directional_feature_contributions_full") - ? undefined - : json["directional_feature_contributions_full"], - directional_feature_contributions_robust: !exists(json, "directional_feature_contributions_robust") - ? undefined - : json["directional_feature_contributions_robust"], - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - case_directional_feature_contributions_full: !exists(json, "case_directional_feature_contributions_full") - ? undefined - : json["case_directional_feature_contributions_full"], - case_directional_feature_contributions_robust: !exists(json, "case_directional_feature_contributions_robust") - ? undefined - : json["case_directional_feature_contributions_robust"], - case_feature_contributions_full: !exists(json, "case_feature_contributions_full") - ? undefined - : json["case_feature_contributions_full"], - case_feature_contributions_robust: !exists(json, "case_feature_contributions_robust") - ? undefined - : json["case_feature_contributions_robust"], - case_mda_full: !exists(json, "case_mda_full") ? undefined : json["case_mda_full"], - case_mda_robust: !exists(json, "case_mda_robust") ? undefined : json["case_mda_robust"], - case_contributions_full: !exists(json, "case_contributions_full") ? undefined : json["case_contributions_full"], - case_contributions_robust: !exists(json, "case_contributions_robust") - ? undefined - : json["case_contributions_robust"], - case_feature_residuals_full: !exists(json, "case_feature_residuals_full") - ? undefined - : json["case_feature_residuals_full"], - case_feature_residuals_robust: !exists(json, "case_feature_residuals_robust") - ? undefined - : json["case_feature_residuals_robust"], - local_case_feature_residual_convictions_full: !exists(json, "local_case_feature_residual_convictions_full") - ? undefined - : json["local_case_feature_residual_convictions_full"], - local_case_feature_residual_convictions_robust: !exists(json, "local_case_feature_residual_convictions_robust") - ? undefined - : json["local_case_feature_residual_convictions_robust"], - global_case_feature_residual_convictions_full: !exists(json, "global_case_feature_residual_convictions_full") - ? undefined - : json["global_case_feature_residual_convictions_full"], - global_case_feature_residual_convictions_robust: !exists(json, "global_case_feature_residual_convictions_robust") - ? undefined - : json["global_case_feature_residual_convictions_robust"], - hypothetical_values: !exists(json, "hypothetical_values") ? undefined : json["hypothetical_values"], - distance_ratio: !exists(json, "distance_ratio") ? undefined : json["distance_ratio"], - distance_ratio_parts: !exists(json, "distance_ratio_parts") - ? undefined - : (json["distance_ratio_parts"] as Array).map(DetailsResponseDistanceRatioPartsInnerFromJSON), - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - similarity_conviction: !exists(json, "similarity_conviction") ? undefined : json["similarity_conviction"], - most_similar_case_indices: !exists(json, "most_similar_case_indices") - ? undefined - : json["most_similar_case_indices"], - generate_attempts: !exists(json, "generate_attempts") ? undefined : json["generate_attempts"], - series_generate_attempts: !exists(json, "series_generate_attempts") ? undefined : json["series_generate_attempts"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - action_values: !exists(json, "action_values") ? undefined : json["action_values"], - }; -} - -export function ReactResponseContentToJSON(value?: ReactResponseContent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - boundary_cases: value.boundary_cases, - categorical_action_probabilities: value.categorical_action_probabilities, - derivation_parameters: - value.derivation_parameters === undefined - ? undefined - : (value.derivation_parameters as Array).map(DerivationParametersToJSON), - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - prediction_stats: value.prediction_stats, - outlying_feature_values: value.outlying_feature_values, - influential_cases: value.influential_cases, - most_similar_cases: value.most_similar_cases, - observational_errors: value.observational_errors, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_ex_post_full: value.feature_mda_ex_post_full, - feature_mda_ex_post_robust: value.feature_mda_ex_post_robust, - directional_feature_contributions_full: value.directional_feature_contributions_full, - directional_feature_contributions_robust: value.directional_feature_contributions_robust, - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - case_directional_feature_contributions_full: value.case_directional_feature_contributions_full, - case_directional_feature_contributions_robust: value.case_directional_feature_contributions_robust, - case_feature_contributions_full: value.case_feature_contributions_full, - case_feature_contributions_robust: value.case_feature_contributions_robust, - case_mda_full: value.case_mda_full, - case_mda_robust: value.case_mda_robust, - case_contributions_full: value.case_contributions_full, - case_contributions_robust: value.case_contributions_robust, - case_feature_residuals_full: value.case_feature_residuals_full, - case_feature_residuals_robust: value.case_feature_residuals_robust, - local_case_feature_residual_convictions_full: value.local_case_feature_residual_convictions_full, - local_case_feature_residual_convictions_robust: value.local_case_feature_residual_convictions_robust, - global_case_feature_residual_convictions_full: value.global_case_feature_residual_convictions_full, - global_case_feature_residual_convictions_robust: value.global_case_feature_residual_convictions_robust, - hypothetical_values: value.hypothetical_values, - distance_ratio: value.distance_ratio, - distance_ratio_parts: - value.distance_ratio_parts === undefined - ? undefined - : (value.distance_ratio_parts as Array).map(DetailsResponseDistanceRatioPartsInnerToJSON), - distance_contribution: value.distance_contribution, - similarity_conviction: value.similarity_conviction, - most_similar_case_indices: value.most_similar_case_indices, - generate_attempts: value.generate_attempts, - series_generate_attempts: value.series_generate_attempts, - action_features: value.action_features, - action_values: value.action_values, - }; -} diff --git a/src/types/models/ReactSeriesActionOutput.ts b/src/types/models/ReactSeriesActionOutput.ts deleted file mode 100644 index e4b4fda..0000000 --- a/src/types/models/ReactSeriesActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactSeriesResponse } from "./ReactSeriesResponse"; -import { ReactSeriesResponseFromJSON, ReactSeriesResponseToJSON } from "./ReactSeriesResponse"; - -/** - * - * @export - * @interface ReactSeriesActionOutput - */ -export interface ReactSeriesActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof ReactSeriesActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof ReactSeriesActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof ReactSeriesActionOutput - */ - operation_type: string; - /** - * - * @type {ReactSeriesResponse} - * @memberof ReactSeriesActionOutput - */ - output?: ReactSeriesResponse | null; -} - -/** - * Check if a given object implements the ReactSeriesActionOutput interface. - */ -export function instanceOfReactSeriesActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function ReactSeriesActionOutputFromJSON(json: any): ReactSeriesActionOutput { - return ReactSeriesActionOutputFromJSONTyped(json, false); -} - -export function ReactSeriesActionOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactSeriesActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : ReactSeriesResponseFromJSON(json["output"]), - }; -} - -export function ReactSeriesActionOutputToJSON(value?: ReactSeriesActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: ReactSeriesResponseToJSON(value.output), - }; -} diff --git a/src/types/models/ReactSeriesRequest.ts b/src/types/models/ReactSeriesRequest.ts deleted file mode 100644 index 95ecadb..0000000 --- a/src/types/models/ReactSeriesRequest.ts +++ /dev/null @@ -1,366 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { FeatureBounds } from "./FeatureBounds"; -import { FeatureBoundsFromJSON, FeatureBoundsToJSON } from "./FeatureBounds"; -import type { ReactDetails } from "./ReactDetails"; -import { ReactDetailsFromJSON, ReactDetailsToJSON } from "./ReactDetails"; - -/** - * - * @export - * @interface ReactSeriesRequest - */ -export interface ReactSeriesRequest { - /** - * A 2D array of context values. - * @type {Array>} - * @memberof ReactSeriesRequest - */ - contexts?: Array>; - /** - * One or more values for action features, if specified will only return the specified explanation - * details for the given actions. - * @type {Array>} - * @memberof ReactSeriesRequest - */ - actions?: Array>; - /** - * If set to true, assumes provided categorical (nominal or ordinal) feature values have already been substituted. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - input_is_substituted?: boolean; - /** - * Only applicable if a substitution value map has been set. If set to false, will not substitute categorical feature values. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - substitute_output?: boolean; - /** - * - * @type {ReactDetails} - * @memberof ReactSeriesRequest - */ - details?: ReactDetails; - /** - * The context features to use for this reaction. - * @type {Array} - * @memberof ReactSeriesRequest - */ - context_features?: Array; - /** - * The action features to use for this reaction. - * @type {Array} - * @memberof ReactSeriesRequest - */ - action_features?: Array; - /** - * A list of feature names whose values should be computed from the provided context in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof ReactSeriesRequest - */ - derived_context_features?: Array; - /** - * A list of feature names whose values should be computed after reaction from the resulting case prior to output, in the specified order. - * - * Note: Relies on the features' "derived_feature_code" attribute to compute the values. If "derived_feature_code" - * attribute is undefined or references non-0 feature indices, the derived value will be null. - * @type {Array} - * @memberof ReactSeriesRequest - */ - derived_action_features?: Array; - /** - * If specified will execute a generative react. If not specified will executed a discriminative react. Conviction is the ratio of expected surprisal to generated surprisal for each feature generated, values are in the range of (0,infinity]. - * @type {number} - * @memberof ReactSeriesRequest - */ - desired_conviction?: number; - /** - * For generative reacts only. If true, excludes features which have a subtype in their feature attributes from the uniqueness check performed when generate_new_cases is "always". - * @type {boolean} - * @memberof ReactSeriesRequest - */ - exclude_novel_nominals_from_uniqueness_check?: boolean; - /** - * For generative reacts only. If false uses model feature residuals, if true recalculates regional model residuals. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - use_regional_model_residuals?: boolean; - /** - * For generative reacts only. - * @type {{ [key: string]: FeatureBounds; }} - * @memberof ReactSeriesRequest - */ - feature_bounds_map?: { [key: string]: FeatureBounds }; - /** - * Control whether generated cases can be those that already exist in the model. This parameter takes in a string that could be one of the following: - * a. "attempt": attempts to generate new cases and if its not possible to generate a new case, it might generate cases in "no" mode (see point c.) - * b. "always": always generates new cases and if its not possible to generate a new case, it returns nulls. - * c. "no": generates data based on the `desired_conviction` specified and the generated data is not guaranteed to be a new case (that is, a case not found in original dataset.) - * @type {string} - * @memberof ReactSeriesRequest - */ - generate_new_cases?: ReactSeriesRequestGenerateNewCasesEnum; - /** - * List of features that will preserve their values from the case specified by `case_indices`, appending and overwriting the specified contexts as necessary. For generative reacts, if `case_indices` isn't specified will preserve feature values of a random case. - * @type {Array} - * @memberof ReactSeriesRequest - */ - preserve_feature_values?: Array; - /** - * The privacy distance criteria for generated new cases. - * @type {string} - * @memberof ReactSeriesRequest - */ - new_case_threshold?: ReactSeriesRequestNewCaseThresholdEnum; - /** - * List of tuples, of session id and index, where index is the original 0-based index of the case as it was trained into the session. If this case does not exist, discriminative react outputs null, generative react ignores it. - * @type {Array>} - * @memberof ReactSeriesRequest - */ - case_indices?: Array>; - /** - * If set to True and specified along with case_indices, each individual react will respectively ignore the corresponding case specified by case_indices by leaving it out. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - leave_case_out?: boolean; - /** - * For generative reacts only. Features will be generated in the same order as provided in the 'action_features' parameter. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - ordered_by_specified_features?: boolean; - /** - * If set to True will scale influence weights by each case's weight_feature weight. If unspecified, case weights will be used if the Trainee has them. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof ReactSeriesRequest - */ - weight_feature?: string; - /** - * The number of series to generate. - * @type {number} - * @memberof ReactSeriesRequest - */ - num_series_to_generate?: number; - /** - * When True, series ids are replaced with unique values on output. When False, will maintain or replace ids with existing trained values, but also allows output of series with duplicate existing ids. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - output_new_series_ids?: boolean; - /** - * Controls how closely generated series should follow existing series (plural). Choices are: "fixed" , "dynamic" or "no": - * a. "fixed", tracks the particular relevant series ID. - * b. "dynamic", tracks the particular relevant series ID, but is allowed to change the series ID that it tracks based on its current context. - * c. "no", does not track any particular series ID. - * @type {string} - * @memberof ReactSeriesRequest - */ - series_id_tracking?: ReactSeriesRequestSeriesIdTrackingEnum; - /** - * Map of feature name to stop conditions. Stops series when a feature's value meets the specified conditions. When set, must provide either one mapping to apply to all series, or a mapping for each series. - * @type {Array} - * @memberof ReactSeriesRequest - */ - series_stop_maps?: Array; - /** - * The maximum size a series is allowed to be. Default is 3 * model_size. A value of 0 is no limit. If forecasting using 'continue_series', then this value defines the maximum length of the forecast. When set, must provide either one max to apply to all series, or a max for each series. - * @type {Array} - * @memberof ReactSeriesRequest - */ - max_series_lengths?: Array; - /** - * List of features to condition just the first case in a series, overwrites 'context_features' and 'derived_context_features' for that first case. All specified initial features must be in one of: 'context_features', 'action_features', 'derived_context_features' or 'derived_action_features'. - * @type {Array} - * @memberof ReactSeriesRequest - */ - initial_features?: Array; - /** - * A 2d list of values corresponding to the initial_features, used to condition just the first case in each series. When set, must provide either one value to apply to all series, or a value for each series. - * @type {Array>} - * @memberof ReactSeriesRequest - */ - initial_values?: Array>; - /** - * A 3d-list of context values, one for each feature for each row for each series. If specified, 'max_series_lengths' are ignored. - * @type {Array>>} - * @memberof ReactSeriesRequest - */ - series_context_values?: Array>>; - /** - * List of context features corresponding to 'series_context_values', if specified must not overlap with any 'initial_features' or 'context_features'. - * @type {Array} - * @memberof ReactSeriesRequest - */ - series_context_features?: Array; - /** - * The time steps at which to end synthesis. Time-series only. Must provide either one for all series, or exactly one per series. - * @type {Array} - * @memberof ReactSeriesRequest - */ - final_time_steps?: Array; - /** - * The time steps at which to begin synthesis. Time-series only. Must provide either one for all series, or exactly one per series. - * @type {Array} - * @memberof ReactSeriesRequest - */ - init_time_steps?: Array; - /** - * When true will attempt to continue existing series instead of starting new series. If continue_series_values is specified, then that series data will be forecasted. If initial_values provide series IDs, it will continue those explicitly specified IDs, otherwise it will randomly select series to continue. Note: terminated series with terminators cannot be continued and will result in null output. - * @type {boolean} - * @memberof ReactSeriesRequest - */ - continue_series?: boolean; - /** - * The list of feature names corresponding to the values in each row of continue_series_values. This value is ignored if continue_series_values is not specified. - * @type {Array} - * @memberof ReactSeriesRequest - */ - continue_series_features?: Array; - /** - * A 3d list of series data to be forecasted with feature values in the same order defined by continue_series_features. The value of continue_series will be ignored and treated as true if this value is specified. - * @type {Array>>} - * @memberof ReactSeriesRequest - */ - continue_series_values?: Array>>; -} - -/** - * @export - * @enum {string} - */ -export type ReactSeriesRequestGenerateNewCasesEnum = "attempt" | "always" | "no"; -/** - * @export - * @enum {string} - */ -export type ReactSeriesRequestNewCaseThresholdEnum = "min" | "max" | "most_similar"; -/** - * @export - * @enum {string} - */ -export type ReactSeriesRequestSeriesIdTrackingEnum = "fixed" | "dynamic" | "no"; - -/** - * Check if a given object implements the ReactSeriesRequest interface. - */ -export function instanceOfReactSeriesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactSeriesRequestFromJSON(json: any): ReactSeriesRequest { - return ReactSeriesRequestFromJSONTyped(json, false); -} - -export function ReactSeriesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactSeriesRequest { - if (json === undefined || json === null) { - return json; - } - return { - contexts: !exists(json, "contexts") ? undefined : json["contexts"], - actions: !exists(json, "actions") ? undefined : json["actions"], - input_is_substituted: !exists(json, "input_is_substituted") ? undefined : json["input_is_substituted"], - substitute_output: !exists(json, "substitute_output") ? undefined : json["substitute_output"], - details: !exists(json, "details") ? undefined : ReactDetailsFromJSON(json["details"]), - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - derived_context_features: !exists(json, "derived_context_features") ? undefined : json["derived_context_features"], - derived_action_features: !exists(json, "derived_action_features") ? undefined : json["derived_action_features"], - desired_conviction: !exists(json, "desired_conviction") ? undefined : json["desired_conviction"], - exclude_novel_nominals_from_uniqueness_check: !exists(json, "exclude_novel_nominals_from_uniqueness_check") - ? undefined - : json["exclude_novel_nominals_from_uniqueness_check"], - use_regional_model_residuals: !exists(json, "use_regional_model_residuals") - ? undefined - : json["use_regional_model_residuals"], - feature_bounds_map: !exists(json, "feature_bounds_map") - ? undefined - : mapValues(json["feature_bounds_map"], FeatureBoundsFromJSON), - generate_new_cases: !exists(json, "generate_new_cases") ? undefined : json["generate_new_cases"], - preserve_feature_values: !exists(json, "preserve_feature_values") ? undefined : json["preserve_feature_values"], - new_case_threshold: !exists(json, "new_case_threshold") ? undefined : json["new_case_threshold"], - case_indices: !exists(json, "case_indices") ? undefined : json["case_indices"], - leave_case_out: !exists(json, "leave_case_out") ? undefined : json["leave_case_out"], - ordered_by_specified_features: !exists(json, "ordered_by_specified_features") - ? undefined - : json["ordered_by_specified_features"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - num_series_to_generate: !exists(json, "num_series_to_generate") ? undefined : json["num_series_to_generate"], - output_new_series_ids: !exists(json, "output_new_series_ids") ? undefined : json["output_new_series_ids"], - series_id_tracking: !exists(json, "series_id_tracking") ? undefined : json["series_id_tracking"], - series_stop_maps: !exists(json, "series_stop_maps") ? undefined : json["series_stop_maps"], - max_series_lengths: !exists(json, "max_series_lengths") ? undefined : json["max_series_lengths"], - initial_features: !exists(json, "initial_features") ? undefined : json["initial_features"], - initial_values: !exists(json, "initial_values") ? undefined : json["initial_values"], - series_context_values: !exists(json, "series_context_values") ? undefined : json["series_context_values"], - series_context_features: !exists(json, "series_context_features") ? undefined : json["series_context_features"], - final_time_steps: !exists(json, "final_time_steps") ? undefined : json["final_time_steps"], - init_time_steps: !exists(json, "init_time_steps") ? undefined : json["init_time_steps"], - continue_series: !exists(json, "continue_series") ? undefined : json["continue_series"], - continue_series_features: !exists(json, "continue_series_features") ? undefined : json["continue_series_features"], - continue_series_values: !exists(json, "continue_series_values") ? undefined : json["continue_series_values"], - }; -} - -export function ReactSeriesRequestToJSON(value?: ReactSeriesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - contexts: value.contexts, - actions: value.actions, - input_is_substituted: value.input_is_substituted, - substitute_output: value.substitute_output, - details: ReactDetailsToJSON(value.details), - context_features: value.context_features, - action_features: value.action_features, - derived_context_features: value.derived_context_features, - derived_action_features: value.derived_action_features, - desired_conviction: value.desired_conviction, - exclude_novel_nominals_from_uniqueness_check: value.exclude_novel_nominals_from_uniqueness_check, - use_regional_model_residuals: value.use_regional_model_residuals, - feature_bounds_map: - value.feature_bounds_map === undefined ? undefined : mapValues(value.feature_bounds_map, FeatureBoundsToJSON), - generate_new_cases: value.generate_new_cases, - preserve_feature_values: value.preserve_feature_values, - new_case_threshold: value.new_case_threshold, - case_indices: value.case_indices, - leave_case_out: value.leave_case_out, - ordered_by_specified_features: value.ordered_by_specified_features, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - num_series_to_generate: value.num_series_to_generate, - output_new_series_ids: value.output_new_series_ids, - series_id_tracking: value.series_id_tracking, - series_stop_maps: value.series_stop_maps, - max_series_lengths: value.max_series_lengths, - initial_features: value.initial_features, - initial_values: value.initial_values, - series_context_values: value.series_context_values, - series_context_features: value.series_context_features, - final_time_steps: value.final_time_steps, - init_time_steps: value.init_time_steps, - continue_series: value.continue_series, - continue_series_features: value.continue_series_features, - continue_series_values: value.continue_series_values, - }; -} diff --git a/src/types/models/ReactSeriesResponse.ts b/src/types/models/ReactSeriesResponse.ts deleted file mode 100644 index 23005c4..0000000 --- a/src/types/models/ReactSeriesResponse.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { ReactSeriesResponseContent } from "./ReactSeriesResponseContent"; -import { ReactSeriesResponseContentFromJSON, ReactSeriesResponseContentToJSON } from "./ReactSeriesResponseContent"; -import type { Warning } from "./Warning"; -import { WarningFromJSON, WarningToJSON } from "./Warning"; - -/** - * - * @export - * @interface ReactSeriesResponse - */ -export interface ReactSeriesResponse { - /** - * - * @type {Array} - * @memberof ReactSeriesResponse - */ - warnings?: Array; - /** - * - * @type {ReactSeriesResponseContent} - * @memberof ReactSeriesResponse - */ - content?: ReactSeriesResponseContent; -} - -/** - * Check if a given object implements the ReactSeriesResponse interface. - */ -export function instanceOfReactSeriesResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactSeriesResponseFromJSON(json: any): ReactSeriesResponse { - return ReactSeriesResponseFromJSONTyped(json, false); -} - -export function ReactSeriesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactSeriesResponse { - if (json === undefined || json === null) { - return json; - } - return { - warnings: !exists(json, "warnings") ? undefined : (json["warnings"] as Array).map(WarningFromJSON), - content: !exists(json, "content") ? undefined : ReactSeriesResponseContentFromJSON(json["content"]), - }; -} - -export function ReactSeriesResponseToJSON(value?: ReactSeriesResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - warnings: value.warnings === undefined ? undefined : (value.warnings as Array).map(WarningToJSON), - content: ReactSeriesResponseContentToJSON(value.content), - }; -} diff --git a/src/types/models/ReactSeriesResponseContent.ts b/src/types/models/ReactSeriesResponseContent.ts deleted file mode 100644 index 3662f75..0000000 --- a/src/types/models/ReactSeriesResponseContent.ts +++ /dev/null @@ -1,436 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { DerivationParameters } from "./DerivationParameters"; -import { DerivationParametersFromJSON, DerivationParametersToJSON } from "./DerivationParameters"; -import type { DetailsResponseDistanceRatioPartsInner } from "./DetailsResponseDistanceRatioPartsInner"; -import { - DetailsResponseDistanceRatioPartsInnerFromJSON, - DetailsResponseDistanceRatioPartsInnerToJSON, -} from "./DetailsResponseDistanceRatioPartsInner"; -import type { DetailsResponseOutlyingFeatureValuesInnerValue } from "./DetailsResponseOutlyingFeatureValuesInnerValue"; - -/** - * - * @export - * @interface ReactSeriesResponseContent - */ -export interface ReactSeriesResponseContent { - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - boundary_cases?: Array>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactSeriesResponseContent - */ - categorical_action_probabilities?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - derivation_parameters?: Array; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactSeriesResponseContent - */ - feature_residuals_full?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactSeriesResponseContent - */ - feature_residuals_robust?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactSeriesResponseContent - */ - prediction_stats?: Array<{ [key: string]: any }>; - /** - * - * @type {Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue; }>} - * @memberof ReactSeriesResponseContent - */ - outlying_feature_values?: Array<{ [key: string]: DetailsResponseOutlyingFeatureValuesInnerValue }>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - influential_cases?: Array>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - most_similar_cases?: Array>; - /** - * Observational errors for all features as defined in feature attributes. - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - observational_errors?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_mda_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_mda_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_mda_ex_post_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_mda_ex_post_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_directional_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_directional_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_feature_contributions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_feature_contributions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - case_mda_full?: Array>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - case_mda_robust?: Array>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - case_contributions_full?: Array>; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - case_contributions_robust?: Array>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_feature_residuals_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - case_feature_residuals_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - local_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - local_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - global_case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: number; }>} - * @memberof ReactSeriesResponseContent - */ - global_case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; - /** - * - * @type {Array<{ [key: string]: any; }>} - * @memberof ReactSeriesResponseContent - */ - hypothetical_values?: Array<{ [key: string]: any }>; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - distance_ratio?: Array; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - distance_ratio_parts?: Array; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - distance_contribution?: Array; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - similarity_conviction?: Array; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - most_similar_case_indices?: Array>; - /** - * - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - generate_attempts?: Array; - /** - * - * @type {Array>} - * @memberof ReactSeriesResponseContent - */ - series_generate_attempts?: Array>; - /** - * The list of all action features, specified and derived. - * @type {Array} - * @memberof ReactSeriesResponseContent - */ - action_features?: Array | null; - /** - * List of series, where each series is a 2d list of values (rows of data the series), where the values are in the same order as 'action_features'. - * @type {Array>>} - * @memberof ReactSeriesResponseContent - */ - action_values?: Array>> | null; -} - -/** - * Check if a given object implements the ReactSeriesResponseContent interface. - */ -export function instanceOfReactSeriesResponseContent(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReactSeriesResponseContentFromJSON(json: any): ReactSeriesResponseContent { - return ReactSeriesResponseContentFromJSONTyped(json, false); -} - -export function ReactSeriesResponseContentFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): ReactSeriesResponseContent { - if (json === undefined || json === null) { - return json; - } - return { - boundary_cases: !exists(json, "boundary_cases") ? undefined : json["boundary_cases"], - categorical_action_probabilities: !exists(json, "categorical_action_probabilities") - ? undefined - : json["categorical_action_probabilities"], - derivation_parameters: !exists(json, "derivation_parameters") - ? undefined - : (json["derivation_parameters"] as Array).map(DerivationParametersFromJSON), - feature_residuals_full: !exists(json, "feature_residuals_full") ? undefined : json["feature_residuals_full"], - feature_residuals_robust: !exists(json, "feature_residuals_robust") ? undefined : json["feature_residuals_robust"], - prediction_stats: !exists(json, "prediction_stats") ? undefined : json["prediction_stats"], - outlying_feature_values: !exists(json, "outlying_feature_values") ? undefined : json["outlying_feature_values"], - influential_cases: !exists(json, "influential_cases") ? undefined : json["influential_cases"], - most_similar_cases: !exists(json, "most_similar_cases") ? undefined : json["most_similar_cases"], - observational_errors: !exists(json, "observational_errors") ? undefined : json["observational_errors"], - feature_mda_full: !exists(json, "feature_mda_full") ? undefined : json["feature_mda_full"], - feature_mda_robust: !exists(json, "feature_mda_robust") ? undefined : json["feature_mda_robust"], - feature_mda_ex_post_full: !exists(json, "feature_mda_ex_post_full") ? undefined : json["feature_mda_ex_post_full"], - feature_mda_ex_post_robust: !exists(json, "feature_mda_ex_post_robust") - ? undefined - : json["feature_mda_ex_post_robust"], - directional_feature_contributions_full: !exists(json, "directional_feature_contributions_full") - ? undefined - : json["directional_feature_contributions_full"], - directional_feature_contributions_robust: !exists(json, "directional_feature_contributions_robust") - ? undefined - : json["directional_feature_contributions_robust"], - feature_contributions_full: !exists(json, "feature_contributions_full") - ? undefined - : json["feature_contributions_full"], - feature_contributions_robust: !exists(json, "feature_contributions_robust") - ? undefined - : json["feature_contributions_robust"], - case_directional_feature_contributions_full: !exists(json, "case_directional_feature_contributions_full") - ? undefined - : json["case_directional_feature_contributions_full"], - case_directional_feature_contributions_robust: !exists(json, "case_directional_feature_contributions_robust") - ? undefined - : json["case_directional_feature_contributions_robust"], - case_feature_contributions_full: !exists(json, "case_feature_contributions_full") - ? undefined - : json["case_feature_contributions_full"], - case_feature_contributions_robust: !exists(json, "case_feature_contributions_robust") - ? undefined - : json["case_feature_contributions_robust"], - case_mda_full: !exists(json, "case_mda_full") ? undefined : json["case_mda_full"], - case_mda_robust: !exists(json, "case_mda_robust") ? undefined : json["case_mda_robust"], - case_contributions_full: !exists(json, "case_contributions_full") ? undefined : json["case_contributions_full"], - case_contributions_robust: !exists(json, "case_contributions_robust") - ? undefined - : json["case_contributions_robust"], - case_feature_residuals_full: !exists(json, "case_feature_residuals_full") - ? undefined - : json["case_feature_residuals_full"], - case_feature_residuals_robust: !exists(json, "case_feature_residuals_robust") - ? undefined - : json["case_feature_residuals_robust"], - local_case_feature_residual_convictions_full: !exists(json, "local_case_feature_residual_convictions_full") - ? undefined - : json["local_case_feature_residual_convictions_full"], - local_case_feature_residual_convictions_robust: !exists(json, "local_case_feature_residual_convictions_robust") - ? undefined - : json["local_case_feature_residual_convictions_robust"], - global_case_feature_residual_convictions_full: !exists(json, "global_case_feature_residual_convictions_full") - ? undefined - : json["global_case_feature_residual_convictions_full"], - global_case_feature_residual_convictions_robust: !exists(json, "global_case_feature_residual_convictions_robust") - ? undefined - : json["global_case_feature_residual_convictions_robust"], - hypothetical_values: !exists(json, "hypothetical_values") ? undefined : json["hypothetical_values"], - distance_ratio: !exists(json, "distance_ratio") ? undefined : json["distance_ratio"], - distance_ratio_parts: !exists(json, "distance_ratio_parts") - ? undefined - : (json["distance_ratio_parts"] as Array).map(DetailsResponseDistanceRatioPartsInnerFromJSON), - distance_contribution: !exists(json, "distance_contribution") ? undefined : json["distance_contribution"], - similarity_conviction: !exists(json, "similarity_conviction") ? undefined : json["similarity_conviction"], - most_similar_case_indices: !exists(json, "most_similar_case_indices") - ? undefined - : json["most_similar_case_indices"], - generate_attempts: !exists(json, "generate_attempts") ? undefined : json["generate_attempts"], - series_generate_attempts: !exists(json, "series_generate_attempts") ? undefined : json["series_generate_attempts"], - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - action_values: !exists(json, "action_values") ? undefined : json["action_values"], - }; -} - -export function ReactSeriesResponseContentToJSON(value?: ReactSeriesResponseContent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - boundary_cases: value.boundary_cases, - categorical_action_probabilities: value.categorical_action_probabilities, - derivation_parameters: - value.derivation_parameters === undefined - ? undefined - : (value.derivation_parameters as Array).map(DerivationParametersToJSON), - feature_residuals_full: value.feature_residuals_full, - feature_residuals_robust: value.feature_residuals_robust, - prediction_stats: value.prediction_stats, - outlying_feature_values: value.outlying_feature_values, - influential_cases: value.influential_cases, - most_similar_cases: value.most_similar_cases, - observational_errors: value.observational_errors, - feature_mda_full: value.feature_mda_full, - feature_mda_robust: value.feature_mda_robust, - feature_mda_ex_post_full: value.feature_mda_ex_post_full, - feature_mda_ex_post_robust: value.feature_mda_ex_post_robust, - directional_feature_contributions_full: value.directional_feature_contributions_full, - directional_feature_contributions_robust: value.directional_feature_contributions_robust, - feature_contributions_full: value.feature_contributions_full, - feature_contributions_robust: value.feature_contributions_robust, - case_directional_feature_contributions_full: value.case_directional_feature_contributions_full, - case_directional_feature_contributions_robust: value.case_directional_feature_contributions_robust, - case_feature_contributions_full: value.case_feature_contributions_full, - case_feature_contributions_robust: value.case_feature_contributions_robust, - case_mda_full: value.case_mda_full, - case_mda_robust: value.case_mda_robust, - case_contributions_full: value.case_contributions_full, - case_contributions_robust: value.case_contributions_robust, - case_feature_residuals_full: value.case_feature_residuals_full, - case_feature_residuals_robust: value.case_feature_residuals_robust, - local_case_feature_residual_convictions_full: value.local_case_feature_residual_convictions_full, - local_case_feature_residual_convictions_robust: value.local_case_feature_residual_convictions_robust, - global_case_feature_residual_convictions_full: value.global_case_feature_residual_convictions_full, - global_case_feature_residual_convictions_robust: value.global_case_feature_residual_convictions_robust, - hypothetical_values: value.hypothetical_values, - distance_ratio: value.distance_ratio, - distance_ratio_parts: - value.distance_ratio_parts === undefined - ? undefined - : (value.distance_ratio_parts as Array).map(DetailsResponseDistanceRatioPartsInnerToJSON), - distance_contribution: value.distance_contribution, - similarity_conviction: value.similarity_conviction, - most_similar_case_indices: value.most_similar_case_indices, - generate_attempts: value.generate_attempts, - series_generate_attempts: value.series_generate_attempts, - action_features: value.action_features, - action_values: value.action_values, - }; -} diff --git a/src/types/models/ReduceDataParams.ts b/src/types/models/ReduceDataParams.ts deleted file mode 100644 index 51bcddb..0000000 --- a/src/types/models/ReduceDataParams.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface ReduceDataParams - */ -export interface ReduceDataParams { - /** - * A list of context features to use when determining which cases to remove. - * @type {Array} - * @memberof ReduceDataParams - */ - features?: Array; - /** - * The name of the weight feature used when performing data reduction. - * @type {string} - * @memberof ReduceDataParams - */ - distribute_weight_feature?: string; - /** - * The quantile to use when deciding which cases to remove. Cases above this quantile will be removed. - * @type {number} - * @memberof ReduceDataParams - */ - influence_weight_entropy_threshold?: number; - /** - * Whether to skip auto-analyzing as cases are removed. - * @type {boolean} - * @memberof ReduceDataParams - */ - skip_auto_analyze?: boolean; -} - -/** - * Check if a given object implements the ReduceDataParams interface. - */ -export function instanceOfReduceDataParams(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function ReduceDataParamsFromJSON(json: any): ReduceDataParams { - return ReduceDataParamsFromJSONTyped(json, false); -} - -export function ReduceDataParamsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReduceDataParams { - if (json === undefined || json === null) { - return json; - } - return { - features: !exists(json, "features") ? undefined : json["features"], - distribute_weight_feature: !exists(json, "distribute_weight_feature") - ? undefined - : json["distribute_weight_feature"], - influence_weight_entropy_threshold: !exists(json, "influence_weight_entropy_threshold") - ? undefined - : json["influence_weight_entropy_threshold"], - skip_auto_analyze: !exists(json, "skip_auto_analyze") ? undefined : json["skip_auto_analyze"], - }; -} - -export function ReduceDataParamsToJSON(value?: ReduceDataParams | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - features: value.features, - distribute_weight_feature: value.distribute_weight_feature, - influence_weight_entropy_threshold: value.influence_weight_entropy_threshold, - skip_auto_analyze: value.skip_auto_analyze, - }; -} diff --git a/src/types/models/RemoveSeriesStoreRequest.ts b/src/types/models/RemoveSeriesStoreRequest.ts deleted file mode 100644 index 7226bbe..0000000 --- a/src/types/models/RemoveSeriesStoreRequest.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a remove series store request. - * @export - * @interface RemoveSeriesStoreRequest - */ -export interface RemoveSeriesStoreRequest { - /** - * The name of a series to remove. - * @type {string} - * @memberof RemoveSeriesStoreRequest - */ - series?: string | null; -} - -/** - * Check if a given object implements the RemoveSeriesStoreRequest interface. - */ -export function instanceOfRemoveSeriesStoreRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function RemoveSeriesStoreRequestFromJSON(json: any): RemoveSeriesStoreRequest { - return RemoveSeriesStoreRequestFromJSONTyped(json, false); -} - -export function RemoveSeriesStoreRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): RemoveSeriesStoreRequest { - if (json === undefined || json === null) { - return json; - } - return { - series: !exists(json, "series") ? undefined : json["series"], - }; -} - -export function RemoveSeriesStoreRequestToJSON(value?: RemoveSeriesStoreRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - series: value.series, - }; -} diff --git a/src/types/models/Session.ts b/src/types/models/Session.ts deleted file mode 100644 index 6bd4319..0000000 --- a/src/types/models/Session.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { AccountIdentity } from "./AccountIdentity"; -import { AccountIdentityFromJSON, AccountIdentityToJSON } from "./AccountIdentity"; - -/** - * A model session. - * @export - * @interface Session - */ -export interface Session { - /** - * The session's unique identifier. - * @type {string} - * @memberof Session - */ - id?: string; - /** - * The name given to the session. - * @type {string} - * @memberof Session - */ - name?: string; - /** - * - * @type {AccountIdentity} - * @memberof Session - */ - user?: AccountIdentity; - /** - * Any key-value pair to store custom metadata for the session. - * @type {{ [key: string]: any; }} - * @memberof Session - */ - metadata?: { [key: string]: any }; - /** - * The timestamp of when the session was issued. - * @type {Date} - * @memberof Session - */ - created_date?: Date; - /** - * The timestamp of when the session was modified. - * @type {Date} - * @memberof Session - */ - modified_date?: Date; -} - -/** - * Check if a given object implements the Session interface. - */ -export function instanceOfSession(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function SessionFromJSON(json: any): Session { - return SessionFromJSONTyped(json, false); -} - -export function SessionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Session { - if (json === undefined || json === null) { - return json; - } - return { - id: !exists(json, "id") ? undefined : json["id"], - name: !exists(json, "name") ? undefined : json["name"], - user: !exists(json, "user") ? undefined : AccountIdentityFromJSON(json["user"]), - metadata: !exists(json, "metadata") ? undefined : json["metadata"], - created_date: !exists(json, "created_date") ? undefined : new Date(json["created_date"]), - modified_date: !exists(json, "modified_date") ? undefined : new Date(json["modified_date"]), - }; -} - -export function SessionToJSON(value?: Session | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - id: value.id, - name: value.name, - user: AccountIdentityToJSON(value.user), - metadata: value.metadata, - created_date: value.created_date === undefined ? undefined : value.created_date.toISOString(), - modified_date: value.modified_date === undefined ? undefined : value.modified_date.toISOString(), - }; -} diff --git a/src/types/models/SessionIdentity.ts b/src/types/models/SessionIdentity.ts deleted file mode 100644 index 6b90435..0000000 --- a/src/types/models/SessionIdentity.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * A model session identity. - * @export - * @interface SessionIdentity - */ -export interface SessionIdentity { - /** - * The session's unique identifier. - * @type {string} - * @memberof SessionIdentity - */ - id?: string; - /** - * The name given to the session. - * @type {string} - * @memberof SessionIdentity - */ - name?: string; -} - -/** - * Check if a given object implements the SessionIdentity interface. - */ -export function instanceOfSessionIdentity(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function SessionIdentityFromJSON(json: any): SessionIdentity { - return SessionIdentityFromJSONTyped(json, false); -} - -export function SessionIdentityFromJSONTyped(json: any, ignoreDiscriminator: boolean): SessionIdentity { - if (json === undefined || json === null) { - return json; - } - return { - id: !exists(json, "id") ? undefined : json["id"], - name: !exists(json, "name") ? undefined : json["name"], - }; -} - -export function SessionIdentityToJSON(value?: SessionIdentity | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - id: value.id, - name: value.name, - }; -} diff --git a/src/types/models/SetAutoAnalyzeParamsRequest.ts b/src/types/models/SetAutoAnalyzeParamsRequest.ts deleted file mode 100644 index b565ba2..0000000 --- a/src/types/models/SetAutoAnalyzeParamsRequest.ts +++ /dev/null @@ -1,239 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Parameters specific for /analyze may be also be passed in and will be cached and used during future auto-analysiss. - * @export - * @interface SetAutoAnalyzeParamsRequest - */ -export interface SetAutoAnalyzeParamsRequest { - /** - * A list of action feature names. - * @type {Array} - * @memberof SetAutoAnalyzeParamsRequest - */ - action_features?: Array; - /** - * A list of context feature names. - * @type {Array} - * @memberof SetAutoAnalyzeParamsRequest - */ - context_features?: Array; - /** - * Number of cross validation folds to do. Value of 1 does hold-one-out instead of k-fold. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - k_folds?: number; - /** - * Number of samples used in calculating feature residuals. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - num_samples?: number; - /** - * Optional list of distance transform value hyperparameters to analyze with. - * @type {Array} - * @memberof SetAutoAnalyzeParamsRequest - */ - dt_values?: Array; - /** - * Optional list of k value hyperparameters to analyze with. - * @type {Array} - * @memberof SetAutoAnalyzeParamsRequest - */ - k_values?: Array; - /** - * Optional list of p value hyperparameters to analyze with. - * @type {Array} - * @memberof SetAutoAnalyzeParamsRequest - */ - p_values?: Array; - /** - * If true, bypass hyperparameter analysis. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - bypass_hyperparameter_analysis?: boolean; - /** - * If true, bypass calculation of feature residuals. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - bypass_calculate_feature_residuals?: boolean; - /** - * If true, bypass calculation of feature weights. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - bypass_calculate_feature_weights?: boolean; - /** - * Optional value, defaults to single_targeted - * single_targeted: analyze hyperparameters for the specified action_features - * omni_targeted: analyze hyperparameters for each context feature as an action feature, ignores action_features parameter - * targetless: analyze hyperparameters for all context features as possible action features, ignores action_features parameter - * @type {string} - * @memberof SetAutoAnalyzeParamsRequest - */ - targeted_model?: SetAutoAnalyzeParamsRequestTargetedModelEnum; - /** - * Optional. Number of cases to sample during analysis. Only applies for k_folds = 1. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - num_analysis_samples?: number; - /** - * Optional. Number of samples to use for analysis. The rest will be randomly held-out and not included in calculations. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - analysis_sub_model_size?: number; - /** - * Optional flag, when true uses deviations for LK metric in queries. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - use_deviations?: boolean; - /** - * Compute and use inverse of residuals as feature weights. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - inverse_residuals_as_weights?: boolean; - /** - * Optional. When True, will scale influence weights by each case's `weight_feature` weight. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - use_case_weights?: boolean; - /** - * The name of the feature whose values to use as case weights. When left unspecified, uses the internally - * managed case weight. - * @type {string} - * @memberof SetAutoAnalyzeParamsRequest - */ - weight_feature?: string; - /** - * Additional experimental analyze parameters. - * @type {{ [key: string]: any; }} - * @memberof SetAutoAnalyzeParamsRequest - */ - experimental_options?: { [key: string]: any }; - /** - * When True, the train operation returns when it's time for the model to be analyzed again. - * @type {boolean} - * @memberof SetAutoAnalyzeParamsRequest - */ - auto_analyze_enabled?: boolean; - /** - * The size of of the model at which to stop doing auto-analysis. Value of 0 means no limit. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - auto_analyze_limit_size?: number; - /** - * The factor by which to increase the analyze threshold every time the model grows to the current threshold size. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - analyze_growth_factor?: number; - /** - * The threshold for the number of cases at which the model should be re-analyzed. - * @type {number} - * @memberof SetAutoAnalyzeParamsRequest - */ - analyze_threshold?: number; -} - -/** - * @export - * @enum {string} - */ -export type SetAutoAnalyzeParamsRequestTargetedModelEnum = "single_targeted" | "omni_targeted" | "targetless"; - -/** - * Check if a given object implements the SetAutoAnalyzeParamsRequest interface. - */ -export function instanceOfSetAutoAnalyzeParamsRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function SetAutoAnalyzeParamsRequestFromJSON(json: any): SetAutoAnalyzeParamsRequest { - return SetAutoAnalyzeParamsRequestFromJSONTyped(json, false); -} - -export function SetAutoAnalyzeParamsRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): SetAutoAnalyzeParamsRequest { - if (json === undefined || json === null) { - return json; - } - return { - action_features: !exists(json, "action_features") ? undefined : json["action_features"], - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - k_folds: !exists(json, "k_folds") ? undefined : json["k_folds"], - num_samples: !exists(json, "num_samples") ? undefined : json["num_samples"], - dt_values: !exists(json, "dt_values") ? undefined : json["dt_values"], - k_values: !exists(json, "k_values") ? undefined : json["k_values"], - p_values: !exists(json, "p_values") ? undefined : json["p_values"], - bypass_hyperparameter_analysis: !exists(json, "bypass_hyperparameter_analysis") - ? undefined - : json["bypass_hyperparameter_analysis"], - bypass_calculate_feature_residuals: !exists(json, "bypass_calculate_feature_residuals") - ? undefined - : json["bypass_calculate_feature_residuals"], - bypass_calculate_feature_weights: !exists(json, "bypass_calculate_feature_weights") - ? undefined - : json["bypass_calculate_feature_weights"], - targeted_model: !exists(json, "targeted_model") ? undefined : json["targeted_model"], - num_analysis_samples: !exists(json, "num_analysis_samples") ? undefined : json["num_analysis_samples"], - analysis_sub_model_size: !exists(json, "analysis_sub_model_size") ? undefined : json["analysis_sub_model_size"], - use_deviations: !exists(json, "use_deviations") ? undefined : json["use_deviations"], - inverse_residuals_as_weights: !exists(json, "inverse_residuals_as_weights") - ? undefined - : json["inverse_residuals_as_weights"], - use_case_weights: !exists(json, "use_case_weights") ? undefined : json["use_case_weights"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - experimental_options: !exists(json, "experimental_options") ? undefined : json["experimental_options"], - auto_analyze_enabled: !exists(json, "auto_analyze_enabled") ? undefined : json["auto_analyze_enabled"], - auto_analyze_limit_size: !exists(json, "auto_analyze_limit_size") ? undefined : json["auto_analyze_limit_size"], - analyze_growth_factor: !exists(json, "analyze_growth_factor") ? undefined : json["analyze_growth_factor"], - analyze_threshold: !exists(json, "analyze_threshold") ? undefined : json["analyze_threshold"], - }; -} - -export function SetAutoAnalyzeParamsRequestToJSON(value?: SetAutoAnalyzeParamsRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_features: value.action_features, - context_features: value.context_features, - k_folds: value.k_folds, - num_samples: value.num_samples, - dt_values: value.dt_values, - k_values: value.k_values, - p_values: value.p_values, - bypass_hyperparameter_analysis: value.bypass_hyperparameter_analysis, - bypass_calculate_feature_residuals: value.bypass_calculate_feature_residuals, - bypass_calculate_feature_weights: value.bypass_calculate_feature_weights, - targeted_model: value.targeted_model, - num_analysis_samples: value.num_analysis_samples, - analysis_sub_model_size: value.analysis_sub_model_size, - use_deviations: value.use_deviations, - inverse_residuals_as_weights: value.inverse_residuals_as_weights, - use_case_weights: value.use_case_weights, - weight_feature: value.weight_feature, - experimental_options: value.experimental_options, - auto_analyze_enabled: value.auto_analyze_enabled, - auto_analyze_limit_size: value.auto_analyze_limit_size, - analyze_growth_factor: value.analyze_growth_factor, - analyze_threshold: value.analyze_threshold, - }; -} diff --git a/src/types/models/StringType.ts b/src/types/models/StringType.ts deleted file mode 100644 index ed82bb4..0000000 --- a/src/types/models/StringType.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface StringType - */ -export interface StringType { - /** - * The name of the data type. - * @type {string} - * @memberof StringType - */ - data_type: string; - /** - * The maximum allowed length of the string. - * @type {number} - * @memberof StringType - */ - length?: number | null; - /** - * The string encoding type. - * @type {string} - * @memberof StringType - */ - encoding?: string | null; -} - -/** - * Check if a given object implements the StringType interface. - */ -export function instanceOfStringType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function StringTypeFromJSON(json: any): StringType { - return StringTypeFromJSONTyped(json, false); -} - -export function StringTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): StringType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - length: !exists(json, "length") ? undefined : json["length"], - encoding: !exists(json, "encoding") ? undefined : json["encoding"], - }; -} - -export function StringTypeToJSON(value?: StringType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - length: value.length, - encoding: value.encoding, - }; -} diff --git a/src/types/models/TimeType.ts b/src/types/models/TimeType.ts deleted file mode 100644 index 1b3393e..0000000 --- a/src/types/models/TimeType.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface TimeType - */ -export interface TimeType { - /** - * The name of the data type. - * @type {string} - * @memberof TimeType - */ - data_type: string; - /** - * The standardized timezone name. - * @type {string} - * @memberof TimeType - */ - timezone?: string | null; -} - -/** - * Check if a given object implements the TimeType interface. - */ -export function instanceOfTimeType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function TimeTypeFromJSON(json: any): TimeType { - return TimeTypeFromJSONTyped(json, false); -} - -export function TimeTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TimeType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - timezone: !exists(json, "timezone") ? undefined : json["timezone"], - }; -} - -export function TimeTypeToJSON(value?: TimeType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - timezone: value.timezone, - }; -} diff --git a/src/types/models/TimedeltaType.ts b/src/types/models/TimedeltaType.ts deleted file mode 100644 index e8d670d..0000000 --- a/src/types/models/TimedeltaType.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface TimedeltaType - */ -export interface TimedeltaType { - /** - * The name of the data type. - * @type {string} - * @memberof TimedeltaType - */ - data_type: string; - /** - * The unit of the time delta. - * @type {string} - * @memberof TimedeltaType - */ - unit?: TimedeltaTypeUnitEnum; -} - -/** - * @export - * @enum {string} - */ -export type TimedeltaTypeUnitEnum = "days" | "seconds" | "nanoseconds"; - -/** - * Check if a given object implements the TimedeltaType interface. - */ -export function instanceOfTimedeltaType(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "data_type" in value; - - return isInstance; -} - -export function TimedeltaTypeFromJSON(json: any): TimedeltaType { - return TimedeltaTypeFromJSONTyped(json, false); -} - -export function TimedeltaTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TimedeltaType { - if (json === undefined || json === null) { - return json; - } - return { - data_type: json["data_type"], - unit: !exists(json, "unit") ? undefined : json["unit"], - }; -} - -export function TimedeltaTypeToJSON(value?: TimedeltaType | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - data_type: value.data_type, - unit: value.unit, - }; -} diff --git a/src/types/models/TraceResponse.ts b/src/types/models/TraceResponse.ts deleted file mode 100644 index fa3b007..0000000 --- a/src/types/models/TraceResponse.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Response from persist_trace - * @export - * @interface TraceResponse - */ -export interface TraceResponse { - /** - * - * @type {string} - * @memberof TraceResponse - */ - presigned_url?: string; - /** - * - * @type {string} - * @memberof TraceResponse - */ - expires_at?: string; -} - -/** - * Check if a given object implements the TraceResponse interface. - */ -export function instanceOfTraceResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraceResponseFromJSON(json: any): TraceResponse { - return TraceResponseFromJSONTyped(json, false); -} - -export function TraceResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TraceResponse { - if (json === undefined || json === null) { - return json; - } - return { - presigned_url: !exists(json, "presigned_url") ? undefined : json["presigned_url"], - expires_at: !exists(json, "expires_at") ? undefined : json["expires_at"], - }; -} - -export function TraceResponseToJSON(value?: TraceResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - presigned_url: value.presigned_url, - expires_at: value.expires_at, - }; -} diff --git a/src/types/models/TrainActionOutput.ts b/src/types/models/TrainActionOutput.ts deleted file mode 100644 index c1a9fa0..0000000 --- a/src/types/models/TrainActionOutput.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { TrainResponse } from "./TrainResponse"; -import { TrainResponseFromJSON, TrainResponseToJSON } from "./TrainResponse"; - -/** - * - * @export - * @interface TrainActionOutput - */ -export interface TrainActionOutput { - /** - * The async action's unique identifier. - * @type {string} - * @memberof TrainActionOutput - */ - action_id?: string; - /** - * The status of the action. - * @type {string} - * @memberof TrainActionOutput - */ - status: string; - /** - * The type of operation that is running. - * @type {string} - * @memberof TrainActionOutput - */ - operation_type: string; - /** - * - * @type {TrainResponse} - * @memberof TrainActionOutput - */ - output?: TrainResponse | null; -} - -/** - * Check if a given object implements the TrainActionOutput interface. - */ -export function instanceOfTrainActionOutput(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "operation_type" in value; - - return isInstance; -} - -export function TrainActionOutputFromJSON(json: any): TrainActionOutput { - return TrainActionOutputFromJSONTyped(json, false); -} - -export function TrainActionOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrainActionOutput { - if (json === undefined || json === null) { - return json; - } - return { - action_id: !exists(json, "action_id") ? undefined : json["action_id"], - status: json["status"], - operation_type: json["operation_type"], - output: !exists(json, "output") ? undefined : TrainResponseFromJSON(json["output"]), - }; -} - -export function TrainActionOutputToJSON(value?: TrainActionOutput | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_id: value.action_id, - status: value.status, - operation_type: value.operation_type, - output: TrainResponseToJSON(value.output), - }; -} diff --git a/src/types/models/TrainRequest.ts b/src/types/models/TrainRequest.ts deleted file mode 100644 index ba328b9..0000000 --- a/src/types/models/TrainRequest.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The body of a train request. - * @export - * @interface TrainRequest - */ -export interface TrainRequest { - /** - * One or more cases to train into the model. - * @type {Array>} - * @memberof TrainRequest - */ - cases: Array>; - /** - * List of feature names. Note, features may not begin with one of the following four characters . ^ ! # - * @type {Array} - * @memberof TrainRequest - */ - features?: Array; - /** - * List of feature names for which values should be derived in the specified order. If this list is not provided, features with the "auto_derive_on_train" feature attribute set to True will be auto-derived. If provided an empty list, no features are derived. Any derived_features that are already in the "features" list will not be derived since their values are being explicitly provided. - * @type {Array} - * @memberof TrainRequest - */ - derived_features?: Array; - /** - * If set to true, assumes provided categorical (nominal or ordinal) feature values have already been substituted. - * @type {boolean} - * @memberof TrainRequest - */ - input_is_substituted?: boolean; - /** - * The name of a feature into which to accumulate neighbors' influences as weight for ablated cases. If unspecified, will not accumulate weights. - * @type {string} - * @memberof TrainRequest - */ - accumulate_weight_feature?: string; - /** - * The name of the series to pull features and case values from internal series storage. If specified, trains on all cases that are stored in the internal series store for the specified series. The trained feature set is the combined features from storage and the passed in features. If cases is of length one, the value(s) of this case are appended to all cases in the series. If cases is the same length as the series, the value of each case in cases is applied in order to each of the cases in the series. - * @type {string} - * @memberof TrainRequest - */ - series?: string; - /** - * When true, any auto-analysis will be skipped within the training process and a status of "analyze" will be returned if an analysis is needed. When false, the training process will automatically trigger an analysis if auto-analyze is enabled and the conditions are met. In the case when an analysis was triggered, the "status" of the TrainResponse will be "analyzed". - * @type {boolean} - * @memberof TrainRequest - */ - skip_auto_analyze?: boolean; - /** - * When true, and accumulate_weight_feature is provided, will accumulate all of the cases' neighbor weights instead of training the cases into the model. - * @type {boolean} - * @memberof TrainRequest - */ - train_weights_only?: boolean; - /** - * Process the request using the asynchronous Request-Reply flow. Otherwise processes request normally. - * @type {boolean} - * @memberof TrainRequest - */ - run_async?: boolean; -} - -/** - * Check if a given object implements the TrainRequest interface. - */ -export function instanceOfTrainRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "cases" in value; - - return isInstance; -} - -export function TrainRequestFromJSON(json: any): TrainRequest { - return TrainRequestFromJSONTyped(json, false); -} - -export function TrainRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrainRequest { - if (json === undefined || json === null) { - return json; - } - return { - cases: json["cases"], - features: !exists(json, "features") ? undefined : json["features"], - derived_features: !exists(json, "derived_features") ? undefined : json["derived_features"], - input_is_substituted: !exists(json, "input_is_substituted") ? undefined : json["input_is_substituted"], - accumulate_weight_feature: !exists(json, "accumulate_weight_feature") - ? undefined - : json["accumulate_weight_feature"], - series: !exists(json, "series") ? undefined : json["series"], - skip_auto_analyze: !exists(json, "skip_auto_analyze") ? undefined : json["skip_auto_analyze"], - train_weights_only: !exists(json, "train_weights_only") ? undefined : json["train_weights_only"], - run_async: !exists(json, "run_async") ? undefined : json["run_async"], - }; -} - -export function TrainRequestToJSON(value?: TrainRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - cases: value.cases, - features: value.features, - derived_features: value.derived_features, - input_is_substituted: value.input_is_substituted, - accumulate_weight_feature: value.accumulate_weight_feature, - series: value.series, - skip_auto_analyze: value.skip_auto_analyze, - train_weights_only: value.train_weights_only, - run_async: value.run_async, - }; -} diff --git a/src/types/models/TrainResponse.ts b/src/types/models/TrainResponse.ts deleted file mode 100644 index 90bcbec..0000000 --- a/src/types/models/TrainResponse.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * The result of the train request. - * @export - * @interface TrainResponse - */ -export interface TrainResponse { - /** - * The indices of ablated cases. - * @type {Array} - * @memberof TrainResponse - */ - ablated_indices?: Array; - /** - * The number of cases that were trained. - * @type {number} - * @memberof TrainResponse - */ - num_trained?: number; - /** - * Status message output. Valid status values are: - * null - default output, no status - * "analyze" - if auto analysis is enabled, the model has grown large enough to be analyzed again, - * and 'skip_auto_analyze' was True on the call to `train`. - * "analyzed" - if auto analysis is enabled and there was an analysis that occurred during training. - * @type {string} - * @memberof TrainResponse - */ - status?: string | null; -} - -/** - * Check if a given object implements the TrainResponse interface. - */ -export function instanceOfTrainResponse(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TrainResponseFromJSON(json: any): TrainResponse { - return TrainResponseFromJSONTyped(json, false); -} - -export function TrainResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrainResponse { - if (json === undefined || json === null) { - return json; - } - return { - ablated_indices: !exists(json, "ablated_indices") ? undefined : json["ablated_indices"], - num_trained: !exists(json, "num_trained") ? undefined : json["num_trained"], - status: !exists(json, "status") ? undefined : json["status"], - }; -} - -export function TrainResponseToJSON(value?: TrainResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - ablated_indices: value.ablated_indices, - num_trained: value.num_trained, - status: value.status, - }; -} diff --git a/src/types/models/Trainee.ts b/src/types/models/Trainee.ts deleted file mode 100644 index 20fb71c..0000000 --- a/src/types/models/Trainee.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { FeatureAttributes } from "./FeatureAttributes"; -import { FeatureAttributesFromJSON, FeatureAttributesToJSON } from "./FeatureAttributes"; - -/** - * - * @export - * @interface Trainee - */ -export interface Trainee { - /** - * - * @type {string} - * @memberof Trainee - */ - name?: string | null; - /** - * - * @type {{ [key: string]: FeatureAttributes; }} - * @memberof Trainee - */ - features?: { [key: string]: FeatureAttributes }; - /** - * If allow, the trainee may be manually persisted and will be persisted automatically only when unloaded. If always, the trainee will be automatically persisted whenever it is updated. If never, the trainee will never be persisted and any requests to explicitly persist it will fail. - * @type {string} - * @memberof Trainee - */ - persistence?: TraineePersistenceEnum; - /** - * - * @type {string} - * @memberof Trainee - */ - project_id?: string; - /** - * - * @type {string} - * @memberof Trainee - */ - id: string; - /** - * Metadata for a trainee. User can specify any key-value pair to store custom metadata for a trainee. - * @type {{ [key: string]: any; }} - * @memberof Trainee - */ - metadata?: { [key: string]: any }; -} - -/** - * @export - * @enum {string} - */ -export type TraineePersistenceEnum = "allow" | "always" | "never"; - -/** - * Check if a given object implements the Trainee interface. - */ -export function instanceOfTrainee(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeFromJSON(json: any): Trainee { - return TraineeFromJSONTyped(json, false); -} - -export function TraineeFromJSONTyped(json: any, ignoreDiscriminator: boolean): Trainee { - if (json === undefined || json === null) { - return json; - } - return { - name: !exists(json, "name") ? undefined : json["name"], - features: !exists(json, "features") ? undefined : mapValues(json["features"], FeatureAttributesFromJSON), - persistence: !exists(json, "persistence") ? undefined : json["persistence"], - project_id: !exists(json, "project_id") ? undefined : json["project_id"], - id: !exists(json, "id") ? undefined : json["id"], - metadata: !exists(json, "metadata") ? undefined : json["metadata"], - }; -} - -export function TraineeToJSON(value?: Trainee | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - name: value.name, - features: value.features === undefined ? undefined : mapValues(value.features, FeatureAttributesToJSON), - persistence: value.persistence, - project_id: value.project_id, - id: value.id, - metadata: value.metadata, - }; -} diff --git a/src/types/models/TraineeAcquireResourcesRequest.ts b/src/types/models/TraineeAcquireResourcesRequest.ts deleted file mode 100644 index 5308489..0000000 --- a/src/types/models/TraineeAcquireResourcesRequest.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface TraineeAcquireResourcesRequest - */ -export interface TraineeAcquireResourcesRequest { - /** - * The maximum seconds to wait to acquire resources. - * @type {number} - * @memberof TraineeAcquireResourcesRequest - */ - timeout?: number; -} - -/** - * Check if a given object implements the TraineeAcquireResourcesRequest interface. - */ -export function instanceOfTraineeAcquireResourcesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeAcquireResourcesRequestFromJSON(json: any): TraineeAcquireResourcesRequest { - return TraineeAcquireResourcesRequestFromJSONTyped(json, false); -} - -export function TraineeAcquireResourcesRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): TraineeAcquireResourcesRequest { - if (json === undefined || json === null) { - return json; - } - return { - timeout: !exists(json, "timeout") ? undefined : json["timeout"], - }; -} - -export function TraineeAcquireResourcesRequestToJSON(value?: TraineeAcquireResourcesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - timeout: value.timeout, - }; -} diff --git a/src/types/models/TraineeIdentity.ts b/src/types/models/TraineeIdentity.ts deleted file mode 100644 index cb117cd..0000000 --- a/src/types/models/TraineeIdentity.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { AccountIdentity } from "./AccountIdentity"; -import { AccountIdentityFromJSON, AccountIdentityToJSON } from "./AccountIdentity"; - -/** - * - * @export - * @interface TraineeIdentity - */ -export interface TraineeIdentity { - /** - * The trainee UUID. - * @type {string} - * @memberof TraineeIdentity - */ - id?: string; - /** - * The trainee name. - * @type {string} - * @memberof TraineeIdentity - */ - name?: string; - /** - * - * @type {AccountIdentity} - * @memberof TraineeIdentity - */ - created_by?: AccountIdentity; -} - -/** - * Check if a given object implements the TraineeIdentity interface. - */ -export function instanceOfTraineeIdentity(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeIdentityFromJSON(json: any): TraineeIdentity { - return TraineeIdentityFromJSONTyped(json, false); -} - -export function TraineeIdentityFromJSONTyped(json: any, ignoreDiscriminator: boolean): TraineeIdentity { - if (json === undefined || json === null) { - return json; - } - return { - id: !exists(json, "id") ? undefined : json["id"], - name: !exists(json, "name") ? undefined : json["name"], - created_by: !exists(json, "created_by") ? undefined : AccountIdentityFromJSON(json["created_by"]), - }; -} - -export function TraineeIdentityToJSON(value?: TraineeIdentity | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - id: value.id, - name: value.name, - created_by: AccountIdentityToJSON(value.created_by), - }; -} diff --git a/src/types/models/TraineeInformation.ts b/src/types/models/TraineeInformation.ts deleted file mode 100644 index bc2f391..0000000 --- a/src/types/models/TraineeInformation.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -import type { TraineeVersion } from "./TraineeVersion"; -import { TraineeVersionFromJSON, TraineeVersionToJSON } from "./TraineeVersion"; - -/** - * Information about the trainee configuration. - * @export - * @interface TraineeInformation - */ -export interface TraineeInformation { - /** - * The library type of the trainee. - * "st": trainee uses the single-threaded amalgam library. - * "mt": trainee uses the multi-threaded amalgam library. - * "openmp": trainee uses the open multiprocessing amalgam library. - * @type {string} - * @memberof TraineeInformation - */ - library_type?: TraineeInformationLibraryTypeEnum; - /** - * - * @type {TraineeVersion} - * @memberof TraineeInformation - */ - version?: TraineeVersion; -} - -/** - * @export - * @enum {string} - */ -export type TraineeInformationLibraryTypeEnum = "st" | "mt" | "openmp"; - -/** - * Check if a given object implements the TraineeInformation interface. - */ -export function instanceOfTraineeInformation(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeInformationFromJSON(json: any): TraineeInformation { - return TraineeInformationFromJSONTyped(json, false); -} - -export function TraineeInformationFromJSONTyped(json: any, ignoreDiscriminator: boolean): TraineeInformation { - if (json === undefined || json === null) { - return json; - } - return { - library_type: !exists(json, "library_type") ? undefined : json["library_type"], - version: !exists(json, "version") ? undefined : TraineeVersionFromJSON(json["version"]), - }; -} - -export function TraineeInformationToJSON(value?: TraineeInformation | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - library_type: value.library_type, - version: TraineeVersionToJSON(value.version), - }; -} diff --git a/src/types/models/TraineeRequest.ts b/src/types/models/TraineeRequest.ts deleted file mode 100644 index 9a8b7ea..0000000 --- a/src/types/models/TraineeRequest.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists, mapValues } from "../runtime"; -import type { FeatureAttributes } from "./FeatureAttributes"; -import { FeatureAttributesFromJSON, FeatureAttributesToJSON } from "./FeatureAttributes"; - -/** - * - * @export - * @interface TraineeRequest - */ -export interface TraineeRequest { - /** - * - * @type {string} - * @memberof TraineeRequest - */ - name?: string | null; - /** - * - * @type {{ [key: string]: FeatureAttributes; }} - * @memberof TraineeRequest - */ - features: { [key: string]: FeatureAttributes }; - /** - * If allow, the trainee may be manually persisted and will be persisted automatically only when unloaded. If always, the trainee will be automatically persisted whenever it is updated. If never, the trainee will never be persisted and any requests to explicitly persist it will fail. - * @type {string} - * @memberof TraineeRequest - */ - persistence?: TraineeRequestPersistenceEnum; - /** - * - * @type {string} - * @memberof TraineeRequest - */ - project_id?: string; - /** - * - * @type {string} - * @memberof TraineeRequest - */ - id?: string; - /** - * Metadata for a trainee. User can specify any key-value pair to store custom metadata for a trainee. - * @type {{ [key: string]: any; }} - * @memberof TraineeRequest - */ - metadata?: { [key: string]: any }; -} - -/** - * @export - * @enum {string} - */ -export type TraineeRequestPersistenceEnum = "allow" | "always" | "never"; - -/** - * Check if a given object implements the TraineeRequest interface. - */ -export function instanceOfTraineeRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "features" in value; - - return isInstance; -} - -export function TraineeRequestFromJSON(json: any): TraineeRequest { - return TraineeRequestFromJSONTyped(json, false); -} - -export function TraineeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TraineeRequest { - if (json === undefined || json === null) { - return json; - } - return { - name: !exists(json, "name") ? undefined : json["name"], - features: mapValues(json["features"], FeatureAttributesFromJSON), - persistence: !exists(json, "persistence") ? undefined : json["persistence"], - project_id: !exists(json, "project_id") ? undefined : json["project_id"], - id: !exists(json, "id") ? undefined : json["id"], - metadata: !exists(json, "metadata") ? undefined : json["metadata"], - }; -} - -export function TraineeRequestToJSON(value?: TraineeRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - name: value.name, - features: mapValues(value.features, FeatureAttributesToJSON), - persistence: value.persistence, - project_id: value.project_id, - id: value.id, - metadata: value.metadata, - }; -} diff --git a/src/types/models/TraineeVersion.ts b/src/types/models/TraineeVersion.ts deleted file mode 100644 index 9bc22c3..0000000 --- a/src/types/models/TraineeVersion.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Trainee version information. - * @export - * @interface TraineeVersion - */ -export interface TraineeVersion { - /** - * The trainee's platform container version. - * @type {string} - * @memberof TraineeVersion - */ - container?: string; - /** - * The version of the Trainee. - * @type {string} - * @memberof TraineeVersion - */ - trainee?: string; - /** - * The version of the loaded Amalgam library. - * @type {string} - * @memberof TraineeVersion - */ - amalgam?: string; -} - -/** - * Check if a given object implements the TraineeVersion interface. - */ -export function instanceOfTraineeVersion(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeVersionFromJSON(json: any): TraineeVersion { - return TraineeVersionFromJSONTyped(json, false); -} - -export function TraineeVersionFromJSONTyped(json: any, ignoreDiscriminator: boolean): TraineeVersion { - if (json === undefined || json === null) { - return json; - } - return { - container: !exists(json, "container") ? undefined : json["container"], - trainee: !exists(json, "trainee") ? undefined : json["trainee"], - amalgam: !exists(json, "amalgam") ? undefined : json["amalgam"], - }; -} - -export function TraineeVersionToJSON(value?: TraineeVersion | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - container: value.container, - trainee: value.trainee, - amalgam: value.amalgam, - }; -} diff --git a/src/types/models/TraineeWorkflowAttributes.ts b/src/types/models/TraineeWorkflowAttributes.ts deleted file mode 100644 index 648bc21..0000000 --- a/src/types/models/TraineeWorkflowAttributes.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface TraineeWorkflowAttributes - */ -export interface TraineeWorkflowAttributes { - /** - * - * @type {{ [key: string]: any; }} - * @memberof TraineeWorkflowAttributes - */ - default_hyperparameter_map?: { [key: string]: any }; - /** - * - * @type {{ [key: string]: any; }} - * @memberof TraineeWorkflowAttributes - */ - hyperparameter_map?: { [key: string]: any }; - /** - * When True, the train operation returns when it's time for the model to be analyzed again. - * @type {boolean} - * @memberof TraineeWorkflowAttributes - */ - auto_analyze_enabled?: boolean; - /** - * The size of of the model at which to stop doing auto-analysis. Value of 0 means no limit. - * @type {number} - * @memberof TraineeWorkflowAttributes - */ - auto_analyze_limit_size?: number; - /** - * The factor by which to increase the analyze threshold every time the model grows to the current threshold size. - * @type {number} - * @memberof TraineeWorkflowAttributes - */ - analyze_growth_factor?: number; - /** - * The threshold for the number of cases at which the model should be re-analyzed. - * @type {number} - * @memberof TraineeWorkflowAttributes - */ - analyze_threshold?: number; -} - -/** - * Check if a given object implements the TraineeWorkflowAttributes interface. - */ -export function instanceOfTraineeWorkflowAttributes(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeWorkflowAttributesFromJSON(json: any): TraineeWorkflowAttributes { - return TraineeWorkflowAttributesFromJSONTyped(json, false); -} - -export function TraineeWorkflowAttributesFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): TraineeWorkflowAttributes { - if (json === undefined || json === null) { - return json; - } - return { - default_hyperparameter_map: !exists(json, "default_hyperparameter_map") - ? undefined - : json["default_hyperparameter_map"], - hyperparameter_map: !exists(json, "hyperparameter_map") ? undefined : json["hyperparameter_map"], - auto_analyze_enabled: !exists(json, "auto_analyze_enabled") ? undefined : json["auto_analyze_enabled"], - auto_analyze_limit_size: !exists(json, "auto_analyze_limit_size") ? undefined : json["auto_analyze_limit_size"], - analyze_growth_factor: !exists(json, "analyze_growth_factor") ? undefined : json["analyze_growth_factor"], - analyze_threshold: !exists(json, "analyze_threshold") ? undefined : json["analyze_threshold"], - }; -} - -export function TraineeWorkflowAttributesToJSON(value?: TraineeWorkflowAttributes | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - default_hyperparameter_map: value.default_hyperparameter_map, - hyperparameter_map: value.hyperparameter_map, - auto_analyze_enabled: value.auto_analyze_enabled, - auto_analyze_limit_size: value.auto_analyze_limit_size, - analyze_growth_factor: value.analyze_growth_factor, - analyze_threshold: value.analyze_threshold, - }; -} diff --git a/src/types/models/TraineeWorkflowAttributesRequest.ts b/src/types/models/TraineeWorkflowAttributesRequest.ts deleted file mode 100644 index 71a5088..0000000 --- a/src/types/models/TraineeWorkflowAttributesRequest.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * Parameters that get passed to get_internal_parameters. - * @export - * @interface TraineeWorkflowAttributesRequest - */ -export interface TraineeWorkflowAttributesRequest { - /** - * The action feature used to determine the desired hyperparameters. - * @type {string} - * @memberof TraineeWorkflowAttributesRequest - */ - action_feature?: string; - /** - * The context features used to determine the desired hyperparameters. - * @type {Array} - * @memberof TraineeWorkflowAttributesRequest - */ - context_features?: Array; - /** - * The mode of calculation (robust or full) used to determine the desired hyperparameters. - * @type {string} - * @memberof TraineeWorkflowAttributesRequest - */ - mode?: TraineeWorkflowAttributesRequestModeEnum; - /** - * The weight feature used to determine the desired hyperparameters. - * @type {string} - * @memberof TraineeWorkflowAttributesRequest - */ - weight_feature?: string; -} - -/** - * @export - * @enum {string} - */ -export type TraineeWorkflowAttributesRequestModeEnum = "robust" | "full"; - -/** - * Check if a given object implements the TraineeWorkflowAttributesRequest interface. - */ -export function instanceOfTraineeWorkflowAttributesRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function TraineeWorkflowAttributesRequestFromJSON(json: any): TraineeWorkflowAttributesRequest { - return TraineeWorkflowAttributesRequestFromJSONTyped(json, false); -} - -export function TraineeWorkflowAttributesRequestFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): TraineeWorkflowAttributesRequest { - if (json === undefined || json === null) { - return json; - } - return { - action_feature: !exists(json, "action_feature") ? undefined : json["action_feature"], - context_features: !exists(json, "context_features") ? undefined : json["context_features"], - mode: !exists(json, "mode") ? undefined : json["mode"], - weight_feature: !exists(json, "weight_feature") ? undefined : json["weight_feature"], - }; -} - -export function TraineeWorkflowAttributesRequestToJSON(value?: TraineeWorkflowAttributesRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - action_feature: value.action_feature, - context_features: value.context_features, - mode: value.mode, - weight_feature: value.weight_feature, - }; -} diff --git a/src/types/models/UpdateSessionRequest.ts b/src/types/models/UpdateSessionRequest.ts deleted file mode 100644 index 86a9ccf..0000000 --- a/src/types/models/UpdateSessionRequest.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface UpdateSessionRequest - */ -export interface UpdateSessionRequest { - /** - * Any key-value pair to store custom metadata for the session. - * @type {{ [key: string]: any; }} - * @memberof UpdateSessionRequest - */ - metadata?: { [key: string]: any }; -} - -/** - * Check if a given object implements the UpdateSessionRequest interface. - */ -export function instanceOfUpdateSessionRequest(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function UpdateSessionRequestFromJSON(json: any): UpdateSessionRequest { - return UpdateSessionRequestFromJSONTyped(json, false); -} - -export function UpdateSessionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateSessionRequest { - if (json === undefined || json === null) { - return json; - } - return { - metadata: !exists(json, "metadata") ? undefined : json["metadata"], - }; -} - -export function UpdateSessionRequestToJSON(value?: UpdateSessionRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - metadata: value.metadata, - }; -} diff --git a/src/types/models/Warning.ts b/src/types/models/Warning.ts deleted file mode 100644 index 1a5f5ff..0000000 --- a/src/types/models/Warning.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { exists } from "../runtime"; -/** - * - * @export - * @interface Warning - */ -export interface Warning { - /** - * - * @type {string} - * @memberof Warning - */ - detail?: string; -} - -/** - * Check if a given object implements the Warning interface. - */ -export function instanceOfWarning(value: object): boolean { - const isInstance = true; - - return isInstance; -} - -export function WarningFromJSON(json: any): Warning { - return WarningFromJSONTyped(json, false); -} - -export function WarningFromJSONTyped(json: any, ignoreDiscriminator: boolean): Warning { - if (json === undefined || json === null) { - return json; - } - return { - detail: !exists(json, "detail") ? undefined : json["detail"], - }; -} - -export function WarningToJSON(value?: Warning | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - detail: value.detail, - }; -} diff --git a/src/types/models/index.ts b/src/types/models/index.ts deleted file mode 100644 index 0bee740..0000000 --- a/src/types/models/index.ts +++ /dev/null @@ -1,94 +0,0 @@ -export * from "./AccountIdentity"; -export * from "./AnalyzeRequest"; -export * from "./ApiVersion"; -export * from "./AppendToSeriesStoreRequest"; -export * from "./AutoAblationParams"; -export * from "./BaseReactRequest"; -export * from "./BeginSessionRequest"; -export * from "./BooleanType"; -export * from "./CaseCountResponse"; -export * from "./CaseEditRequest"; -export * from "./CaseRemoveRequest"; -export * from "./Cases"; -export * from "./CasesRequest"; -export * from "./DatetimeType"; -export * from "./DateType"; -export * from "./DerivationParameters"; -export * from "./DestructTraineeResponse"; -export * from "./DetailsResponse"; -export * from "./DetailsResponseDistanceRatioPartsInner"; -export * from "./DetailsResponseOutlyingFeatureValuesInnerValue"; -export * from "./DistancesRequest"; -export * from "./DistancesResponse"; -export * from "./EvaluateActionOutput"; -export * from "./EvaluateRequest"; -export * from "./EvaluateResponse"; -export * from "./ExtremeCasesRequest"; -export * from "./FeatureAddRequest"; -export * from "./FeatureAttributes"; -export * from "./FeatureAutoDeriveOnTrain"; -export * from "./FeatureAutoDeriveOnTrainCustom"; -export * from "./FeatureAutoDeriveOnTrainProgress"; -export * from "./FeatureBounds"; -export * from "./FeatureConviction"; -export * from "./FeatureConvictionActionOutput"; -export * from "./FeatureConvictionRequest"; -export * from "./FeatureMarginalStats"; -export * from "./FeatureMarginalStatsRequest"; -export * from "./FeatureOriginalType"; -export * from "./FeatureRemoveRequest"; -export * from "./FeatureTimeSeries"; -export * from "./ImputeRequest"; -export * from "./IntegerType"; -export * from "./MarginalStats"; -export * from "./Metrics"; -export * from "./ModelError"; -export * from "./NumericType"; -export * from "./ObjectType"; -export * from "./PairwiseDistancesActionOutput"; -export * from "./PairwiseDistancesRequest"; -export * from "./RandomSeedRequest"; -export * from "./ReactActionOutput"; -export * from "./ReactAggregateActionOutput"; -export * from "./ReactAggregateDetails"; -export * from "./ReactAggregateRequest"; -export * from "./ReactAggregateResponse"; -export * from "./ReactAggregateResponseContent"; -export * from "./ReactAggregateResponseContentConfusionMatrix"; -export * from "./ReactDetails"; -export * from "./ReactGroupActionOutput"; -export * from "./ReactGroupRequest"; -export * from "./ReactGroupResponse"; -export * from "./ReactGroupResponseContent"; -export * from "./ReactIntoFeaturesActionOutput"; -export * from "./ReactIntoFeaturesRequest"; -export * from "./ReactIntoFeaturesResponse"; -export * from "./ReactRequest"; -export * from "./ReactResponse"; -export * from "./ReactResponseContent"; -export * from "./ReactSeriesActionOutput"; -export * from "./ReactSeriesRequest"; -export * from "./ReactSeriesResponse"; -export * from "./ReactSeriesResponseContent"; -export * from "./ReduceDataParams"; -export * from "./RemoveSeriesStoreRequest"; -export * from "./Session"; -export * from "./SessionIdentity"; -export * from "./SetAutoAnalyzeParamsRequest"; -export * from "./StringType"; -export * from "./TimedeltaType"; -export * from "./TimeType"; -export * from "./TraceResponse"; -export * from "./TrainActionOutput"; -export * from "./Trainee"; -export * from "./TraineeAcquireResourcesRequest"; -export * from "./TraineeIdentity"; -export * from "./TraineeInformation"; -export * from "./TraineeRequest"; -export * from "./TraineeVersion"; -export * from "./TraineeWorkflowAttributes"; -export * from "./TraineeWorkflowAttributesRequest"; -export * from "./TrainRequest"; -export * from "./TrainResponse"; -export * from "./UpdateSessionRequest"; -export * from "./Warning"; diff --git a/src/types/runtime.ts b/src/types/runtime.ts deleted file mode 100644 index 6ea3831..0000000 --- a/src/types/runtime.ts +++ /dev/null @@ -1,18 +0,0 @@ -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export class RequiredError extends Error { - override name = "RequiredError"; - constructor( - public field: string, - msg?: string, - ) { - super(msg); - } -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {}); -} diff --git a/src/types/schemas/AblationThresholdMap.ts b/src/types/schemas/AblationThresholdMap.ts new file mode 100644 index 0000000..66f2f7f --- /dev/null +++ b/src/types/schemas/AblationThresholdMap.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * AblationThresholdMap + */ + +/** + * Map of prediction stats to map of feature name to threshold value. thresholds can be absolute, delta, or relative depending on which parameter is being used. + */ +export type AblationThresholdMap = Record>; diff --git a/src/types/schemas/AddFeature.ts b/src/types/schemas/AddFeature.ts new file mode 100644 index 0000000..4d20c9f --- /dev/null +++ b/src/types/schemas/AddFeature.ts @@ -0,0 +1,68 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * AddFeature + * + * Adds the specified feature on all cases for a trainee that match the specified condition. overwrites features that + * if condition are not specified, adds feature for all cases and to the model. if condition is an empty assoc, will not modify feature metadata in the model. + * if feature attributes are passed in, will also set the model's feature attributes. + * updates the accumulated data mass for the model proportional to the number of cases modified. + */ +import type { Condition } from "./Condition"; +import type { FeatureAttributes } from "./FeatureAttributes"; + +export type AddFeatureRequest = { + /** + * Assoc of feature->value(s). + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + */ + condition?: Condition; + + /** + * If specified ignores condition and returns cases for the specified session id + */ + condition_session?: string; + + /** + * List of case ids to operate on. if specified, conditions will be ignored + */ + entities?: string[]; + + /** + * Name of feature to odd + */ + feature: string; + + /** + * Assoc of feature specific attributes for this feature. if unspecified and conditions are not specified, will assume feature type as 'continuous'. + */ + feature_attributes?: FeatureAttributes; + + /** + * Value for the feature + */ + feature_value?: any; + + /** + * Flag, if set to true, will not update hyperparameter metadata map + * @default false + */ + internal_feature?: boolean; + + /** + * {type "boolean"} + * @default true + */ + overwrite?: boolean; + + /** + * The session id when this call is being made + * @default "none" + */ + session?: string; +}; diff --git a/src/types/schemas/Analyze.ts b/src/types/schemas/Analyze.ts new file mode 100644 index 0000000..93ad8ce --- /dev/null +++ b/src/types/schemas/Analyze.ts @@ -0,0 +1,110 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Analyze + * + * Analyzes the data to compute the appropriate statistics, uncertainties, and select parameters as appropriate. + */ +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type AnalyzeRequest = { + /** + * List of action features to analyze for. applicable only to 'single_targeted' mode + * @default [] + */ + action_features?: string[]; + + /** + * Number of samples to use for analysis. the rest will be randomly held-out and not included in calculations + */ + analysis_sub_model_size?: number; + + /** + * Flag, if set to true will skip the computation of feature residuals + * @default false + */ + bypass_calculate_feature_residuals?: boolean; + + /** + * Flag, if set to true will skip the computation of feature weights + * @default false + */ + bypass_calculate_feature_weights?: boolean; + + /** + * Flag, if true will not do any search over k, p, and dt parameters, but still may compute feature residuals + * depending on other parameters. + * @default false + */ + bypass_hyperparameter_analysis?: boolean; + + /** + * List of context features to analyze + * @default [] + */ + context_features?: string[]; + + /** + * List of values for dt (the distance transform) to grid search during analysis + */ + dt_values?: number[]; + + /** + * Whether to use inverse residuals as feature weights. if unspecified, inverse residuals will be used as weights for + * targetless params, otherwise this method will not be used. + */ + inverse_residuals_as_weights?: boolean | null; + + /** + * Number of cross validation folds to do. value of 1 does hold-one-out instead of k-fold + * @default 1 + */ + k_folds?: number; + + /** + * List of values for k (the number of cases making up a local model) to grid search during analysis + */ + k_values?: number[]; + + /** + * Number of cases to sample during analysis. only applies for k_folds = 1 + */ + num_analysis_samples?: number; + + /** + * Number of cases to use to approximate residuals + */ + num_samples?: number; + + /** + * List of values for p (the parameter of the lebesgue space) to grid search during analysis + */ + p_values?: number[]; + + /** + * Enumeration, default is "single_targeted" + * "single_targeted" = analyze hyperparameters for the specified action_features + * "omni_targeted" = analyze hyperparameters for each action feature, using all other features as context_features. if action_features aren't specified, uses all context_features. + * "targetless" = analyze hyperparameters for all context features as possible action features, ignores action_features parameter + * @default "single_targeted" + */ + targeted_model?: "single_targeted" | "omni_targeted" | "targetless"; + + /** + * When true will scale influence weights by each case's weight_feature weight. if use_case_weights isn't specified, it will + * be true if auto ablation is enabled and false otherwise + */ + use_case_weights?: UseCaseWeights; + + /** + * Whether to use deviations for lk metric in queries. when true forces the use + * of deviations, when false will not use deviations. if unspecified, the better performing option will be selected. + */ + use_deviations?: boolean | null; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/AppendToSeriesStore.ts b/src/types/schemas/AppendToSeriesStore.ts new file mode 100644 index 0000000..f96daf0 --- /dev/null +++ b/src/types/schemas/AppendToSeriesStore.ts @@ -0,0 +1,24 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * AppendToSeriesStore + * + * Append cases to a series + */ + +export type AppendToSeriesStoreRequest = { + /** + * List of context features for the corresponding context_values + */ + context_features: string[]; + + /** + * List of lists. case values corresponding to the context features to store into a series. + */ + context_values: any[][]; + + /** + * Series id, the key for storing series of react cases + */ + series: string; +}; diff --git a/src/types/schemas/BuiltInFeatures.ts b/src/types/schemas/BuiltInFeatures.ts new file mode 100644 index 0000000..f665d69 --- /dev/null +++ b/src/types/schemas/BuiltInFeatures.ts @@ -0,0 +1,51 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * BuiltInFeatures + */ +import type { EditHistory } from "./EditHistory"; + +/** + * The features and their values created by the howso engine automatically + */ +export type BuiltInFeatures = { + ".case_edit_history"?: EditHistory; + /** + * The default feature to store case weight, which scales the influence of a case during queries. + */ + ".case_weight"?: number | null; + /** + * The list of features that have been imputed for the case. + */ + ".imputed"?: string[] | null; + /** + * The normalized influence of a case on a prediction. + */ + ".influence_weight"?: number; + /** + * The influence of a case on a prediction. + */ + ".raw_influence_weight"?: number; + /** + * The zero-based index of the case within its series sorted by time. + */ + ".series_index"?: number; + /** + * A 0-1 float describing the progress though the case's series at the point in time described by the case. + */ + ".series_progress"?: number; + /** + * The delta between the series progress of the previous case of the series and the case being described. + */ + ".series_progress_delta"?: number; + /** + * The name of the session the case was trained in. + */ + ".session"?: string; + /** + * The 0-based index of the case's order in training within its session. + */ + ".session_training_index"?: number; +} & Record<`${string}_delta_${number}`, number | null> & + Record<`${string}_lag_${number}`, any> & + Record<`${string}_rate_${number}`, number | null>; diff --git a/src/types/schemas/CaseIndices.ts b/src/types/schemas/CaseIndices.ts new file mode 100644 index 0000000..13b344f --- /dev/null +++ b/src/types/schemas/CaseIndices.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * CaseIndices + */ + +/** + * List of tuples containing the session id and index, where index is the original 0-based index of the case as it was trained into the session. this explicitly specifies the cases to retrieve. + */ +export type CaseIndices = (string | number)[][]; diff --git a/src/types/schemas/ClearImputedData.ts b/src/types/schemas/ClearImputedData.ts new file mode 100644 index 0000000..27318cb --- /dev/null +++ b/src/types/schemas/ClearImputedData.ts @@ -0,0 +1,20 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ClearImputedData + * + * Clear values that were imputed during a specified session, but won't clear values that were manually set by user after the impute + */ + +export type ClearImputedDataRequest = { + /** + * Session id of the impute for which to clear the data. if null, will clear all imputed + */ + impute_session?: string; + + /** + * Session id of this action + * @default "clear_impute_none" + */ + session?: string; +}; diff --git a/src/types/schemas/Condition.ts b/src/types/schemas/Condition.ts new file mode 100644 index 0000000..68eb6ca --- /dev/null +++ b/src/types/schemas/Condition.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Condition + */ + +/** + * The condition map to select the cases to remove that meet all the provided conditions. the dictionary keys are the feature name and values are one of: + * - none + * - a value, must match exactly. + * - an array of two numeric values, specifying an inclusive range. only applicable to continuous and numeric ordinal features. + * - an array of string values, must match any of these values exactly. only applicable to nominal and string ordinal features. + */ +export type Condition = Record; diff --git a/src/types/schemas/CopySubtrainee.ts b/src/types/schemas/CopySubtrainee.ts new file mode 100644 index 0000000..4d1736f --- /dev/null +++ b/src/types/schemas/CopySubtrainee.ts @@ -0,0 +1,36 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * CopySubtrainee + * + * Creates a copy of a trainee and stores it a subtrainee, returns the name of the copied trainee on success + */ + +export type CopySubtraineeRequest = { + /** + * Id of source trainee to copy. ignored if source_name_path is specified. + * if neither source_name_path nor source_id are specified, copies the trainee itself. + */ + source_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee to copy. + */ + source_name_path?: string[]; + + /** + * Id of target trainee to copy trainee into. ignored if target_name_path is specified. + * if neither target_name_path nor target_id are specified, copies as a direct child of trainee + */ + target_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee to copy trainee into. + */ + target_name_path?: string[]; + + /** + * Name of new copied trainee + */ + target_trainee: string | string[]; +}; diff --git a/src/types/schemas/CreateSubtrainee.ts b/src/types/schemas/CreateSubtrainee.ts new file mode 100644 index 0000000..e3a9c23 --- /dev/null +++ b/src/types/schemas/CreateSubtrainee.ts @@ -0,0 +1,25 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * CreateSubtrainee + * + * Creates a new instance of a contained trainee as specified by the entity label "trainee". + */ + +export type CreateSubtraineeRequest = { + /** + * Path to the file (optional) + */ + filepath?: string; + + /** + * Name of trainee to create + * @default "" + */ + trainee?: string | string[]; + + /** + * Unique id for trainee + */ + trainee_id?: string; +}; diff --git a/src/types/schemas/DeleteSession.ts b/src/types/schemas/DeleteSession.ts new file mode 100644 index 0000000..951a9cb --- /dev/null +++ b/src/types/schemas/DeleteSession.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * DeleteSession + * + * Removes replay specified by session and any references within cases + */ + +export type DeleteSessionRequest = { + /** + * Session to remove + */ + session: string; +}; diff --git a/src/types/schemas/DeleteSubtrainee.ts b/src/types/schemas/DeleteSubtrainee.ts new file mode 100644 index 0000000..12cac82 --- /dev/null +++ b/src/types/schemas/DeleteSubtrainee.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * DeleteSubtrainee + * + * Destroys the instance of the trainee specified by the parameter "trainee". + */ + +export type DeleteSubtraineeRequest = { + /** + * Name path of trainee + */ + trainee: string | string[]; +}; diff --git a/src/types/schemas/DesiredConviction.ts b/src/types/schemas/DesiredConviction.ts new file mode 100644 index 0000000..27ba0cf --- /dev/null +++ b/src/types/schemas/DesiredConviction.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * DesiredConviction + */ + +/** + * If null, will do a discriminative react. if specified, will do a generative react. for generative react, value of desired avg conviction of generated cases, in the range of (0,infinity] with 1 as standard. larger values will increase the variance (or creativity) of the generated case from the existing model. smaller values will decrease the variance (or creativity) of the generated case from the existing model. + */ +export type DesiredConviction = number | null; diff --git a/src/types/schemas/EditCases.ts b/src/types/schemas/EditCases.ts new file mode 100644 index 0000000..d635853 --- /dev/null +++ b/src/types/schemas/EditCases.ts @@ -0,0 +1,66 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * EditCases + * + * Edit feature values for the specified cases. + * cases are specified by either case_indices or by the condition. if neither is provided, edits all cases. + * updates the accumulated data mass for the model proportional to the number of cases and features modified. + * returns null if invalid features specified or an assoc with "count" + */ +import type { CaseIndices } from "./CaseIndices"; +import type { Condition } from "./Condition"; + +export type EditCasesRequest = { + /** + * List of pair (list) of session id and index, where index is the original 0-based session_training_index of the case as + * it was trained. if specified, ignores condition and condition_session + * @default [] + */ + case_indices?: CaseIndices; + + /** + * Assoc of feature->value(s) + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * two values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + * @default {} + */ + condition?: Condition; + + /** + * If specified ignores condition and operates on cases for the specified session id + */ + condition_session?: string; + + /** + * List of names of feature to edit + */ + features: string[]; + + /** + * List of values corresponding to features + */ + feature_values: any[]; + + /** + * Limit on the number of cases to edit; if set to zero there will be no limit. + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + */ + num_cases?: number; + + /** + * Enum used only with 'condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + * @default "exact" + */ + precision?: "exact" | "similar"; + + /** + * The session id when this call is being made + * @default "none" + */ + session?: string; +}; diff --git a/src/types/schemas/EditHistory.ts b/src/types/schemas/EditHistory.ts new file mode 100644 index 0000000..2c9c003 --- /dev/null +++ b/src/types/schemas/EditHistory.ts @@ -0,0 +1,11 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * EditHistory + */ +import type { EditHistoryRecord } from "./EditHistoryRecord"; + +/** + * The edit history of a given case. keyed by the session id and in order of occurrence. + */ +export type EditHistory = Record; diff --git a/src/types/schemas/EditHistoryRecord.ts b/src/types/schemas/EditHistoryRecord.ts new file mode 100644 index 0000000..834ce3b --- /dev/null +++ b/src/types/schemas/EditHistoryRecord.ts @@ -0,0 +1,27 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * EditHistoryRecord + */ + +/** + * A record of a single edit that was made to a feature of a case. + */ +export type EditHistoryRecord = { + /** + * The feature that was modified. + */ + feature?: string; + /** + * The previous value. + */ + previous_value?: any; + /** + * The type of modification. + */ + type?: "set" | "remove" | "impute" | "edit"; + /** + * The new value. + */ + value?: any; +}; diff --git a/src/types/schemas/Evaluate.ts b/src/types/schemas/Evaluate.ts new file mode 100644 index 0000000..a7a8edc --- /dev/null +++ b/src/types/schemas/Evaluate.ts @@ -0,0 +1,20 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Evaluate + * + * Evaluate custom amalgam code for feature values of every case in the model and returns + * a list of the custom code's return values for each feature specified. + */ + +export type EvaluateRequest = { + /** + * Custom code to aggregrate the results from using features_to_code + */ + aggregation_code?: string; + + /** + * A assoc of feature names to custom code + */ + features_to_code_map: Record; +}; diff --git a/src/types/schemas/ExecuteOnSubtrainee.ts b/src/types/schemas/ExecuteOnSubtrainee.ts new file mode 100644 index 0000000..430b26d --- /dev/null +++ b/src/types/schemas/ExecuteOnSubtrainee.ts @@ -0,0 +1,42 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ExecuteOnSubtrainee + * + * Execute any method in the api directly on any child trainee of this trainee, used for hierarchy operations. + */ + +export type ExecuteOnSubtraineeRequest = { + /** + * Flag, applicable only to 'load_subtrainee' and 'save_subtrainee' and if specifying child_name_path or child_id. + * for 'save_subtrainee', stores the child out as an independent trainee and removes it as a contained entity. + * for 'load_subtrainee' updates hierarchy by adding the child as an independently stored trainee to the hierarchy without loading the trainee as a subtrainee. + */ + as_external?: boolean; + + /** + * Id of child trainee to execute method. ignored if child_name_path is specified + */ + child_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee for execution of method + */ + child_name_path?: string[]; + + /** + * Trainee id of trainee being loaded, must be specified only when 'load_subtrainee' and as_external is true. + */ + load_external_trainee_id?: string; + + /** + * Name of method to execute + */ + method: string; + + /** + * Payload to pass to the method + * @default {} + */ + payload?: Record; +}; diff --git a/src/types/schemas/ExportTrainee.ts b/src/types/schemas/ExportTrainee.ts new file mode 100644 index 0000000..7127328 --- /dev/null +++ b/src/types/schemas/ExportTrainee.ts @@ -0,0 +1,33 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ExportTrainee + * + * Export trainee's metadata, case and session data into json files. + * this method should be run by a script from the ./migrations folder + */ + +export type ExportTraineeRequest = { + /** + * Flag, default false. if true will decode (e.g., convert from epoch to datetime) any encoded feature values + * when exporting cases if false case feature values will be exported just as they are stored in the trainee + * @default false + */ + decode_cases?: boolean; + + /** + * Base path to howso engine core installation + */ + root_filepath?: string; + + /** + * Name of trainee, reference for filename + */ + trainee: string; + + /** + * Path to save the exported meta.json and exp.json files. + * if unspecified, will save them into the base installation /migrations/ directory. + */ + trainee_filepath?: string; +}; diff --git a/src/types/schemas/FeatureAttributes.ts b/src/types/schemas/FeatureAttributes.ts new file mode 100644 index 0000000..7572716 --- /dev/null +++ b/src/types/schemas/FeatureAttributes.ts @@ -0,0 +1,214 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * FeatureAttributes + */ +import type { FeatureBoundsMap } from "./FeatureBoundsMap"; + +/** + * The mapping of attributes for a single feature + */ +export type FeatureAttributes = { + /** + * Derive feature by creating two new continuous features: `.series_progress` and `.series_progress_delta`. series progress values range from 0 to 1.0 for each case in the series. series progress delta values are the delta value of the progress for each case. both of these features are used to determine when to stop series synthesis. + */ + auto_derive_on_train?: { + /** + * The amalgam code used to derive the feature value. + */ + code?: string; + /** + * The train derive operation type. + */ + derive_type?: "custom" | "start" | "end" | "progress"; + /** + * Feature name(s) that define the order of the series. + */ + ordered_by_features?: string[]; + /** + * Feature name(s) whose values are used to identify cases within the same series. + */ + series_id_features?: string[]; + }; + bounds?: FeatureBoundsMap; + /** + * Cyclic features are set by specifying a `cycle_length` value in the feature attributes. `cycle_length` requires a single value, which is the upper bound of the difference for the cycle range. for example, if `cycle_length` is 360, then a value of 1 and 359 will have a difference of 2. cyclic features have no restrictions in the input dataset, however, cyclic features will be output on a scale from 0 to `cycle_length`. to constrain the output to a different range, modify the `min` and `max` `bounds` feature attribute. + * + * examples: + * - degrees: values should be 0-359, cycle_length = 360 + * - days: values should be 0-6, cycle_length = 7 + * - hours: values should be 0-23, cycle_length = 24 + */ + cycle_length?: number; + /** + * Specify the data type for features with a type of nominal or continuous. default is `string` for nominals and `number` for continuous. + * + * valid values include: + * - `string`, `number`, `formatted_date_time`, `json`, `amalgam`, `yaml`: valid for both nominal and continuous. + * - `string_mixable`: valid only when type is continuous (predicted values may result in interpolated strings containing a combination of characters from multiple original values). + * - `boolean`: valid only for nominals. + */ + data_type?: "string" | "number" | "boolean" | "formatted_date_time" | "string_mixable" | "json" | "yaml" | "amalgam"; + /** + * If specified, feature values should match the date format specified by this string. only applicable to continuous features. + */ + date_time_format?: string; + /** + * Decimal places to round to, default is no rounding. if `significant_digits` is also specified, the number will be rounded to the specified number of significant digits first, then rounded to the number of decimal points as specified by this parameter. + */ + decimal_places?: number; + /** + * A list of other feature names that this feature either depends on or features that depend on this feature. should be used when there are multi-type value features that tightly depend on values based on other multi-type value features. + */ + dependent_features?: string[]; + /** + * Code defining how the value for this feature could be derived if this feature is specified as a `derived_context_feature` or a `derived_action_feature` during react flows. for `react_series`, the data referenced is the accumulated series data (as a list of rows), and for non-series reacts, the data is the one single row. each row is comprised of all the combined context and action features. referencing data in these rows uses 0-based indexing, where the current row index is 0, the previous row's is 1, etc. the specified code may do simple logic and numeric operations on feature values referenced via feature name and row offset + * + * examples: + * - ``"#x 1"``: use the value for feature 'x' from the previously processed row (offset of 1, one lag value). + * - ``"(- #y 0 #x 1)"``: feature 'y' value from current (offset 0) row minus feature 'x' value from previous (offset 1) row. + */ + derived_feature_code?: string; + /** + * Set to true for nominal features containing nominal ids, specifying that his feature should be used to compute case weights for id based privacy. for time series, this feature will be used as the id for each time series generation. + */ + id_feature?: boolean; + /** + * The date time format locale. if unspecified, uses platform default locale. + */ + locale?: string; + /** + * The number of time steps traced back by the maximum lag feature created for this feature. + */ + max_row_lag?: number; + /** + * Flag a categorical nominal feature as non-sensitive. it is recommended that all nominal features be represented with either an `int-id` subtype or another available nominal subtype using the `subtype` attribute. however, if the nominal feature is non-sensitive, setting this parameter to true will bypass the `subtype` requirement. only applicable to nominal features. + */ + non_sensitive?: boolean; + /** + * Modify how dependent features with nulls are treated during a react, specifically when they use null as a context value. only applicable to dependent features. + * + * when false (default), the feature will be treated as a non-dependent context feature. + * when true for nominal types, treats null as an individual dependent class value, only cases that also have nulls as this feature's value will be considered. + * when true for continuous types, only the cases with the same dependent feature values as the cases that also have nulls as this feature's value will be considered. + */ + null_is_dependent?: boolean; + /** + * Specifies the observational mean absolute error for this feature. use when the error value is already known. + */ + observational_error?: number; + /** + * Original data formats used by clients. automatically populated by clients to store client language specific context about features. + */ + original_format?: any; + /** + * Original data type details. used by clients to determine how to serialize and deserialize feature data. + */ + original_type?: { + /** + * The original type of the data. + */ + data_type: "object" | "string" | "numeric" | "integer" | "boolean" | "datetime" | "time" | "date" | "timedelta"; + } & Record; + /** + * The feature whose values this time-series feature's values are derived from. + */ + parent?: string; + /** + * The type of time-series processing used by the parent feature. + */ + parent_type?: "delta" | "rate"; + /** + * Custom amalgam code that is called on resulting values of this feature during react operations. + */ + post_process?: string; + /** + * A sample of a value for the feature. + */ + sample?: any; + /** + * Round to the specified significant digits, default is no rounding. + */ + significant_digits?: number; + /** + * The type used in novel nominal substitution. + */ + subtype?: string; + /** + * Time series options for a feature. + */ + time_series?: { + /** + * If specified, ensures that the largest difference between feature values is not larger than this specified value. a null value means no max boundary. the length of the list must match the number of derivatives as specified by `order`. only applicable when time series type is set to `delta`. + */ + delta_max?: number[]; + /** + * If specified, ensures that the smallest difference between features values is not smaller than this specified value. a null value means no min boundary. the length of the list must match the number of derivatives as specified by `order`. only applicable when time series type is set to `delta`. + */ + delta_min?: number[]; + /** + * The number of orders of derivatives that should be derived instead of synthesized. ignored if order is not provided. + */ + derived_orders?: number; + /** + * If specified, generates lag features containing previous values using the enumerated lag offsets. takes precedence over `num_lags`. if neither `num_lags` nor `lags` is specified for a feature, then a single lag feature is generated. + */ + lags?: number[]; + /** + * If specified, generates the specified amount of lag features containing previous values. if `lags` is specified, then this parameter will be ignored. if neither `num_lags` nor `lags` is specified for a feature, then a single lag feature is generated. + */ + num_lags?: number; + /** + * If provided, will generate the specified number of derivatives and boundary values. + */ + order?: number; + /** + * If specified, ensures that the rate (the difference quotient, the discrete version of derivative) for this feature won't be more than the value provided. a null value means no max boundary. the value must be in epoch format for the time feature. the length of the list must match the number of derivatives as specified by `order`. only applicable when time series type is set to `rate`. + */ + rate_max?: number[]; + /** + * If specified, ensures that the rate (the difference quotient, the discrete version of derivative) for this feature won't be less than the value provided. a null value means no min boundary. the value must be in epoch format for the time feature. the length of the list must match the number of derivatives as specified by `order`. only applicable when time series type is set to `rate`. + */ + rate_min?: number[]; + /** + * When true, requires that the model identify and learn values that explicitly denote the end of a series. only applicable to id features for a series. + */ + series_has_terminators?: boolean; + /** + * When true, requires that a series ends on a terminator value. only applicable to id features for a series. + */ + stop_on_terminator?: boolean; + /** + * When true, the feature will be treated as the time feature for time series modeling. additionally, time features must use type `delta`. + */ + time_feature?: boolean; + /** + * When `rate` is specified, uses the difference of the current value from its previous value divided by the change in time since the previous value. when `delta` is specified, uses the difference of the current value from its previous value regardless of the elapsed time. set to `delta` if feature has `time_feature` set to true. + */ + type?: "rate" | "delta"; + /** + * Controls whether future values of independent time series are considered. applicable only to the time feature. when false, the time feature is not universal and allows using future data from other series in decisions; this is applicable when the time is not globally relevant and is independent for each time series. when true, universally excludes using any data with from the future from all series; this is applicable when time is globally relevant and there are events that may affect all time series. if there is any possibility of global relevancy of time, it is generally recommended to set this value to true, which is the default. + */ + universal?: boolean; + }; + /** + * The order of rate/delta being described by this time-series feature. + */ + ts_order?: number; + /** + * The type of value being captured by this time-series feature. + */ + ts_type?: "lag" | "delta" | "rate"; + /** + * The type of the feature. + * + * - continuous: a continuous numeric value. (e.g. temperature or humidity) + * - nominal: a numeric or string value with no ordering. (e.g. the name of a fruit) + * - ordinal: a nominal numeric value with ordering. (e.g. rating scale, 1-5 stars) + */ + type: "continuous" | "ordinal" | "nominal"; + /** + * Flag feature as only having unique values. only applicable to nominals features. + */ + unique?: boolean; +}; diff --git a/src/types/schemas/FeatureAttributesIndex.ts b/src/types/schemas/FeatureAttributesIndex.ts new file mode 100644 index 0000000..5c1c7d6 --- /dev/null +++ b/src/types/schemas/FeatureAttributesIndex.ts @@ -0,0 +1,11 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * FeatureAttributesIndex + */ +import type { FeatureAttributes } from "./FeatureAttributes"; + +/** + * A map of feature name to feature attributes. + */ +export type FeatureAttributesIndex = Record; diff --git a/src/types/schemas/FeatureBoundsMap.ts b/src/types/schemas/FeatureBoundsMap.ts new file mode 100644 index 0000000..44316bb --- /dev/null +++ b/src/types/schemas/FeatureBoundsMap.ts @@ -0,0 +1,33 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * FeatureBoundsMap + */ + +/** + * A map defining any feature bounds, allowed values, and constraints. + */ +export type FeatureBoundsMap = { + /** + * Explicitly allowed values to be output. + */ + allowed?: any[]; + /** + * Allow nulls to be output, per their distribution in the data. defaults to true. + */ + allow_null?: boolean; + /** + * Amalgam code, whose logic has to evaluate to true for value to be considered valid when this feature is being generated. same format as 'derived_feature_code'. + * examples: + * - ``"(> #f1 0 #f2 0)"``: feature 'f1' value from current (offset 0) data must be bigger than feature 'f2' value from current (offset 0) data. + */ + constraint?: string; + /** + * The maximum value to be output. may be a number or date string. + */ + max?: number | string; + /** + * The minimum value to be output. may be a number or date string. + */ + min?: number | string; +}; diff --git a/src/types/schemas/FullHyperparameterMap.ts b/src/types/schemas/FullHyperparameterMap.ts new file mode 100644 index 0000000..e9e1f5f --- /dev/null +++ b/src/types/schemas/FullHyperparameterMap.ts @@ -0,0 +1,8 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * FullHyperparameterMap + */ +import type { HyperparameterMap } from "./HyperparameterMap"; + +export type FullHyperparameterMap = Record>>>; diff --git a/src/types/schemas/GenerateNewCases.ts b/src/types/schemas/GenerateNewCases.ts new file mode 100644 index 0000000..12d2d0b --- /dev/null +++ b/src/types/schemas/GenerateNewCases.ts @@ -0,0 +1,13 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GenerateNewCases + */ + +/** + * Control whether generated cases can be those that already exist in the model. this parameter takes in a string that could be one of the following: + * a. "attempt": attempts to generate new cases and if its not possible to generate a new case, it might generate cases in "no" mode (see point c.) + * b. "always": always generates new cases and if its not possible to generate a new case, it returns nulls. + * c. "no": generates data based on the `desired_conviction` specified and the generated data is not guaranteed to be a new case (that is, a case not found in original dataset.) + */ +export type GenerateNewCases = "no" | "attempt" | "always"; diff --git a/src/types/schemas/GetCases.ts b/src/types/schemas/GetCases.ts new file mode 100644 index 0000000..e8a680e --- /dev/null +++ b/src/types/schemas/GetCases.ts @@ -0,0 +1,71 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetCases + * + * Returns assoc with features and cases - a list of lists of all feature values. retrieves all feature values for cases for + * all (unordered) sessions in the order they were trained within each session. if a session is specified, only that session's + * cases wil be output. + */ +import type { CaseIndices } from "./CaseIndices"; +import type { Condition } from "./Condition"; +import type { Precision } from "./Precision"; + +export type GetCasesRequest = { + /** + * List of pair (list) of session id and index, where index is the original 0-based session_training_index of the + * case as it was trained. if specified, ignores session and condition/precision parameters. + */ + case_indices?: CaseIndices; + + /** + * A query condition describing the cases to return. + */ + condition?: Condition; + + /** + * List of features to retrieve. + * @default [] + */ + features?: string[]; + + /** + * If true, will return the audit data of which features for each row were imputed (auto-filled) + * @default false + */ + indicate_imputed?: boolean; + + /** + * Limit on the number of cases to retrieve; if set to zero there will be no limit. + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + */ + num_cases?: number; + + /** + * Flag, when true only returns an assoc of case ids and no features + * @default false + */ + output_ids?: boolean; + + /** + * String, default is 'exact', used only with 'condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + * @default "exact" + */ + precision?: Precision; + + /** + * Session from which to get cases (even if by condition). + */ + session?: string; + + /** + * Set flag to skip decoding feature values into their nominal values for output. + * @default 0 + */ + skip_decoding?: number; +}; + +export type GetCasesResponse = { + cases?: any[][]; + features?: string[]; +}; diff --git a/src/types/schemas/GetDistances.ts b/src/types/schemas/GetDistances.ts new file mode 100644 index 0000000..a7f4585 --- /dev/null +++ b/src/types/schemas/GetDistances.ts @@ -0,0 +1,73 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetDistances + * + * Returns an assoc with case distances, containing a list of case session indices and a list of lists (matrix) of the computed distances. + * in the following format: + * { + * 'column_case_indices' : [ session-indices ], + * 'row_case_indices' : [ session-indices ], + * 'distances': [ [ pairwise distances ] ] + * } + */ +import type { CaseIndices } from "./CaseIndices"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type GetDistancesRequest = { + /** + * If specified, uses targeted hyperparameters used to predict this action_feature, otherwise uses targetless hyperparameters. + */ + action_feature?: string; + + /** + * List of pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was + * trained. if specified, returns pairwise distances for all of these cases. ignored if feature_values is provided. if neither feature_values nor + * case_indices is specified, runs on the full dataset. + */ + case_indices?: CaseIndices; + + /** + * Number of columns to compute in the matrix. if unspecified, is set to the same number as all the cases. + */ + column_count?: number; + + /** + * Starting column index of the full matrix of cases for which to compute distances. default value is 0 + * @default 0 + */ + column_offset?: number; + + /** + * Which features to use when computing case distances. if unspecified uses all features. + */ + features?: string[]; + + /** + * If specified, returns case distances of the local model relative to these values, ignores case_indices parameter. + */ + feature_values?: any[]; + + /** + * Number of rows to compute in the matrix. if unspecified, is set to the same number as all the cases. + */ + row_count?: number; + + /** + * Starting row index of the full matrix of cases for which to compute distances. default value is 0 + * @default 0 + */ + row_offset?: number; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. if unspecified, + * case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/GetEntityPathById.ts b/src/types/schemas/GetEntityPathById.ts new file mode 100644 index 0000000..4ddb04d --- /dev/null +++ b/src/types/schemas/GetEntityPathById.ts @@ -0,0 +1,21 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetEntityPathById + * + * Returns the full entity path to a child trainee provided its unique trainee id if it is contained in the hierarchy. + * iterates down the hierarchy searching for a trainee that matches the specified id, returns null if not found or + * a string error if found but trainee is stored externally as an independent trainee. + */ + +export type GetEntityPathByIdRequest = { + /** + * Unique id of trainee + */ + id: string; + + /** + * List of strings, entity path to parent of trainee + */ + path: string[]; +}; diff --git a/src/types/schemas/GetExtremeCases.ts b/src/types/schemas/GetExtremeCases.ts new file mode 100644 index 0000000..0c6f5b4 --- /dev/null +++ b/src/types/schemas/GetExtremeCases.ts @@ -0,0 +1,24 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetExtremeCases + * + * Retrieve the top or bottom number of cases for a specified feature, sorted top to bottom for top, and bottom to top for bottom + */ + +export type GetExtremeCasesRequest = { + /** + * The features for which values should be returned + */ + features: string[]; + + /** + * Number of cases to return, positive value will return the top (largest value), negative will return smallest + */ + num: number; + + /** + * The feature for which to sort the cases by + */ + sort_feature: string; +}; diff --git a/src/types/schemas/GetFeatureConviction.ts b/src/types/schemas/GetFeatureConviction.ts new file mode 100644 index 0000000..9d030b6 --- /dev/null +++ b/src/types/schemas/GetFeatureConviction.ts @@ -0,0 +1,52 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetFeatureConviction + * + * Computes the conviction for each feature and returns an assoc of feature -> conviction value + */ +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type GetFeatureConvictionRequest = { + /** + * List of action features to use as the baseline for conviction instead of the full model + * @default [] + */ + action_features?: string[]; + + /** + * List of cases for which to use as the model to compute feature conviction + * @default [] + */ + case_ids?: string[]; + + /** + * Calculate and output familiarity conviction of adding the specified features + * @default true + */ + familiarity_conviction_addition?: boolean; + + /** + * Calculate and output familiarity conviction of removing the specified features + * @default false + */ + familiarity_conviction_removal?: boolean; + + /** + * List of feature names + * @default [] + */ + features?: string[]; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. if unspecified, + * case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/GetMarginalStats.ts b/src/types/schemas/GetMarginalStats.ts new file mode 100644 index 0000000..a15c328 --- /dev/null +++ b/src/types/schemas/GetMarginalStats.ts @@ -0,0 +1,40 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetMarginalStats + * + * Outputs all marginal stats (min, max, median, mean, mode, count, uniques, mean_absdev, variance, stddev, skew, kurtosis, entropy) + * for all features in the format of feature -> assoc stat -> value. the marginal stats can be computed for a subset of the data using condition, precision, and num_cases + */ +import type { Condition } from "./Condition"; +import type { Precision } from "./Precision"; + +export type GetMarginalStatsRequest = { + /** + * Assoc of feature->value(s) + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * two values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + */ + condition?: Condition; + + /** + * Limit on the number of cases to use in calculating conditional prediction stats; if set to zero there will be no limit. + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + */ + num_cases?: number; + + /** + * Default is 'exact', used only with 'condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + * @default "exact" + */ + precision?: Precision; + + /** + * Name of case weight feature + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/GetPairwiseDistances.ts b/src/types/schemas/GetPairwiseDistances.ts new file mode 100644 index 0000000..d31d2b0 --- /dev/null +++ b/src/types/schemas/GetPairwiseDistances.ts @@ -0,0 +1,62 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetPairwiseDistances + * + * Returns a list of computed distances between respective cases specified in either from_values or from_case_indices to to_values or to_case_indices. + * if one case is specified in any of the lists, all respective distances are computed to/from that one case. + */ +import type { CaseIndices } from "./CaseIndices"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type GetPairwiseDistancesRequest = { + /** + * If specified, uses targeted hyperparameters used to predict this action_feature, otherwise uses targetless hyperparameters. + */ + action_feature?: string; + + /** + * Which features to use when computing pairwise distances. if unspecified uses all features. + */ + features?: string[]; + + /** + * List of pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was trained. + * if specified must be either length of 1 or match length of to_values or to_case_indices. + * @default [] + */ + from_case_indices?: CaseIndices; + + /** + * List of cases (lists of values), i.e., a 2d-list of values. either from_values or from_case_indices must be specified, not both. + * if specified must be either length of 1 or match length of to_values or to_case_indices. + * @default [] + */ + from_values?: any[][]; + + /** + * List of pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was trained. + * if specified must be either length of 1 or match length of from_values or from_case_indices. + * @default [] + */ + to_case_indices?: CaseIndices; + + /** + * List of cases (lists of values), i.e., a 2d-list of values. either to_values or to_case_indices must be specified, not both. + * if specified must be either length of 1 or match length of from_values or from_case_indices. + * @default [] + */ + to_values?: any[][]; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. if unspecified, + * case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/GetParams.ts b/src/types/schemas/GetParams.ts new file mode 100644 index 0000000..928a3fc --- /dev/null +++ b/src/types/schemas/GetParams.ts @@ -0,0 +1,30 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetParams + * + * Return the full internal parameters map if no parameters are specified. + * if any of the parameters are specified, then gethyperparameters is called, which uses the specified parameters to find the most suitable set of hyperparameters to return + */ + +export type GetParamsRequest = { + /** + * The target feature of the desired hyperparameters + */ + action_feature?: string; + + /** + * The set of context features used for the desired hyperparameters + */ + context_features?: string[]; + + /** + * The method of calculation used to find the desired hyperparameters + */ + mode?: "robust" | "full"; + + /** + * The weight feature used in the calculation of the desired hyperparameters + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/GetSessionIndices.ts b/src/types/schemas/GetSessionIndices.ts new file mode 100644 index 0000000..664aca4 --- /dev/null +++ b/src/types/schemas/GetSessionIndices.ts @@ -0,0 +1,15 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetSessionIndices + * + * Return list of all session indices for a specified session. + * session indices are 0-based index of number of the case for the session used for replays; may change if cases are removed + */ + +export type GetSessionIndicesRequest = { + /** + * Id of session + */ + session: string; +}; diff --git a/src/types/schemas/GetSessionMetadata.ts b/src/types/schemas/GetSessionMetadata.ts new file mode 100644 index 0000000..989b3c8 --- /dev/null +++ b/src/types/schemas/GetSessionMetadata.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetSessionMetadata + * + * Returns all the metadata for a specified session + */ + +export type GetSessionMetadataRequest = { + /** + * Name of session to return metadata for + */ + session: string; +}; diff --git a/src/types/schemas/GetSessionTrainingIndices.ts b/src/types/schemas/GetSessionTrainingIndices.ts new file mode 100644 index 0000000..5534d5b --- /dev/null +++ b/src/types/schemas/GetSessionTrainingIndices.ts @@ -0,0 +1,15 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetSessionTrainingIndices + * + * Return list of all session training indices for a specified session. + * session training indices are 0-based index of the case, ordered by training during the session; is not changed + */ + +export type GetSessionTrainingIndicesRequest = { + /** + * Id of session + */ + session: string; +}; diff --git a/src/types/schemas/GetSessions.ts b/src/types/schemas/GetSessions.ts new file mode 100644 index 0000000..00f9284 --- /dev/null +++ b/src/types/schemas/GetSessions.ts @@ -0,0 +1,15 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * GetSessions + * + * Returns a list of all of the training sessions, assoc of id->session, and whatever other attributes specified. + */ + +export type GetSessionsRequest = { + /** + * List of metadata attributes to return from the session + * @default [] + */ + attributes?: string[]; +}; diff --git a/src/types/schemas/HyperparameterMap.ts b/src/types/schemas/HyperparameterMap.ts new file mode 100644 index 0000000..159eb2e --- /dev/null +++ b/src/types/schemas/HyperparameterMap.ts @@ -0,0 +1,64 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * HyperparameterMap + */ + +export type HyperparameterMap = { + /** + * Flag indicating if all feature's residuals have been cached. + */ + allFeatureResidualsCached?: boolean; + /** + * Internal flag indicating if derived features have been analyzed. + */ + derivedAutoAnalyzed?: boolean; + /** + * The distance transform. used as an exponent to convert distance to influence before normalization. + */ + dt: number; + /** + * Internal map of features to their deviations. includes null deviations and sparse deviation matrices. + */ + featureDeviations?: Record; + /** + * Internal map of features to various domain attributes. + */ + featureDomainAttributes?: Record; + /** + * Map of ordinal features to their deviations. + */ + featureOrdinalDeviations?: Record; + /** + * Map of features to their computed feature residuals. + */ + featureResiduals?: Record; + /** + * Map of features to feature weights used in the distance metric. + */ + featureWeights?: Record; + /** + * Error computed during the grid search in analysis. + */ + gridSearchError?: number; + /** + * The number of most similar cases used for interpolation. + */ + k: number; + /** + * Map of features to null uncertainties which describes the distances in the context of missing values. + */ + nullUncertainties?: Record; + /** + * The parameter of the lebesgue space. + */ + p: number; + /** + * The list of strings that make up the path to the set of hyperparameters within the larger hyperparameter map. + */ + paramPath?: string[]; + /** + * Flag indicating if deviations are used in the distance metric. + */ + useDeviations?: boolean; +}; diff --git a/src/types/schemas/Impute.ts b/src/types/schemas/Impute.ts new file mode 100644 index 0000000..bbf31cb --- /dev/null +++ b/src/types/schemas/Impute.ts @@ -0,0 +1,34 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Impute + * + * Imputes the model, filling in all the (null) feature values + */ + +export type ImputeRequest = { + /** + * A positive integer, specifying how many rows to fill before recomputing entropy. default is 1 which should return the + * best accuracy since it'll recompute it everytime. higher values should improve performance but may decrease accuracy of results + * @default 1 + */ + batch_size?: number; + + /** + * List of features to use for imputation. if unspecified will use all the features in the dataset + * @default [] + */ + features?: string[]; + + /** + * List of features to impute. if unspecified will use features + * @default [] + */ + features_to_impute?: string[]; + + /** + * The session id for this impute + * @default "none" + */ + session?: string; +}; diff --git a/src/types/schemas/LoadSubtrainee.ts b/src/types/schemas/LoadSubtrainee.ts new file mode 100644 index 0000000..c9d80f8 --- /dev/null +++ b/src/types/schemas/LoadSubtrainee.ts @@ -0,0 +1,37 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * LoadSubtrainee + * + * Attempts to load a subtrainee with the following optional parameters. + * if a parameter is not specified, it will look to this entity's own label of the same name. + * if the saved instance does not exist the existing trainee will remain unmodified and the function will return null. + * assumes loaded trainee filenames need to be escaped + * returns the trainee name if successful, null if not + */ + +export type LoadSubtraineeRequest = { + /** + * Name to load (without extension) + * @default "" + */ + filename?: string; + + /** + * Base path to load from + * @default "" + */ + filepath?: string; + + /** + * Flag, default to false. if set to true will load each case from its individual file + * @default false + */ + separate_files?: boolean; + + /** + * Name path of trainee to load + * @default "" + */ + trainee?: string | string[]; +}; diff --git a/src/types/schemas/MoveCases.ts b/src/types/schemas/MoveCases.ts new file mode 100644 index 0000000..bd3646e --- /dev/null +++ b/src/types/schemas/MoveCases.ts @@ -0,0 +1,75 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * MoveCases + * + * Moves all cases that match the specified conditions in the hierarchy of the specified trainee + */ +import type { CaseIndices } from "./CaseIndices"; +import type { Condition } from "./Condition"; +import type { Precision } from "./Precision"; + +export type MoveCasesRequest = { + /** + * A list of session id and training index tuples that specify which cases are to be moved + */ + case_indices?: CaseIndices; + + /** + * Assoc of feature->value(s) (no value = must have feature, one value = must equal exactly the value, two values = inclusive between). ignored if case_indices is specified. + * @default {} + */ + condition?: Condition; + + /** + * Name of feature into which to distribute the removed cases' weights to their neighbors. + * applicable only if not preserving session data. + */ + distribute_weight_feature?: string; + + /** + * Limit on the number of cases to move; if set to zero there will be no limit. ignored if case_indices is specified. + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + */ + num_cases?: number; + + /** + * Flag, whether to query for 'exact' matches; if set to 'similar' will move num_cases with the most similar values. ignored if case_indices is specified. + * @default "exact" + */ + precision?: Precision; + + /** + * If true will just move cases from source to target, otherwise will do session cleanup + * @default false + */ + preserve_session_data?: boolean; + + /** + * The session id when this call is being made. used for training the cases into the target_trainee once when not preserving session data. + * @default "none" + */ + session?: string; + + /** + * Id of source trainee from which to move cases. ignored if source_name_path is specified. + * if neither source_name_path nor source_id are specified, moves cases from the trainee itself. + */ + source_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee from which to move cases. + */ + source_name_path?: string[]; + + /** + * Id of target trainee to move cases to. ignored if target_name_path is specified. + * if neither target_name_path nor target_id are specified, moves cases to the trainee itself. + */ + target_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee to move cases to. + */ + target_name_path?: string[]; +}; diff --git a/src/types/schemas/NewCaseThreshold.ts b/src/types/schemas/NewCaseThreshold.ts new file mode 100644 index 0000000..f5dc17e --- /dev/null +++ b/src/types/schemas/NewCaseThreshold.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * NewCaseThreshold + */ + +/** + * The privacy distance criteria for generated new cases. + */ +export type NewCaseThreshold = "min" | "max" | "most_similar"; diff --git a/src/types/schemas/Precision.ts b/src/types/schemas/Precision.ts new file mode 100644 index 0000000..6eba86c --- /dev/null +++ b/src/types/schemas/Precision.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Precision + */ + +/** + * Exact matching or fuzzy matching. + */ +export type Precision = "exact" | "similar"; diff --git a/src/types/schemas/PredictionStat.ts b/src/types/schemas/PredictionStat.ts new file mode 100644 index 0000000..72e5642 --- /dev/null +++ b/src/types/schemas/PredictionStat.ts @@ -0,0 +1,21 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * PredictionStat + */ + +/** + * Types of prediction statistics. + */ +export type PredictionStat = + | "mae" + | "confusion_matrix" + | "r2" + | "rmse" + | "spearman_coeff" + | "precision" + | "recall" + | "accuracy" + | "mcc" + | "all" + | "missing_value_accuracy"; diff --git a/src/types/schemas/React.ts b/src/types/schemas/React.ts new file mode 100644 index 0000000..8feb249 --- /dev/null +++ b/src/types/schemas/React.ts @@ -0,0 +1,381 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * React + * + * Run reacts in a batch, output a an assoc of list of outputs from each individual react. + */ +import type { CaseIndices } from "./CaseIndices"; +import type { DesiredConviction } from "./DesiredConviction"; +import type { FeatureBoundsMap } from "./FeatureBoundsMap"; +import type { GenerateNewCases } from "./GenerateNewCases"; +import type { ReactDetails } from "./ReactDetails"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type ReactRequest = { + /** + * Full list of features to output values for the case + * @default [] + */ + action_features?: string[]; + + /** + * ;values of action features. if specified will bypass react and only do the explanation if details is set. + * if specified must be either length of 1 or num_reacts. one list us used per individual reaction + */ + action_values?: any[][]; + + /** + * Flag, if set to true will allow return of null values if there are nulls in the local model for the action features. applicable + * only to discriminative reacts. + * @default false + */ + allow_nulls?: boolean; + + /** + * Pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was + * trained into the session. if this case does not exist, discriminative react outputs null, generative react ignores it. + * if specified must be either length of 1 or num_reacts. + */ + case_indices?: CaseIndices; + + /** + * List of context features. for generative react, features used to condition the generated case + * @default [] + */ + context_features?: string[]; + + /** + * 2d-list of context values. for generative react, values used to condition the generated case + * if specified must be either length of 1 or num_reacts. one list is used per individual reaction + */ + context_values?: any[][]; + + /** + * List of action features whose values should be computed from the resulting action prior to output, in the specified + * order. must be a subset of action_features. + * note: both of these derived feature lists rely on the features' "derived_feature_code" attribute to compute the values. + * if 'derived_feature_code' attribute is undefined or references non-0 feature indices, the derived value will be null. + * @default [] + */ + derived_action_features?: string[]; + + /** + * List of context features whose values should be computed from the provided contexts in the specified order. + * must be different than context_features. + * @default [] + */ + derived_context_features?: string[]; + + /** + * If null, will do a discriminative react. if specified, will do a generative react + * for generative react, value of desired avg conviction of generated cases, in the range of (0,infinity] with 1 as standard + * larger values will increase the variance (or creativity) of the generated case from the existing model + * smaller values will decrease the variance (or creativity) of the generated case from the existing model + */ + desired_conviction?: DesiredConviction; + + /** + * An assoc of flags for which type of audit data to return, and corresponding values to return (if applicable) in the format of: + * (assoc + * "influential_cases" true or false. if true outputs the most influential cases and their influence weights + * based on the surprisal of each case relative to the context being predicted among the + * cases. uses only the context features of the reacted case. + * + * "influential_cases_familiarity_convictions" true or false. if true outputs familiarity conviction of + * addition for each of the influential cases. + * + * "influential_cases_raw_weights" true or false. if true outputs the surprisal for each of the influential cases. + * not applicable to generative reacts. + * + * "derivation_parameters" true or false. if true outputs the parameters used during the react. these parameters + * include k, p, distance_transform, feature_weights, feature_deviations, nominal_class_counts, and flags to indicate + * if deviations or inverse residual weighting were used. + * + * "hypothetical_values" assoc context feature -> values. if specified, shows how a prediction could change + * in a what-if scenario where the influential cases' context feature values are replaced with + * the specified values. iterates over all influential cases, predicting the action features + * for each one using the updated hypothetical values. outputs the predicted arithmetic + * average over the influential cases for each action feature. + * + * "most_similar_cases" true or false. if true outputs an automatically determined (when + * 'num_most_similar_cases' is not specified) relevant number of similar cases, which will + * first include the influential cases. uses only the context features of the reacted case. + * + * "num_most_similar_cases" integer. outputs this manually specified number of most similar cases, which will + * first include the influential cases. + * + * "num_most_similar_case_indices" integer. outputs the specified number of most similar case indices when + * 'distance_ratio' is also set to true. + * + * "boundary_cases" true or false. if true outputs an automatically determined (when 'num_boundary_cases' is + * not specified) relevant number of boundary cases. uses both context and action features + * of the reacted case to determine the counterfactual boundary based on action features, + * which maximize the dissimilarity of action features while maximizing the similarity of + * context features. if action features aren't specified, uses familarity conviction to + * determine the boundary instead. + * + * "num_boundary_cases" integer. outputs this manually specified number of boundary cases. + * + * 'boundary_cases_familiarity_convictions" true or false. if true outputs familiarity conviction of addition for + * each of the boundary cases when 'boundary_cases' is also set to true. + * + * "distance_ratio" true or false. if true outputs the ratio of distance (relative surprisal) between this + * reacted case and its nearest case to the minimum distance (relative surprisal) in between + * the closest two cases in the local area. all distances are computed using only the + * specified context features. + * + * "distance_contribution" true of false. if true outputs the distance contribution (expected total surprisal + * contribution) for the reacted case. uses both context and action feature values. + * + * "similarity_conviction" true or false. if true outputs similarity conviction for the reacted case. + * uses both context and action feature values as the case values for all computations. this is + * defined as expected (weighted-local) distance contribution / reacted case distance contribution. + * + * "outlying_feature_values" true or false. if true outputs the reacted case's context feature values that are + * outside the min or max of the corresponding feature values of all the cases in the local + * model area. uses only the context features of the reacted case to determine that area. + * + * "categorical_action_probabilities" true or false. if true outputs probabilities for each class for the action + * features. applicable only to categorical action features. single_react_series calls additionally + * output "aggregate_categorical_action_probabilities" for each series. + * + * "observational_errors" true or false. if true outputs observational errors for all features as defined + * in feature attributes. + * + * "feature_residuals_robust" true or false. if true outputs feature residuals for all (context and action) features + * locally around the prediction. uses only the context features of the reacted case to + * determine that area. uses robust calculations, which uses uniform sampling from + * the power set of features as the contexts for predictions. + * + * "feature_residuals_full" true or false. if true outputs feature residuals for all (context and action) features + * locally around the prediction. uses only the context features of the reacted case to + * determine that area. uses full calculations, which uses leave-one-out context features for computations. + * + * "prediction_stats" true or false. if true outputs full feature prediction stats for all (context and action) + * features locally around the prediction. the stats eligible to be returned are ("r2", "rmse", "spearman_coeff", + * "precision", "recall", "accuracy", "mcc", "confusion_matrix", "missing_value_accuracy"). confusion matrices + * may also be returned by setting 'confusion_matrices' to true. uses only the context features of the + * reacted case to determine that area. uses full calculations, which uses leave-one-out context features for + * computations. + * + * "feature_mda_robust" true or false. if true outputs each context feature's robust mean decrease in accuracy of predicting + * the action feature given the context. uses only the context features of the reacted + * case to determine that area. uses robust calculations, which uses uniform sampling from + * the power set of features as the contexts for predictions. + * + * "feature_mda_full" true or false. if true outputs each context feature's full mean decrease in accuracy of predicting + * the action feature given the context. uses only the context features of the reacted + * case to determine that area. uses full calculations, which uses leave-one-out context features for computations. + * + * "feature_mda_ex_post_robust" true or false. if true outputs each context feature's mean decrease in accuracy of + * predicting the action feature as a detail given that the specified prediction was + * already made as specified by the action value. uses both context and action features of + * the reacted case to determine that area. uses robust calculations, which uses uniform sampling from + * the power set of features as the contexts for predictions. + * + * "feature_mda_ex_post_full" true or false. if true outputs each context feature's mean decrease in accuracy of + * predicting the action feature as a detail given that the specified prediction was + * already made as specified by the action value. uses both context and action features of + * the reacted case to determine that area. uses full calculations, which uses leave-one-out for features for computations. + * + * "feature_contributions_robust" true or false. if true outputs each context feature's differences between the + * predicted action feature value and the predicted action feature value if each context + * feature were not in the model for all context features in the local model area. outputs + * both 'feature_contributions' and non-absolute 'directional_feature_contributions'. + * uses robust calculations, which uses uniform sampling from the power set of features as + * the contexts for predictions. + * + * "feature_contributions_full" true or false. if true outputs each context feature's differences between the + * predicted action feature value and the predicted action feature value if each context + * feature were not in the model for all context features in the local model area. outputs + * both 'feature_contributions' and non-absolute 'directional_feature_contributions'. + * uses full calculations, which uses leave-one-out context features for computations. + * + * "case_mda_robust" true or false. if true outputs each influential case's mean decrease in accuracy of predicting + * the action feature in the local model area, as if each individual case were included + * versus not included. uses only the context features of the reacted case to determine + * that area. uses robust calculations, which uses uniform sampling from the power set of all combinations of cases. + * + * "case_mda_full" true or false. if true outputs each influential case's mean decrease in accuracy of predicting + * the action feature in the local model area, as if each individual case were included + * versus not included. uses only the context features of the reacted case to determine + * that area. uses full calculations, which uses leave-one-out for cases for computations. + * + * "case_contributions_robust" true or false. if true outputs each influential case's differences between the + * predicted action feature value and the predicted action feature value if each + * individual case were not included. uses only the context features of the reacted case + * to determine that area. uses robust calculations, which uses uniform sampling from the power set of all + * combinations of cases. + * + * "case_contributions_full" true or false. if true outputs each influential case's differences between the + * predicted action feature value and the predicted action feature value if each + * individual case were not included. uses only the context features of the reacted case + * to determine that area. uses full calculations, which uses leave-one-out for cases for computations. + * + * "case_feature_residuals_robust" true or false. if true outputs feature residuals for all (context and action) + * features for just the specified case. uses leave-one-out for each feature, while + * using the others to predict the left out feature with their corresponding values + * from this case. uses robust calculations, which uses uniform sampling from + * the power set of features as the contexts for predictions. + * + * "case_feature_residuals_full" true or false. if true outputs feature residuals for all (context and action) + * features for just the specified case. uses leave-one-out for each feature, while + * using the others to predict the left out feature with their corresponding values + * from this case. uses full calculations, which uses leave-one-out context features for computations. + * + * "case_feature_contributions_robust" true or false. if true outputs each context feature's differences between the + * predicted action feature value and the predicted action feature value if each context + * feature were not in the model for all context features in this case, using only the + * values from this specific case. uses robust calculations, which uses uniform sampling from + * the power set of features as the contexts for predictions. + * + * "case_feature_contributions_full" true or false. if true outputs each context feature's differences between the + * predicted action feature value and the predicted action feature value if each context + * feature were not in the model for all context features in this case, using only the + * values from this specific case. uses full calculations, which uses leave-one-out context features for computations. + * + * "num_robust_influence_samples_per_case" integer. specifies the number of robust samples to use for each case. + * applicable only for computing robust feature contributions or robust case feature contributions. + * when unspecified, defaults to 2000. higher values will take longer but provide more stable results. + * + * "case_feature_residual_convictions_robust" true or false. if true outputs this case's robust feature residual + * convictions for the region around the prediction. uses only the context features of + * the reacted case to determine that region. computed as: region feature residual / case feature residual. + * uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. + * + * "case_feature_residual_convictions_full" true or false. if true outputs this case's full feature residual + * convictions for the region around the prediction. uses only the context features of + * the reacted case to determine that region. computed as: region feature residual / case feature residual. + * uses full calculations, which uses leave-one-out context features for computations. + * + * "features" list of features that specifies what features to calculate per-feature details for. (contributions, mda, residuals, etc) + * when robust computations are false. this should generally preserve compute, but will not when computing details robustly. + * + * "generate_attempts" true or false. if true, outputs the total number of attempts to generate the unique case. only applicable for generative + * reacts. when used with reactseries, "series_generate_attempts" is also returned. + * ) + */ + details?: ReactDetails; + + /** + * If true will exclude sensitive features whose values will be + * replaced after synthesis from uniqueness check. + * only applicable when desired_conviction is specified. + * @default false + */ + exclude_novel_nominals_from_uniqueness_check?: boolean; + + /** + * List of additional features to return with audit data + * @default [] + */ + extra_features?: string[]; + + /** + * Assoc of : + * to ensure that specified features' generated values stay in bounds + * for nominal features instead of min/max it's a set of allowed values, ie: + * allow_null - default is true, if true nulls may be generated per their distribution in the data + * only used when desired_conviction is specified + * @default {} + */ + feature_bounds_map?: Record; + + /** + * Enum, acceptable values are: + * null or 'no' : output any generated case + * 'always' : only output original cases, outputs null for all feature values if unable to generate a new case + * 'attempt' : output any generated case only if generation fails all initial attempts to output original cases + * @default "no" + */ + generate_new_cases?: GenerateNewCases; + + /** + * Flag, if set to true assumes provided categorical (nominal or ordinal) feature values already been substituted. + * @default false + */ + input_is_substituted?: boolean; + + /** + * Series id, if specified will store an internal record of all reacts for that series + */ + into_series_store?: string; + + /** + * Flag, if set to true and specified along with case_indices, will set ignore_case to the one specified by case_indices. + */ + leave_case_out?: boolean; + + /** + * Distance to determine privacy cutoff. used to query the local minimum distance used in the distance ratio + * accepted values: + * 'max': the maximum local distance + * 'min': the minimum local distance + * 'most_similar': the closest distance of the most similar case + * null: the minimum local distance + * @default "min" + */ + new_case_threshold?: "min" | "max" | "most_similar"; + + /** + * Total number of cases to generate for generative reacts. + */ + num_cases_to_generate?: number; + + /** + * Flag, if true order of generated feature values will match the order of features + * @default false + */ + ordered_by_specified_features?: boolean; + + /** + * List of feature names that will be made available during the execution of post_process feature attributes + * @default [] + */ + post_process_features?: string[]; + + /** + * 2d-list of values corresponding to post_process_features that will be made available during the execution of post_process feature attributes. + * if specified must be either length of 1 or num_reacts. one list is used per individual reaction. + */ + post_process_values?: any[][]; + + /** + * List of features that will preserve their values from the case specified by case_indices, appending and + * overwriting the specified context and context features as necessary. for generative reacts, if case_indices isn't specified, + * will preserve feature values of a random case. + * @default [] + */ + preserve_feature_values?: string[]; + + /** + * See #react for description. if specified must be length of num_reacts. + */ + rand_seed?: any[]; + + /** + * Flag, default is true, only applicable if a substitution value map has been set. if set to false, will not substitute categorical feature values. + * only used when desired_conviction is specified + * @default true + */ + substitute_output?: boolean; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. + * if a weight is missing, uses 1 as the weight. if unspecified, case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Flag, if false uses model feature residuals, if true recalculates regional model residuals. only used when desired_conviction is specified + * @default true + */ + use_regional_model_residuals?: boolean; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/ReactAggregate.ts b/src/types/schemas/ReactAggregate.ts new file mode 100644 index 0000000..3d0bf53 --- /dev/null +++ b/src/types/schemas/ReactAggregate.ts @@ -0,0 +1,191 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactAggregate + * + * Computes, caches, and returns specified details and feature prediction statistics such as mean decrease in accuracy (mda), residuals (accuracy, mean absolute error), + * precision, recall, etc. returns details and feature prediction stats for all features in the format of feature -> assoc stat -> value + */ +import type { ReactAggregateDetails } from "./ReactAggregateDetails"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type ReactAggregateRequest = { + /** + * Target feature for which to do computations. if "prediction_stats_action_feature" and "feature_influences_action_feature" + * are not provided, they will default to this value. + */ + action_feature?: string; + + /** + * List of features to do residuals and prediction stats computations for. default is the value of context_features + * @default [] + */ + action_features?: string[]; + + /** + * Number, optional, default is 15. applicable only to confusion matrices when computing residuals, the number of predictions + * a class should have (value of a cell in the matrix) for it to remain in the confusion matrix. if the count is less than this value, it will + * be accumulated into a single value of all insignificant predictions for the class and removed from the confusion matrix. + * @default 15 + */ + confusion_matrix_min_count?: number; + + /** + * List of features to use as contexts for computations. default is all features if unspecified. + * @default [] + */ + context_features?: string[]; + + /** + * Assoc, optional. an assoc of flags for which type of audit data to return, and corresponding values to return (if applicable) in the format of: + * (assoc + * prediction_stats: optional true/false. if true outputs full feature prediction stats for all (context and action) + * features. the prediction stats returned are set by the "selected_prediction_stats" parameter. uses full calculations, which + * uses leave-one-out for features for computations. uses full computation. + * feature_residuals_full: optional, none/true/false. for each context_feature, use the full set of all other context_features to + * predict the feature. when true, computes, caches, and returns the residuals for all features. uses full computation. + * when "prediction_stats" in the "details" parameter is true, it will also compute and cache the feature residuals. + * feature_residuals_robust: optional, none/true/false. for each context_feature, computes, caches, and returns the same stats as residuals but using the robust + * (power set/permutations) set of all other context_features to predict the feature. uses robust computation. + * feature_contributions_full: optional, none/true/false. for each context_feature, use the full set of all other context_features to compute the + * mean absolute delta between prediction of action_feature with and without the context_feature in the model. uses full computation. + * feature_contributions_robust: optional, none/true/false. for each context_feature, use the robust (power set/permutation) set of all other context_features + * to compute the mean absolute delta between prediction of action_feature with and without the context_feature in the model. uses robust computation. + * uses robust computation. + * feature_mda_full: optional, none/true/false. if true will compute mean decrease in accuracy (feature_mda) for each context feature at predicting mda_action_features. + * drop each feature and use the full set of remaining context features for each prediction. uses full computation. + * feature_mda_permutation_full: optional, none/true/false. compute feature_mda_full by scrambling each feature and using the full set of remaining context features + * for each prediction. uses full computation. + * feature_mda_robust: optional, none/true/false. compute feature_mda by dropping each feature and using the robust (power set/permutations) set of + * remaining context features for each prediction. uses robust computation. + * feature_mda_permutation_robust: optional, none/true/false. compute feature_mda by scrambling each feature and using the robust (power set/permutations) + * set of remaining context features for each prediction. uses robust computation. + * selected_prediction_stats": list of strings, optional. allowed values are: + * "mae" : mean absolute error. for continuous features, this is calculated as the mean of absolute values of the difference + * between the actual and predicted values. for nominal features, this is 1 - the average categorical action probability of each case's + * correct classes. categorical action probabilities are the probabilities for each class for the action feature. + * "r2": r-squared coefficient of determination, for continuous features only. + * "rmse": root mean squared error, for continuous features only. + * "spearman_coeff": spearman's rank correlation coefficient, for continuous features only. + * "precision": precision (positive predictive) value for nominal features only. aggregated by taking the unweighted means of each classes' precisions. + * "recall": recall (sensitivity) value for nominal features only. aggregated by taking the unweighted means of each classes' recalls. + * "accuracy": the number of correct predictions divided by the total number of predictions. + * "confusion_matrix": a matrix showing the number of predicted values of each class + * for each unique value of the predicted feature. outputs the sparse confusion matrix. + * "missing_value_accuracy" : the number of correct predictions on cases with missing values values divided by the total number of cases with missing + * values for a specified feature. + * "all": all of the available prediction stats including the confusion_matrix + * if empty, will return all of the available prediction stats not including the confusion matrices. + * action_condition: assoc of feature->value(s), optional. if specified, will condition the action set, which is the dataset for which the prediction stats are for. + * if both 'action_condition' and 'context_condition' are provided, then all of the action cases selected by the 'action_condition' + * will be excluded from the context set, which is the set being queried to make to make predictions on the action set, effectively holding them out. + * if only 'action_condition' is specified, then only the single predicted case will be left out. + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * two values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + * action_condition_precision: optional string, default is 'exact', used only with 'action_condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + * action_num_samples: optional, limit on the number of action cases used in calculating conditional prediction stats. works with or without 'action_condition_filter_query'. + * if 'action_condition' is set: + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + * if 'action_condition' is not set: + * if null, will be set to the howso default limit of 2000. default is null + * context_condition: assoc of feature->value(s), optional. if specified, will condition the context set, which is the set being queried to make to make predictions on the action set. + * if both 'action_condition' and 'context_condition' are provided, then all of the cases from the action set, which is the dataset for which the prediction stats are for, + * will be excluded from the context set, effectively holding them out. if only 'action_condition' is specified, then only the single predicted case will be left out. + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * two values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + * context_condition_precision: optional string, default is 'exact'. used only with 'context_condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + * context_num_samples: optional, limit on the number of context cases when 'context_condition_precision' is set to 'similar'. + * if null, will be set to k. default is null + * prediction_stats_features: list of string, optional. list of features to use when calculating conditional prediction stats. should contain all action and context features desired. if + * 'action_feature' is also provided, that feature will automatically be appended to this list if it is not already in the list + * "feature_residuals_robust" true or false. if true outputs feature residuals for all (context and action) features + * locally around the prediction. uses only the context features of the reacted case to + * determine that area. + * ) + */ + details?: ReactAggregateDetails; + + /** + * When feature influences such as contributions and mda, use this feature as the action feature. + * if not provided, will default to the "action_feature" if provided. + */ + feature_influences_action_feature?: string; + + /** + * Full path for hyperparameters to use for computation. + * if specified for any residual computations, takes precendence over action_feature parameter. + */ + hyperparameter_param_path?: string[]; + + /** + * Total sample size of model to use (using sampling with replacement) for robust contribution computation. + * defaults to 300. + */ + num_robust_influence_samples?: number; + + /** + * Specifies the number of robust samples to use for each case for robust contribution computations. + * defaults to 300 + 2 * (number of features). + */ + num_robust_influence_samples_per_case?: number; + + /** + * Total sample size of model to use (using sampling with replacement) for robust feature_mda and residual computation. + * defaults to 1000 * (1 + log(number of features)). note: robust feature_mda will be updated to use num_robust_influence_samples in a future release. + */ + num_robust_residual_samples?: number; + + /** + * Total sample size of model to use (using sampling with replacement) for all non-robust computation. + * defaults to 1000. if specified overrides sample_model_fraction. + */ + num_samples?: number; + + /** + * When calculating residuals and prediction stats, uses this target features's hyperparameters. the trainee must + * have been analyzed with this feature as the action feature first. if both "prediction_stats_action_feature" and "action_feature" are not provided, + * by default residuals and prediction stats uses ".targetless" hyperparameters. if "action_feature" is provided, and this value is not provided, will + * default to the value of "action_feature". + */ + prediction_stats_action_feature?: string; + + /** + * Flag, optional. if specified, will attempt to return stats that were computed using hyperpparameters with the + * specified robust or non-robust type. + */ + robust_hyperparameters?: boolean; + + /** + * Value 0.0 - 1.0, percent of model to use in sampling (using sampling without replacement). + * applicable only to non-robust computation. ignored if num_samples is specified. + */ + sample_model_fraction?: number; + + /** + * If specified will calculate only on a sub model of the specified size from the full model. + * applicable only to models > 1000 cases. + */ + sub_model_size?: number; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. if unspecified, + * case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * "generate_attempts" true or false. if true, outputs the total number of attempts to generate the unique case. only applicable for generative + * reacts where generate_new_cases is "always" or "attempt". when used with reactseries, "series_generate_attempts" is also returned. + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/ReactAggregateDetails.ts b/src/types/schemas/ReactAggregateDetails.ts new file mode 100644 index 0000000..fdc4c38 --- /dev/null +++ b/src/types/schemas/ReactAggregateDetails.ts @@ -0,0 +1,81 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactAggregateDetails + */ +import type { Condition } from "./Condition"; +import type { Precision } from "./Precision"; +import type { SelectedPredictionStats } from "./SelectedPredictionStats"; + +export type ReactAggregateDetails = { + /** + * If specified, will condition the action set, which is the dataset for which the prediction stats are for. if both 'action_condition' and 'context_condition' are provided, then all of the action cases selected by the 'action_condition' will be excluded from the context set, which is the set being queried to make to make predictions on the action set, effectively holding them out. if only 'action_condition' is specified, then only the single predicted case will be left out. + */ + action_condition?: Condition; + /** + * Used only with 'action_condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + */ + action_condition_precision?: Precision; + /** + * Limit on the number of action cases used in calculating conditional prediction stats. works with or without 'action_condition_filter_query'. + * if 'action_condition' is set: + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + * + * if 'action_condition' is not set: + * if null, will be set to the howso default limit of 2000. default is null + */ + action_num_samples?: number; + /** + * If specified, will condition the context set, which is the set being queried to make to make predictions on the action set. if both 'action_condition' and 'context_condition' are provided, then all of the cases from the action set, which is the dataset for which the prediction stats are for, will be excluded from the context set, effectively holding them out. if only 'action_condition' is specified, then only the single predicted case will be left out. + */ + context_condition?: Condition; + /** + * Optional, limit on the number of context cases when 'context_condition_precision' is set to 'similar'. if null, will be set to k. default is null. + */ + context_condition_num_samples?: number; + /** + * Default is 'exact'. used only with 'context_condition' parameter, will find exact matches if 'exact' and similar cases if 'similar'. + */ + context_condition_precision?: Precision; + /** + * If true will for each context_feature, use the full set of all other context_features to compute the mean absolute delta between prediction of action_feature with and without the context_feature in the model. uses full computation. + */ + feature_contributions_full?: boolean; + /** + * For each context_feature, use the robust (power set/permutation) set of all other context_features to compute the mean absolute delta between prediction of action_feature with and without the context_feature in the model. uses robust computation. uses robust computation. + */ + feature_contributions_robust?: boolean; + /** + * If true will compute mean decrease in accuracy (feature_mda) for each context feature at predicting mda_action_features. drop each feature and use the full set of remaining context features for each prediction. false removes cached values. uses full computation. + */ + feature_mda_full?: boolean; + /** + * If true will compute feature_mda_full by scrambling each feature and using the full set of remaining context features for each prediction. false removes cached values. uses full computation. + */ + feature_mda_permutation_full?: boolean; + /** + * If true will compute feature_mda by scrambling each feature and using the robust (power set/permutations) set of remaining context features for each prediction. false removes cached values. uses robust computation. + */ + feature_mda_permutation_robust?: boolean; + /** + * If true will compute feature_mda by dropping each feature and using the robust (power set/permutations) set of remaining context features for each prediction. false removes cached values. uses robust computation. + */ + feature_mda_robust?: boolean; + /** + * If true, will for each context_feature, use the full set of all other context_features to predict the feature. when true, computes, caches, and returns the residuals for all features. uses full computation. when "prediction_stats" in the "details" parameter is true, it will also compute and cache the feature residuals. + */ + feature_residuals_full?: boolean; + /** + * If true, will for each context_feature, computes, caches, and returns the same stats as residuals but using the robust (power set/permutations) set of all other context_features to predict the feature. uses robust computation. + */ + feature_residuals_robust?: boolean; + /** + * If true outputs full feature prediction stats for all (context and action) features. the prediction stats returned are set by the `"selected_prediction_stats`" parameter. uses full calculations, which uses leave-one-out for features for computations. uses full computation. + */ + prediction_stats?: boolean; + /** + * List of features to use when calculating conditional prediction stats. should contain all action and context features desired. if 'action_feature' is also provided, that feature will automatically be appended to this list if it is not already in the list + */ + prediction_stats_features?: string[]; + selected_prediction_stats?: SelectedPredictionStats; +}; diff --git a/src/types/schemas/ReactDetails.ts b/src/types/schemas/ReactDetails.ts new file mode 100644 index 0000000..a9e749a --- /dev/null +++ b/src/types/schemas/ReactDetails.ts @@ -0,0 +1,166 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactDetails + */ +import type { SelectedPredictionStats } from "./SelectedPredictionStats"; + +export type ReactDetails = { + /** + * When true, outputs an automatically determined (when 'num_boundary_cases' is not specified) relevant number of boundary cases. uses both context and action features of the reacted case to determine the counterfactual boundary based on action features, which maximize the dissimilarity of action features while maximizing the similarity of context features. if action features aren't specified, uses familiarity conviction to determine the boundary instead. + */ + boundary_cases?: boolean; + /** + * When true, outputs familiarity conviction of addition for each of the boundary cases. + */ + boundary_cases_familiarity_convictions?: boolean; + /** + * If true outputs each influential case's differences between the + */ + case_contributions_full?: boolean; + /** + * If true outputs each influential case's differences between the predicted action feature value and the predicted action feature value if each individual case were not included. uses only the context features of the reacted case to determine that area. uses robust calculations, which uses uniform sampling from the power set of all combinations of cases. + */ + case_contributions_robust?: boolean; + /** + * If true outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context feature were not in the model for all context features in this case, using only the values from this specific case. uses full calculations, which uses leave-one-out for cases for computations. directional case feature contributions are returned under the 'case_directional_feature_contributions_full' key. + */ + case_feature_contributions_full?: boolean; + /** + * If true outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context feature were not in the model for all context features in this case, using only the values from this specific case. uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. directional case feature contributions are returned under the 'case_directional_feature_contributions_robust' key. + */ + case_feature_contributions_robust?: boolean; + /** + * If true, outputs feature residuals for all (context and action) features for just the specified case. uses leave-one-out for each feature, while using the others to predict the left out feature with their corresponding values from this case. uses full calculations, which uses leave-one-out for cases for computations. + */ + case_feature_residuals_full?: boolean; + /** + * If true, outputs feature residuals for all (context and action) features for just the specified case. uses leave-one-out for each feature, while using the others to predict the left out feature with their corresponding values from this case. uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. + */ + case_feature_residuals_robust?: boolean; + /** + * If true, outputs this case's feature residual model. computed as: model feature full residual divided by case feature full residual. + */ + case_feature_residual_convictions_full?: boolean; + /** + * If true, outputs this case's feature residual model. computed as: model feature robust residual divided by case feature robust residual. + */ + case_feature_residual_convictions_robust?: boolean; + /** + * If true, outputs each influential case's mean decrease in accuracy of predicting the action feature in the local model area, as if each individual case were included versus not included. uses only the context features of the reacted case to determine that area. uses full calculations, which uses leave-one-out for cases for computations. + */ + case_mda_full?: boolean; + /** + * If true, outputs each influential case's mean decrease in accuracy of predicting the action feature in the local model area, as if each individual case were included versus not included. uses only the context features of the reacted case to determine that area. uses robust calculations, which uses uniform sampling from the power set of all combinations of cases. + */ + case_mda_robust?: boolean; + /** + * When true, outputs probabilities for each class for the action. applicable only to categorical action features. + */ + categorical_action_probabilities?: boolean; + /** + * If true, outputs a dictionary of the parameters used in the react call. these include k, p, distance_transform, feature_weights, feature_deviations, and nominal_class_counts. + */ + derivation_parameters?: boolean; + /** + * When true, outputs the distance contribution (expected total surprisal contribution) for the reacted case. uses both context and action feature values. + */ + distance_contribution?: boolean; + /** + * When true, outputs the ratio of distance (relative surprisal) between this reacted case and its nearest case to the minimum distance (relative surprisal) in between the closest two cases in the local area. all distances are computed using only the specified context features. + */ + distance_ratio?: boolean; + /** + * A list of feature names that specifies for what features will per-feature details be computed (residuals, contributions, mda, etc.). this should generally preserve compute, but will not when computing details robustly. details will be computed for all context and action features if this is not specified. + */ + features?: string[]; + /** + * If true outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context were not in the model for all context features in the local model area. uses full calculations, which uses leave-one-out for cases for computations. directional feature contributions are returned under the key 'directional_feature_contributions_full'. + */ + feature_contributions_full?: boolean; + /** + * If true outputs each context feature's absolute and directional differences between the predicted action feature value and the predicted action feature value if each context were not in the model for all context features in the local model area uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. directional feature contributions are returned under the key 'directional_feature_contributions_robust'. + */ + feature_contributions_robust?: boolean; + /** + * If true, outputs each context feature's mean decrease in accuracy of predicting the action feature as an explanation detail given that the specified prediction was already made as specified by the action value. uses both context and action features of the reacted case to determine that area. uses full calculations, which uses leave-one-out for cases for computations. + */ + feature_mda_ex_post_full?: boolean; + /** + * If true, outputs each context feature's mean decrease in accuracy of predicting the action feature as an explanation detail given that the specified prediction was already made as specified by the action value. uses both context and action features of the reacted case to determine that area. uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. + */ + feature_mda_ex_post_robust?: boolean; + /** + * When true will compute mean decrease in accuracy (mda) for each context feature at predicting the action feature. drop each feature and use the full set of remaining context features for each prediction. false removes cached values. + */ + feature_mda_full?: boolean; + /** + * Compute mean decrease in accuracy mda by dropping each feature and using the robust (power set/permutations) set of remaining context features for each prediction. false removes cached values. + */ + feature_mda_robust?: boolean; + /** + * If true, outputs feature residuals for all (context and action) features locally around the prediction. uses only the context features of the reacted case to determine that area. uses full calculations, which uses leave-one-out for cases for computations. + */ + feature_residuals_full?: boolean; + /** + * If true, outputs feature residuals for all (context and action) features locally around the prediction. uses only the context features of the reacted case to determine that area. uses robust calculations, which uses uniform sampling from the power set of features as the contexts for predictions. 'selected_prediction_stats' controls the returned prediction stats. + */ + feature_residuals_robust?: boolean; + /** + * When true, outputs the number of attempts taken to generate each case. only applicable when 'generate_new_cases' is "always" or "attempt". when used in react_series, "series_generate_attempts" is also returned. + */ + generate_attempts?: boolean; + /** + * A dictionary of feature name to feature value. if specified, shows how a prediction could change in a what-if scenario where the influential cases' context feature values are replaced with the specified values. iterates over all influential cases, predicting the action features each one using the updated hypothetical values. outputs the predicted arithmetic over the influential cases for each action feature. + */ + hypothetical_values?: Record; + /** + * When true, outputs the most influential cases and their influence weights based on the surprisal of each case relative to the context being predicted among the cases. uses only the context features of the reacted case. + */ + influential_cases?: boolean; + /** + * When true, outputs familiarity conviction of addition for each of the influential cases. + */ + influential_cases_familiarity_convictions?: boolean; + /** + * When true, outputs the surprisal for each of the influential cases. + */ + influential_cases_raw_weights?: boolean; + /** + * When true, outputs an automatically determined (when 'num_most_similar_cases' is not specified) relevant number of similar cases, which will first include the influential cases. uses only the context features of the reacted case. + */ + most_similar_cases?: boolean; + /** + * When defined, outputs this manually specified number of boundary cases. takes precedence over 'boundary_cases' parameter. + */ + num_boundary_cases?: number; + /** + * When defined, outputs this manually specified number of most similar cases, which will first include the influential cases. takes precedence over 'most_similar_cases' parameter. + */ + num_most_similar_cases?: number; + /** + * When defined, outputs the specified number of most similar case indices when 'distance_ratio' is also set to true. + */ + num_most_similar_case_indices?: number; + /** + * Specifies the number of robust samples to use for each case. applicable only for computing robust feature contributions or robust case feature contributions. defaults to 2000 when unspecified. higher values will take longer but provide more stable results. + */ + num_robust_influence_samples_per_case?: number; + /** + * When true, outputs observational errors for all features as defined in feature attributes. + */ + observational_errors?: boolean; + /** + * When true, outputs the reacted case's context feature values that are outside the min or max of the corresponding feature values of all the cases in the local model area. uses only the context features of the reacted case to determine that area. + */ + outlying_feature_values?: boolean; + /** + * When true outputs feature prediction stats for all (context and action) features locally around the prediction. the stats returned are ("r2", "rmse", "spearman_coeff", "precision", "recall", "accuracy", "mcc", "confusion_matrix", "missing_value_accuracy"). uses only the context features of the reacted case to determine that area. uses full calculations, which uses leave-one-out context features for computations. 'selected_prediction_stats' controls the returned prediction stats. + */ + prediction_stats?: boolean; + selected_prediction_stats?: SelectedPredictionStats; + /** + * When true, outputs similarity conviction for the reacted case. uses both context and action feature values as the case values for all computations. this is defined as expected (local) distance contribution divided by reacted case distance contribution. + */ + similarity_conviction?: boolean; +}; diff --git a/src/types/schemas/ReactGroup.ts b/src/types/schemas/ReactGroup.ts new file mode 100644 index 0000000..4faa9b9 --- /dev/null +++ b/src/types/schemas/ReactGroup.ts @@ -0,0 +1,83 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactGroup + * + * Computes the convictions of an average case for each given hypothetical set of cases specified + * output an assoc react key -> list of corresponding values from each individual group. + * example output for 2 groups: + * (assoc + * "base_model_average_distance_contribution" (list 4.0 4.1) + * "combined_model_average_distance_contribution" (list 4.05 3.9) + * "distance_contributions" (list 4.5 3.2) + * ) + */ +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type ReactGroupRequest = { + /** + * Calculate and output distance contribution ratios in the output assoc + * @default false + */ + distance_contributions?: boolean; + + /** + * Calculate and output familiarity conviction of adding the specified new_cases in the output assoc + * @default true + */ + familiarity_conviction_addition?: boolean; + + /** + * Calculate and output familiarity conviction of removing the specified new_cases in the output assoc + * @default false + */ + familiarity_conviction_removal?: boolean; + + /** + * List of feature names + * @default [] + */ + features?: string[]; + + /** + * Calculate and output the kl divergence of adding the specified new_cases in the output assoc + * @default false + */ + kl_divergence_addition?: boolean; + + /** + * Calculate and output the kl divergence of removing the specified new_cases in the output assoc + * @default false + */ + kl_divergence_removal?: boolean; + + /** + * A list of lists of lists of values corresponding to a list of sets of feature values, where the values are ordered corresponding to + * the features + */ + new_cases: any[][][]; + + /** + * If true will output p value of addition + * @default false + */ + p_value_of_addition?: boolean; + + /** + * If true will output p value of removal + * @default false + */ + p_value_of_removal?: boolean; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. + * if a weight is missing, uses 1 as the weight. if unspecified, case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/ReactIntoFeatures.ts b/src/types/schemas/ReactIntoFeatures.ts new file mode 100644 index 0000000..639f6cb --- /dev/null +++ b/src/types/schemas/ReactIntoFeatures.ts @@ -0,0 +1,67 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactIntoFeatures + * + * Computes various data, such as familiarity convictions and distance contribution for each case in the model and stores them into specified features. + */ +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type ReactIntoFeaturesRequest = { + /** + * The list of case ids for the model to calculate conviction for + */ + case_ids?: (string | number)[][]; + + /** + * True or string, if true will use default value of "distance_contribution" for feature name + */ + distance_contribution?: boolean | string; + + /** + * True or string, if true will use default value of "familiarity_conviction_addition" for feature name + */ + familiarity_conviction_addition?: boolean | string; + + /** + * True or string, if true will use default value of "familiarity_conviction_removal" for feature name + */ + familiarity_conviction_removal?: boolean | string; + + /** + * List of features for which to calculate conviction, will default to trainee's default features if unspecified + */ + features?: string[]; + + /** + * True or string, if true will use default value of "influence_weight_entropy" + */ + influence_weight_entropy?: boolean | string; + + /** + * True or string, default is false. if true will use default value of 'p_value_of_addition' for feature name + */ + p_value_of_addition?: boolean | string; + + /** + * True or string, default is false. if true will use default value of 'p_value_of_removal' for feature name + */ + p_value_of_removal?: boolean | string; + + /** + * True or string, if true will use default value of "similarity_conviction" for feature name + */ + similarity_conviction?: boolean | string; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. if unspecified, + * case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/ReactSeries.ts b/src/types/schemas/ReactSeries.ts new file mode 100644 index 0000000..f6aa486 --- /dev/null +++ b/src/types/schemas/ReactSeries.ts @@ -0,0 +1,257 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReactSeries + * + * React in a series until a series_stop_map condition is met. aggregates rows of data corresponding to the specified context, action, + * derived_context and derived_action features, utilizing previous rows to derive values as necessary. outputs an assoc of "action_features" and + * corresponding "series" where "series" is the completed 'matrix' for the corresponding action_features and derived_action_features. + */ +import type { CaseIndices } from "./CaseIndices"; +import type { DesiredConviction } from "./DesiredConviction"; +import type { FeatureBoundsMap } from "./FeatureBoundsMap"; +import type { GenerateNewCases } from "./GenerateNewCases"; +import type { NewCaseThreshold } from "./NewCaseThreshold"; +import type { ReactDetails } from "./ReactDetails"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type ReactSeriesRequest = { + /** + * List of feature names corresponding to values in each row of action_values + * @default [] + */ + action_features?: string[]; + + /** + * 2d-list of predicted feature values for non time-series features, one list is used per series. + * @default [] + */ + action_values?: any[][]; + + /** + * Pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was + * trained into the session. if this case does not exist, discriminative react outputs null, generative react ignores it. + */ + case_indices?: CaseIndices; + + /** + * List of feature names corresponding to values in each row of context_values + * @default [] + */ + context_features?: string[]; + + /** + * 2d-list of context feature values for non time-series features, one list is used per series. + */ + context_values?: any[][]; + + /** + * Flag, default is false. when true will attempt to continue existing series instead of starting new series. + * if initial_values provide series ids, it will continue those explicitly specified ids, otherwise it will randomly select series to continue. + * note: terminated series with terminators cannot be continued and will result in null output. + * @default false + */ + continue_series?: boolean; + + /** + * List of features corresponding to the values in each row of continue_series_values. + * this value is ignored if continue_series_values is not specified. + */ + continue_series_features?: string[]; + + /** + * 3d-list of values, when specified will continue this specific untrained series as defined by these values. + * continue_series flag will be ignored and treated as true if this value is specified. + */ + continue_series_values?: any[][]; + + /** + * List of action features whose values should be computed from the resulting last row in series, in the specified + * order. must be a subset of action_features. + * note: both of these derived feature lists rely on the features' "derived_feature_code" attribute to compute the values. + * if 'derived_feature_code' attribute is undefined or references non-existing feature indices, the derived value will be null. + * @default [] + */ + derived_action_features?: string[]; + + /** + * List of context features whose values should be computed from the entire series in the specified order. + * must be different than context_features. + * @default [] + */ + derived_context_features?: string[]; + + /** + * If null, will do a discriminative react. if specified, will do a generative react + * for generative react, value of desired avg conviction of generated cases, in the range of (0,infinity] with 1 as standard + * larger values will increase the variance (or creativity) of the generated case from the existing model + * smaller values will decrease the variance (or creativity) of the generated case from the existing model + */ + desired_conviction?: DesiredConviction; + + /** + * See the description for the details parameter of #react + */ + details?: ReactDetails; + + /** + * If true will exclude sensitive features whose values will be + * replaced after synthesis from uniqueness check. + */ + exclude_novel_nominals_from_uniqueness_check?: boolean; + + /** + * List of additional features to return with audit data from details + */ + extra_features?: string[]; + + /** + * Assoc of : + * to ensure that specified features' generated values stay in bounds + * for nominal features instead of min/max it's a set of allowed values, ie: + * allow_null - default is true, if true nulls may be generated per their distribution in the data + * @default {} + */ + feature_bounds_map?: Record; + + /** + * Time step values at which to end synthesis for each series, applicable only for time series. + */ + final_time_steps?: (number | string)[]; + + /** + * Enum, acceptable values are: + * null or 'no' : output any generated case + * 'always' : only output original cases, outputs null for all feature values if unable to generate a new case + * 'attempt' : output any generated case only if generation fails all initial attempts to output original cases + * @default "no" + */ + generate_new_cases?: GenerateNewCases; + + /** + * List of features to condition just the first case in a series, overwrites context_features and + * derived_context_features for that first case. all specified initial features must be in one of: context_features, action_features, + * derived_context_features or derived_action_features. if provided a value that isn't in one of those lists, it will be ignored. + * @default [] + */ + initial_features?: string[]; + + /** + * 2d-list of values corresponding to the initial_features, used to condition just the first case in a series. one list is used per series. + */ + initial_values?: any[][]; + + /** + * Time step values at which to begin synthesis for each series, applicable only for time series. + */ + init_time_steps?: (number | string)[]; + + /** + * Flag, if set to true assumes provided categorical (nominal or ordinal) feature values already been substituted. + * @default false + */ + input_is_substituted?: boolean; + + /** + * Flag, if set to true and specified along with case_indices, will set ignore_case to the one specified by case_indices. + */ + leave_case_out?: boolean; + + /** + * List of maximum sizes each series is allowed to be. default is 3 * model_size, a 0 or less is no limit. + * if forecasting with 'continue_series', this defines the maximum length of the forecast. + */ + max_series_lengths?: number[]; + + /** + * Distance to determine privacy cutoff. used to query the local minimum distance used in the distance ratio + * accepted values: + * 'max': the maximum local distance + * 'min': the minimum local distance + * 'most_similar': the closest distance of the most similar case + * null: the minimum local distance + * @default "min" + */ + new_case_threshold?: NewCaseThreshold; + + /** + * Total number of series to generate, for generative reacts. + * + * all of the following parameters, if specified, must be either length of 1 or equal to the length of + * context_values/case_indices for discriminative reacts, and num_series_to_generate for generative reacts. + */ + num_series_to_generate?: number; + + /** + * Flag, if true order of generated feature values will match the order of features + */ + ordered_by_specified_features?: boolean; + + /** + * Flag, if true series ids are replaced with unique values on output. + * @default true + */ + output_new_series_ids?: boolean; + + /** + * List of features that will preserve their values from the case specified by case_indices, appending and + * overwriting the specified context and context features as necessary. for generative reacts, if case_indices isn't specified, + * will preserve feature values of a random case. + * @default [] + */ + preserve_feature_values?: string[]; + + /** + * List of features corresponding to series_context_values + * @default [] + */ + series_context_features?: string[]; + + /** + * 3d-list of values, context value for each feature for each row of a series. + * if specified max_series_lengths are ignored. + */ + series_context_values?: any[][][]; + + /** + * Controls how closely generated series should follow existing series (plural). + * choices are: "fixed", "dynamic" or "no". if "fixed", tracks the particular relevant series id. if "dynamic", tracks the particular + * relevant series id, but is allowed to change the series id that it tracks based on its current context. if "no", does not track any particular series id. + * @default "fixed" + */ + series_id_tracking?: "fixed" | "dynamic" | "no"; + + /** + * List of assocs of feature -> stop conditions: + * for continuous features: { feature: { "min" : val, "max": val } } - stops series when feature value exceeds max or is smaller than min + * for nominal features: { feature: { "values" : ['val1', 'val2' ]} } - stops series when feature value matches any of the values listed + * specifying ".series_progress" with a value between 0 and 1.0 corresponding to percent completion e.g., { ".series_progress" : .95 } - + * stops series when it progresses at or beyond 95%. + * one assoc is used per series. + * @default [] + */ + series_stop_maps?: Record[]; + + /** + * Flag, default is true, only applicable if a substitution value map has been set. if set to false, will not substitute categorical feature values. + * @default true + */ + substitute_output?: boolean; + + /** + * Flag, whether to use case weights or not. if unspecified will automatically select based on cached parameters + */ + use_case_weights?: UseCaseWeights; + + /** + * Flag, if false uses model feature residuals, if true recalculates regional model residuals. + * @default true + */ + use_regional_model_residuals?: boolean; + + /** + * Name of the feature that stores case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/ReduceData.ts b/src/types/schemas/ReduceData.ts new file mode 100644 index 0000000..e245768 --- /dev/null +++ b/src/types/schemas/ReduceData.ts @@ -0,0 +1,69 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * ReduceData + * + * Reduce the trained data by removing cases which have an influence weight entropy that falls above + * a threshold. + */ +import type { AblationThresholdMap } from "./AblationThresholdMap"; + +export type ReduceDataRequest = { + /** + * A map of measure names (any of the prediction stats) to a map of feature names to threshold value. + * absolute thresholds will cause data reduction to stop when any of the measure values for any of + * the features for which a threshold is defined go avove the threshold (in the case of rmse and + * mae) or below the threshold (otherwise). + * @default {} + */ + abs_threshold_map?: AblationThresholdMap; + + /** + * The number of cases to ablate between analyses and influence weight entropy recalculation + * @default 2000 + */ + batch_size?: number; + + /** + * A map of measure names (any of the prediction stats) to a map of feature names to threshold value. + * delta thresholds will cause data reduction to stop when the delta between any of the measure values + * for any of the features for which a threshold is defined and its previous value go avove the threshold + * (in the case of rmse and mae) or below the threshold (otherwise). + * @default {} + */ + delta_threshold_map?: AblationThresholdMap; + + /** + * Name of feature whose values to use as case weights, defaults to ".case_weight" + * @default ".case_weight" + */ + distribute_weight_feature?: string; + + /** + * List of features to use when computing influence weight entropies, defaults to all trained features + * @default [] + */ + features?: string[]; + + /** + * Numeric maximum threshold for influence weight entropy of cases to keep, defaults to the value + * influence weight entropy threshold stored within the trainee + * @default 0.15 + */ + influence_weight_entropy_threshold?: number; + + /** + * A map of measure names (any of the prediction stats) to a map of feature names to threshold value. + * relative thresholds will cause data reduction to stop when the relative change between any of the + * measure values for any of the features for which a threshold is defined and its previous value go + * avove the threshold (in the case of rmse and mae) or below the threshold (otherwise). + * @default {} + */ + rel_threshold_map?: AblationThresholdMap; + + /** + * Skip auto analyzing as cases are removed + * @default false + */ + skip_auto_analyze?: boolean; +}; diff --git a/src/types/schemas/RemoveCases.ts b/src/types/schemas/RemoveCases.ts new file mode 100644 index 0000000..4e7e114 --- /dev/null +++ b/src/types/schemas/RemoveCases.ts @@ -0,0 +1,45 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * RemoveCases + * + * Removes all cases that match the specified conditions from trainee + */ +import type { CaseIndices } from "./CaseIndices"; +import type { Condition } from "./Condition"; +import type { Precision } from "./Precision"; + +export type RemoveCasesRequest = { + /** + * A list of session id and training index tuples that specify which cases are to be removed + */ + case_indices?: CaseIndices; + + /** + * Assoc of feature->value(s) (no value = must have feature, one value = must equal exactly the value, two values = inclusive between). ignored if case_indices is specified. + * @default {} + */ + condition?: Condition; + + /** + * If specified, ignores condition and instead operates on all cases that were trained with this session id. ignored if case_indices is specified. + */ + condition_session?: string; + + /** + * Name of feature into which to distribute the removed cases' weights to their neighbors. + */ + distribute_weight_feature?: string; + + /** + * Limit on the number of cases to move; if set to zero there will be no limit. ignored if case_indices is specified. + * if null, will be set to k if precision is "similar" or no limit if precision is "exact". default is null + */ + num_cases?: number; + + /** + * Flag, whether to query for 'exact' matches; if set to 'similar' will remove num_cases with the most similar values. ignored if case_indices is specified. + * @default "exact" + */ + precision?: Precision; +}; diff --git a/src/types/schemas/RemoveFeature.ts b/src/types/schemas/RemoveFeature.ts new file mode 100644 index 0000000..d84234c --- /dev/null +++ b/src/types/schemas/RemoveFeature.ts @@ -0,0 +1,39 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * RemoveFeature + * + * Removes the specified feature on all cases for a trainee that match the specified condition + * if conditions are not specified, removes feature for all cases and from the model, if condition is an empty assoc, leaves the feature metadata in the model. + * updates the accumulated data mass for the model proportional to the number of cases modified. + */ +import type { Condition } from "./Condition"; + +export type RemoveFeatureRequest = { + /** + * Assoc of feature->value(s). + * no value = must have feature + * - for continuous or numeric ordinal features: + * one value = must equal exactly the value or be close to it for fuzzy match + * values = inclusive between + * - for nominal or string ordinal features: + * n values = must match any of these values exactly + */ + condition?: Condition; + + /** + * If specified ignores condition and operates on cases for the specified session id + */ + condition_session?: string; + + /** + * The feature name to remove + */ + feature: string; + + /** + * The session id when this call is being made + * @default "none" + */ + session?: string; +}; diff --git a/src/types/schemas/RemoveSeriesStore.ts b/src/types/schemas/RemoveSeriesStore.ts new file mode 100644 index 0000000..633dc76 --- /dev/null +++ b/src/types/schemas/RemoveSeriesStore.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * RemoveSeriesStore + * + * Clears stored series + */ + +export type RemoveSeriesStoreRequest = { + /** + * Series id to clear. if not provided, removes entire store + */ + series?: string | null; +}; diff --git a/src/types/schemas/RenameSubtrainee.ts b/src/types/schemas/RenameSubtrainee.ts new file mode 100644 index 0000000..5b0ac3b --- /dev/null +++ b/src/types/schemas/RenameSubtrainee.ts @@ -0,0 +1,24 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * RenameSubtrainee + * + * Rename a contained trainee + */ + +export type RenameSubtraineeRequest = { + /** + * Id of child trainee to rename. ignored if child_name_path is specified + */ + child_id?: string; + + /** + * List of strings specifying the user-friendly path of the child subtrainee to rename + */ + child_name_path?: string[]; + + /** + * New name of child trainee + */ + new_name: string; +}; diff --git a/src/types/schemas/SaveSubtrainee.ts b/src/types/schemas/SaveSubtrainee.ts new file mode 100644 index 0000000..10c5632 --- /dev/null +++ b/src/types/schemas/SaveSubtrainee.ts @@ -0,0 +1,38 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SaveSubtrainee + * + * Saves a subtrainee with the following optional parameters, escapes trainee filenames on save + */ + +export type SaveSubtraineeRequest = { + /** + * Name to store (without extension) + * @default "" + */ + filename?: string; + + /** + * Base path to store to + * @default "" + */ + filepath?: string; + + /** + * Flag, default to false. if set to true will save each case as an individual file + * @default false + */ + separate_files?: boolean; + + /** + * Trainee instance name path to store + * @default "" + */ + trainee?: string | string[]; + + /** + * Unique id for trainee. must be provided if trainee does not have one already specified. + */ + trainee_id?: string; +}; diff --git a/src/types/schemas/SelectedPredictionStats.ts b/src/types/schemas/SelectedPredictionStats.ts new file mode 100644 index 0000000..257627c --- /dev/null +++ b/src/types/schemas/SelectedPredictionStats.ts @@ -0,0 +1,11 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SelectedPredictionStats + */ +import type { PredictionStat } from "./PredictionStat"; + +/** + * Types of stats to output. when unspecified, returns all except the confusion_matrix. if all, then returns all including the confusion_matrix. + */ +export type SelectedPredictionStats = PredictionStat[]; diff --git a/src/types/schemas/SetAutoAblationParams.ts b/src/types/schemas/SetAutoAblationParams.ts new file mode 100644 index 0000000..2ec4d49 --- /dev/null +++ b/src/types/schemas/SetAutoAblationParams.ts @@ -0,0 +1,81 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetAutoAblationParams + * + * Sets the model to auto-ablate by tracking its size and training certain cases as weights + */ + +export type SetAutoAblationParamsRequest = { + /** + * The number of ablated cases to compute influence weights for distribution at a time + * @default 100 + */ + ablated_cases_distribution_batch_size?: number; + + /** + * Flag, default is false. when true, any enabled ablation techniques will be run at during training. + * @default false + */ + auto_ablation_enabled?: boolean; + + /** + * The weight feature that should be used when ablating. + * @default ".case_weight" + */ + auto_ablation_weight_feature?: string; + + /** + * The number of cases to ablate between analyses and influence weight entropy recalculation + * @default 2000 + */ + batch_size?: number; + + /** + * The conviction value above which cases will be ablated + */ + conviction_lower_threshold?: number; + + /** + * The conviction value below which cases will be ablated + */ + conviction_upper_threshold?: number; + + /** + * List of features. for each of the features specified, will ablate a case if the prediction + * matches exactly. + */ + exact_prediction_features?: string[]; + + /** + * The influence weight entropy quantile that a case must be beneath in order to be trained. + * default of 0.6. + * @default 0.15 + */ + influence_weight_entropy_threshold?: number; + + /** + * Stores the threshold for the minimum number of cases at which the model should auto-ablate. + * default of 1000. + * @default 1000 + */ + minimum_model_size?: number; + + /** + * Assoc of feature -> percent. for each of the features specified, will + * ablate a case if abs(prediction - case value) / prediction <= percent + */ + relative_prediction_threshold_map?: Record; + + /** + * List of features. for each of the features specified, will ablate a case if + * abs(prediction - case value) <= feature residual + */ + residual_prediction_features?: string[]; + + /** + * Assoc of feature -> [min, max]. for each of the features specified, will + * ablate a case if the prediction >= (case value - min) and the prediction <= (case value + max) + */ + tolerance_prediction_threshold_map?: Record; +}; diff --git a/src/types/schemas/SetAutoAnalyzeParams.ts b/src/types/schemas/SetAutoAnalyzeParams.ts new file mode 100644 index 0000000..ae54d6e --- /dev/null +++ b/src/types/schemas/SetAutoAnalyzeParams.ts @@ -0,0 +1,127 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetAutoAnalyzeParams + * + * Sets the model to auto-analyze by tracking its size and notifying the clients in train responses when it should be analyzed + */ +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type SetAutoAnalyzeParamsRequest = { + /** + * {type "list" values "string"} + */ + action_features?: string[]; + + /** + * Number of samples to use for analysis. the rest will be randomly held-out and not included in calculations + */ + analysis_sub_model_size?: number; + + /** + * The factor by which to increase the analyze threshold everytime the model grows to the current threshold size + * default of two orders of magnitude using the universal scaling factor e + * @default 7.389056 + */ + analyze_growth_factor?: number; + + /** + * Stores the threshold for the number of cases at which the model should be re-analyzed. default of 100. + * @default 100 + */ + analyze_threshold?: number; + + /** + * Flag, default is false. when true, returns when it's time for model to be analyzed again. + * @default false + */ + auto_analyze_enabled?: boolean; + + /** + * Flag, if set to true will skip the computation of feature residuals + * @default false + */ + bypass_calculate_feature_residuals?: boolean; + + /** + * Flag, if set to true will skip the computation of feature weights + * @default false + */ + bypass_calculate_feature_weights?: boolean; + + /** + * Flag, if true will not do any search over k, p, and dt parameters, but still may compute feature residuals + * depending on other parameters. + * @default false + */ + bypass_hyperparameter_analysis?: boolean; + + /** + * Parameter for analyze + * {type "list" values "string"} + */ + context_features?: string[]; + + /** + * List of values for dt (the distance transform) to grid search during analysis + */ + dt_values?: number[]; + + /** + * Whether to use inverse residuals as feature weights. if unspecified, inverse residuals will be used as weights for + * targetless params, otherwise this method will not be used. + */ + inverse_residuals_as_weights?: boolean | null; + + /** + * Number of cross validation folds to do. value of 1 does hold-one-out instead of k-fold + * @default 1 + */ + k_folds?: number; + + /** + * List of values for k (the number of cases making up a local model) to grid search during analysis + */ + k_values?: number[]; + + /** + * Number of cases to sample during analysis. only applies for k_folds = 1 + */ + num_analysis_samples?: number; + + /** + * Number of cases to use to approximate residuals + */ + num_samples?: number; + + /** + * List of values for p (the parameter of the lebesgue space) to grid search during analysis + */ + p_values?: number[]; + + /** + * Enumeration, default is "single_targeted" + * "single_targeted" = analyze hyperparameters for the specified action_features + * "omni_targeted" = analyze hyperparameters for each action feature, using all other features as context_features. if action_features aren't specified, uses all context_features. + * "targetless" = analyze hyperparameters for all context features as possible action features, ignores action_features parameter + */ + targeted_model?: "single_targeted" | "omni_targeted" | "targetless"; + + /** + * When true will scale influence weights by each case's weight_feature weight. if use_case_weights isn't specified, it will + * be true if auto ablation is enabled and false otherwise + */ + use_case_weights?: UseCaseWeights; + + /** + * Whether to use deviations for lk metric in queries. when true forces the use + * of deviations, when false will not use deviations. if unspecified, the better performing option will be selected. + */ + use_deviations?: boolean | null; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/SetFeatureAttributes.ts b/src/types/schemas/SetFeatureAttributes.ts new file mode 100644 index 0000000..fea5709 --- /dev/null +++ b/src/types/schemas/SetFeatureAttributes.ts @@ -0,0 +1,165 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetFeatureAttributes + * + * Set all features and their attributes for the trainee, and returns the updated feature attributes + */ +import type { FeatureAttributesIndex } from "./FeatureAttributesIndex"; + +export type SetFeatureAttributesRequest = { + /** + * Flag, default to true. create time series feature attributes if necessary + * @default true + */ + create_ts_attributes?: boolean; + + /** + * Assoc of feature -> attributes, attributes defined below: + * + * 'type': string, one of 'continuous', 'ordinal' or 'nominal'. default is 'continuous'. + * + * 'bounds' : assoc of of bounds for feature value generation, keys of assoc defined below as: + * 'min': number or date string, the minimum value to be output + * 'max': number or date string, the maximum value to be output + * 'allowed': list of explicitly allowed values to be output. example: ["low", "medium", "high"] + * 'allow_null': flag, allow nulls to be output, per their distribution in the data. defaults to true + * 'constraint': code, whose logic has to evaluate to true for value to be considered valid. + * same format as 'derived_feature_code. example: "(> #f1 0 #f2 0)" + * + * 'cycle_length': integer, specifies cycle length of cyclic feature, default is no cycle length + * + * 'date_time_format': string datetime format, only applicable to continuous features. if specified, feature values + * should match the date format specified by this string and sets 'data_type' to 'formatted_date_time'. + * example: "%y-%m-%d". if unspecified but 'data_type' is 'formatted_date_time', this will be set to + * iso8601 format of "%y-%m-%dt%h:%m:%s" + * + * 'locale': string, the date time format locale. if unspecified, uses platform default locale. example: "en_us" + * + * 'significant_digits': integer, round to the specified significant digits, default is no rounding + * + * 'decimal_places': integer, decimal places to round to, default is no rounding. if "significant_digits" + * is also specified, the number will be rounded to the specified number of significant + * digits first, then rounded to the number of decimal points as specified by this parameter + * + * 'observational_error': number, specifies the observational mean absolute error for this feature. use when the error + * value is already known. default is 0 + * + * 'data_type': string, specify the data type for features with a type of nominal or continuous + * defaults to 'string' for nominals and 'number' for continuous + * valid values for both are: 'string', 'number', 'json', 'amalgam', 'yaml' + * 'string_mixable' and 'formatted_date_time' are valid only when type is continuous + * 'boolean' is valid only when type is nominal + * + * 'id_feature': boolean, set to true only for nominal features containing nominal ids to specify that this + * feature should be used to compute case weights for id based privacy. for time series, + * this feature will be used as the id for each time series generation. default is false + * + * 'unique': boolean, flag feature as only having unique values. only applicable to nominal features. defaults to false. + * + * 'dependent_features': list, a list of other feature(s) that this feature depends on or that are dependent on this + * feature. this restricts the cases that can be selected as neighbors (such as in react) to ones + * that satisfy the dependency, if possible. if this is not possible, either due to insufficient data + * which satisfy the dependency or because dependencies are probabilistic, the dependency may not be + * maintained. be aware that dependencies introduce further constraints to data and so several + * dependencies or dependencies on already constrained datasets may restrict which operations are + * possible while maintaining the dependency. as a rule of thumb, sets of features that have + * dependency relationships should generally not include more than 1 continuous feature, unless + * the continuous features have a small number of values that are commonly used. + * + * 'null_is_dependent': boolean, modifies how dependent features with nulls are treated during a react, specifically + * when they use null as a context value. only applicable to dependent features. when false, the + * feature will be treated as a non-dependent context feature. when true for nominal types, + * treats null as an individual dependent class value, only cases that also have nulls as this + * feature's value will be considered. when true for continuous types, only the cases with the + * same dependent feature values as the cases that also have nulls as this feature's value + * will be considered. default is false. + * + * 'auto_derive_on_train': assoc, defines how to create and derive all the values for this feature from + * the trained dataset. for full list of specific 'auto_derive_on_train' feature + * attributes refer the comments at the top of the derive.amlg module. + * + * 'derived_feature_code': string, code defining how the value for this feature could be derived if this feature + * is specified as a "derived_context_feature" or a "derived_action_feature" during + * react flows. for react_series, the data referenced is the accumulated series data + * (as a list of rows), and for non-series reacts, the data is the one single row. + * each row is comprised of all the combined context and action features. referencing + * data in these rows uses 0-based indexing, where the current row index is 0, the + * previous row's is 1, etc. specified code may do simple logic and numeric operations + * on feature values referenced via feature name and row offset. + * examples: + * "#x 1" - use the value for feature 'x' from the previously processed row (offset of 1, one lag value). + * "(- #y 0 #x 1)" - feature 'y' value from current (offset 0) row minus feature 'x' value from previous (offset 1) row. + * + * 'post_process': string, custom amalgam code that is called on resulting values of this feature during react operations. + * example: "(set_digits #x 0 3.1 (list 1 0) 2 3 (false))" + * + * 'non_sensitive': boolean, flag a categorical nominal feature as non-sensitive. it is recommended that + * all nominal features be represented with either an 'int-id' subtype or another + * available nominal subtype using the 'subtype' attribute. however, if the nominal + * feature is non-sensitive, setting this parameter to true will bypass the 'subtype' + * requirement. only applicable to nominal features. default is false + * + * 'subtype': string, the type used in novel nominal substitution. + * + * 'original_type': string, original data type details. used by clients to determine how to serialize and deserialize feature data. + * + * 'original_format': string, original data formats used by clients. automatically populated by clients + * to store client language specific context about features. + * + * 'time_series': assoc, defining time series options for a feature, keys of assoc defined below as: + * + * 'type': string, one of "rate" or "delta". when 'rate' is specified, uses the difference of the current value + * from its previous value divided by the change in time since the previous value. + * when 'delta' is specified, uses the difference of the current value from its previous value + * regardless of the elapsed time. set to 'delta' if feature has 'time_feature' set to true. + * + * 'time_feature': boolean, when true, the feature will be treated as the time feature for time + * series modeling. additionally, time features must use type 'delta'. default is false. + * + * 'order': integer, if provided, will generate the specified number of derivatives and boundary values. default is 1 + * + * 'derived_orders': integer, the number of orders of derivatives that should be derived instead of synthesized. + * ignored if order is not provided. default is 0. + * + * 'lags': list of number, if specified, generates lag features containing previous values using the enumerated lag offsets. + * takes precedence over 'num_lags'. if neither 'num_lags' nor 'lags' is specified for a feature, then a single + * lag feature is generated. example: [1,2] + * + * 'num_lags': integer, if specified, generates the specified amount of lag features containing previous values. + * if 'lags' is specified, then this parameter will be ignored. if neither 'num_lags' nor 'lags' is specified + * for a feature, then a single lag feature is generated. default is 1. + * + * 'rate_min': list of number, if specified, ensures that the rate (the difference quotient, the discrete version + * of derivative) for this feature won't be less than the value provided. a null value means no min boundary. + * the value must be in epoch format for the time feature. the length of the list must match the number of + * derivatives as specified by 'order'. only applicable when time series type is set to 'rate'. example: [0.1] + * + * 'rate_max': list of number, if specified, ensures that the rate (the difference quotient, the discrete version + * of derivative) for this feature won't be more than the value provided. a null value means no max boundary. + * the value must be in epoch format for the time feature. the length of the list must match the number of + * derivatives as specified by 'order'. only applicable when time series type is set to 'rate'. example: [0.8] + * + * 'delta_min': list of number, if specified, ensures that the smallest difference between features values is not smaller + * than this specified value. a null value means no min boundary. the length of the list must match the number of + * derivatives as specified by 'order'. only applicable when time series type is set to 'delta'. example: [0.2] + * + * 'delta_max': list of number, if specified, ensures that the largest difference between feature values is not larger than + * this specified value. a null value means no max boundary. the length of the list must match the number of + * derivatives as specified by 'order'. only applicable when time series type is set to 'delta'. example: [2.0] + * + * 'series_has_terminators': boolean, when true, requires that the model identify and learn values that explicitly denote + * the end of a series. only applicable to id features for a series. default is false + * + * 'stop_on_terminator': boolean, when true, requires that a series ends on a terminator value. + * only applicable to id features for a series. default is false + * + * 'universal': boolean, applicable only to the time_feature, controls whether future values of independent time series are considered. + * when false, time_feature is not universal and allows using future data from other series in decisions; + * this is applicable when the time is not globally relevant and is independent for each time series. + * when true, universally excludes using any data with from the future from all series; + * this is applicable when time is globally relevant and there are events that may affect all time series. + * if there is any possibility of global relevancy of time, it is generally recommended to set this value to true, which is the default. + */ + feature_attributes: FeatureAttributesIndex; +}; diff --git a/src/types/schemas/SetInfluenceWeightThreshold.ts b/src/types/schemas/SetInfluenceWeightThreshold.ts new file mode 100644 index 0000000..6f89047 --- /dev/null +++ b/src/types/schemas/SetInfluenceWeightThreshold.ts @@ -0,0 +1,17 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetInfluenceWeightThreshold + * + * Set the influence weight threshold for outputting only the k neighbors whose influence weight is <= to this threshold + * default value is 0.99 + */ + +export type SetInfluenceWeightThresholdRequest = { + /** + * Number, amount of total influence weight to accumulate among nearest + * neighbors before stopping (for influential cases) + * @default 0.99 + */ + influence_weight_threshold?: number; +}; diff --git a/src/types/schemas/SetMetadata.ts b/src/types/schemas/SetMetadata.ts new file mode 100644 index 0000000..5c4f974 --- /dev/null +++ b/src/types/schemas/SetMetadata.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetMetadata + * + * Set metadata for model + */ + +export type SetMetadataRequest = { + /** + * Arbitary map of metadata to store in a trainee + */ + metadata: Record | null; +}; diff --git a/src/types/schemas/SetParams.ts b/src/types/schemas/SetParams.ts new file mode 100644 index 0000000..b9faf42 --- /dev/null +++ b/src/types/schemas/SetParams.ts @@ -0,0 +1,46 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetParams + * + * Sets internal hyperparameters + */ +import type { FullHyperparameterMap } from "./FullHyperparameterMap"; +import type { HyperparameterMap } from "./HyperparameterMap"; + +export type SetParamsRequest = { + /** + * The factor by which to increase the analyze threshold everytime the model grows to the current threshold size + * default of two orders of magnitude using the universal scaling factor e + * @default 7.389056 + */ + analyze_growth_factor?: number; + + /** + * Stores the threshold for the number of cases at which the model should be re-analyzed. default of 100. + * @default 100 + */ + analyze_threshold?: number; + + /** + * Flag, default is false. when true, returns when it's time for model to be analyzed again. + * @default false + */ + auto_analyze_enabled?: boolean; + + /** + * An assoc of hyperparameters to use when no others are available must contain k, p, and dt. + */ + default_hyperparameter_map?: HyperparameterMap; + + /** + * Must have at least an action feature (e.g., .targetless) -> a contexts key -> robust -> k, p and dt provided. + * example: + * { + * ".targetless" { "featurea.featureb.": { "robust" : { "k" : number, "p" : number, "dt": number }}}, + * "featurea" : { "featureb.featurec.": { "full" : { "k" : number, "p" : number, "dt": number }}}, + * ... + * } + */ + hyperparameter_map?: FullHyperparameterMap; +}; diff --git a/src/types/schemas/SetParentId.ts b/src/types/schemas/SetParentId.ts new file mode 100644 index 0000000..01c3de8 --- /dev/null +++ b/src/types/schemas/SetParentId.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetParentId + * + * Set trainee's unique parent id + */ + +export type SetParentIdRequest = { + /** + * The unique string identifier for the parent of the trainee + */ + parent_id?: string | null; +}; diff --git a/src/types/schemas/SetRandomSeed.ts b/src/types/schemas/SetRandomSeed.ts new file mode 100644 index 0000000..9bf863a --- /dev/null +++ b/src/types/schemas/SetRandomSeed.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetRandomSeed + * + * Set the random seed on a trainee + */ + +export type SetRandomSeedRequest = { + /** + * The value of the random seed to set on the trainee, assigns a system-provided 64-bit random number if null is provided + */ + seed?: number | string | null; +}; diff --git a/src/types/schemas/SetSessionMetadata.ts b/src/types/schemas/SetSessionMetadata.ts new file mode 100644 index 0000000..81dd715 --- /dev/null +++ b/src/types/schemas/SetSessionMetadata.ts @@ -0,0 +1,19 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetSessionMetadata + * + * Set session metadata for a specified session. + */ + +export type SetSessionMetadataRequest = { + /** + * Any arbitrary metadata. + */ + metadata: Record; + + /** + * Id of session to modify. + */ + session: string; +}; diff --git a/src/types/schemas/SetSubstituteFeatureValues.ts b/src/types/schemas/SetSubstituteFeatureValues.ts new file mode 100644 index 0000000..3c9fa9f --- /dev/null +++ b/src/types/schemas/SetSubstituteFeatureValues.ts @@ -0,0 +1,16 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetSubstituteFeatureValues + * + * Sets substitution feature values used in case generation + */ + +export type SetSubstituteFeatureValuesRequest = { + /** + * Assoc of feature -> assoc of value -> substitution. + * if this map is null, all substitutions will be disabled and cleared + * if any feature in the substitution_value_map has a missing or empty assoc of substitutions, substitution values will immeditally be generated + */ + substitution_value_map: Record; +}; diff --git a/src/types/schemas/SetTraineeId.ts b/src/types/schemas/SetTraineeId.ts new file mode 100644 index 0000000..9afc76c --- /dev/null +++ b/src/types/schemas/SetTraineeId.ts @@ -0,0 +1,14 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SetTraineeId + * + * Set trainee's unique id + */ + +export type SetTraineeIdRequest = { + /** + * A unique string identifier for the trainee + */ + trainee_id?: string | null; +}; diff --git a/src/types/schemas/SingleReact.ts b/src/types/schemas/SingleReact.ts new file mode 100644 index 0000000..c9f3d81 --- /dev/null +++ b/src/types/schemas/SingleReact.ts @@ -0,0 +1,206 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SingleReact + * + * React to a provided context. if desired_conviction is provided, it does a generative react. + * + * output: + * default output of this method is a react object in the format of + * , where all_action_values is a list of all action + * values, reacted/generated and derived, in the same order as all_action_features, e.g., [2, "a", .75384] to match ['width','name','height'] + * if details is specified, the react object will contain appropriate additional details properties and values, + * details example: { 'action_values': [2, "a", .75384], 'action_features' : ['width','name','height'], 'residual_conviction': 1.3, + * 'influential_cases' : etc... } + * see api docs for documentation of all output properties + */ +import type { DesiredConviction } from "./DesiredConviction"; +import type { FeatureBoundsMap } from "./FeatureBoundsMap"; +import type { GenerateNewCases } from "./GenerateNewCases"; +import type { NewCaseThreshold } from "./NewCaseThreshold"; +import type { ReactDetails } from "./ReactDetails"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type SingleReactRequest = { + /** + * Full list of features to output values for the case + * @default [] + */ + action_features?: string[]; + + /** + * Values of action features. if specified will bypass react and only do the explanation if details is set + * @default [] + */ + action_values?: any[]; + + /** + * Flag, if set to true will allow return of null values if there are nulls in the local model for the action features. applicable + * only to discriminative reacts. + * @default false + */ + allow_nulls?: boolean; + + /** + * Pair (list) of session id and index, where index is the original 0-based session_training_index of the case as it was + * trained into the session. if this case does not exist, discriminative react outputs null, generative react ignores it. + */ + case_indices?: (string | number)[]; + + /** + * List of context features. for generative react, features used to condition the generated case + * @default [] + */ + context_features?: string[]; + + /** + * List of context values, for generative react, values used to condition the generated case + * @default [] + */ + context_values?: any[]; + + /** + * List of action features whose values should be computed from the resulting action prior to output, in the specified + * order. must be a subset of action_features. + * note: both of these derived feature lists rely on the features' "derived_feature_code" attribute to compute the values. + * if 'derived_feature_code' attribute is undefined or references non-0 feature indices, the derived value will be null. + * @default [] + */ + derived_action_features?: string[]; + + /** + * List of context features whose values should be computed from the provided contexts in the specified order. + * must be different than context_features. + * @default [] + */ + derived_context_features?: string[]; + + /** + * If null, will do a discriminative react. if specified, will do a generative react + * for generative react, value of desired avg conviction of generated cases, in the range of (0,infinity] with 1 as standard + * larger values will increase the variance (or creativity) of the generated case from the existing model + * smaller values will decrease the variance (or creativity) of the generated case from the existing model + */ + desired_conviction?: DesiredConviction; + + /** + * See the description of the details parameter of #react + */ + details?: ReactDetails; + + /** + * If true will exclude sensitive features whose values will be + * replaced after synthesis from uniqueness check. + * only applicable when desired_conviction is specified. + * @default false + */ + exclude_novel_nominals_from_uniqueness_check?: boolean; + + /** + * List of additional features to return with audit data + * @default [] + */ + extra_features?: string[]; + + /** + * Assoc of : + * to ensure that specified features' generated values stay in bounds + * for nominal features instead of min/max it's a set of allowed values, ie: + * allow_null - default is true, if true nulls may be generated per their distribution in the data + * only used when desired_conviction is specified + * @default {} + */ + feature_bounds_map?: Record; + + /** + * Enum, acceptable values are: + * null or 'no' : output any generated case + * 'always' : only output original cases, outputs null for all feature values if unable to generate a new case + * 'attempt' : output any generated case only if generation fails all initial attempts to output original cases + * @default "no" + */ + generate_new_cases?: GenerateNewCases; + + /** + * Case_id, if set will query for k+1 cases and ignore the perfect matching case during the reaction + */ + ignore_case?: string; + + /** + * Flag, if set to true assumes provided categorical (nominal or ordinal) feature values already been substituted. + * @default false + */ + input_is_substituted?: boolean; + + /** + * Series id, if specified will store an internal record of all reacts for that series + */ + into_series_store?: string; + + /** + * Flag, if set to true and specified along with case_indices, will set ignore_case to the one specified by case_indices. + */ + leave_case_out?: boolean; + + /** + * Distance to determine privacy cutoff. used to query the local minimum distance used in the distance ratio + * accepted values: + * 'max': the maximum local distance + * 'min': the minimum local distance + * 'most_similar': the closest distance of the most similar case + * null: the minimum local distance + * @default "min" + */ + new_case_threshold?: NewCaseThreshold; + + /** + * Flag, if true order of generated feature values will match the order of features + * @default false + */ + ordered_by_specified_features?: boolean; + + /** + * List of feature names that will be made available during the execution of post_process feature attributes + * @default [] + */ + post_process_features?: string[]; + + /** + * List of values corresponding to post_process_features that will be made available during the execution fo post_process feature attributes + * @default [] + */ + post_process_values?: any[]; + + /** + * List of features that will preserve their values from the case specified by case_indices, appending and + * overwriting the specified context and context features as necessary. for generative reacts, if case_indices isn't specified, + * will preserve feature values of a random case. + * @default [] + */ + preserve_feature_values?: string[]; + + /** + * Flag, default is true, only applicable if a substitution value map has been set. if set to false, will not substitute categorical feature values. + * only used when desired_conviction is specified + * @default true + */ + substitute_output?: boolean; + + /** + * Flag, if set to true will scale influence weights by each case's weight_feature weight. + * if a weight is missing, uses 1 as the weight. if unspecified, case weights will be used if the trainee has them. + */ + use_case_weights?: UseCaseWeights; + + /** + * Flag, if false uses model feature residuals, if true recalculates regional model residuals. only used when desired_conviction is specified + * @default true + */ + use_regional_model_residuals?: boolean; + + /** + * Name of feature whose values to use as case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/SingleReactSeries.ts b/src/types/schemas/SingleReactSeries.ts new file mode 100644 index 0000000..94455ea --- /dev/null +++ b/src/types/schemas/SingleReactSeries.ts @@ -0,0 +1,212 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * SingleReactSeries + * + * React in a series until a series_stop_map condition is met. aggregates rows of data corresponding to the specified context, action, + * derived_context and derived_action features, utilizing previous rows to derive values as necessary. outputs an assoc of "action_features" and + * corresponding "series" where "series" is the completed 'matrix' for the corresponding action_features and derived_action_features. + */ +import type { DesiredConviction } from "./DesiredConviction"; +import type { FeatureBoundsMap } from "./FeatureBoundsMap"; +import type { GenerateNewCases } from "./GenerateNewCases"; +import type { UseCaseWeights } from "./UseCaseWeights"; + +export type SingleReactSeriesRequest = { + /** + * List of feature names corresponding to values in each row of action_values + * @default [] + */ + action_features?: string[]; + + /** + * List of predicted feature values for non time-series features + * @default [] + */ + action_values?: any[]; + + /** + * List of feature names corresponding to values in each row of context_values + * @default [] + */ + context_features?: string[]; + + /** + * List of context feature values for non time-series features + * @default [] + */ + context_values?: any[]; + + /** + * Flag, default is false. when true will attempt to continue existing series instead of starting new series. + * if initial_values provide series ids, it will continue those explicitly specified ids, otherwise it will randomly select series to continue. + * note: terminated series with terminators cannot be continued and will result in null output. + * @default false + */ + continue_series?: boolean; + + /** + * List of features corresponding to the values in each row of continue_series_values. + * this value is ignored if continue_series_values is not specified. + */ + continue_series_features?: string[]; + + /** + * List of lists of values, when specified will continue this specific untrained series as defined by these values. + * continue_series flag will be ignored and treated as true if this value is specified. + */ + continue_series_values?: any[][]; + + /** + * List of action features whose values should be computed from the resulting last row in series, in the specified + * order. must be a subset of action_features. + * note: both of these derived feature lists rely on the features' "derived_feature_code" attribute to compute the values. + * if 'derived_feature_code' attribute is undefined or references non-existing feature indices, the derived value will be null. + * @default [] + */ + derived_action_features?: string[]; + + /** + * List of context features whose values should be computed from the entire series in the specified order. + * must be different than context_features. + * @default [] + */ + derived_context_features?: string[]; + + /** + * If null, will do a discriminative react. if specified, will do a generative react + * for generative react, value of desired avg conviction of generated cases, in the range of (0,infinity] with 1 as standard + * larger values will increase the variance (or creativity) of the generated case from the existing model + * smaller values will decrease the variance (or creativity) of the generated case from the existing model + */ + desired_conviction?: DesiredConviction; + + /** + * List of additional features to return with audit data from details + * @default [] + */ + extra_features?: string[]; + + /** + * Assoc of : + * to ensure that specified features' generated values stay in bounds + * for nominal features instead of min/max it's a set of allowed values, ie: + * allow_null - default is true, if true nulls may be generated per their distribution in the data + * @default {} + */ + feature_bounds_map?: Record; + + /** + * Enum, acceptable values are: + * null or 'no' : output any generated case + * 'always' : only output original cases, outputs null for all feature values if unable to generate a new case + * 'attempt' : output any generated case only if generation fails all initial attempts to output original cases + * @default "no" + */ + generate_new_cases?: GenerateNewCases; + + /** + * List of features to condition just the first case in a series, overwrites context_features and + * derived_context_features for that first case. all specified initial features must be in one of: context_features, action_features, + * derived_context_features or derived_action_features. if provided a value that isn't in one of those lists, it will be ignored. + * @default [] + */ + initial_features?: string[]; + + /** + * List of values corresponding to the initial_features, used to condition just the first case in a series. + */ + initial_values?: any[]; + + /** + * Flag, if set to true assumes provided categorical (nominal or ordinal) feature values already been substituted. + * @default false + */ + input_is_substituted?: boolean; + + /** + * Maximum size a series is allowed to be. default is 3 * model_size, a 0 or less is no limit. + * if forecasting with 'continue_series', this defines the maximum length of the forecast. + */ + max_series_length?: number; + + /** + * Distance to determine privacy cutoff. used to query the local minimum distance used in the distance ratio + * accepted values: + * 'max': the maximum local distance + * 'min': the minimum local distance + * 'most_similar': the closest distance of the most similar case + * null: the minimum local distance + * @default "min" + */ + new_case_threshold?: string; + + /** + * Flag, default to true. if true, series ids are replaced with unique values on output. + * if false, will maintain or replace ids with existing trained values, but also allows output of series with duplicate existing ids. + * @default true + */ + output_new_series_ids?: boolean; + + /** + * List of features that will preserve their values from the case specified by case_indices, appending and + * overwriting the specified context and context features as necessary. for generative reacts, if case_indices isn't specified, + * will preserve feature values of a random case. + * @default [] + */ + preserve_feature_values?: string[]; + + /** + * List of features corresponding to series_context_values + * @default [] + */ + series_context_features?: string[]; + + /** + * 2d-list of values, context value for each feature for each row of the series. + * if specified, max_series_length is ignored. + * @default [] + */ + series_context_values?: any[][]; + + /** + * Controls how closely generated series should follow existing series (plural). + * choices are: "fixed", "dynamic" or "no". if "fixed", tracks the particular relevant series id. if "dynamic", tracks the particular + * relevant series id, but is allowed to change the series id that it tracks based on its current context. if "no", does not track any particular series id. + * @default "fixed" + */ + series_id_tracking?: "fixed" | "dynamic" | "no"; + + /** + * Assoc of feature -> stop conditions: + * for continuous features: { feature: { "min" : val, "max": val } } - stops series when feature value exceeds max or is smaller than min + * for nominal features: { feature: { "values" : ['val1', 'val2' ]} } - stops series when feature value matches any of the values listed + * specifying ".series_progress" with a value between 0 and 1.0 corresponding to percent completion e.g., { ".series_progress" : .95 } - + * stops series when it progresses at or beyond 95%. + * @default {} + */ + series_stop_map?: Record; + + /** + * Flag, default is true, only applicable if a substitution value map has been set. if set to false, will not substitute categorical feature values. + * @default true + */ + substitute_output?: boolean; + + /** + * Flag, whether to use case weights or not. if unspecified will automatically select based on cached parameters + */ + use_case_weights?: UseCaseWeights; + + /** + * Flag, if false uses model feature residuals, if true recalculates regional model residuals. + * @default true + */ + use_regional_model_residuals?: boolean; + + /** + * Name of the feature that stores case weights + * @default ".case_weight" + */ + weight_feature?: string; +}; diff --git a/src/types/schemas/Train.ts b/src/types/schemas/Train.ts new file mode 100644 index 0000000..05049f6 --- /dev/null +++ b/src/types/schemas/Train.ts @@ -0,0 +1,79 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * Train + * + * Train the passed in cases, filtering out cases that match optionally passed in ablation parameters + * returns a response object in the following format: + * (associate + * "num_trained" num_trained_cases + * "ablated_indices" (list of session training indices for the ablated cases) + * "status" "status output message" + * ) + * list of 'status' values: + * (null) - default output, no status output + * "analyzed" - if auto analysis is enabled and model has grown large enough to be analyzed again and was analyzed + * "analyze" - if auto analysis is enabled and model has grown large enough to be analyzed again but was not analyzed + */ + +export type TrainRequest = { + /** + * Name of feature into which to accumulate neighbors' influences as weight for ablated cases. if unspecified, will not accumulate weights. + */ + accumulate_weight_feature?: string; + + /** + * Flag, allows feature names beginning with "." if true, otherwise an error will be given if any features start with ".". + * @default false + */ + allow_training_reserved_features?: boolean; + + /** + * List of cases, ie a list of lists of values. + */ + cases: any[][]; + + /** + * List of features to derive in the specified order. if this list is not provided, features with + * the 'auto_derive_on_train' feature attribute set to true will be auto-derived. if provided an empty list, will not derive any features. + * any derived_features that are already in the 'features' list will not be derived since their values are being explicitly provided. + */ + derived_features?: string[]; + + /** + * The list of features. + */ + features: string[]; + + /** + * Flag, if set to true assumes provided categorical (nominal or ordinal) feature values already been substituted. + * @default false + */ + input_is_substituted?: boolean; + + /** + * Name of series to pull features and case values from internal series storage. if specified, trains on all cases that are + * stored in the internal series store for the specified series and session. the trained feature set is the combined features from storage + * and the passed in features. if input_cases is of length one, the value(s) of this case are appended to all cases in the series. + * if input_cases is the same length as the series, the value of each case in input_cases is applied in order to each of the cases in the + * series. + */ + series?: string; + + /** + * The session label to record these cases to. if not specified, refers to this entity's label of same name. + */ + session?: string; + + /** + * Flag, if set to true, will not auto_analyze, but will instead return the status "analyze" which indicates that an analyze call is recommended + * @default false + */ + skip_auto_analyze?: boolean; + + /** + * Flag, if set to true, and accumulate_weight_feature is provided, will not train on the cases, but instead accumulate all of their neighbor weights. + * @default false + */ + train_weights_only?: boolean; +}; diff --git a/src/types/schemas/UpgradeTrainee.ts b/src/types/schemas/UpgradeTrainee.ts new file mode 100644 index 0000000..e3cbd0c --- /dev/null +++ b/src/types/schemas/UpgradeTrainee.ts @@ -0,0 +1,31 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * UpgradeTrainee + * + * Update version to latest, auto importing any exported data. + */ + +export type UpgradeTraineeRequest = { + /** + * Base path to howso engine core installation + */ + root_filepath?: string; + + /** + * Flag, if true will load each case from its individual file + * @default false + */ + separate_files?: boolean; + + /** + * Name of trainee to import and update + */ + trainee: string; + + /** + * Path from which to load previously exported meta.json and exp.json files. + * if unspecified, expects them to be located in the base installation /migrations/ directory. + */ + trainee_json_filepath?: string; +}; diff --git a/src/types/schemas/UseCaseWeights.ts b/src/types/schemas/UseCaseWeights.ts new file mode 100644 index 0000000..105b4ec --- /dev/null +++ b/src/types/schemas/UseCaseWeights.ts @@ -0,0 +1,10 @@ +/** + * WARNING: This file is auto generated, do not modify manually. + * + * UseCaseWeights + */ + +/** + * If set to true will scale influence weights by each case's weight_feature weight. if null, case weights will be used if the trainee has them. + */ +export type UseCaseWeights = boolean | null; diff --git a/src/types/schemas/index.ts b/src/types/schemas/index.ts new file mode 100644 index 0000000..d40e9a0 --- /dev/null +++ b/src/types/schemas/index.ts @@ -0,0 +1,76 @@ +/** + * NOTE: This file is auto generated, do not modify manually. + */ +export * from "./AblationThresholdMap"; +export * from "./AddFeature"; +export * from "./Analyze"; +export * from "./AppendToSeriesStore"; +export * from "./BuiltInFeatures"; +export * from "./CaseIndices"; +export * from "./ClearImputedData"; +export * from "./Condition"; +export * from "./CopySubtrainee"; +export * from "./CreateSubtrainee"; +export * from "./DeleteSession"; +export * from "./DeleteSubtrainee"; +export * from "./DesiredConviction"; +export * from "./EditCases"; +export * from "./EditHistory"; +export * from "./EditHistoryRecord"; +export * from "./Evaluate"; +export * from "./ExecuteOnSubtrainee"; +export * from "./ExportTrainee"; +export * from "./FeatureAttributes"; +export * from "./FeatureAttributesIndex"; +export * from "./FeatureBoundsMap"; +export * from "./FullHyperparameterMap"; +export * from "./GenerateNewCases"; +export * from "./GetCases"; +export * from "./GetDistances"; +export * from "./GetEntityPathById"; +export * from "./GetExtremeCases"; +export * from "./GetFeatureConviction"; +export * from "./GetMarginalStats"; +export * from "./GetPairwiseDistances"; +export * from "./GetParams"; +export * from "./GetSessionIndices"; +export * from "./GetSessionMetadata"; +export * from "./GetSessionTrainingIndices"; +export * from "./GetSessions"; +export * from "./HyperparameterMap"; +export * from "./Impute"; +export * from "./LoadSubtrainee"; +export * from "./MoveCases"; +export * from "./NewCaseThreshold"; +export * from "./Precision"; +export * from "./PredictionStat"; +export * from "./React"; +export * from "./ReactAggregate"; +export * from "./ReactAggregateDetails"; +export * from "./ReactDetails"; +export * from "./ReactGroup"; +export * from "./ReactIntoFeatures"; +export * from "./ReactSeries"; +export * from "./ReduceData"; +export * from "./RemoveCases"; +export * from "./RemoveFeature"; +export * from "./RemoveSeriesStore"; +export * from "./RenameSubtrainee"; +export * from "./SaveSubtrainee"; +export * from "./SelectedPredictionStats"; +export * from "./SetAutoAblationParams"; +export * from "./SetAutoAnalyzeParams"; +export * from "./SetFeatureAttributes"; +export * from "./SetInfluenceWeightThreshold"; +export * from "./SetMetadata"; +export * from "./SetParams"; +export * from "./SetParentId"; +export * from "./SetRandomSeed"; +export * from "./SetSessionMetadata"; +export * from "./SetSubstituteFeatureValues"; +export * from "./SetTraineeId"; +export * from "./SingleReact"; +export * from "./SingleReactSeries"; +export * from "./Train"; +export * from "./UpgradeTrainee"; +export * from "./UseCaseWeights"; diff --git a/src/types/session.ts b/src/types/session.ts new file mode 100644 index 0000000..db3adc2 --- /dev/null +++ b/src/types/session.ts @@ -0,0 +1,26 @@ +export type BaseSession = { + /** + * The Session's unique identifier. + */ + id: string; + + /** + * The name given to the Session. + */ + name?: string | null; + + /** + * Any key-value pair to be stored with the Session. + */ + metadata?: { [key: string]: any }; + + /** + * The timestamp of when the Session was issued. + */ + created_date?: Date; + + /** + * The timestamp of when the Session was last modified. + */ + modified_date?: Date; +}; diff --git a/src/types/shims/FeatureOriginalType.ts b/src/types/shims/FeatureOriginalType.ts new file mode 100644 index 0000000..88f2fde --- /dev/null +++ b/src/types/shims/FeatureOriginalType.ts @@ -0,0 +1,112 @@ +export interface OriginalTypeBoolean { + /** + * The name of the data type. + */ + data_type: "boolean"; +} + +export interface OriginalTypeDatetime { + /** + * The name of the data type. + */ + data_type: "datetime"; + /** + * The standardized timezone name. + */ + timezone?: string | null; +} + +export interface OriginalTypeDate { + /** + * The name of the data type. + */ + data_type: "date"; +} + +export interface OriginalTypeInteger { + /** + * The name of the data type. + */ + data_type: "integer"; + /** + * The size of the integer (in bytes). + */ + size?: number; + /** + * If the integer is unsigned. + */ + unsigned?: boolean; +} + +export interface OriginalTypeNumeric { + /** + * The name of the data type. + */ + data_type: "numeric"; + /** + * The format of the number. + */ + format?: "decimal"; + /** + * The size of the number (in bytes). + */ + size?: number; +} + +export interface OriginalTypeObject { + /** + * The name of the data type. + */ + data_type: "object"; +} + +export interface OriginalTypeString { + /** + * The name of the data type. + */ + data_type: "string"; + /** + * The maximum allowed length of the string. + */ + length?: number | null; + /** + * The string encoding type. + */ + encoding?: string | null; +} + +export interface OriginalTypeTime { + /** + * The name of the data type. + */ + data_type: "time"; + /** + * The standardized timezone name. + */ + timezone?: string | null; +} + +export interface OriginalTypeTimedelta { + /** + * The name of the data type. + */ + data_type: "timedelta"; + /** + * The unit of the time delta. + */ + unit?: "days" | "seconds" | "nanoseconds"; +} + +/** + * Original data type details. Used by clients to determine how to serialize and deserialize feature data. + */ +export type FeatureOriginalType = + | OriginalTypeBoolean + | OriginalTypeDate + | OriginalTypeDatetime + | OriginalTypeInteger + | OriginalTypeNumeric + | OriginalTypeObject + | OriginalTypeString + | OriginalTypeTime + | OriginalTypeTimedelta; diff --git a/src/types/shims/GetMarginalStats.ts b/src/types/shims/GetMarginalStats.ts new file mode 100644 index 0000000..51dcdfe --- /dev/null +++ b/src/types/shims/GetMarginalStats.ts @@ -0,0 +1,34 @@ +export type GetMarginalStatsResponse = { + [key: string]: { + /** Ex: null; */ + skew: number | null; + /** Ex: null; */ + min: number | null; + /** Ex: null; */ + mean: number | null; + /** Ex: null; */ + percentile_75: number | null; + /** Ex: 150; */ + count: number | null; + /** Ex: null; */ + variance: number | null; + /** Ex: null; */ + mean_absdev: number | null; + /** Ex: null; */ + stddev: number | null; + /** Ex: 3; */ + uniques: number | null; + /** Ex: null; */ + median: number | null; + /** Ex: 1.0986122886681096; */ + entropy: number | null; + /** Ex: null; */ + kurtosis: number | null; + /** Ex: "Iris-versicolor"; */ + mode: number | null; + /** Ex: null; */ + max: number | null; + /** Ex: null; */ + percentile_25: number | null; + }; +}; diff --git a/src/types/shims/GetParams.ts b/src/types/shims/GetParams.ts new file mode 100644 index 0000000..55089f2 --- /dev/null +++ b/src/types/shims/GetParams.ts @@ -0,0 +1,10 @@ +import { FullHyperparameterMap, HyperparameterMap } from "../schemas"; + +export type GetParamsResponse = { + default_hyperparameter_map?: FullHyperparameterMap; + hyperparameter_map?: HyperparameterMap; + auto_analyze_enabled?: boolean; + auto_analyze_limit_size?: number; + analyze_growth_factor?: number; + analyze_threshold?: number; +}; diff --git a/src/types/shims/React.ts b/src/types/shims/React.ts new file mode 100644 index 0000000..4b5383b --- /dev/null +++ b/src/types/shims/React.ts @@ -0,0 +1,58 @@ +export type ReactResponse = { + boundary_cases?: any[][]; + categorical_action_probabilities?: Array<{ [key: string]: any }>; + derivation_parameters?: Array<{ + k?: number; + p?: number; + distance_transform?: number; + feature_weights?: { [key: string]: number }; + feature_deviations?: { [key: string]: number }; + nominal_class_counts?: { [key: string]: number }; + use_irw?: boolean; + }>; + feature_residuals_full?: Array<{ [key: string]: any }>; + feature_residuals_robust?: Array<{ [key: string]: any }>; + prediction_stats?: Array<{ [key: string]: any }>; + outlying_feature_values?: Array<{ + [key: string]: { + input_case_value?: number; + local_max?: number; + }; + }>; + influential_cases?: any[][]; + most_similar_cases?: any[][]; + observational_errors?: Array<{ [key: string]: number }>; + feature_mda_full?: Array<{ [key: string]: number }>; + feature_mda_robust?: Array<{ [key: string]: number }>; + feature_mda_ex_post_full?: Array<{ [key: string]: number }>; + feature_mda_ex_post_robust?: Array<{ [key: string]: number }>; + directional_feature_contributions_full?: Array<{ [key: string]: number }>; + directional_feature_contributions_robust?: Array<{ [key: string]: number }>; + feature_contributions_full?: Array<{ [key: string]: number }>; + feature_contributions_robust?: Array<{ [key: string]: number }>; + case_directional_feature_contributions_full?: Array<{ [key: string]: number }>; + case_directional_feature_contributions_robust?: Array<{ [key: string]: number }>; + case_feature_contributions_full?: Array<{ [key: string]: number }>; + case_feature_contributions_robust?: Array<{ [key: string]: number }>; + case_mda_full?: Array>; + case_mda_robust?: Array>; + case_contributions_full?: Array>; + case_contributions_robust?: Array>; + case_feature_residuals_full?: Array<{ [key: string]: number }>; + case_feature_residuals_robust?: Array<{ [key: string]: number }>; + case_feature_residual_convictions_full?: Array<{ [key: string]: number }>; + case_feature_residual_convictions_robust?: Array<{ [key: string]: number }>; + hypothetical_values?: Array<{ [key: string]: any }>; + distance_ratio?: Array; + distance_ratio_parts?: Array<{ + local_distance_contribution?: number | null; + nearest_distance?: number | null; + }>; + distance_contribution?: Array; + similarity_conviction?: Array; + most_similar_case_indices?: Array>; + generate_attempts?: Array; + series_generate_attempts?: Array>; + action_features?: Array | null; + action_values?: Array> | null; +}; diff --git a/src/types/shims/ReactAggregate.ts b/src/types/shims/ReactAggregate.ts new file mode 100644 index 0000000..b950909 --- /dev/null +++ b/src/types/shims/ReactAggregate.ts @@ -0,0 +1,27 @@ +export type ReactAggregateResponse = { + [key: string]: { + accuracy?: number | null; + confusion_matrix?: { + matrix?: { [key: string]: { [key: string]: number } }; + leftover_correct?: number; + leftover_incorrect?: number; + other_counts?: number; + }; + feature_contributions_full?: number | null; + feature_contributions_robust?: number | null; + mae?: number | null; + feature_residuals_full?: number | null; + feature_residuals_robust?: number | null; + feature_mda_full?: number | null; + feature_mda_robust?: number | null; + feature_mda_permutation_full?: number | null; + feature_mda_permutation_robust?: number | null; + precision?: number | null; + r2?: number | null; + recall?: number | null; + missing_value_accuracy?: number | null; + rmse?: number | null; + spearman_coeff?: number | null; + mcc?: number | null; + }; +}; diff --git a/src/types/shims/Train.ts b/src/types/shims/Train.ts new file mode 100644 index 0000000..238c6f3 --- /dev/null +++ b/src/types/shims/Train.ts @@ -0,0 +1,5 @@ +export type TrainResponse = { + ablated_indices?: number[]; + num_trained: number; + status?: "analyze" | "analyzed" | null; +}; diff --git a/src/types/shims/index.ts b/src/types/shims/index.ts new file mode 100644 index 0000000..b68bebb --- /dev/null +++ b/src/types/shims/index.ts @@ -0,0 +1,6 @@ +export * from "./FeatureOriginalType"; +export * from "./GetMarginalStats"; +export * from "./GetParams"; +export * from "./React"; +export * from "./ReactAggregate"; +export * from "./Train"; diff --git a/src/types/trainee.ts b/src/types/trainee.ts new file mode 100644 index 0000000..d1e5dd6 --- /dev/null +++ b/src/types/trainee.ts @@ -0,0 +1,25 @@ +export type BaseTrainee = { + /** + * The unique identifier of the Trainee. + */ + id: string; + + /** + * The name of the Trainee. + */ + name?: string | null; + + /** + * The type of persistence schedule to use. + * If allow, the trainee may be manually persisted and will be persisted automatically only when unloaded. + * If always, the trainee will be automatically persisted whenever it is updated. + * If never, the trainee will never be persisted and any requests to explicitly persist it will fail. + * @default "allow" + */ + persistence?: "allow" | "always" | "never"; + + /** + * Any key-value pair to be stored with the Trainee. + */ + metadata?: { [key: string]: any }; +};