Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
MCP 2.0: OAuth and fat inserts (#863)
Brad Barbin0acd75e9727e
diff --git a/.claude/skills/error/SKILL.md b/.claude/skills/error/SKILL.mdnew file mode 100644index 0000000000..928aa85e2a--- /dev/null+++ b/.claude/skills/error/SKILL.md@@ -0,0 +1,58 @@+---+name: error+description: Capture a screenshot and snapshot of the current browser page when an error is encountered during e2e testing. Saves to docs/e2e/<slug>/screenshots/.+---++# Error Capture++Capture diagnostic artifacts when the browser shows an error during e2e testing. This skill is a building block — other skills (e.g. `/smoke-test`) invoke it when they detect a failure.++## When to Use++Call this whenever an `agent-browser snapshot` reveals:+- "Something went wrong" heading+- "Authentication Error" or similar error message+- A blank page or unexpected redirect+- Any content that indicates the page failed to render++## Procedure++### 1. Determine the worktree slug++Read `.env.local` in the project root and extract the `CARBON_WORKTREE` value.++### 2. Ensure the output directory exists++```bash+mkdir -p docs/e2e/${CARBON_WORKTREE}/screenshots+```++### 3. Capture the screenshot++Use a descriptive filename with the module/route name and a timestamp:++```bash+agent-browser screenshot docs/e2e/${CARBON_WORKTREE}/screenshots/${module}-$(date +%Y%m%d-%H%M%S).png+```++For example: `docs/e2e/my-worktree/screenshots/accounting-20260606-143022.png`++### 4. Capture the snapshot text++Save the element snapshot alongside the screenshot for debugging without a browser:++```bash+agent-browser snapshot -i > docs/e2e/${CARBON_WORKTREE}/screenshots/${module}-$(date +%Y%m%d-%H%M%S).txt+```++### 5. Report++After capturing, log the file paths and continue — do **not** stop the calling skill. The caller decides whether to abort or continue.++## Output++Two files saved to `docs/e2e/<slug>/screenshots/`:+- `{module}-{timestamp}.png` — visual screenshot+- `{module}-{timestamp}.txt` — element snapshot text++These paths are gitignored (`docs/e2e` in `.gitignore`).diff --git a/.claude/skills/login/SKILL.md b/.claude/skills/login/SKILL.mdnew file mode 100644index 0000000000..e506f856d2--- /dev/null+++ b/.claude/skills/login/SKILL.md@@ -0,0 +1,56 @@+---+name: login+description: Log into the local Carbon ERP dev server using agent-browser and DEV_BYPASS_EMAIL. Use before any browser automation that requires an authenticated session.+---++# Login++Authenticate against the local Carbon ERP dev environment using the `DEV_BYPASS_EMAIL` bypass. This skill is a building block — other skills (e.g. `/smoke-test`) invoke it before doing authenticated work.++## Prerequisites++- Dev server running (`pnpm dev` or `crbn up`)+- `[email protected]` set in `.env.local` (added automatically by `crbn up`)+- The `[email protected]` user seeded in the database (done automatically by `crbn up`)++## Procedure++### 1. Resolve the ERP URL++Read `.env.local` in the project root and extract the `ERP_URL` value. This varies per worktree.++### 2. Open the login page++```bash+agent-browser open ${ERP_URL}/login && agent-browser wait --load networkidle && agent-browser snapshot -i+```++### 3. Fill the email and submit++Find the email input and the sign-in button from the snapshot refs:++```bash+agent-browser fill @eN "[email protected]"+agent-browser click @eN && agent-browser wait --load networkidle+```++### 4. Verify login succeeded++```bash+agent-browser snapshot -i+```++Confirm the page:+- Redirected to `/x` (the authenticated dashboard)+- Shows a greeting like "Good afternoon, Test" or "Good morning, Test"+- Displays module cards (Accounting, Sales, Inventory, etc.)++If the snapshot instead shows "Authentication Error" or remains on `/login`, login **failed** — stop and report the error.++## Output++After successful login the browser session is authenticated. Subsequent `agent-browser` commands in the same session will carry the auth cookies. Do **not** call `agent-browser close` — leave the session open for the caller.++## Navigating to the MES++The MES app is at a separate URL. Read `MES_URL` from `.env.local` to navigate there. The same auth cookies apply — no separate login is needed.diff --git a/.claude/skills/smoke-test/SKILL.md b/.claude/skills/smoke-test/SKILL.mdnew file mode 100644index 0000000000..3b56e51df3--- /dev/null+++ b/.claude/skills/smoke-test/SKILL.md@@ -0,0 +1,74 @@+---+name: smoke-test+description: Run an e2e smoke test against the local Carbon ERP dev server using agent-browser. Logs in via /login, then navigates through core modules to verify they load without errors.+---++# E2E Smoke Test++Run a quick end-to-end smoke test against the local Carbon ERP dev environment.++## Prerequisites++- Dev server running (`pnpm dev` or `crbn up`)+- `crbn up` seeds the smoke-test user and sets `DEV_BYPASS_EMAIL` automatically++## Procedure++### Step 1: Login++Invoke the `/login` skill to authenticate the browser session. If login fails, stop and report — all other steps depend on auth.++### Step 2: Navigate Core Modules++Read `ERP_URL` from `.env.local` in the project root.++Visit each module and verify the page loads without errors. For each module:++1. Navigate to the module URL+2. Wait for network idle+3. Take a snapshot+4. Verify the page rendered content (table, cards, or expected UI elements)+5. Check for error messages or blank pages++**Module routes to test (append to ERP_URL):**++| Module | Path |+|-------------|-----------------------|+| Dashboard | `/x` |+| Sales | `/x/sales/orders` |+| Purchasing | `/x/purchasing/orders`|+| Inventory | `/x/inventory` |+| Items | `/x/items/parts` |+| Accounting | `/x/accounting/charts`|+| People | `/x/people/employee ` |+| Resources | `/x/resources` |+| Production | `/x/production` |+| Settings | `/x/settings/company` |++For each module:+```bash+agent-browser open ${ERP_URL}/x/sales/orders && agent-browser wait --load networkidle && agent-browser snapshot -i+```++### Step 3: Report Results++After visiting all modules, report a summary table:++| Module | Status | Notes |+|--------|--------|-------|+| Login | PASS/FAIL | ... |+| Sales | PASS/FAIL | ... |+| ... | ... | ... |++A module **passes** if the snapshot shows expected content (tables, headings, cards) and no error messages. A module **fails** if the page is blank, shows an error, or fails to load.++## Failure Handling++- If a module fails, invoke the `/error` skill to capture a screenshot and snapshot, then continue to the next module.++## Cleanup++Close the browser session when done:+```bash+agent-browser close+```diff --git a/.claude/skills/test/SKILL.md b/.claude/skills/test/SKILL.mdnew file mode 100644index 0000000000..0961777363--- /dev/null+++ b/.claude/skills/test/SKILL.md@@ -0,0 +1,208 @@+---+name: test+description: Agentically test a specific feature by analyzing the branch diff, building a test plan, and driving the app through agent-browser. Builds on /login and /error skills. Caches successful playbooks to llm/test-playbooks/ for reuse.+---++# Feature Test++Agentically test a specific feature or workflow in the running Carbon ERP dev server. Analyzes the current branch to understand what changed, then drives the browser through the relevant create/update/delete flows to verify they work end-to-end.++## Arguments++The user may provide:+- A feature description: `/test creating a purchase order`+- A GitHub issue: `/test #1234`+- Nothing (infer from the branch diff): `/test`++## Procedure++### Step 1: Check for existing playbooks++Before doing anything else, check if there are cached playbooks for the feature being tested:++```bash+ls llm/test-playbooks/+```++If a matching playbook exists (e.g., `create-purchase-order.md` when testing purchase order creation), read it and use the cached navigation steps, selectors, and field mappings. This saves significant time — skip to Step 4 (Login) and use the playbook's steps directly.++If no playbook exists, continue to Step 2 to build one from scratch.++### Step 2: Understand what to test++**If a feature description was provided**, use it directly as the test target.++**If a GitHub issue was provided**, fetch it:+```bash+gh issue view <number> --json title,body+```++**If nothing was provided**, analyze the branch diff to identify testable features:+```bash+git diff main --stat+git log --oneline main..HEAD+```++Focus on:+- New or modified route files under `routes/x+/` (these are user-facing pages)+- Changes to service files under `modules/` (business logic changes)+- New migrations (schema changes that affect forms)++From this analysis, identify 1-3 concrete user workflows to test (e.g., "create a new purchase order", "update a job's details", "create a stock transfer").++### Step 3: Build the test plan++For each workflow, plan the steps as a user would perform them:++1. **Navigate** to the relevant page (list view or "new" form)+2. **Fill** required form fields with realistic test data+3. **Submit** the form+4. **Verify** the result (redirect to detail page, success toast, record appears in list)++Write the plan out before executing so the user can see what you intend to do.++### Step 4: Login++Invoke the `/login` skill to authenticate the browser session. If login fails, stop and report.++### Step 5: Read ERP_URL++```bash+grep ERP_URL .env.local+```++### Step 6: Execute each test++For each planned workflow:++#### 6a. Navigate to the page++```bash+agent-browser open ${ERP_URL}/<route> && agent-browser wait --load networkidle && agent-browser snapshot -i+```++#### 6b. Interact with the form++Use snapshot refs to fill fields and click buttons. General patterns:++**Text inputs:**+```bash+agent-browser fill @eN "value"+```++**Select/combobox fields (Carbon uses custom comboboxes):**+```bash+agent-browser click @eN # open the dropdown+agent-browser snapshot -i # find the option refs+agent-browser click @eM # select the option+```++**Submit:**+```bash+agent-browser click @eN # click the submit/save button+agent-browser wait --load networkidle+agent-browser snapshot -i # verify the result+```++#### 6c. Verify the result++After submission, check the snapshot for:+- **Success indicators**: redirect to a detail page, URL changed, "created" or "updated" text, success toast+- **Failure indicators**: validation errors (red text, "is required"), error toasts, "Something went wrong", page didn't change++If verification shows an error, invoke the `/error` skill to capture diagnostics, then continue to the next test.++#### 6d. Record the result++Track each test with its status:+- **PASS**: Form submitted, redirected to expected page, record created/updated+- **FAIL**: Error encountered, validation failed, unexpected behavior+- **SKIP**: Could not test (prerequisite missing, page not found)++### Step 7: Cache successful playbooks++After each **PASS** test, write or update a playbook file at `llm/test-playbooks/<feature-slug>.md`. This is critical for future efficiency.++**Playbook format:**++```markdown+# <Feature Name>++Last tested: <date>+Route: <URL path>++## Prerequisites+- <any required data, e.g., "at least one supplier must exist">++## Steps++### 1. Navigate+- URL: `/x/<route>/new`+- Expected: form with fields [list fields seen]++### 2. Fill form+- Field "<label>" (<selector hint, e.g., "first combobox">): "<value>"+- Field "<label>" (<selector hint>): "<value>"+- ...++### 3. Submit+- Button: "<button label>"++### 4. Verify+- Expected redirect: `/x/<route>/<id>`+- Success indicator: <what to look for>++## Selector Notes+- The supplier combobox is the first combobox on the page, labeled "Supplier"+- The location field auto-populates from user defaults+- The submit button is labeled "Save" in the form footer+- After submit, a toast appears briefly with "Purchase order created"++## Common Failures+- "Supplier is required" — no suppliers seeded in the database+- "Location is required" — user has no default location assigned+```++**Rules for playbook caching:**+- Use kebab-case filenames: `create-purchase-order.md`, `create-job.md`, `update-quote.md`+- Only cache after a PASS — never cache failed or partial runs+- Include selector hints (not exact refs like `@e5`, since those change between sessions), describe them by label, position, or role (e.g., "the first combobox labeled Supplier")+- Record common failures you encountered before getting to PASS — this helps future runs avoid dead ends+- Update existing playbooks rather than creating duplicates+- Include prerequisite data observations (e.g., "needs at least one supplier")++### Step 8: Report++Print a summary table:++| # | Test | Status | Notes |+|---|------|--------|-------|+| 1 | Create purchase order | PASS | Created PO-000123, redirected to detail page |+| 2 | Create job for part | FAIL | "Location is required" validation error |+| 3 | Update quote details | PASS | Updated customer name successfully |++If any tests failed, include the screenshot paths from `/error`.++### Step 9: Cleanup++```bash+agent-browser close+```++## Tips for Carbon ERP forms++- **Required fields** are marked with asterisks or show validation errors on submit+- **Combobox/select fields** need a click to open, then a search or click on an option+- **Date fields** can be typed directly in `YYYY-MM-DD` format+- **Number fields** accept plain numbers+- **The submit button** is usually labeled "Save", "Create", or "Submit" and is at the bottom of the form or in the footer+- **After creating a record**, the app typically redirects to the detail page with the new record's ID in the URL+- **Drawer forms** (child routes) appear as overlays — look for the drawer's submit button, not the parent page's+- **Toast notifications** appear briefly — check the snapshot immediately after submission++## Failure Handling++- If a page fails to load, invoke `/error` and move to the next test+- If a form field can't be found, take a snapshot, log the issue, and move on+- If prerequisite data is missing (e.g., no suppliers exist to create a PO), note it as SKIP with an explanation+- Never stop the entire test run for a single failure — complete all planned testsdiff --git a/.gitignore b/.gitignoreindex 0dd484b7e9..a032c919f3 100644--- a/.gitignore+++ b/.gitignore@@ -61,6 +61,7 @@ packages/database/supabase/seed.sql.carbon-worktree.superpowersdocs/superpowers+docs/e2ellm/tasksapps/*/portless.jsonpackages/database/supabase/snippets/**\ No newline at end of filediff --git a/.husky/pre-commit b/.husky/pre-commitindex a9d5d17401..8c5a9e483b 100755--- a/.husky/pre-commit+++ b/.husky/pre-commit@@ -21,5 +21,5 @@ fi# Regenerate MCP tools if any .service.ts file was modifiedif git diff --cached --name-only | grep -q '\.service\.ts$'; thennpx tsx scripts/generate-mcp.ts- git add apps/erp/app/routes/api+/mcp+/lib/tools/ apps/erp/app/routes/api+/mcp+/lib/server.ts apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json llm/cache/mcp-tools-reference.md+ git add apps/erp/app/routes/api+/mcp+/lib/server.ts apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json llm/cache/mcp-tools-reference.mdfi\ No newline at end of filediff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 0000000000..c06bd689a4--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,93 @@+## Environment++- This project is a manufacturing system called Carbon. It contains apps for ERP, MES, and a training app called academy.+- Any time you want to know about the project, first use the Task tool to query the files in `llm/cache/`. Do this constantly, literally any time you want to know anything. Don't check the code first, ALWAYS check the cache.+- There are specific workflows defined in `llm/workflows/`. ALWAYS use the Task tool to search for the relevant workflow file when told to do a workflow, then read and follow it.++## Core Principles++- **Simplicity First:** Make every change as simple as possible. Minimize code impact. Do not over-engineer simple or obvious fixes.+- **No Laziness:** Identify root causes. Avoid temporary fixes. Apply senior developer standards.+- **Minimal Impact:** Touch only what is necessary. Avoid introducing new bugs.+- **Demand Elegance:** For non-trivial changes, pause and ask whether there is a more elegant solution. If a fix feels hacky, implement the solution you would choose knowing everything you now know. Critically evaluate your own work before presenting it.+- **Use existing components.** Grep `packages/react/src/` and `apps/erp/app/components/` before writing UI. Prefer built-in variants over custom `bg-*`/`text-*` classes.++## Workflow Orchestration++### Plan First++- Enter plan mode for any non-trivial task (three or more steps, or involving architectural decisions).+- If something goes wrong, stop and re-plan immediately rather than continuing blindly.+- Use plan mode for verification steps, not just implementation.+- Write detailed specifications upfront to reduce ambiguity.++### Subagent Strategy++- Use subagents liberally to keep the main context window clean.+- Offload research, exploration, and parallel analysis to subagents.+- For complex problems, allocate more compute via subagents.+- Assign one task per subagent to ensure focused execution.++### Verification Before Done++- Never declare a task complete without proving it works.+- Diff behavior between main and your changes when relevant.+- Ask: "Would a staff engineer approve this?"+- Run tests, check logs, and demonstrate correctness.++### Autonomous Bug Fixing++- When given a bug report, fix it without asking for unnecessary guidance.+- Review logs, errors, and failing tests, then resolve them.+- Avoid requiring context switching from the user.+- Fix failing CI tests proactively.++## Task Management++1. **Plan First:** Write the plan to `llm/tasks/todo.md` with checkable items.+2. **Verify Plan:** Review before starting implementation.+3. **Track Progress:** Mark items complete as you go.+4. **Explain Changes:** Provide a high-level summary at each step.+5. **Add Review Section:** Add a review section to `llm/tasks/todo.md`.+6. **Capture Lessons:** Update `llm/tasks/lessons.md` after corrections.++### Self-Improvement Loop++- After any correction from the user, update `llm/tasks/lessons.md` with the relevant pattern.+- Create rules for yourself that prevent repeating the same mistake.+- Iterate on these lessons rigorously until the mistake rate declines.+- Review lessons at the start of each session when relevant to the project.++## Tool Rules++### General++- ALWAYS prefer your default tools over resorting to the Bash tool. You historically have a bad habit of doing `find ... | xargs ... grep` where you could just use your Grep tool. Avoid this! Just use the simple Grep tool.++### Grep++- ALWAYS try spawning a subtask to search the cache first if you are looking for something you aren't 100% confident exists.+- NEVER assume something exists with too specific a pattern. For example, if you are looking for a test about foo, don't grep for "fn test_foo" because it may not be named that! Think broader and more general.+- ALWAYS filter out the results from the `**/node_modules/**`, `**/.vercel/**` and `**/.turbo/**` directories which fill up with trash you don't want to search.+- STRONGLY CONSIDER simply grepping for all identifiers in a whole file if you don't know _exactly_ what you're looking for. Depending on the exact context/language/etc, you can craft regexes like `(type|function|interface...etc) .*[{;]$` or be more or less sophisticated as needed. Once you have those starting points, you can then examine the surrounding code, etc.+- STRONGLY CONSIDER using the Task tool to have a sub-agent run the grep if the results are of unknown size, such as dumping all the identifiers in a file. Have it return just the relevant stuff.++### TodoWrite++- ALWAYS append this to every item: "Spawn subtasks to query the cache folder any time I need to learn something about the codebase. NEVER update the cache with plans or information about code that is not yet committed." This is very important even though it seems silly.+- NEVER create an explicit todo item for updating the cache.++### Cache (`llm/cache/`)++- ALWAYS update the cache if you learn something about the codebase that was not in the cache and is not from a current change you're making (i.e. is committed).+- ALWAYS update the cache after a commit.+- NEVER update the cache about staged/uncommitted code.+- NEVER rebuild the database to test changes. Wait for the user to do that.++## Browser Automation++With the user's permission, use the `/login` and `/test` skill to verify fixes.++## Migrations++Follow the instructions in `llm/workflows/database-migration.md` for adding migrations\ No newline at end of filediff --git a/CLAUDE.md b/CLAUDE.mdindex 6547b50953..eef4bd20cf 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,98 +1 @@-# CLAUDE.md--## Environment--- This project is a manufacturing system called Carbon. It contains apps for ERP, MES, and a training app called academy.-- Any time you want to know about the project, first use the Task tool to query the files in `llm/cache/`. Do this constantly, literally any time you want to know anything. Don't check the code first, ALWAYS check the cache.-- There are specific workflows defined in `llm/workflows/`. ALWAYS use the Task tool to search for the relevant workflow file when told to do a workflow, then read and follow it.--## Core Principles--- **Simplicity First:** Make every change as simple as possible. Minimize code impact. Do not over-engineer simple or obvious fixes.-- **No Laziness:** Identify root causes. Avoid temporary fixes. Apply senior developer standards.-- **Minimal Impact:** Touch only what is necessary. Avoid introducing new bugs.-- **Demand Elegance:** For non-trivial changes, pause and ask whether there is a more elegant solution. If a fix feels hacky, implement the solution you would choose knowing everything you now know. Critically evaluate your own work before presenting it.-- **Use existing components.** Grep `packages/react/src/` and `apps/erp/app/components/` before writing UI. Prefer built-in variants over custom `bg-*`/`text-*` classes.--## Workflow Orchestration--### Plan First--- Enter plan mode for any non-trivial task (three or more steps, or involving architectural decisions).-- If something goes wrong, stop and re-plan immediately rather than continuing blindly.-- Use plan mode for verification steps, not just implementation.-- Write detailed specifications upfront to reduce ambiguity.--### Subagent Strategy--- Use subagents liberally to keep the main context window clean.-- Offload research, exploration, and parallel analysis to subagents.-- For complex problems, allocate more compute via subagents.-- Assign one task per subagent to ensure focused execution.--### Verification Before Done--- Never declare a task complete without proving it works.-- Diff behavior between main and your changes when relevant.-- Ask: "Would a staff engineer approve this?"-- Run tests, check logs, and demonstrate correctness.--### Autonomous Bug Fixing--- When given a bug report, fix it without asking for unnecessary guidance.-- Review logs, errors, and failing tests, then resolve them.-- Avoid requiring context switching from the user.-- Fix failing CI tests proactively.--## Task Management--1. **Plan First:** Write the plan to `llm/tasks/todo.md` with checkable items.-2. **Verify Plan:** Review before starting implementation.-3. **Track Progress:** Mark items complete as you go.-4. **Explain Changes:** Provide a high-level summary at each step.-5. **Add Review Section:** Add a review section to `llm/tasks/todo.md`.-6. **Capture Lessons:** Update `llm/tasks/lessons.md` after corrections.--### Self-Improvement Loop--- After any correction from the user, update `llm/tasks/lessons.md` with the relevant pattern.-- Create rules for yourself that prevent repeating the same mistake.-- Iterate on these lessons rigorously until the mistake rate declines.-- Review lessons at the start of each session when relevant to the project.--## Tool Rules--### General--- ALWAYS prefer your default tools over resorting to the Bash tool. You historically have a bad habit of doing `find ... | xargs ... grep` where you could just use your Grep tool. Avoid this! Just use the simple Grep tool.--### Grep--- ALWAYS try spawning a subtask to search the cache first if you are looking for something you aren't 100% confident exists.-- NEVER assume something exists with too specific a pattern. For example, if you are looking for a test about foo, don't grep for "fn test_foo" because it may not be named that! Think broader and more general.-- ALWAYS filter out the results from the `**/node_modules/**`, `**/.vercel/**` and `**/.turbo/**` directories which fill up with trash you don't want to search.-- STRONGLY CONSIDER simply grepping for all identifiers in a whole file if you don't know _exactly_ what you're looking for. Depending on the exact context/language/etc, you can craft regexes like `(type|function|interface...etc) .*[{;]$` or be more or less sophisticated as needed. Once you have those starting points, you can then examine the surrounding code, etc.-- STRONGLY CONSIDER using the Task tool to have a sub-agent run the grep if the results are of unknown size, such as dumping all the identifiers in a file. Have it return just the relevant stuff.--### TodoWrite--- ALWAYS append this to every item: "Spawn subtasks to query the cache folder any time I need to learn something about the codebase. NEVER update the cache with plans or information about code that is not yet committed." This is very important even though it seems silly.-- NEVER create an explicit todo item for updating the cache.--### Cache (`llm/cache/`)--- ALWAYS update the cache if you learn something about the codebase that was not in the cache and is not from a current change you're making (i.e. is committed).-- ALWAYS update the cache after a commit.-- NEVER update the cache about staged/uncommitted code.-- NEVER rebuild the database to test changes. Wait for the user to do that.--## Browser Automation--Use `agent-browser` for web automation. Run `agent-browser --help` for all commands.--Core workflow:--1. `agent-browser open <url>` - Navigate to page-2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)-3. `agent-browser click @e1` / `fill @e2 "text"` - Interact using refs-4. Re-snapshot after page changes\ No newline at end of file\ No newline at end of filediff --git a/apps/erp/app/components/Chat/AnimatedSizeContainer.tsx b/apps/erp/app/components/Chat/AnimatedSizeContainer.tsxdeleted file mode 100644index f780cb7101..0000000000--- a/apps/erp/app/components/Chat/AnimatedSizeContainer.tsx+++ /dev/null@@ -1,64 +0,0 @@-import { cn } from "@carbon/react";-import { motion } from "framer-motion";-import type { ComponentPropsWithoutRef, PropsWithChildren } from "react";-import { forwardRef, useRef } from "react";-import { useResizeObserver } from "~/hooks/useResizeObserver";--type AnimatedSizeContainerProps = PropsWithChildren<{- width?: boolean;- height?: boolean;-}> &- Omit<ComponentPropsWithoutRef<typeof motion.div>, "animate" | "children">;--/**- * A container with animated width and height (each optional) based on children dimensions- */-const AnimatedSizeContainer = forwardRef<- HTMLDivElement,- AnimatedSizeContainerProps->(- (- {- width = false,- height = false,- className,- transition,- children,- ...rest- }: AnimatedSizeContainerProps,- forwardedRef- ) => {- const containerRef = useRef<HTMLDivElement>(null);- const resizeObserverEntry = useResizeObserver(- containerRef as React.RefObject<Element>- );-- return (- <motion.div- ref={forwardedRef}- className={cn("overflow-hidden", className)}- animate={{- width: width- ? (resizeObserverEntry?.contentRect?.width ?? "auto")- : "auto",- height: height- ? (resizeObserverEntry?.contentRect?.height ?? "auto")- : "auto"- }}- transition={transition ?? { type: "spring", duration: 0.3 }}- {...rest}- >- <div- ref={containerRef}- className={cn(height && "h-max", width && "w-max")}- >- {children}- </div>- </motion.div>- );- }-);--AnimatedSizeContainer.displayName = "AnimatedSizeContainer";--export { AnimatedSizeContainer };diff --git a/apps/erp/app/components/Chat/AnimatedStatus.tsx b/apps/erp/app/components/Chat/AnimatedStatus.tsxdeleted file mode 100644index c02ae05ec0..0000000000--- a/apps/erp/app/components/Chat/AnimatedStatus.tsx+++ /dev/null@@ -1,74 +0,0 @@-import { TextShimmer } from "@carbon/react";-import { AnimatePresence, motion } from "framer-motion";-import type { IconType } from "react-icons";--interface AnimatedStatusProps {- text: string | null;- shimmerDuration?: number;- className?: string;- fadeDuration?: number;- /** Animation variant for status changes */- variant?: "fade" | "slide" | "scale" | "blur-fade";- /** Optional icon to display before the text */- icon?: IconType | null;-}--export function AnimatedStatus({- text,- shimmerDuration = 1,- className,- fadeDuration = 0.2,- variant = "fade",- icon: Icon-}: AnimatedStatusProps) {- // Animation variants for different effects- const animations = {- fade: {- initial: { opacity: 0 },- animate: { opacity: 1 },- exit: { opacity: 0 }- },- slide: {- initial: { opacity: 0, x: 10 },- animate: { opacity: 1, x: 0 },- exit: { opacity: 0, x: -10 }- },- scale: {- initial: { opacity: 0, scale: 0.95 },- animate: { opacity: 1, scale: 1 },- exit: { opacity: 0, scale: 0.95 }- },- "blur-fade": {- initial: { opacity: 0, filter: "blur(4px)" },- animate: { opacity: 1, filter: "blur(0px)" },- exit: { opacity: 0, filter: "blur(4px)" }- }- };-- const selectedAnimation = animations[variant];-- return (- <div className="relative whitespace-nowrap h-8 flex items-center">- <AnimatePresence mode="wait">- {text && (- <motion.div- key={text} // Re-mount when text changes to trigger animation- initial={selectedAnimation.initial}- animate={selectedAnimation.animate}- exit={selectedAnimation.exit}- transition={{- duration: fadeDuration,- ease: "easeInOut"- }}- className="flex items-center gap-1.5 text-muted-foreground"- >- {Icon && <Icon className="h-3 w-3 shrink-0 text-current" />}- <TextShimmer className={className} duration={shimmerDuration}>- {text || ""}- </TextShimmer>- </motion.div>- )}- </AnimatePresence>- </div>- );-}diff --git a/apps/erp/app/components/Chat/Canvas/index.ts b/apps/erp/app/components/Chat/Canvas/index.tsdeleted file mode 100644index ace5f44abb..0000000000--- a/apps/erp/app/components/Chat/Canvas/index.ts+++ /dev/null@@ -1,15 +0,0 @@-import { useArtifacts } from "@ai-sdk-tools/artifacts/client";--export function Canvas() {- // @ts-expect-error TS2339 - TODO: fix type- const { current } = useArtifacts({- exclude: ["chat-title", "followup-questions"]- });-- switch (current?.type) {- // case "burn-rate":- // return <BurnRateCanvas />;- default:- return null;- }-}diff --git a/apps/erp/app/components/Chat/ChatHeader.tsx b/apps/erp/app/components/Chat/ChatHeader.tsxdeleted file mode 100644index 074888a4b9..0000000000--- a/apps/erp/app/components/Chat/ChatHeader.tsx+++ /dev/null@@ -1,17 +0,0 @@-import { ChatNavigation } from "./ChatNavigation";-import { ChatTitle } from "./ChatTitle";--export function ChatHeader() {- return (- <div className="flex items-center justify-start pl-9 relative h-8">- <ChatNavigation />- <ChatTitle />- {/* {!isHome && (- <div className="absolute right-0 flex items-center gap-4">- <NewChatButton />- <ChatHistory />- </div>- )} */}- </div>- );-}diff --git a/apps/erp/app/components/Chat/ChatHistory.tsx b/apps/erp/app/components/Chat/ChatHistory.tsxdeleted file mode 100644index 5b17be2fe6..0000000000--- a/apps/erp/app/components/Chat/ChatHistory.tsx+++ /dev/null@@ -1,143 +0,0 @@-import {- IconButton,- Input,- Popover,- PopoverContent,- PopoverTrigger,- Skeleton,- useDebounce,- useDisclosure,- useUrlParams-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { useState } from "react";-import { LuMenu, LuSearch, LuTrash } from "react-icons/lu";-import { useDateFormatter } from "~/hooks";--type Chat = {- id: string;- title: string | null;- createdAt: Date;- updatedAt: Date;-};--function ChatHistorySkeleton() {- return (- <div className="space-y-4">- {Array.from({ length: 10 }, (_, i) => (- <div key={`chat-skeleton-${i + 1}`} className="flex flex-col gap-1">- <Skeleton className="h-4 w-3/4" />- <Skeleton className="h-3 w-1/2" />- </div>- ))}- </div>- );-}--export function ChatHistory({- chats,- isLoading-}: {- chats: Chat[];- isLoading: boolean;-}) {- const { t } = useLingui();- const { formatTimeAgo } = useDateFormatter();- const [, setParams] = useUrlParams();-- const [searchQuery, setSearchQuery] = useState("");- const historyDisclosure = useDisclosure();-- // Debounced search to avoid too many API calls- const debouncedSearch = useDebounce(setSearchQuery, 300);-- const handleChatSelect = (chatId: string) => {- setParams({ chatId });- historyDisclosure.onClose();- };-- const handleDeleteChat = (e: React.MouseEvent, chatId: string) => {- alert(`Delete chat ${chatId}`);- };-- return (- <Popover- open={historyDisclosure.isOpen}- onOpenChange={historyDisclosure.onToggle}- >- <PopoverTrigger asChild>- <IconButton- variant="secondary"- icon={<LuMenu />}- aria-label={t`Open chat history`}- />- </PopoverTrigger>- <PopoverContent className="w-[380px] p-0" align="end">- <div className="p-4">- <div className="relative mb-4">- <LuSearch- className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground"- size={14}- />- <Input- placeholder={t`Search history`}- className="pl-9"- onChange={(e) => debouncedSearch(e.target.value)}- />- </div>-- <div className="max-h-80 overflow-y-auto">- {isLoading ? (- <ChatHistorySkeleton />- ) : chats?.length === 0 ? (- <div className="flex items-center justify-center py-8">- <div className="text-sm text-muted-foreground">- {searchQuery ? (- <Trans>No chats found</Trans>- ) : (- <Trans>No chat history</Trans>- )}- </div>- </div>- ) : (- <div className="space-y-4">- {chats?.map((chat: Chat) => (- <div- key={chat.id}- className="group relative flex items-center justify-between hover:bg-muted/50 rounded-md p-2 -m-2"- >- <button- type="button"- onClick={() => handleChatSelect(chat.id)}- className="flex-1 text-left"- >- <div className="flex flex-col gap-1">- <div className="text-sm font-medium line-clamp-1">- {chat.title || t`New chat`}- </div>- <div className="text-xs text-muted-foreground">- {formatTimeAgo(chat.updatedAt.toISOString())}- </div>- </div>- </button>- <button- type="button"- onClick={(e) => handleDeleteChat(e, chat.id)}- className="opacity-0 group-hover:opacity-100 transition-opacity duration-200 p-1 hover:bg-destructive/10 rounded-sm"- title={t`Delete chat`}- >- <LuTrash- size={14}- className="text-muted-foreground hover:text-destructive"- />- </button>- </div>- ))}- </div>- )}- </div>- </div>- </PopoverContent>- </Popover>- );-}diff --git a/apps/erp/app/components/Chat/ChatInput.tsx b/apps/erp/app/components/Chat/ChatInput.tsxdeleted file mode 100644index dc6019dc01..0000000000--- a/apps/erp/app/components/Chat/ChatInput.tsx+++ /dev/null@@ -1,222 +0,0 @@-import {- useChatActions,- useChatId,- useChatStatus,- useDataPart-} from "@ai-sdk-tools/store";-import { cn } from "@carbon/react";-import { useLingui } from "@lingui/react/macro";-import { forwardRef, useRef } from "react";-import { CommandMenu } from "./CommandMenu";-import { useChatStore } from "./lib/store";-import type { PromptInputMessage } from "./PromptInput";-import {- PromptInput,- PromptInputActionAddAttachments,- PromptInputAttachment,- PromptInputAttachments,- PromptInputBody,- PromptInputSubmit,- PromptInputTextarea,- PromptInputToolbar,- PromptInputTools-} from "./PromptInput";-import type { RecordButtonRef } from "./RecordButton";-import { RecordButton } from "./RecordButton";-import { SuggestedActionsButton } from "./SuggestedActions";-import { SuggestedPrompts } from "./SuggestedPrompts";-import { WebSearchButton } from "./WebSearch";--export interface ChatInputMessage extends PromptInputMessage {- metadata?: {- agentChoice?: string;- toolChoice?: string;- };-}--interface ChatInputProps {- hasMessages: boolean;-}--export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(- function ChatInput({ hasMessages }, ref) {- const { t } = useLingui();- const textareaRef = useRef<HTMLTextAreaElement>(null);-- const status = useChatStatus();- const { sendMessage, stop } = useChatActions();- const chatId = useChatId();-- const [, clearSuggestions] = useDataPart<{ prompts: string[] }>(- "suggestions"- );-- // const { } = useArtifacts({- // exclude: ["chat-title", "followup-questions"],- // });- // const isCanvasVisible = false;-- const {- input,- isWebSearch,- isUploading,- isRecording,- isProcessing,- showCommands,- selectedCommandIndex,- filteredCommands,- setInput,- handleInputChange,- handleKeyDown,- resetCommandState- } = useChatStore();-- const handleSubmit = (message: ChatInputMessage) => {- // If currently streaming or submitted, stop instead of submitting- if (status === "streaming" || status === "submitted") {- stop();- return;- }-- const hasText = Boolean(message.text);- const hasAttachments = Boolean(message.files?.length);-- if (!(hasText || hasAttachments)) {- return;- }-- sendMessage({- text: message.text || "Sent with attachments",- files: message.files,- metadata: {- agentChoice: message.metadata?.agentChoice,- toolChoice: message.metadata?.toolChoice- }- });- setInput("");- };-- return (- <>- <div- className={cn(- "transition-all duration-300 ease-in-out",- hasMessages ? "absolute bottom-6 left-0 z-20 w-full" : ""- // isCanvasVisible ? "right-[603px]" : "right-0"- )}- >- <div className="mx-auto w-full pt-2 relative">- {/* Command Suggestions Menu */}- <SuggestedPrompts />- <CommandMenu />-- <PromptInput onSubmit={handleSubmit} globalDrop multiple>- <PromptInputBody>- <PromptInputAttachments>- {(attachment) => <PromptInputAttachment data={attachment} />}- </PromptInputAttachments>- <PromptInputTextarea- ref={textareaRef}- autoFocus- onChange={handleInputChange}- onKeyDown={(e) => {- // Handle Enter key for commands- if (e.key === "Enter" && showCommands) {- e.preventDefault();- const selectedCommand =- filteredCommands[selectedCommandIndex];- if (selectedCommand) {- // Execute command through the store- if (!chatId) return;-- clearSuggestions();-- sendMessage({- role: "user",- parts: [- { type: "text", text: selectedCommand.title }- ],- metadata: {- toolCall: {- toolName: selectedCommand.toolName,- toolParams: selectedCommand.toolParams- }- }- });-- setInput("");- resetCommandState();- }- return;- }-- // Handle Enter key for normal messages- if (e.key === "Enter" && !showCommands) {- e.preventDefault();- if (input.trim()) {- if (status === "streaming" || status === "submitted") {- stop?.();- // Continue to send the new message after stopping- }-- // Clear old suggestions- clearSuggestions();-- sendMessage({- text: input,- files: [],- metadata: {- webSearch: isWebSearch- }- });-- setInput("");- resetCommandState();- }- return;- }-- // Handle other keys normally- handleKeyDown(e);- }}- value={input}- placeholder={- isWebSearch- ? t({- id: "Search the web",- message: "Search the web"- })- : t({- id: "Ask anything",- message: "Ask anything"- })- }- />- </PromptInputBody>- <PromptInputToolbar>- <PromptInputTools>- <PromptInputActionAddAttachments />- <SuggestedActionsButton />- <WebSearchButton />- </PromptInputTools>-- <PromptInputTools>- <RecordButton ref={ref} size={16} />- <PromptInputSubmit- disabled={- (!input && !status) ||- isUploading ||- isRecording ||- isProcessing- }- status={status}- />- </PromptInputTools>- </PromptInputToolbar>- </PromptInput>- </div>- </div>- </>- );- }-);diff --git a/apps/erp/app/components/Chat/ChatInterface.tsx b/apps/erp/app/components/Chat/ChatInterface.tsxdeleted file mode 100644index b419309c3e..0000000000--- a/apps/erp/app/components/Chat/ChatInterface.tsx+++ /dev/null@@ -1,217 +0,0 @@-import { useArtifacts } from "@ai-sdk-tools/artifacts/client";-import { useChat, useChatActions, useDataPart } from "@ai-sdk-tools/store";-import { useCarbon } from "@carbon/auth";-import { cn } from "@carbon/react";-import { useLocale } from "@react-aria/i18n";-import { DefaultChatTransport, generateId } from "ai";-import { useEffect, useMemo, useRef } from "react";-import { Greeting } from "~/components/Greeting";-import { useUser } from "~/hooks";-import { path } from "~/utils/path";-import { Canvas } from "./Canvas";-import { ChatHeader } from "./ChatHeader";-import type { ChatInputMessage } from "./ChatInput";-import { ChatInput } from "./ChatInput";-import { ChatMessages } from "./ChatMessages";-import { ChatStatusIndicators } from "./ChatStatusIndicators";-import { ChatWidgets } from "./ChatWidgets";-import {- Conversation,- ConversationContent,- ConversationScrollButton-} from "./Conversation";-import { useChatInterface } from "./hooks/useChatInterface";-import { useChatStatus } from "./hooks/useChatStatus";-import type { UIChatMessage } from "./lib/types";-import type { RecordButtonRef } from "./RecordButton";--type Props = {- geo?: {- city?: string;- country?: string;- };-};--export function ChatInterface({ geo }: Props) {- const { chatId: routeChatId } = useChatInterface();- const recordButtonRef = useRef<RecordButtonRef>(null);-- const chatId = useMemo(() => routeChatId ?? generateId(), [routeChatId]);- const { reset } = useChatActions();- const prevChatIdRef = useRef<string | null>(routeChatId);- const [, clearSuggestions] = useDataPart<{ prompts: string[] }>(- "suggestions"- );-- // Reset chat state when navigating away from a chat (sidebar, browser back, etc.)- useEffect(() => {- const prevChatId = prevChatIdRef.current;- const currentChatId = routeChatId;-- // If we had a chatId before and now we don't (navigated away), reset- // Or if we're switching to a different chatId, reset- if (prevChatId && prevChatId !== currentChatId) {- reset();- clearSuggestions();- }-- // Update the ref for next comparison- prevChatIdRef.current = currentChatId;- }, [routeChatId, reset, clearSuggestions]);-- const { locale } = useLocale();- const { accessToken } = useCarbon();- const {- id: userId,- firstName,- lastName,- company: {- id: companyId,- name: companyName,- baseCurrencyCode: baseCurrency- }- } = useUser();-- // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration- const authenticatedFetch = useMemo(- () =>- Object.assign(- async (url: RequestInfo | URL, requestOptions?: RequestInit) => {- return fetch(url, {- ...requestOptions,- headers: {- ...requestOptions?.headers,- Authorization: `Bearer ${accessToken}`,- "Content-Type": "application/json",- "x-company-id": companyId,- "x-user-id": userId- }- });- }- ),-- [accessToken]- );-- const { messages, status } = useChat<UIChatMessage>({- id: chatId,- transport: new DefaultChatTransport({- api: path.to.api.chat,- fetch: authenticatedFetch,- prepareSendMessagesRequest({ messages, id }) {- const lastMessage = messages[messages.length - 1] as ChatInputMessage;-- const agentChoice = lastMessage.metadata?.agentChoice;- const toolChoice = lastMessage.metadata?.toolChoice;-- return {- body: {- id,- fullName: `${firstName} ${lastName}`,- companyName,- baseCurrency: baseCurrency ?? "USD",- country: geo?.country,- city: geo?.city,- message: lastMessage,- agentChoice,- toolChoice,- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,- locale- }- };- }- })- });-- const { agentStatus, currentToolCall } = useChatStatus(messages, status);-- // @ts-expect-error TS2339 - TODO: fix type- const { artifacts } = useArtifacts();- const hasArtifacts = artifacts && artifacts.length > 0;- const hasMessages = messages.length > 0;-- const [suggestions] = useDataPart<{ prompts: string[] }>("suggestions");- const hasSuggestions = suggestions?.prompts && suggestions.prompts.length > 0;-- return (- <div className="relative flex size-full overflow-hidden bg-background h-[calc(100dvh-49px)]">- {/* Canvas slides in from right when artifacts are present */}- <div- className={cn(- "fixed right-0 top-0 bottom-0 z-20",- hasArtifacts ? "translate-x-0" : "translate-x-full",- hasMessages && "transition-transform duration-300 ease-in-out"- )}- >- {hasArtifacts && <Canvas />}- </div>-- {/* Main chat area - container that slides left when canvas opens */}- <div- className={cn(- "relative flex-1",- hasMessages && "transition-all duration-300 ease-in-out",- hasArtifacts && "mr-[600px]",- !hasMessages && "flex items-center justify-center"- )}- >- {hasMessages && (- <>- {/* Conversation view - messages with absolute positioning for proper height */}- <div className="absolute inset-0 flex flex-col">- <div- className={cn(- "sticky top-0 left-0 z-10 shrink-0",- hasMessages && "transition-all duration-300 ease-in-out",- hasArtifacts ? "right-[600px]" : "right-0"- )}- >- <div className="bg-background/80 dark:bg-background/50 backdrop-blur-sm p-2 border-b">- <ChatHeader />- </div>- </div>- <Conversation>- <ConversationContent className="pb-48 pt-14">- <div className="max-w-2xl mx-auto w-full">- <ChatMessages- messages={messages}- isStreaming={- status === "streaming" || status === "submitted"- }- />- <ChatStatusIndicators- agentStatus={agentStatus}- currentToolCall={currentToolCall}- status={status}- />- </div>- </ConversationContent>- <ConversationScrollButton- className={cn(hasSuggestions ? "bottom-52" : "bottom-42")}- />- </Conversation>- </div>- </>- )}-- {/* Fixed input at bottom - respects parent container boundaries */}- <div- className={cn(- "transition-all duration-300 ease-in-out max-w-2xl mx-auto px-6",- hasMessages- ? "absolute bottom-0 left-0"- : "w-full -mt-[20dvh] flex flex-col gap-8 items-center justify-center",- hasArtifacts ? "right-[600px]" : "right-0"- )}- >- {!hasMessages && <Greeting size="h1" className="font-medium" />}- <div className="w-full pb-2">- <ChatInput ref={recordButtonRef} hasMessages={hasMessages} />- </div>-- {!hasMessages && <ChatWidgets recordButtonRef={recordButtonRef} />}- </div>- </div>- </div>- );-}diff --git a/apps/erp/app/components/Chat/ChatMessages.tsx b/apps/erp/app/components/Chat/ChatMessages.tsxdeleted file mode 100644index 4fd787e6ab..0000000000--- a/apps/erp/app/components/Chat/ChatMessages.tsx+++ /dev/null@@ -1,181 +0,0 @@-import type { UIMessage } from "ai";-import { LuPaperclip } from "react-icons/lu";-import { Message, MessageContent } from "~/components/Message";-import { FaviconStack } from "./Favicon";-import { Markdown } from "./Markdown/Markdown";--interface ChatMessagesProps {- messages: UIMessage[];- isStreaming?: boolean;-}--interface SourceItem {- url: string;- title: string;- publishedDate?: string;-}--interface WebSearchToolOutput {- sources?: SourceItem[];-}--/**- * Extract sources from webSearch tool results- * Sources are already deduplicated by the tool- */-function extractWebSearchSources(parts: UIMessage["parts"]): SourceItem[] {- const sources: SourceItem[] = [];-- for (const part of parts) {- const type = part.type as string;- if (type === "tool-webSearch") {- const output = (part as { output?: WebSearchToolOutput }).output;- if (output?.sources) {- sources.push(...output.sources);- }- }- }-- return sources;-}--/**- * Extract source-url parts from AI SDK- */-function extractAiSdkSources(parts: UIMessage["parts"]): SourceItem[] {- const sources: SourceItem[] = [];-- for (const part of parts) {- if (part.type === "source-url") {- const sourcePart = part as { url: string; title?: string };- sources.push({- url: sourcePart.url,- title: sourcePart.title || sourcePart.url- });- }- }-- return sources;-}--/**- * Extract file parts from message- */-function extractFileParts(parts: UIMessage["parts"]) {- return parts.filter((part) => part.type === "file");-}--export function ChatMessages({- messages,- isStreaming = false-}: ChatMessagesProps) {- return (- <>- {messages.map(({ parts, ...message }, index) => {- // Extract text parts- const textParts = parts.filter((part) => part.type === "text");- const textContent = textParts- .map((part) => (part.type === "text" ? part.text : ""))- .join("");-- // Extract file parts- const fileParts = extractFileParts(parts);-- // Extract sources from AI SDK and webSearch- const aiSdkSources = extractAiSdkSources(parts);-- // Extract sources from webSearch tool results (already deduplicated)- const webSearchSources = extractWebSearchSources(parts);-- // Combine sources and deduplicate between AI SDK and webSearch sources- const allSources = [...aiSdkSources, ...webSearchSources];- const uniqueSources = allSources.filter(- (source, index, self) =>- index === self.findIndex((s) => s.url === source.url)- );-- // Check if this is the last (currently streaming) message- const isLastMessage = index === messages.length - 1;-- // Show sources only after response is finished (not on the currently streaming message)- const shouldShowSources =- uniqueSources.length > 0 &&- message.role === "assistant" &&- (!isLastMessage || !isStreaming);-- return (- <div key={message.id}>- {/* Render file attachments */}- {fileParts.length > 0 && (- <Message from={message.role}>- <MessageContent className="max-w-[80%]">- <div className="flex flex-wrap gap-2 mb-2">- {fileParts.map((part) => {- if (part.type !== "file") return null;-- const file = part as {- type: "file";- url?: string;- mediaType?: string;- filename?: string;- };-- // Create a unique key from file properties- const fileKey = `${file.url}-${file.filename}`;- const isImage = file.mediaType?.startsWith("image/");-- if (isImage && file.url) {- return (- <div- key={fileKey}- className="relative rounded-lg border overflow-hidden"- >- <img- src={file.url}- alt={file.filename || "attachment"}- className="max-w-xs max-h-48 object-cover"- width={300}- height={192}- />- </div>- );- }-- return (- <div- key={fileKey}- className="flex items-center gap-2 px-3 py-2 rounded-lg border bg-muted/50"- >- <LuPaperclip className="size-4 shrink-0 text-muted-foreground" />- <span className="text-sm font-medium">- {file.filename || "Unknown file"}- </span>- </div>- );- })}- </div>- </MessageContent>- </Message>- )}-- {/* Render text content in message */}- {textParts.length > 0 && (- <Message from={message.role}>- <MessageContent className="max-w-[80%]">- <Markdown html>{textContent}</Markdown>- </MessageContent>- </Message>- )}-- {/* Render sources as stacked favicons - show immediately when available */}- {shouldShowSources && (- <div className="max-w-[80%]">- <FaviconStack sources={uniqueSources} />- </div>- )}- </div>- );- })}- </>- );-}diff --git a/apps/erp/app/components/Chat/ChatNavigation.tsx b/apps/erp/app/components/Chat/ChatNavigation.tsxdeleted file mode 100644index 637d95d01a..0000000000--- a/apps/erp/app/components/Chat/ChatNavigation.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { useChatActions } from "@ai-sdk-tools/store";-import { IconButton } from "@carbon/react";-import { useLingui } from "@lingui/react/macro";-import { LuArrowLeft } from "react-icons/lu";-import { useNavigate } from "react-router";-import { path } from "~/utils/path";-import { useChatInterface } from "./hooks/useChatInterface";--export function ChatNavigation() {- const { t } = useLingui();- const navigate = useNavigate();- const { reset } = useChatActions();- const { isChatPage } = useChatInterface();-- const handleBack = () => {- reset();- navigate(path.to.authenticatedRoot);- };-- if (!isChatPage) return null;-- return (- <div className="absolute left-0">- <IconButton- aria-label={t`Back to home`}- variant="ghost"- onClick={handleBack}- icon={<LuArrowLeft />}- />- </div>- );-}diff --git a/apps/erp/app/components/Chat/ChatStatusIndicators.tsx b/apps/erp/app/components/Chat/ChatStatusIndicators.tsxdeleted file mode 100644index 34ee7755a9..0000000000--- a/apps/erp/app/components/Chat/ChatStatusIndicators.tsx+++ /dev/null@@ -1,44 +0,0 @@-import { AnimatedStatus } from "./AnimatedStatus";-import { Loader } from "./Loader";-import { getStatusMessage } from "./lib/agent";-import type { AgentStatus } from "./lib/types";-import { getToolIcon, getToolMessage } from "./ToolCallIndicator";--interface ChatStatusIndicatorsProps {- agentStatus: AgentStatus | null;- currentToolCall: string | null;- status?: string;-}--export function ChatStatusIndicators({- agentStatus,- currentToolCall,- status-}: ChatStatusIndicatorsProps) {- const statusMessage = getStatusMessage(agentStatus);- const toolMessage = currentToolCall ? getToolMessage(currentToolCall) : null;-- // Always prioritize tool message over agent status when a tool is running- const displayMessage = toolMessage || statusMessage;-- // Get icon for current tool - always show icon when tool is running- const toolIcon = currentToolCall ? getToolIcon(currentToolCall) : null;-- return (- <div className="h-8 flex items-center">- <AnimatedStatus- text={displayMessage ?? null}- shimmerDuration={0.75}- fadeDuration={0.1}- variant="slide"- className="text-xs font-normal"- icon={toolIcon}- />-- {((agentStatus && !getStatusMessage(agentStatus)) ||- (status === "submitted" && !agentStatus && !currentToolCall)) && (- <Loader />- )}- </div>- );-}diff --git a/apps/erp/app/components/Chat/ChatTitle.tsx b/apps/erp/app/components/Chat/ChatTitle.tsxdeleted file mode 100644index c44bf1cb62..0000000000--- a/apps/erp/app/components/Chat/ChatTitle.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { useDataPart } from "@ai-sdk-tools/store";-import { AnimatePresence, motion } from "framer-motion";--interface ChatTitleData {- chatId: string;- title: string;-}--export function ChatTitle() {- const [chatTitle] = useDataPart<ChatTitleData>("chat-title", {- onData: (dataPart) => {- if (dataPart.data.title) {- document.title = `${dataPart.data.title} - Carbon`;- }- }- });-- return (- <AnimatePresence mode="wait">- {chatTitle?.title && (- <motion.div- key={chatTitle.title}- initial={{ width: 0, opacity: 0 }}- animate={{ width: "auto", opacity: 1 }}- exit={{ width: 0, opacity: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="overflow-hidden"- >- <div className="text-sm font-medium text-foreground whitespace-nowrap">- {chatTitle.title}- </div>- </motion.div>- )}- </AnimatePresence>- );-}diff --git a/apps/erp/app/components/Chat/ChatWidgets.tsx b/apps/erp/app/components/Chat/ChatWidgets.tsxdeleted file mode 100644index 3f86103746..0000000000--- a/apps/erp/app/components/Chat/ChatWidgets.tsx+++ /dev/null@@ -1,59 +0,0 @@-import { Button } from "@carbon/react";-import { Trans } from "@lingui/react/macro";-import type { RefObject } from "react";-import {- LuAudioLines,- LuChevronDown,- LuSearch,- LuSquarePen-} from "react-icons/lu";-import { useUIStore } from "~/stores/ui";-import CreateMenu from "../Layout/Topbar/CreateMenu";-import type { RecordButtonRef } from "./RecordButton";--interface ChatWidgetsProps {- recordButtonRef?: RefObject<RecordButtonRef>;-}--export function ChatWidgets({ recordButtonRef }: ChatWidgetsProps) {- const { openSearchModal } = useUIStore();-- const handleVoiceClick = () => {- recordButtonRef?.current?.handleRecordClick();- };-- return (- <div className="w-full flex gap-3 justify-center items-center">- <Button- variant="secondary"- className="rounded-full"- leftIcon={<LuSearch />}- onClick={openSearchModal}- >- <Trans>Search</Trans>- </Button>-- <CreateMenu- trigger={- <Button- variant="secondary"- className="rounded-full"- leftIcon={<LuSquarePen />}- rightIcon={<LuChevronDown />}- >- <Trans>Create</Trans>- </Button>- }- />-- <Button- variant="secondary"- className="rounded-full"- leftIcon={<LuAudioLines />}- onClick={handleVoiceClick}- >- <Trans>Voice</Trans>- </Button>- </div>- );-}diff --git a/apps/erp/app/components/Chat/CommandMenu.tsx b/apps/erp/app/components/Chat/CommandMenu.tsxdeleted file mode 100644index fd44a09e2a..0000000000--- a/apps/erp/app/components/Chat/CommandMenu.tsx+++ /dev/null@@ -1,119 +0,0 @@-import { useChatActions, useChatId } from "@ai-sdk-tools/store";-import { cn } from "@carbon/react";-import type { RefObject } from "react";-import { useEffect, useRef } from "react";-import { LuArrowRight } from "react-icons/lu";-import { useOnClickOutside } from "~/hooks/useOnClickOutside";-import { AnimatedSizeContainer } from "./AnimatedSizeContainer";-import { useChatStore } from "./lib/store";--export function CommandMenu() {- const commandListRef = useRef<HTMLDivElement>(null);- const {- filteredCommands,- selectedCommandIndex,- showCommands,- // handleCommandSelect,- resetCommandState,- setInput,- setShowCommands- } = useChatStore();-- const { sendMessage } = useChatActions();- const chatId = useChatId();-- // Close command menu when clicking outside (but not on the toggle button)- useOnClickOutside(commandListRef as RefObject<HTMLElement>, (event) => {- if (showCommands) {- // Check if the click was on the suggested actions toggle button- const target = event.target as Element;- const isToggleButton = target.closest("[data-suggested-actions-toggle]");-- // Only close if it's not the toggle button- if (!isToggleButton) {- setShowCommands(false);- }- }- });-- const handleCommandExecution = (command: any) => {- if (!chatId) return;-- sendMessage({- role: "user",- parts: [{ type: "text", text: command.title }],- metadata: {- toolCall: {- toolName: command.toolName,- toolParams: command.toolParams- }- }- });-- setInput("");- resetCommandState();- };-- // Scroll selected command into view- useEffect(() => {- if (commandListRef.current && showCommands) {- const selectedElement = commandListRef.current.querySelector(- `[data-index="${selectedCommandIndex}"]`- );- if (selectedElement) {- selectedElement.scrollIntoView({ block: "nearest" });- }- }- }, [selectedCommandIndex, showCommands]);-- if (!showCommands || filteredCommands.length === 0) return null;-- return (- <div- ref={commandListRef}- className="absolute bottom-full left-0 right-0 mb-2 w-full z-30"- >- <AnimatedSizeContainer- height- className="bg-[#f7f7f7]/85 dark:bg-[#171717]/85 backdrop-blur-lg max-h-80 overflow-y-auto"- transition={{- type: "spring",- duration: 0.2,- bounce: 0.1,- ease: "easeOut"- }}- style={{- transformOrigin: "bottom center"- }}- >- <div className="p-2">- {filteredCommands.map((command, index) => {- const isActive = selectedCommandIndex === index;- return (- <div- key={`${command.command}-${index}`}- className={cn(- "px-2 py-2 text-sm cursor-pointer transition-colors flex items-center justify-between group",- isActive- ? "bg-black/5 dark:bg-white/5"- : "hover:bg-black/5 dark:hover:bg-white/5"- )}- onClick={() => handleCommandExecution(command)}- data-index={index}- >- <div>- <span className="text-[#666] ml-2">{command.title}</span>- </div>- {isActive && (- <span className="material-icons-outlined text-sm opacity-50 group-hover:opacity-100 text-gray-600 dark:text-gray-400 group-hover:text-black dark:group-hover:text-white">- <LuArrowRight />- </span>- )}- </div>- );- })}- </div>- </AnimatedSizeContainer>- </div>- );-}diff --git a/apps/erp/app/components/Chat/Conversation.tsx b/apps/erp/app/components/Chat/Conversation.tsxdeleted file mode 100644index 93c0ba8123..0000000000--- a/apps/erp/app/components/Chat/Conversation.tsx+++ /dev/null@@ -1,94 +0,0 @@-import { cn, IconButton } from "@carbon/react";-import type { ComponentProps } from "react";-import { useCallback } from "react";-import { LuArrowDown } from "react-icons/lu";-import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";--export type ConversationProps = ComponentProps<typeof StickToBottom>;--export const Conversation = ({ className, ...props }: ConversationProps) => (- <StickToBottom- className={cn("relative flex-1 overflow-y-auto", className)}- initial="smooth"- resize="smooth"- role="log"- {...props}- />-);--export type ConversationContentProps = ComponentProps<- typeof StickToBottom.Content->;--export const ConversationContent = ({- className,- ...props-}: ConversationContentProps) => (- <StickToBottom.Content className={cn("p-4", className)} {...props} />-);--export type ConversationEmptyStateProps = ComponentProps<"div"> & {- title?: string;- description?: string;- icon?: React.ReactNode;-};--export const ConversationEmptyState = ({- className,- title = "No messages yet",- description = "Start a conversation to see messages here",- icon,- children,- ...props-}: ConversationEmptyStateProps) => (- <div- className={cn(- "flex size-full flex-col items-center justify-center gap-3 p-8 text-center",- className- )}- {...props}- >- {children ?? (- <>- {icon && <div className="text-muted-foreground">{icon}</div>}- <div className="space-y-1">- <h3 className="font-medium text-sm">{title}</h3>- {description && (- <p className="text-muted-foreground text-sm">{description}</p>- )}- </div>- </>- )}- </div>-);--// @ts-expect-error TS2304 - TODO: fix type-export type ConversationScrollButtonProps = ComponentProps<typeof Button>;--export const ConversationScrollButton = ({- className,- ...props-}: ConversationScrollButtonProps) => {- const { isAtBottom, scrollToBottom } = useStickToBottomContext();-- const handleScrollToBottom = useCallback(() => {- scrollToBottom();- }, [scrollToBottom]);-- return (- !isAtBottom && (- <IconButton- icon={<LuArrowDown />}- className={cn(- "absolute bottom-42 left-[50%] translate-x-[-50%] rounded-full",- className- )}- onClick={handleScrollToBottom}- size="icon"- type="button"- variant="secondary"- {...props}- />- )- );-};diff --git a/apps/erp/app/components/Chat/DevTools.client.tsx b/apps/erp/app/components/Chat/DevTools.client.tsxdeleted file mode 100644index f4a1e1a07e..0000000000--- a/apps/erp/app/components/Chat/DevTools.client.tsx+++ /dev/null@@ -1,17 +0,0 @@-import { AIDevtools } from "@ai-sdk-tools/devtools";-import { getAppUrl } from "@carbon/auth";-import { path } from "~/utils/path";--export function DevTools() {- return (- <AIDevtools- config={{- streamCapture: {- enabled: true,- endpoint: `${getAppUrl()}${path.to.api.chat}`,- autoConnect: true- }- }}- />- );-}diff --git a/apps/erp/app/components/Chat/Favicon.tsx b/apps/erp/app/components/Chat/Favicon.tsxdeleted file mode 100644index 47420a5f88..0000000000--- a/apps/erp/app/components/Chat/Favicon.tsx+++ /dev/null@@ -1,92 +0,0 @@-import { getFaviconUrl } from "@carbon/utils";-import { AnimatePresence, motion } from "framer-motion";-import { LuBook } from "react-icons/lu";--interface SourceItem {- url: string;- title: string;-}--interface FaviconStackProps {- sources: SourceItem[];-}--export function FaviconStack({ sources }: FaviconStackProps) {- if (sources.length === 0) return null;-- return (- <div className="flex items-center not-prose mb-4">- <div className="flex items-center">- <AnimatePresence mode="popLayout">- {sources.map((source, index) => (- <motion.a- key={source.url}- href={source.url}- target="_blank"- rel="noreferrer"- initial={{- opacity: 0,- scale: 0.6,- x: 50,- filter: "blur(4px)"- }}- animate={{- opacity: 1,- scale: 1,- x: 0,- filter: "blur(0px)",- zIndex: sources.length - index- }}- exit={{- opacity: 0,- scale: 0.8,- x: -20,- filter: "blur(4px)"- }}- transition={{- duration: 0.4,- delay: index * 0.04,- ease: [0.16, 1, 0.3, 1] // Custom easing for smooth motion- }}- className="relative group -ml-2 first:ml-0"- style={{ zIndex: sources.length - index }}- >- <div className="relative w-5 h-5 rounded-full bg-background border-2 border-border overflow-hidden flex items-center justify-center shadow-sm">- <img- src={getFaviconUrl(source.url)}- alt=""- className="w-full h-full object-cover"- onError={(e) => {- // Hide image and show fallback icon- const target = e.target as HTMLImageElement;- target.style.display = "none";- const parent = target.parentElement;- const fallback = parent?.querySelector(- ".fallback-icon"- ) as HTMLElement;- if (fallback) fallback.style.display = "block";- }}- />- <LuBook- className="fallback-icon w-3 h-3 hidden text-muted-foreground"- style={{ display: "none" }}- />- </div>-- {/* Tooltip on hover */}- <div className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-popover text-popover-foreground text-xs rounded-md shadow-md whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10">- {source.title}- </div>- </motion.a>- ))}- </AnimatePresence>- </div>-- {sources.length > 0 && (- <span className="text-xs text-muted-foreground ml-2">- {sources.length} {sources.length === 1 ? "source" : "sources"}- </span>- )}- </div>- );-}diff --git a/apps/erp/app/components/Chat/FollowupQuestions.tsx b/apps/erp/app/components/Chat/FollowupQuestions.tsxdeleted file mode 100644index 4ce1c777b8..0000000000--- a/apps/erp/app/components/Chat/FollowupQuestions.tsx+++ /dev/null@@ -1,104 +0,0 @@-// import { followupQuestionsArtifact } from "@api/ai/artifacts/followup-questions";--export function FollowupQuestions() {- return null;- // const { data } = useArtifact(followupQuestionsArtifact);- // const [isVisible, setIsVisible] = useState(false);- // const { sendMessage } = useChatActions();- // const { setChatId } = useChatInterface();- // const { resetCommandState } = useChatStore();- // const status = useChatStatus();- // const chatId = useChatId();-- // const handleQuestionSelect = (question: string) => {- // if (chatId) {- // setChatId(chatId);-- // sendMessage({- // role: "user",- // parts: [{ type: "text", text: question }],- // });-- // resetCommandState();- // }- // };-- // useEffect(() => {- // if (- // status !== "streaming" &&- // data?.questions &&- // data.questions.length > 0- // ) {- // // Small delay to allow for smooth animation- // setTimeout(() => setIsVisible(true), 100);- // } else {- // setIsVisible(false);- // }- // }, [data]);-- // if (!data?.questions || data.questions.length === 0) {- // return null;- // }-- // return (- // <AnimatePresence>- // {isVisible && (- // <motion.div- // className="absolute bottom-full left-0 right-0 mb-3"- // initial={{ opacity: 0, y: 20 }}- // animate={{ opacity: 1, y: 0 }}- // exit={{ opacity: 0, y: 20 }}- // transition={{ duration: 0.3, ease: "easeOut" }}- // >- // <div className="relative">- // <motion.div- // className="flex items-center gap-2 overflow-x-auto justify-start [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"- // variants={{- // hidden: { opacity: 0 },- // visible: {- // opacity: 1,- // transition: {- // staggerChildren: 0.1,- // delayChildren: 0.1,- // },- // },- // }}- // initial="hidden"- // animate="visible"- // >- // {data.questions.map((question, index) => (- // <motion.div- // key={`followup-${question.slice(0, 20)}-${index}`}- // variants={{- // hidden: { opacity: 0, y: 10, scale: 0.9 },- // visible: {- // opacity: 1,- // y: 0,- // scale: 1,- // transition: {- // type: "spring",- // stiffness: 300,- // damping: 24,- // },- // },- // }}- // >- // <Button- // variant="outline"- // size="sm"- // className="h-7 px-3 text-xs rounded-full text-[#707070] bg-background/95 backdrop-blur-md border-border hover:bg-accent/50 transition-colors whitespace-nowrap"- // onClick={() => handleQuestionSelect(question)}- // >- // {question}- // </Button>- // </motion.div>- // ))}- // </motion.div>- // {/* Right fade gradient to indicate more content */}- // <div className="absolute top-0 right-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent pointer-events-none" />- // </div>- // </motion.div>- // )}- // </AnimatePresence>- // );-}diff --git a/apps/erp/app/components/Chat/LICENSE b/apps/erp/app/components/Chat/LICENSEdeleted file mode 100644index 3638d7346a..0000000000--- a/apps/erp/app/components/Chat/LICENSE+++ /dev/null@@ -1,663 +0,0 @@-Copyright (c) 2023-present Midday Labs AB.-- GNU AFFERO GENERAL PUBLIC LICENSE- Version 3, 19 November 2007--Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>-Everyone is permitted to copy and distribute verbatim copies-of this license document, but changing it is not allowed.-- Preamble--The GNU Affero General Public License is a free, copyleft license for-software and other kinds of works, specifically designed to ensure-cooperation with the community in the case of network server software.--The licenses for most software and other practical works are designed-to take away your freedom to share and change the works. By contrast,-our General Public Licenses are intended to guarantee your freedom to-share and change all versions of a program--to make sure it remains free-software for all its users.--When we speak of free software, we are referring to freedom, not-price. Our General Public Licenses are designed to make sure that you-have the freedom to distribute copies of free software (and charge for-them if you wish), that you receive source code or can get it if you-want it, that you can change the software or use pieces of it in new-free programs, and that you know you can do these things.--Developers that use our General Public Licenses protect your rights-with two steps: (1) assert copyright on the software, and (2) offer-you this License which gives you legal permission to copy, distribute-and/or modify the software.--A secondary benefit of defending all users' freedom is that-improvements made in alternate versions of the program, if they-receive widespread use, become available for other developers to-incorporate. Many developers of free software are heartened and-encouraged by the resulting cooperation. However, in the case of-software used on network servers, this result may fail to come about.-The GNU General Public License permits making a modified version and-letting the public access it on a server without ever releasing its-source code to the public.--The GNU Affero General Public License is designed specifically to-ensure that, in such cases, the modified source code becomes available-to the community. It requires the operator of a network server to-provide the source code of the modified version running there to the-users of that server. Therefore, public use of a modified version, on-a publicly accessible server, gives the public access to the source-code of the modified version.--An older license, called the Affero General Public License and-published by Affero, was designed to accomplish similar goals. This is-a different license, not a version of the Affero GPL, but Affero has-released a new version of the Affero GPL which permits relicensing under-this license.--The precise terms and conditions for copying, distribution and-modification follow.-- TERMS AND CONDITIONS--0. Definitions.--"This License" refers to version 3 of the GNU Affero General Public License.--"Copyright" also means copyright-like laws that apply to other kinds of-works, such as semiconductor masks.--"The Program" refers to any copyrightable work licensed under this-License. Each licensee is addressed as "you". "Licensees" and-"recipients" may be individuals or organizations.--To "modify" a work means to copy from or adapt all or part of the work-in a fashion requiring copyright permission, other than the making of an-exact copy. The resulting work is called a "modified version" of the-earlier work or a work "based on" the earlier work.--A "covered work" means either the unmodified Program or a work based-on the Program.--To "propagate" a work means to do anything with it that, without-permission, would make you directly or secondarily liable for-infringement under applicable copyright law, except executing it on a-computer or modifying a private copy. Propagation includes copying,-distribution (with or without modification), making available to the-public, and in some countries other activities as well.--To "convey" a work means any kind of propagation that enables other-parties to make or receive copies. Mere interaction with a user through-a computer network, with no transfer of a copy, is not conveying.--An interactive user interface displays "Appropriate Legal Notices"-to the extent that it includes a convenient and prominently visible-feature that (1) displays an appropriate copyright notice, and (2)-tells the user that there is no warranty for the work (except to the-extent that warranties are provided), that licensees may convey the-work under this License, and how to view a copy of this License. If-the interface presents a list of user commands or options, such as a-menu, a prominent item in the list meets this criterion.--1. Source Code.--The "source code" for a work means the preferred form of the work-for making modifications to it. "Object code" means any non-source-form of a work.--A "Standard Interface" means an interface that either is an official-standard defined by a recognized standards body, or, in the case of-interfaces specified for a particular programming language, one that-is widely used among developers working in that language.--The "System Libraries" of an executable work include anything, other-than the work as a whole, that (a) is included in the normal form of-packaging a Major Component, but which is not part of that Major-Component, and (b) serves only to enable use of the work with that-Major Component, or to implement a Standard Interface for which an-implementation is available to the public in source code form. A-"Major Component", in this context, means a major essential component-(kernel, window system, and so on) of the specific operating system-(if any) on which the executable work runs, or a compiler used to-produce the work, or an object code interpreter used to run it.--The "Corresponding Source" for a work in object code form means all-the source code needed to generate, install, and (for an executable-work) run the object code and to modify the work, including scripts to-control those activities. However, it does not include the work's-System Libraries, or general-purpose tools or generally available free-programs which are used unmodified in performing those activities but-which are not part of the work. For example, Corresponding Source-includes interface definition files associated with source files for-the work, and the source code for shared libraries and dynamically-linked subprograms that the work is specifically designed to require,-such as by intimate data communication or control flow between those-subprograms and other parts of the work.--The Corresponding Source need not include anything that users-can regenerate automatically from other parts of the Corresponding-Source.--The Corresponding Source for a work in source code form is that-same work.--2. Basic Permissions.--All rights granted under this License are granted for the term of-copyright on the Program, and are irrevocable provided the stated-conditions are met. This License explicitly affirms your unlimited-permission to run the unmodified Program. The output from running a-covered work is covered by this License only if the output, given its-content, constitutes a covered work. This License acknowledges your-rights of fair use or other equivalent, as provided by copyright law.--You may make, run and propagate covered works that you do not-convey, without conditions so long as your license otherwise remains-in force. You may convey covered works to others for the sole purpose-of having them make modifications exclusively for you, or provide you-with facilities for running those works, provided that you comply with-the terms of this License in conveying all material for which you do-not control copyright. Those thus making or running the covered works-for you must do so exclusively on your behalf, under your direction-and control, on terms that prohibit them from making any copies of-your copyrighted material outside their relationship with you.--Conveying under any other circumstances is permitted solely under-the conditions stated below. Sublicensing is not allowed; section 10-makes it unnecessary.--3. Protecting Users' Legal Rights From Anti-Circumvention Law.--No covered work shall be deemed part of an effective technological-measure under any applicable law fulfilling obligations under article-11 of the WIPO copyright treaty adopted on 20 December 1996, or-similar laws prohibiting or restricting circumvention of such-measures.--When you convey a covered work, you waive any legal power to forbid-circumvention of technological measures to the extent such circumvention-is effected by exercising rights under this License with respect to-the covered work, and you disclaim any intention to limit operation or-modification of the work as a means of enforcing, against the work's-users, your or third parties' legal rights to forbid circumvention of-technological measures.--4. Conveying Verbatim Copies.--You may convey verbatim copies of the Program's source code as you-receive it, in any medium, provided that you conspicuously and-appropriately publish on each copy an appropriate copyright notice;-keep intact all notices stating that this License and any-non-permissive terms added in accord with section 7 apply to the code;-keep intact all notices of the absence of any warranty; and give all-recipients a copy of this License along with the Program.--You may charge any price or no price for each copy that you convey,-and you may offer support or warranty protection for a fee.--5. Conveying Modified Source Versions.--You may convey a work based on the Program, or the modifications to-produce it from the Program, in the form of source code under the-terms of section 4, provided that you also meet all of these conditions:-- a) The work must carry prominent notices stating that you modified- it, and giving a relevant date.-- b) The work must carry prominent notices stating that it is- released under this License and any conditions added under section- 7. This requirement modifies the requirement in section 4 to- "keep intact all notices".-- c) You must license the entire work, as a whole, under this- License to anyone who comes into possession of a copy. This- License will therefore apply, along with any applicable section 7- additional terms, to the whole of the work, and all its parts,- regardless of how they are packaged. This License gives no- permission to license the work in any other way, but it does not- invalidate such permission if you have separately received it.-- d) If the work has interactive user interfaces, each must display- Appropriate Legal Notices; however, if the Program has interactive- interfaces that do not display Appropriate Legal Notices, your- work need not make them do so.--A compilation of a covered work with other separate and independent-works, which are not by their nature extensions of the covered work,-and which are not combined with it such as to form a larger program,-in or on a volume of a storage or distribution medium, is called an-"aggregate" if the compilation and its resulting copyright are not-used to limit the access or legal rights of the compilation's users-beyond what the individual works permit. Inclusion of a covered work-in an aggregate does not cause this License to apply to the other-parts of the aggregate.--6. Conveying Non-Source Forms.--You may convey a covered work in object code form under the terms-of sections 4 and 5, provided that you also convey the-machine-readable Corresponding Source under the terms of this License,-in one of these ways:-- a) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by the- Corresponding Source fixed on a durable physical medium- customarily used for software interchange.-- b) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by a- written offer, valid for at least three years and valid for as- long as you offer spare parts or customer support for that product- model, to give anyone who possesses the object code either (1) a- copy of the Corresponding Source for all the software in the- product that is covered by this License, on a durable physical- medium customarily used for software interchange, for a price no- more than your reasonable cost of physically performing this- conveying of source, or (2) access to copy the- Corresponding Source from a network server at no charge.-- c) Convey individual copies of the object code with a copy of the- written offer to provide the Corresponding Source. This- alternative is allowed only occasionally and noncommercially, and- only if you received the object code with such an offer, in accord- with subsection 6b.-- d) Convey the object code by offering access from a designated- place (gratis or for a charge), and offer equivalent access to the- Corresponding Source in the same way through the same place at no- further charge. You need not require recipients to copy the- Corresponding Source along with the object code. If the place to- copy the object code is a network server, the Corresponding Source- may be on a different server (operated by you or a third party)- that supports equivalent copying facilities, provided you maintain- clear directions next to the object code saying where to find the- Corresponding Source. Regardless of what server hosts the- Corresponding Source, you remain obligated to ensure that it is- available for as long as needed to satisfy these requirements.-- e) Convey the object code using peer-to-peer transmission, provided- you inform other peers where the object code and Corresponding- Source of the work are being offered to the general public at no- charge under subsection 6d.--A separable portion of the object code, whose source code is excluded-from the Corresponding Source as a System Library, need not be-included in conveying the object code work.--A "User Product" is either (1) a "consumer product", which means any-tangible personal property which is normally used for personal, family,-or household purposes, or (2) anything designed or sold for incorporation-into a dwelling. In determining whether a product is a consumer product,-doubtful cases shall be resolved in favor of coverage. For a particular-product received by a particular user, "normally used" refers to a-typical or common use of that class of product, regardless of the status-of the particular user or of the way in which the particular user-actually uses, or expects or is expected to use, the product. A product-is a consumer product regardless of whether the product has substantial-commercial, industrial or non-consumer uses, unless such uses represent-the only significant mode of use of the product.--"Installation Information" for a User Product means any methods,-procedures, authorization keys, or other information required to install-and execute modified versions of a covered work in that User Product from-a modified version of its Corresponding Source. The information must-suffice to ensure that the continued functioning of the modified object-code is in no case prevented or interfered with solely because-modification has been made.--If you convey an object code work under this section in, or with, or-specifically for use in, a User Product, and the conveying occurs as-part of a transaction in which the right of possession and use of the-User Product is transferred to the recipient in perpetuity or for a-fixed term (regardless of how the transaction is characterized), the-Corresponding Source conveyed under this section must be accompanied-by the Installation Information. But this requirement does not apply-if neither you nor any third party retains the ability to install-modified object code on the User Product (for example, the work has-been installed in ROM).--The requirement to provide Installation Information does not include a-requirement to continue to provide support service, warranty, or updates-for a work that has been modified or installed by the recipient, or for-the User Product in which it has been modified or installed. Access to a-network may be denied when the modification itself materially and-adversely affects the operation of the network or violates the rules and-protocols for communication across the network.--Corresponding Source conveyed, and Installation Information provided,-in accord with this section must be in a format that is publicly-documented (and with an implementation available to the public in-source code form), and must require no special password or key for-unpacking, reading or copying.--7. Additional Terms.--"Additional permissions" are terms that supplement the terms of this-License by making exceptions from one or more of its conditions.-Additional permissions that are applicable to the entire Program shall-be treated as though they were included in this License, to the extent-that they are valid under applicable law. If additional permissions-apply only to part of the Program, that part may be used separately-under those permissions, but the entire Program remains governed by-this License without regard to the additional permissions.--When you convey a copy of a covered work, you may at your option-remove any additional permissions from that copy, or from any part of-it. (Additional permissions may be written to require their own-removal in certain cases when you modify the work.) You may place-additional permissions on material, added by you to a covered work,-for which you have or can give appropriate copyright permission.--Notwithstanding any other provision of this License, for material you-add to a covered work, you may (if authorized by the copyright holders of-that material) supplement the terms of this License with terms:-- a) Disclaiming warranty or limiting liability differently from the- terms of sections 15 and 16 of this License; or-- b) Requiring preservation of specified reasonable legal notices or- author attributions in that material or in the Appropriate Legal- Notices displayed by works containing it; or-- c) Prohibiting misrepresentation of the origin of that material, or- requiring that modified versions of such material be marked in- reasonable ways as different from the original version; or-- d) Limiting the use for publicity purposes of names of licensors or- authors of the material; or-- e) Declining to grant rights under trademark law for use of some- trade names, trademarks, or service marks; or-- f) Requiring indemnification of licensors and authors of that- material by anyone who conveys the material (or modified versions of- it) with contractual assumptions of liability to the recipient, for- any liability that these contractual assumptions directly impose on- those licensors and authors.--All other non-permissive additional terms are considered "further-restrictions" within the meaning of section 10. If the Program as you-received it, or any part of it, contains a notice stating that it is-governed by this License along with a term that is a further-restriction, you may remove that term. If a license document contains-a further restriction but permits relicensing or conveying under this-License, you may add to a covered work material governed by the terms-of that license document, provided that the further restriction does-not survive such relicensing or conveying.--If you add terms to a covered work in accord with this section, you-must place, in the relevant source files, a statement of the-additional terms that apply to those files, or a notice indicating-where to find the applicable terms.--Additional terms, permissive or non-permissive, may be stated in the-form of a separately written license, or stated as exceptions;-the above requirements apply either way.--8. Termination.--You may not propagate or modify a covered work except as expressly-provided under this License. Any attempt otherwise to propagate or-modify it is void, and will automatically terminate your rights under-this License (including any patent licenses granted under the third-paragraph of section 11).--However, if you cease all violation of this License, then your-license from a particular copyright holder is reinstated (a)-provisionally, unless and until the copyright holder explicitly and-finally terminates your license, and (b) permanently, if the copyright-holder fails to notify you of the violation by some reasonable means-prior to 60 days after the cessation.--Moreover, your license from a particular copyright holder is-reinstated permanently if the copyright holder notifies you of the-violation by some reasonable means, this is the first time you have-received notice of violation of this License (for any work) from that-copyright holder, and you cure the violation prior to 30 days after-your receipt of the notice.--Termination of your rights under this section does not terminate the-licenses of parties who have received copies or rights from you under-this License. If your rights have been terminated and not permanently-reinstated, you do not qualify to receive new licenses for the same-material under section 10.--9. Acceptance Not Required for Having Copies.--You are not required to accept this License in order to receive or-run a copy of the Program. Ancillary propagation of a covered work-occurring solely as a consequence of using peer-to-peer transmission-to receive a copy likewise does not require acceptance. However,-nothing other than this License grants you permission to propagate or-modify any covered work. These actions infringe copyright if you do-not accept this License. Therefore, by modifying or propagating a-covered work, you indicate your acceptance of this License to do so.--10. Automatic Licensing of Downstream Recipients.--Each time you convey a covered work, the recipient automatically-receives a license from the original licensors, to run, modify and-propagate that work, subject to this License. You are not responsible-for enforcing compliance by third parties with this License.--An "entity transaction" is a transaction transferring control of an-organization, or substantially all assets of one, or subdividing an-organization, or merging organizations. If propagation of a covered-work results from an entity transaction, each party to that-transaction who receives a copy of the work also receives whatever-licenses to the work the party's predecessor in interest had or could-give under the previous paragraph, plus a right to possession of the-Corresponding Source of the work from the predecessor in interest, if-the predecessor has it or can get it with reasonable efforts.--You may not impose any further restrictions on the exercise of the-rights granted or affirmed under this License. For example, you may-not impose a license fee, royalty, or other charge for exercise of-rights granted under this License, and you may not initiate litigation-(including a cross-claim or counterclaim in a lawsuit) alleging that-any patent claim is infringed by making, using, selling, offering for-sale, or importing the Program or any portion of it.--11. Patents.--A "contributor" is a copyright holder who authorizes use under this-License of the Program or a work on which the Program is based. The-work thus licensed is called the contributor's "contributor version".--A contributor's "essential patent claims" are all patent claims-owned or controlled by the contributor, whether already acquired or-hereafter acquired, that would be infringed by some manner, permitted-by this License, of making, using, or selling its contributor version,-but do not include claims that would be infringed only as a-consequence of further modification of the contributor version. For-purposes of this definition, "control" includes the right to grant-patent sublicenses in a manner consistent with the requirements of-this License.--Each contributor grants you a non-exclusive, worldwide, royalty-free-patent license under the contributor's essential patent claims, to-make, use, sell, offer for sale, import and otherwise run, modify and-propagate the contents of its contributor version.--In the following three paragraphs, a "patent license" is any express-agreement or commitment, however denominated, not to enforce a patent-(such as an express permission to practice a patent or covenant not to-sue for patent infringement). To "grant" such a patent license to a-party means to make such an agreement or commitment not to enforce a-patent against the party.--If you convey a covered work, knowingly relying on a patent license,-and the Corresponding Source of the work is not available for anyone-to copy, free of charge and under the terms of this License, through a-publicly available network server or other readily accessible means,-then you must either (1) cause the Corresponding Source to be so-available, or (2) arrange to deprive yourself of the benefit of the-patent license for this particular work, or (3) arrange, in a manner-consistent with the requirements of this License, to extend the patent-license to downstream recipients. "Knowingly relying" means you have-actual knowledge that, but for the patent license, your conveying the-covered work in a country, or your recipient's use of the covered work-in a country, would infringe one or more identifiable patents in that-country that you have reason to believe are valid.--If, pursuant to or in connection with a single transaction or-arrangement, you convey, or propagate by procuring conveyance of, a-covered work, and grant a patent license to some of the parties-receiving the covered work authorizing them to use, propagate, modify-or convey a specific copy of the covered work, then the patent license-you grant is automatically extended to all recipients of the covered-work and works based on it.--A patent license is "discriminatory" if it does not include within-the scope of its coverage, prohibits the exercise of, or is-conditioned on the non-exercise of one or more of the rights that are-specifically granted under this License. You may not convey a covered-work if you are a party to an arrangement with a third party that is-in the business of distributing software, under which you make payment-to the third party based on the extent of your activity of conveying-the work, and under which the third party grants, to any of the-parties who would receive the covered work from you, a discriminatory-patent license (a) in connection with copies of the covered work-conveyed by you (or copies made from those copies), or (b) primarily-for and in connection with specific products or compilations that-contain the covered work, unless you entered into that arrangement,-or that patent license was granted, prior to 28 March 2007.--Nothing in this License shall be construed as excluding or limiting-any implied license or other defenses to infringement that may-otherwise be available to you under applicable patent law.--12. No Surrender of Others' Freedom.--If conditions are imposed on you (whether by court order, agreement or-otherwise) that contradict the conditions of this License, they do not-excuse you from the conditions of this License. If you cannot convey a-covered work so as to satisfy simultaneously your obligations under this-License and any other pertinent obligations, then as a consequence you may-not convey it at all. For example, if you agree to terms that obligate you-to collect a royalty for further conveying from those to whom you convey-the Program, the only way you could satisfy both those terms and this-License would be to refrain entirely from conveying the Program.--13. Remote Network Interaction; Use with the GNU General Public License.--Notwithstanding any other provision of this License, if you modify the-Program, your modified version must prominently offer all users-interacting with it remotely through a computer network (if your version-supports such interaction) an opportunity to receive the Corresponding-Source of your version by providing access to the Corresponding Source-from a network server at no charge, through some standard or customary-means of facilitating copying of software. This Corresponding Source-shall include the Corresponding Source for any work covered by version 3-of the GNU General Public License that is incorporated pursuant to the-following paragraph.--Notwithstanding any other provision of this License, you have-permission to link or combine any covered work with a work licensed-under version 3 of the GNU General Public License into a single-combined work, and to convey the resulting work. The terms of this-License will continue to apply to the part which is the covered work,-but the work with which it is combined will remain governed by version-3 of the GNU General Public License.--14. Revised Versions of this License.--The Free Software Foundation may publish revised and/or new versions of-the GNU Affero General Public License from time to time. Such new versions-will be similar in spirit to the present version, but may differ in detail to-address new problems or concerns.--Each version is given a distinguishing version number. If the-Program specifies that a certain numbered version of the GNU Affero General-Public License "or any later version" applies to it, you have the-option of following the terms and conditions either of that numbered-version or of any later version published by the Free Software-Foundation. If the Program does not specify a version number of the-GNU Affero General Public License, you may choose any version ever published-by the Free Software Foundation.--If the Program specifies that a proxy can decide which future-versions of the GNU Affero General Public License can be used, that proxy's-public statement of acceptance of a version permanently authorizes you-to choose that version for the Program.--Later license versions may give you additional or different-permissions. However, no additional obligations are imposed on any-author or copyright holder as a result of your choosing to follow a-later version.--15. Disclaimer of Warranty.--THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.--16. Limitation of Liability.--IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF-SUCH DAMAGES.--17. Interpretation of Sections 15 and 16.--If the disclaimer of warranty and limitation of liability provided-above cannot be given local legal effect according to their terms,-reviewing courts shall apply local law that most closely approximates-an absolute waiver of all civil liability in connection with the-Program, unless a warranty or assumption of liability accompanies a-copy of the Program in return for a fee.-- END OF TERMS AND CONDITIONS-- How to Apply These Terms to Your New Programs--If you develop a new program, and you want it to be of the greatest-possible use to the public, the best way to achieve this is to make it-free software which everyone can redistribute and change under these terms.--To do so, attach the following notices to the program. It is safest-to attach them to the start of each source file to most effectively-state the exclusion of warranty; and each file should have at least-the "copyright" line and a pointer to where the full notice is found.-- <one line to give the program's name and a brief idea of what it does.>- Copyright (C) <year> <name of author>-- This program is free software: you can redistribute it and/or modify- it under the terms of the GNU Affero General Public License as published- by the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU Affero General Public License for more details.-- You should have received a copy of the GNU Affero General Public License- along with this program. If not, see <https://www.gnu.org/licenses/>.--Also add information on how to contact you by electronic and paper mail.--If your software can interact with users remotely through a computer-network, you should also make sure that it provides a way for users to-get its source. For example, if your program is a web application, its-interface could display a "Source" link that leads users to an archive-of the code. There are many ways you could offer source, and different-solutions will be better for different programs; see section 13 for the-specific requirements.--You should also get your employer (if you work as a programmer) or school,-if any, to sign a "copyright disclaimer" for the program, if necessary.-For more information on this, and how to apply and follow the GNU AGPL, see-<https://www.gnu.org/licenses/>.\ No newline at end of filediff --git a/apps/erp/app/components/Chat/Loader.tsx b/apps/erp/app/components/Chat/Loader.tsxdeleted file mode 100644index ddf2bb5ac1..0000000000--- a/apps/erp/app/components/Chat/Loader.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { cn } from "@carbon/react";-import { Trans } from "@lingui/react/macro";-import type { HTMLAttributes } from "react";--type LoaderIconProps = {- size?: number;-};--const LoaderIcon = ({ size = 16 }: LoaderIconProps) => (- <svg- height={size}- strokeLinejoin="round"- style={{ color: "currentcolor" }}- viewBox="0 0 16 16"- width={size}- >- <title>- <Trans>Loader</Trans>- </title>- <g clipPath="url(#clip0_2393_1490)">- <path d="M8 0V4" stroke="currentColor" strokeWidth="1.5" />- <path- d="M8 16V12"- opacity="0.5"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M3.29773 1.52783L5.64887 4.7639"- opacity="0.9"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M12.7023 1.52783L10.3511 4.7639"- opacity="0.1"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M12.7023 14.472L10.3511 11.236"- opacity="0.4"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M3.29773 14.472L5.64887 11.236"- opacity="0.6"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M15.6085 5.52783L11.8043 6.7639"- opacity="0.2"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M0.391602 10.472L4.19583 9.23598"- opacity="0.7"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M15.6085 10.4722L11.8043 9.2361"- opacity="0.3"- stroke="currentColor"- strokeWidth="1.5"- />- <path- d="M0.391602 5.52783L4.19583 6.7639"- opacity="0.8"- stroke="currentColor"- strokeWidth="1.5"- />- </g>- <defs>- <clipPath id="clip0_2393_1490">- <rect fill="white" height="16" width="16" />- </clipPath>- </defs>- </svg>-);--export type LoaderProps = HTMLAttributes<HTMLDivElement> & {- size?: number;-};--export const Loader = ({ className, size = 16, ...props }: LoaderProps) => (- <div- className={cn(- "inline-flex animate-spin items-center justify-center",- className- )}- {...props}- >- <LoaderIcon size={size} />- </div>-);diff --git a/apps/erp/app/components/Chat/Markdown/Markdown.tsx b/apps/erp/app/components/Chat/Markdown/Markdown.tsxdeleted file mode 100644index 43a7d316df..0000000000--- a/apps/erp/app/components/Chat/Markdown/Markdown.tsx+++ /dev/null@@ -1,92 +0,0 @@-import { getAppUrl } from "@carbon/auth";-import { CodeBlock } from "@carbon/react";-import { memo, useMemo } from "react";-import type { Components } from "react-markdown";-import ReactMarkdown from "react-markdown";-import { Link } from "react-router";-import { allowedHTMLElements, rehypePlugins, remarkPlugins } from "./utils";--type MarkdownProps = {- children: string;- html?: boolean;- limitedMarkdown?: boolean;-};--export const Markdown = memo(- ({ children, html = false, limitedMarkdown = false }: MarkdownProps) => {- const components = useMemo(() => {- return {- a: (props) => {- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { children, node, href, ...rest } = props;- if (href?.startsWith("/")) {- return (- <Link- {...rest}- to={href}- className="text-blue-700 dark:text-blue-400 font-bold underline"- >- {children}- </Link>- );- }-- if (href?.startsWith(getAppUrl())) {- return (- <Link- {...rest}- to={href?.replace(getAppUrl(), "")}- className="text-blue-700 dark:text-blue-400 font-bold underline"- >- {children}- </Link>- );- }-- return (- <a- {...rest}- className="text-blue-700 dark:text-blue-400 font-bold underline"- >- {children}- </a>- );- },-- pre: (props) => {- const { children, node, ...rest } = props;-- const [firstChild] = node?.children ?? [];-- if (- firstChild &&- firstChild.type === "element" &&- firstChild.tagName === "code" &&- firstChild.children?.[0]?.type === "text"- ) {- // @ts-ignore- const { className } = firstChild.properties;- const [, language = "plaintext"] =- /language-(\w+)/.exec(String(className) || "") ?? [];-- return <CodeBlock className={language}>{children}</CodeBlock>;- }-- return <pre {...rest}>{children}</pre>;- }- } satisfies Components;- }, []);-- return (- <ReactMarkdown- allowedElements={allowedHTMLElements}- components={components}- remarkPlugins={remarkPlugins(limitedMarkdown)}- rehypePlugins={rehypePlugins(html)}- >- {children}- </ReactMarkdown>- );- }-);-Markdown.displayName = "Markdown";diff --git a/apps/erp/app/components/Chat/Markdown/utils.ts b/apps/erp/app/components/Chat/Markdown/utils.tsdeleted file mode 100644index 953977bc43..0000000000--- a/apps/erp/app/components/Chat/Markdown/utils.ts+++ /dev/null@@ -1,136 +0,0 @@-import rehypeRaw from "rehype-raw";-import type { Options as RehypeSanitizeOptions } from "rehype-sanitize";-import rehypeSanitize, { defaultSchema } from "rehype-sanitize";-import remarkGfm from "remark-gfm";-import type { PluggableList, Plugin } from "unified";-import { SKIP, visit } from "unist-util-visit";--export const allowedHTMLElements = [- "a",- "b",- "blockquote",- "br",- "code",- "dd",- "del",- "details",- "div",- "dl",- "dt",- "em",- "h1",- "h2",- "h3",- "h4",- "h5",- "h6",- "hr",- "i",- "ins",- "kbd",- "li",- "ol",- "p",- "pre",- "q",- "rp",- "rt",- "ruby",- "s",- "samp",- "source",- "span",- "strike",- "strong",- "sub",- "summary",- "sup",- "table",- "tbody",- "td",- "tfoot",- "th",- "thead",- "tr",- "ul",- "var"-];--const rehypeSanitizeOptions: RehypeSanitizeOptions = {- ...defaultSchema,- tagNames: allowedHTMLElements,- attributes: {- ...defaultSchema.attributes,- div: [- ...(defaultSchema.attributes?.div ?? []),- "data*",- ["className", "__boltArtifact__"]- ]- },- strip: []-};--export function remarkPlugins(limitedMarkdown: boolean) {- const plugins: PluggableList = [remarkGfm];-- if (limitedMarkdown) {- plugins.unshift(limitedMarkdownPlugin);- }-- return plugins;-}--export function rehypePlugins(html: boolean) {- const plugins: PluggableList = [];-- if (html) {- // @ts-ignore- plugins.push(rehypeRaw, [rehypeSanitize, rehypeSanitizeOptions]);- }-- return plugins;-}--const limitedMarkdownPlugin: Plugin = () => {- return (tree, file) => {- const contents = file.toString();-- visit(tree, (node: any, index, parent: any) => {- if (- index == null ||- parent == null ||- !parent.children ||- [- "paragraph",- "text",- "inlineCode",- "code",- "strong",- "emphasis",- "table",- "tableRow",- "tableCell"- ].includes(node.type) ||- !node.position- ) {- return true;- }-- let value = contents.slice(- node.position.start.offset,- node.position.end.offset- );-- if (node.type === "heading") {- value = `\n${value}`;- }-- parent.children[index] = {- type: "text",- value- } as any;-- return [SKIP, index] as const;- });- };-};diff --git a/apps/erp/app/components/Chat/NewChat.tsx b/apps/erp/app/components/Chat/NewChat.tsxdeleted file mode 100644index f445885d6c..0000000000--- a/apps/erp/app/components/Chat/NewChat.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { Button } from "@carbon/react";-import { generateId } from "ai";-import { LuCirclePlus } from "react-icons/lu";-import { useUrlParams } from "~/hooks";--export function NewChat() {- const [, setParams] = useUrlParams();-- const handleNewChat = () => {- setParams({ chatId: generateId() });- };-- return (- <Button variant="secondary" isIcon onClick={handleNewChat}>- <LuCirclePlus size={16} />- </Button>- );-}diff --git a/apps/erp/app/components/Chat/PromptInput.tsx b/apps/erp/app/components/Chat/PromptInput.tsxdeleted file mode 100644index 4a74265c11..0000000000--- a/apps/erp/app/components/Chat/PromptInput.tsx+++ /dev/null@@ -1,696 +0,0 @@-import {- Button,- cn,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- IconButton,- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,- Textarea,- useIsomorphicLayoutEffect-} from "@carbon/react";-import { useLingui } from "@lingui/react/macro";-import type { ChatStatus, FileUIPart } from "ai";-import { nanoid } from "nanoid";-import type {- ChangeEventHandler,- ComponentProps,- FormEvent,- FormEventHandler,- HTMLAttributes,- KeyboardEventHandler,- RefObject-} from "react";-import {- Children,- createContext,- Fragment,- forwardRef,- useCallback,- useContext,- useEffect,- useMemo,- useRef,- useState-} from "react";-import { LuArrowUp, LuPaperclip, LuPlus, LuSquare, LuX } from "react-icons/lu";--type AttachmentsContextType = {- files: (FileUIPart & { id: string })[];- add: (files: File[] | FileList) => void;- remove: (id: string) => void;- clear: () => void;- openFileDialog: () => void;- fileInputRef: RefObject<HTMLInputElement | null>;-};--const AttachmentsContext = createContext<AttachmentsContextType | null>(null);--export const usePromptInputAttachments = () => {- const context = useContext(AttachmentsContext);-- if (!context) {- throw new Error(- "usePromptInputAttachments must be used within a PromptInput"- );- }-- return context;-};--export type PromptInputAttachmentProps = HTMLAttributes<HTMLDivElement> & {- data: FileUIPart & { id: string };- className?: string;-};--export function PromptInputAttachment({- data,- className,- ...props-}: PromptInputAttachmentProps) {- const { t } = useLingui();- const attachments = usePromptInputAttachments();-- return (- <div- className={cn("group relative h-14 w-14 border", className)}- key={data.id}- {...props}- >- {data.mediaType?.startsWith("image/") && data.url ? (- <img- alt={data.filename || "attachment"}- className="size-full object-cover"- height={56}- src={data.url}- width={56}- />- ) : (- <div className="flex size-full items-center justify-center text-muted-foreground">- <LuPaperclip className="size-4" />- </div>- )}- <IconButton- aria-label={t`Remove attachment`}- icon={<LuX />}- className="-right-1.5 -top-1.5 absolute h-6 w-6 rounded-full opacity-0 group-hover:opacity-100"- onClick={() => attachments.remove(data.id)}- variant="secondary"- size="sm"- />- </div>- );-}--export type PromptInputAttachmentsProps = Omit<- HTMLAttributes<HTMLDivElement>,- "children"-> & {- children: (attachment: FileUIPart & { id: string }) => React.ReactNode;-};--export function PromptInputAttachments({- className,- children,- ...props-}: PromptInputAttachmentsProps) {- const attachments = usePromptInputAttachments();- const [height, setHeight] = useState(0);- const contentRef = useRef<HTMLDivElement>(null);-- useIsomorphicLayoutEffect(() => {- const el = contentRef.current;- if (!el) {- return;- }- const ro = new ResizeObserver(() => {- setHeight(el.getBoundingClientRect().height);- });- ro.observe(el);- setHeight(el.getBoundingClientRect().height);- return () => ro.disconnect();- }, []);-- return (- <div- aria-live="polite"- className={cn(- "overflow-hidden transition-[height] duration-200 ease-out",- className- )}- style={{ height: attachments.files.length ? height : 0 }}- {...props}- >- <div className="flex flex-wrap gap-2 p-3 pt-3" ref={contentRef}>- {attachments.files.map((file) => (- <Fragment key={file.id}>{children(file)}</Fragment>- ))}- </div>- </div>- );-}--export type PromptInputActionAddAttachmentsProps = ComponentProps<- typeof DropdownMenuItem-> & {- label?: string;-};--export const PromptInputActionAddAttachments = ({- ...props-}: PromptInputActionAddAttachmentsProps) => {- const { t } = useLingui();- const attachments = usePromptInputAttachments();-- return (- // @ts-expect-error- <IconButton- aria-label={t`Add attachments`}- variant="ghost"- type="button"- {...props}- icon={<LuPaperclip />}- onClick={() => attachments.openFileDialog()}- />- );-};--export type PromptInputMessage = {- text?: string;- files?: FileUIPart[];-};--export type PromptInputProps = Omit<- HTMLAttributes<HTMLFormElement>,- "onSubmit"-> & {- accept?: string; // e.g., "image/*" or leave undefined for any- multiple?: boolean;- // When true, accepts drops anywhere on document. Default false (opt-in).- globalDrop?: boolean;- // Render a hidden input with given name and keep it in sync for native form posts. Default false.- syncHiddenInput?: boolean;- // Minimal constraints- maxFiles?: number;- maxFileSize?: number; // bytes- onError?: (err: {- code: "max_files" | "max_file_size" | "accept";- message: string;- }) => void;- onSubmit: (- message: PromptInputMessage,- event: FormEvent<HTMLFormElement>- ) => void;-};--export const PromptInput = ({- className,- accept,- multiple,- globalDrop,- syncHiddenInput,- maxFiles,- maxFileSize,- onError,- onSubmit,- ...props-}: PromptInputProps) => {- const [items, setItems] = useState<(FileUIPart & { id: string })[]>([]);- const inputRef = useRef<HTMLInputElement | null>(null);- const anchorRef = useRef<HTMLSpanElement>(null);- const formRef = useRef<HTMLFormElement | null>(null);-- // Find nearest form to scope drag & drop- useEffect(() => {- const root = anchorRef.current?.closest("form");- if (root instanceof HTMLFormElement) {- formRef.current = root;- }- }, []);-- const openFileDialog = useCallback(() => {- inputRef.current?.click();- }, []);-- const matchesAccept = useCallback(- (f: File) => {- if (!accept || accept.trim() === "") {- return true;- }- // Simple check: if accept includes "image/*", filter to images; otherwise allow.- if (accept.includes("image/*")) {- return f.type.startsWith("image/");- }- return true;- },- [accept]- );-- const add = useCallback(- (files: File[] | FileList) => {- const incoming = Array.from(files);- const accepted = incoming.filter((f) => matchesAccept(f));- if (accepted.length === 0) {- onError?.({- code: "accept",- message: "No files match the accepted types."- });- return;- }- const withinSize = (f: File) =>- maxFileSize ? f.size <= maxFileSize : true;- const sized = accepted.filter(withinSize);- if (sized.length === 0 && accepted.length > 0) {- onError?.({- code: "max_file_size",- message: "All files exceed the maximum size."- });- return;- }- setItems((prev) => {- const capacity =- typeof maxFiles === "number"- ? Math.max(0, maxFiles - prev.length)- : undefined;- const capped =- typeof capacity === "number" ? sized.slice(0, capacity) : sized;- if (typeof capacity === "number" && sized.length > capacity) {- onError?.({- code: "max_files",- message: "Too many files. Some were not added."- });- }- const next: (FileUIPart & { id: string })[] = [];- for (const file of capped) {- next.push({- id: nanoid(),- type: "file",- url: URL.createObjectURL(file),- mediaType: file.type,- filename: file.name- });- }- return prev.concat(next);- });- },- [matchesAccept, maxFiles, maxFileSize, onError]- );-- const remove = useCallback((id: string) => {- setItems((prev) => {- const found = prev.find((file) => file.id === id);- if (found?.url) {- URL.revokeObjectURL(found.url);- }- return prev.filter((file) => file.id !== id);- });- }, []);-- const clear = useCallback(() => {- setItems((prev) => {- for (const file of prev) {- if (file.url) {- URL.revokeObjectURL(file.url);- }- }- return [];- });- }, []);-- // Note: File input cannot be programmatically set for security reasons- // The syncHiddenInput prop is no longer functional- useEffect(() => {- if (syncHiddenInput && inputRef.current) {- // Clear the input when items are cleared- if (items.length === 0) {- inputRef.current.value = "";- }- }- }, [items, syncHiddenInput]);-- // Attach drop handlers on nearest form and document (opt-in)- useEffect(() => {- const form = formRef.current;- if (!form) {- return;- }- const onDragOver = (e: DragEvent) => {- if (e.dataTransfer?.types?.includes("Files")) {- e.preventDefault();- }- };- const onDrop = (e: DragEvent) => {- if (e.dataTransfer?.types?.includes("Files")) {- e.preventDefault();- }- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {- add(e.dataTransfer.files);- }- };- form.addEventListener("dragover", onDragOver);- form.addEventListener("drop", onDrop);- return () => {- form.removeEventListener("dragover", onDragOver);- form.removeEventListener("drop", onDrop);- };- }, [add]);-- useEffect(() => {- if (!globalDrop) {- return;- }- const onDragOver = (e: DragEvent) => {- if (e.dataTransfer?.types?.includes("Files")) {- e.preventDefault();- }- };- const onDrop = (e: DragEvent) => {- if (e.dataTransfer?.types?.includes("Files")) {- e.preventDefault();- }- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {- add(e.dataTransfer.files);- }- };- document.addEventListener("dragover", onDragOver);- document.addEventListener("drop", onDrop);- return () => {- document.removeEventListener("dragover", onDragOver);- document.removeEventListener("drop", onDrop);- };- }, [add, globalDrop]);-- const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {- if (event.currentTarget.files) {- add(event.currentTarget.files);- }- };-- const handleSubmit: FormEventHandler<HTMLFormElement> = (event) => {- event.preventDefault();-- const files: FileUIPart[] = items.map(({ ...item }) => ({- ...item- }));-- onSubmit({ text: event.currentTarget.message.value, files }, event);- };-- const ctx = useMemo<AttachmentsContextType>(- () => ({- files: items.map((item) => ({ ...item, id: item.id })),- add,- remove,- clear,- openFileDialog,- fileInputRef: inputRef- }),- [items, add, remove, clear, openFileDialog]- );-- return (- <AttachmentsContext.Provider value={ctx}>- <span aria-hidden="true" className="hidden" ref={anchorRef} />- <input- accept={accept}- className="hidden"- multiple={multiple}- onChange={handleChange}- ref={inputRef}- type="file"- />- <form- className={cn(- "w-full overflow-hidden bg-card rounded-xl border border-foreground/10 ring-[6px] dark:ring-[#1E1E21] ring-[#DADADA]",- className- )}- onSubmit={handleSubmit}- {...props}- />- </AttachmentsContext.Provider>- );-};--export type PromptInputBodyProps = HTMLAttributes<HTMLDivElement>;--export const PromptInputBody = ({- className,- ...props-}: PromptInputBodyProps) => (- <div className={cn(className, "flex flex-col")} {...props} />-);--export type PromptInputTextareaProps = ComponentProps<typeof Textarea>;--export const PromptInputTextarea = forwardRef<- HTMLTextAreaElement,- PromptInputTextareaProps->(- (- { onChange, className, placeholder = "You can just do things", ...props },- ref- ) => {- const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (e) => {- if (e.key === "Enter") {- // Don't submit if IME composition is in progress- if (e.nativeEvent.isComposing) {- return;- }-- if (e.shiftKey) {- // Allow newline- return;- }-- // Submit on Enter (without Shift)- e.preventDefault();- const form = e.currentTarget.form;- if (form) {- form.requestSubmit();- }- }- };-- return (- <Textarea- ref={ref}- className={cn(- "w-full resize-none rounded-none border-none p-3 pt-4 shadow-none outline-none ring-0 text-base",- "field-sizing-content bg-transparent placeholder:text-muted-foreground",- "max-h-[55px] min-h-[55px]",- "focus-visible:ring-0",- className- )}- name="message"- onChange={(e) => {- onChange?.(e);- }}- onKeyDown={handleKeyDown}- placeholder={placeholder}- {...props}- />- );- }-);--export type PromptInputToolbarProps = HTMLAttributes<HTMLDivElement>;--export const PromptInputToolbar = ({- className,- ...props-}: PromptInputToolbarProps) => (- <div- className={cn(- "flex items-center justify-between px-3 pt-1 pb-2",- className- )}- {...props}- />-);--export type PromptInputToolsProps = HTMLAttributes<HTMLDivElement>;--export const PromptInputTools = ({- className,- ...props-}: PromptInputToolsProps) => (- <div className={cn("flex items-center gap-0.5", className)} {...props} />-);--export type PromptInputButtonProps = ComponentProps<typeof Button>;--export const PromptInputButton = ({- variant = "ghost",- className,- size,- type = "button",- ...props-}: PromptInputButtonProps) => {- const newSize =- (size ?? Children.count(props.children) > 1) ? "default" : "icon";-- return (- <Button- className={cn(- "shrink-0 gap-1.5",- variant === "ghost" && "text-muted-foreground",- newSize === "default" && "px-3",- className- )}- isIcon={newSize === "icon"}- type="button"- variant={variant}- {...props}- />- );-};--export type PromptInputActionMenuProps = ComponentProps<typeof DropdownMenu>;-export const PromptInputActionMenu = (props: PromptInputActionMenuProps) => (- <DropdownMenu {...props} />-);--export type PromptInputActionMenuTriggerProps = ComponentProps<- typeof Button-> & {};-export const PromptInputActionMenuTrigger = ({- className,- children,- ...props-}: PromptInputActionMenuTriggerProps) => (- <DropdownMenuTrigger asChild>- <PromptInputButton className={className} {...props}>- {children ?? <LuPlus className="size-4" />}- </PromptInputButton>- </DropdownMenuTrigger>-);--export type PromptInputActionMenuContentProps = ComponentProps<- typeof DropdownMenuContent->;-export const PromptInputActionMenuContent = ({- className,- ...props-}: PromptInputActionMenuContentProps) => (- <DropdownMenuContent align="start" className={cn(className)} {...props} />-);--export type PromptInputActionMenuItemProps = ComponentProps<- typeof DropdownMenuItem->;-export const PromptInputActionMenuItem = ({- className,- ...props-}: PromptInputActionMenuItemProps) => (- <DropdownMenuItem className={cn(className)} {...props} />-);--// Note: Actions that perform side-effects (like opening a file dialog)-// are provided in opt-in modules (e.g., prompt-input-attachments).--export type PromptInputSubmitProps = Omit<- ComponentProps<typeof Button>,- "size"-> & {- status?: ChatStatus;- size?: "default" | "icon";-};--export const PromptInputSubmit = ({- className,- variant = "primary",- size = "icon",- status,- children,- ...props-}: PromptInputSubmitProps) => {- const { t } = useLingui();- let Icon = <LuArrowUp />;-- if (status === "streaming") {- Icon = <LuSquare />;- } else if (status === "error") {- Icon = <LuX />;- }-- return children ? (- <Button- className={cn("gap-1.5", className)}- type="submit"- variant={variant}- {...props}- >- {children}- </Button>- ) : (- <IconButton- aria-label={t`Submit`}- icon={Icon}- isRound- className="before:rounded-full after:rounded-full"- type="submit"- variant={variant}- {...props}- />- );-};--export type PromptInputModelSelectProps = ComponentProps<typeof Select>;--export const PromptInputModelSelect = (props: PromptInputModelSelectProps) => (- <Select {...props} />-);--export type PromptInputModelSelectTriggerProps = ComponentProps<- typeof SelectTrigger->;--export const PromptInputModelSelectTrigger = ({- className,- ...props-}: PromptInputModelSelectTriggerProps) => (- <SelectTrigger- className={cn(- "border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors",- 'hover:bg-accent hover:text-foreground [&[aria-expanded="true"]]:bg-accent [&[aria-expanded="true"]]:text-foreground',- className- )}- {...props}- />-);--export type PromptInputModelSelectContentProps = ComponentProps<- typeof SelectContent->;--export const PromptInputModelSelectContent = ({- className,- ...props-}: PromptInputModelSelectContentProps) => (- <SelectContent className={cn(className)} {...props} />-);--export type PromptInputModelSelectItemProps = ComponentProps<typeof SelectItem>;--export const PromptInputModelSelectItem = ({- className,- ...props-}: PromptInputModelSelectItemProps) => (- <SelectItem className={cn(className)} {...props} />-);--export type PromptInputModelSelectValueProps = ComponentProps<- typeof SelectValue->;--export const PromptInputModelSelectValue = ({- className,- ...props-}: PromptInputModelSelectValueProps) => (- <SelectValue className={cn(className)} {...props} />-);diff --git a/apps/erp/app/components/Chat/RecordButton.tsx b/apps/erp/app/components/Chat/RecordButton.tsxdeleted file mode 100644index b6ccfb6497..0000000000--- a/apps/erp/app/components/Chat/RecordButton.tsx+++ /dev/null@@ -1,228 +0,0 @@-import { cn, IconButton, Spinner } from "@carbon/react";-import { useLingui } from "@lingui/react/macro";-import { forwardRef, useCallback, useImperativeHandle } from "react";-import { useAudioRecording } from "./hooks/useAudioRecording";-import { useChatStore } from "./lib/store";--// Custom Record Icon with smooth animation-const RecordIcon = ({- size = 16,- isRecording = false-}: {- size?: number;- isRecording?: boolean;-}) => {- return (- <svg- width={size}- height={size}- viewBox="0 0 24 24"- fill="currentColor"- xmlns="http://www.w3.org/2000/svg"- >- {/* Recreate the Material Design MdOutlineGraphicEq icon with individual bars for wave-like animation */}-- {/* Bar 1 (leftmost, shortest) */}- <rect x="3" y="10" width="2" height="4" fill="currentColor">- {isRecording && (- <>- <animate- attributeName="height"- values="4;2;6;3;8;1;5;2;7;4"- dur="2.4s"- repeatCount="indefinite"- begin="0s"- />- <animate- attributeName="y"- values="10;11;7;10.5;6;11.5;8.5;11;6.5;10"- dur="2.4s"- repeatCount="indefinite"- begin="0s"- />- </>- )}- </rect>-- {/* Bar 2 (second from left) */}- <rect x="7" y="6" width="2" height="12" fill="currentColor">- {isRecording && (- <>- <animate- attributeName="height"- values="12;8;16;10;18;6;14;9;15;12"- dur="2.7s"- repeatCount="indefinite"- begin="0.45s"- />- <animate- attributeName="y"- values="6;8;2;7;1;9;5;7.5;4.5;6"- dur="2.7s"- repeatCount="indefinite"- begin="0.45s"- />- </>- )}- </rect>-- {/* Bar 3 (center, tallest) */}- <rect x="11" y="2" width="2" height="20" fill="currentColor">- {isRecording && (- <>- <animate- attributeName="height"- values="20;14;22;16;24;12;18;15;21;20"- dur="2.1s"- repeatCount="indefinite"- begin="0.9s"- />- <animate- attributeName="y"- values="2;5;1;4;0;6;3;4.5;1.5;2"- dur="2.1s"- repeatCount="indefinite"- begin="0.9s"- />- </>- )}- </rect>-- {/* Bar 4 (second from right) */}- <rect x="15" y="6" width="2" height="12" fill="currentColor">- {isRecording && (- <>- <animate- attributeName="height"- values="12;16;8;14;10;18;6;13;9;12"- dur="3.3s"- repeatCount="indefinite"- begin="1.35s"- />- <animate- attributeName="y"- values="6;2;8;5;7;1;9;5.5;7.5;6"- dur="3.3s"- repeatCount="indefinite"- begin="1.35s"- />- </>- )}- </rect>-- {/* Bar 5 (rightmost) */}- <rect x="19" y="10" width="2" height="4" fill="currentColor">- {isRecording && (- <>- <animate- attributeName="height"- values="4;6;2;7;3;8;1;5;3;4"- dur="3.0s"- repeatCount="indefinite"- begin="1.8s"- />- <animate- attributeName="y"- values="10;7;11;6.5;10.5;6;11.5;8.5;10.5;10"- dur="3.0s"- repeatCount="indefinite"- begin="1.8s"- />- </>- )}- </rect>- </svg>- );-};--export interface RecordButtonProps {- disabled?: boolean;- className?: string;- size?: number;-}--export interface RecordButtonRef {- handleRecordClick: () => void;-}--export const RecordButton = forwardRef<RecordButtonRef, RecordButtonProps>(- function RecordButton({ disabled = false, className, size = 16 }, ref) {- const { t } = useLingui();- const {- input,- setInput,- isRecording,- isProcessing,- setIsRecording,- setIsProcessing- } = useChatStore();- const { startRecording, stopRecording, transcribeAudio } =- useAudioRecording();-- const handleRecordClick = useCallback(async () => {- if (isRecording) {- // Stop recording and transcribe- try {- setIsProcessing(true);- const audioBlob = await stopRecording();-- if (audioBlob) {- const transcribedText = await transcribeAudio(audioBlob);-- if (transcribedText.trim()) {- setInput(input ? `${input} ${transcribedText}` : transcribedText);- }- }- } catch (error) {- console.error("Failed to process recording:", error);- } finally {- setIsRecording(false);- setIsProcessing(false);- }- } else {- // Start recording and reset input- try {- setInput(""); // Reset input when starting to record- await startRecording();- setIsRecording(true);- } catch (error) {- console.error("Failed to start recording:", error);- }- }- }, [- isRecording,- stopRecording,- startRecording,- transcribeAudio,- setInput,- input,- setIsRecording,- setIsProcessing- ]);-- // Expose the handleRecordClick method via ref- useImperativeHandle(ref, () => ({- handleRecordClick- }));-- return (- <IconButton- aria-label={t`Record`}- variant="ghost"- isRound- icon={- isProcessing ? <Spinner /> : <RecordIcon isRecording={isRecording} />- }- isDisabled={isProcessing}- onClick={handleRecordClick}- disabled={disabled}- className={cn(- isRecording &&- "text-indigo-600 hover:text-indigo-600 [&_svg]:text-indigo-600 [&_svg]:hover:text-indigo-600",- disabled && "opacity-50",- className- )}- />- );- }-);diff --git a/apps/erp/app/components/Chat/SuggestedActions.tsx b/apps/erp/app/components/Chat/SuggestedActions.tsxdeleted file mode 100644index 779979f341..0000000000--- a/apps/erp/app/components/Chat/SuggestedActions.tsx+++ /dev/null@@ -1,129 +0,0 @@-import { useChatActions, useChatId } from "@ai-sdk-tools/store";-import { cn, IconButton } from "@carbon/react";-import { useLingui } from "@lingui/react/macro";-import { LuZap } from "react-icons/lu";-import { useChatStore } from "./lib/store";--type SuggestedAction = {- id: string;- toolName: string;- toolParams: Record<string, any>;- text: string;-};--export function SuggestedActions() {- const { sendMessage } = useChatActions();- const chatId = useChatId();-- const handleToolCall = (params: {- toolName: string;- toolParams: Record<string, any>;- text: string;- }) => {- if (!chatId) return;-- sendMessage({- role: "user",- parts: [{ type: "text", text: params.text }],- metadata: {- toolCall: {- toolName: params.toolName,- toolParams: params.toolParams- }- }- });- };-- // UI configuration based on action ID- const uiConfig: Record<- string,- {- icon: React.ComponentType<any>;- title: string;- description: string;- }- > = {- // "get-runway": {- // icon: Icons.Speed,- // title: "Runway",- // description: "Show me my runway",- // },- };-- const suggestedActions: SuggestedAction[] = [];-- return (- <div className="w-full px-6 mt-10 mb-8 flex items-center justify-center">- <div className="flex gap-3 overflow-x-auto scrollbar-hide">- {suggestedActions.map((action) => {- const config = uiConfig[action.id];- const Icon = config?.icon;- const title = config?.title || action.id;- const description =- config?.description || `Execute ${action.toolName}`;-- return (- <button- key={action.id}- type="button"- className={cn(- "border border-border hover:bg-accent hover:border-border-hover",- "px-3 py-2 flex items-center gap-2 cursor-pointer",- "transition-all duration-300 min-w-fit whitespace-nowrap"- )}- onClick={() => {- handleToolCall({- toolName: action.toolName,- toolParams: action.toolParams,- text: description- });- }}- >- {Icon && <Icon className="w-4 h-4 text-muted-foreground" />}- <span className="text-foreground text-[12px] font-medium">- {title}- </span>- </button>- );- })}- </div>- </div>- );-}--export function SuggestedActionsButton() {- const { t } = useLingui();- const { showCommands, setShowCommands } = useChatStore();-- const handleClick = (e: React.MouseEvent) => {- // Prevent the click from bubbling up and being detected as an "outside click"- e.stopPropagation();-- // Toggle the command menu- setShowCommands(!showCommands);-- // Focus textarea for keyboard navigation when opening- if (!showCommands) {- requestAnimationFrame(() => {- document.querySelector("textarea")?.focus();- });- }- };-- return (- <IconButton- aria-label={t`Suggested Actions`}- icon={<LuZap />}- variant="ghost"- type="button"- onClick={handleClick}- className={cn(- showCommands- ? "text-foreground"- : "text-muted-foreground hover:text-foreground"- )}- // Add data attribute to help identify this button for exclusion from outside clicks- data-suggested-actions-toggle- />- );-}diff --git a/apps/erp/app/components/Chat/SuggestedPrompts.tsx b/apps/erp/app/components/Chat/SuggestedPrompts.tsxdeleted file mode 100644index 44ad641328..0000000000--- a/apps/erp/app/components/Chat/SuggestedPrompts.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { useChatActions, useDataPart } from "@ai-sdk-tools/store";-import { Button } from "@carbon/react";-import { AnimatePresence, motion } from "framer-motion";-import { useChatInterface } from "./hooks/useChatInterface";--type SuggestionsData = {- prompts: string[];-};--const delay = 1;--export function SuggestedPrompts() {- const [suggestions, clearSuggestions] =- useDataPart<SuggestionsData>("suggestions");- const { sendMessage } = useChatActions();- const { isChatPage } = useChatInterface();-- const handlePromptClick = (prompt: string) => {- clearSuggestions();- sendMessage({ text: prompt });- };-- if (- !suggestions?.prompts ||- suggestions.prompts.length === 0 ||- !isChatPage- ) {- return null;- }-- const prompts = suggestions.prompts;-- return (- <AnimatePresence mode="wait">- <motion.div- initial={{ opacity: 0, y: 20 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: 10 }}- transition={{ duration: 0.3, delay, ease: "easeOut" }}- className="absolute bottom-full left-0 right-0 w-full z-30 flex gap-2 mb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"- >- {prompts.map((prompt, index) => (- <motion.div- key={prompt}- initial={{ opacity: 0, y: 10 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, scale: 0.95 }}- transition={{- duration: 0.2,- delay: delay + index * 0.05,- ease: "easeOut"- }}- >- <Button- variant="ghost"- size="sm"- onClick={() => handlePromptClick(prompt)}- className="px-2 py-1 h-auto rounded-full text-xs font-normal border text-muted-foreground flex-shrink-0 whitespace-nowrap"- >- {prompt}- </Button>- </motion.div>- ))}- </motion.div>- </AnimatePresence>- );-}diff --git a/apps/erp/app/components/Chat/ToolCallIndicator.tsx b/apps/erp/app/components/Chat/ToolCallIndicator.tsxdeleted file mode 100644index ed9922f5c5..0000000000--- a/apps/erp/app/components/Chat/ToolCallIndicator.tsx+++ /dev/null@@ -1,55 +0,0 @@-import { cn, TextShimmer } from "@carbon/react";-import type { IconType } from "react-icons";-import { LuBrain } from "react-icons/lu";-import { toolConfigs as toolDisplayConfig } from "~/routes/api+/ai+/chat+/tools/config";--export type SupportedToolName = keyof typeof toolDisplayConfig;--export interface ToolCallIndicatorProps {- toolName: SupportedToolName;- className?: string;-}--export function getToolIcon(toolName: SupportedToolName): IconType | null {- if (toolName === "handoff_to_agent") {- return LuBrain;- }- if (toolName === "updateWorkingMemory") {- return LuBrain;- }- return toolDisplayConfig[toolName]?.icon ?? null;-}--export function getToolMessage(toolName: SupportedToolName): string | null {- if (toolName === "handoff_to_agent") {- return "Connecting you with the right specialist...";- }- if (toolName === "updateWorkingMemory") {- return "Updating working memory...";- }- return toolDisplayConfig[toolName]?.message ?? null;-}--export function ToolCallIndicator({- toolName,- className-}: ToolCallIndicatorProps) {- const config = toolDisplayConfig[toolName];-- if (!config) {- return null;- }-- return (- <div className={cn("flex justify-start mt-3 animate-fade-in", className)}>- <div className="border px-3 py-1 flex items-center gap-2 w-fit">- <div className="flex items-center justify-center size-3.5">- <config.icon size={14} />- </div>- <TextShimmer className="text-xs text-muted-foreground" duration={1}>- {config.displayText ?? ""}- </TextShimmer>- </div>- </div>- );-}diff --git a/apps/erp/app/components/Chat/WebSearch.tsx b/apps/erp/app/components/Chat/WebSearch.tsxdeleted file mode 100644index 401b4cbfb7..0000000000--- a/apps/erp/app/components/Chat/WebSearch.tsx+++ /dev/null@@ -1,184 +0,0 @@-import {- Avatar,- cn,- IconButton,- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { AnimatePresence, motion } from "framer-motion";-import type { ComponentProps } from "react";-import { useEffect, useState } from "react";-import { LuGlobe } from "react-icons/lu";-import { useChatStore } from "./lib/store";--interface WebSearchSource {- title?: string;- url?: string;- domain?: string;-}--export type WebSearchSourcesProps = ComponentProps<"div"> & {- sources: WebSearchSource[];- showSourceCount?: boolean;-};--function extractDomainFromUrl(url: string): string {- try {- const urlObj = new URL(url);- return urlObj.hostname.replace(/^www\./, "");- } catch {- return "";- }-}--export const WebSearchSources = ({- sources: providedSources,- showSourceCount = true,- className-}: WebSearchSourcesProps) => {- const [animatedSources, setAnimatedSources] = useState<WebSearchSource[]>([]);-- // Animate in sources as they become available- useEffect(() => {- if (!providedSources?.length) {- setAnimatedSources([]);- return;- }-- // Add sources one by one with a delay- providedSources.forEach((source, index) => {- setTimeout(() => {- setAnimatedSources((prev) => {- // Only add if not already present- if (prev.some((s) => s.url === source.url)) {- return prev;- }- return [...prev, source];- });- }, index * 150); // 150ms delay between each source- });- }, [providedSources]);-- if (!providedSources?.length) {- return null;- }-- return (- <motion.div- className={cn("mt-3", className)}- initial={{ opacity: 0, y: 10 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.3 }}- >- <TooltipProvider>- <div className="flex items-center gap-2">- <div className="flex items-center -space-x-2">- <AnimatePresence mode="popLayout">- {animatedSources.map((source, index) => (- <WebSearchSourceAvatar- key={source.url}- source={source}- zIndex={animatedSources.length - index}- index={index}- />- ))}- </AnimatePresence>- </div>- <motion.div- className="flex items-center gap-1 px-2 py-1 bg-muted/50 rounded-full"- initial={{ opacity: 0, scale: 0.8 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.3, delay: 0.1 }}- >- <span className="text-xs text-muted-foreground font-medium">- <Trans>Sources</Trans>- </span>- <span className="text-xs text-muted-foreground">•</span>- <motion.span- className="text-xs text-muted-foreground"- key={animatedSources.length}- initial={{ opacity: 0, scale: 0.5 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.2 }}- >- {animatedSources.length}- </motion.span>- </motion.div>- </div>- </TooltipProvider>- </motion.div>- );-};--interface WebSearchSourceAvatarProps {- source: WebSearchSource;- zIndex?: number;- index?: number;-}--const WebSearchSourceAvatar = ({- source,- zIndex = 0,- index = 0-}: WebSearchSourceAvatarProps) => {- const domain = source.domain || extractDomainFromUrl(source.url || "");-- return (- <Tooltip delayDuration={100}>- <TooltipTrigger asChild>- <motion.div- className="inline-flex cursor-pointer"- style={{ zIndex }}- initial={{ opacity: 0, scale: 0, x: -20 }}- animate={{ opacity: 1, scale: 1, x: 0 }}- exit={{ opacity: 0, scale: 0, x: -20 }}- transition={{- duration: 0.4,- delay: index * 0.1,- type: "spring",- stiffness: 200,- damping: 20- }}- whileHover={{- scale: 1.1,- transition: { duration: 0.2 }- }}- whileTap={{ scale: 0.95 }}- onClick={() =>- window.open(source.url, "_blank", "noopener,noreferrer")- }- >- <Avatar- className="h-5 w-5 cursor-pointer border-2 border-background shadow-sm"- src={`https://img.logo.dev/${domain}?token=pk_X-1ZO13GSgeOoUrIuJ6GMQ&size=64&retina=true`}- name={domain.split(".")[0]}- />- </motion.div>- </TooltipTrigger>- <TooltipContent side="top" className="max-w-xs">- <div className="space-y-1">- <p className="font-medium text-sm">{source.title}</p>- <p className="text-xs text-muted-foreground">{domain}</p>- </div>- </TooltipContent>- </Tooltip>- );-};--export function WebSearchButton() {- const { t } = useLingui();- const { isWebSearch, setIsWebSearch } = useChatStore();-- return (- <IconButton- type="button"- variant={isWebSearch ? "primary" : "ghost"}- icon={<LuGlobe />}- onClick={() => setIsWebSearch(!isWebSearch)}- aria-label={t`Web Search`}- />- );-}diff --git a/apps/erp/app/components/Chat/hooks/useAudioRecording.tsx b/apps/erp/app/components/Chat/hooks/useAudioRecording.tsxdeleted file mode 100644index 1408a2589e..0000000000--- a/apps/erp/app/components/Chat/hooks/useAudioRecording.tsx+++ /dev/null@@ -1,174 +0,0 @@-import { SUPABASE_URL, useCarbon } from "@carbon/auth";-import { useCallback, useRef, useState } from "react";-import { useUser } from "~/hooks";--interface UseAudioRecordingReturn {- isRecording: boolean;- isProcessing: boolean;- startRecording: () => Promise<void>;- stopRecording: () => Promise<Blob | null>;- transcribeAudio: (audioBlob: Blob) => Promise<string>;-}--export function useAudioRecording(): UseAudioRecordingReturn {- const [isRecording, setIsRecording] = useState(false);- const [isProcessing, setIsProcessing] = useState(false);- const mediaRecorderRef = useRef<MediaRecorder | null>(null);- const audioChunksRef = useRef<Blob[]>([]);- const streamRef = useRef<MediaStream | null>(null);- const recordingTimerRef = useRef<NodeJS.Timeout | null>(null);-- // Hard limit: 1 minute (60 seconds)- const MAX_RECORDING_TIME = 15 * 1000; // 15 seconds in milliseconds-- const stopRecording = useCallback(async (): Promise<Blob | null> => {- return new Promise((resolve) => {- // Clear the recording timer if it exists- if (recordingTimerRef.current) {- clearTimeout(recordingTimerRef.current);- recordingTimerRef.current = null;- }-- if (!mediaRecorderRef.current || !isRecording) {- resolve(null);- return;- }-- mediaRecorderRef.current.onstop = () => {- // Stop all audio tracks- if (streamRef.current) {- for (const track of streamRef.current.getTracks()) {- track.stop();- }- }- streamRef.current = null;-- // Create audio blob from chunks- const audioBlob =- audioChunksRef.current.length > 0- ? new Blob(audioChunksRef.current, {- type: "audio/webm;codecs=opus"- })- : null;-- // Clear chunks- audioChunksRef.current = [];- setIsRecording(false);- resolve(audioBlob);- };-- mediaRecorderRef.current.stop();- });- }, [isRecording]);-- // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration- const startRecording = useCallback(async () => {- try {- const stream = await navigator.mediaDevices.getUserMedia({- audio: {- echoCancellation: true,- noiseSuppression: true,- sampleRate: 44100- }- });-- streamRef.current = stream;- const mediaRecorder = new MediaRecorder(stream, {- mimeType: "audio/webm;codecs=opus"- });-- mediaRecorderRef.current = mediaRecorder;- audioChunksRef.current = [];-- mediaRecorder.ondataavailable = (event) => {- if (event.data.size > 0) {- audioChunksRef.current.push(event.data);- }- };-- mediaRecorder.start(1000); // Collect data every second- setIsRecording(true);-- // Set up auto-stop timer for 1 minute limit- recordingTimerRef.current = setTimeout(() => {- console.log("Recording automatically stopped after 15 seconds");- stopRecording();- }, MAX_RECORDING_TIME);- } catch (error) {- console.error("Error starting audio recording:", error);- throw error;- }- }, [MAX_RECORDING_TIME, stopRecording]);-- const { accessToken } = useCarbon();- const {- id: userId,- company: { id: companyId }- } = useUser();- const transcribeAudio = useCallback(- async (audioBlob: Blob): Promise<string> => {- setIsProcessing(true);-- try {- // Convert blob to base64- const arrayBuffer = await audioBlob.arrayBuffer();- const base64Audio = btoa(- new Uint8Array(arrayBuffer).reduce(- (data, byte) => data + String.fromCharCode(byte),- ""- )- );-- // Get authenticated session- const transcriptionUrl = `${SUPABASE_URL}/functions/v1/transcription`;- const response = await fetch(transcriptionUrl, {- method: "POST",- headers: {- "Content-Type": "application/json",- Authorization: `Bearer ${accessToken}`,- "x-company-id": companyId,- "x-user-id": userId- },- body: JSON.stringify({- audio: base64Audio,- mimeType: audioBlob.type- })- });-- if (!response.ok) {- const errorText = await response.text();- console.error("Transcription API error:", {- status: response.status,- statusText: response.statusText,- body: errorText- });- throw new Error(- `Failed to transcribe audio: ${response.status} ${response.statusText}`- );- }-- const data = await response.json();-- if (!data.success) {- throw new Error(data.error || "Transcription failed");- }-- return data.text;- } catch (error) {- console.error("Error transcribing audio:", error);- throw error;- } finally {- setIsProcessing(false);- }- },- [accessToken, companyId, userId]- );-- return {- isRecording,- isProcessing,- startRecording,- stopRecording,- transcribeAudio- };-}diff --git a/apps/erp/app/components/Chat/hooks/useChatInterface.tsx b/apps/erp/app/components/Chat/hooks/useChatInterface.tsxdeleted file mode 100644index 57b973465b..0000000000--- a/apps/erp/app/components/Chat/hooks/useChatInterface.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { useMount, useOptimisticLocation, useUrlParams } from "@carbon/react";-import { generateId } from "ai";-import { useCallback } from "react";-import { path } from "~/utils/path";--export function useChatInterface() {- const [params, setParams] = useUrlParams();- const location = useOptimisticLocation();- const chatId = params.get("c") || null;-- const isChatPage = !!chatId;- const isHome = location.pathname === path.to.authenticatedRoot;-- useMount(() => {- if (isHome && !chatId) {- setParams({ c: generateId() });- }- });-- const setChatId = useCallback(- (id: string) => {- setParams({ c: id });- },- [setParams]- );-- return {- isChatPage,- chatId,- setChatId- };-}diff --git a/apps/erp/app/components/Chat/hooks/useChatStatus.tsx b/apps/erp/app/components/Chat/hooks/useChatStatus.tsxdeleted file mode 100644index a0051831f6..0000000000--- a/apps/erp/app/components/Chat/hooks/useChatStatus.tsx+++ /dev/null@@ -1,118 +0,0 @@-import { useDataPart } from "@ai-sdk-tools/store";-import type { ChatStatus, ToolUIPart, UIMessage } from "ai";-import { useMemo } from "react";-import type { AgentStatus } from "../lib/types";--interface ChatStatusResult {- agentStatus: AgentStatus | null;- currentToolCall: string | null;- hasTextContent: boolean;-}--/**- * Hook to derive chat status indicators from messages and streaming state.- *- * This hook manages the logic for showing agent status and tool messages:- * - Agent status: shown when routing or executing (before content starts)- * - Tool message: shown when a tool is actively running- * - Hidden: when text content is streaming or chat is ready- */-export function useChatStatus(- messages: UIMessage[],- status: ChatStatus-): ChatStatusResult {- const [agentStatusData] = useDataPart<AgentStatus>("agent-status");-- const result = useMemo(() => {- if (messages.length === 0) {- return {- agentStatus: agentStatusData,- currentToolCall: null,- hasTextContent: false- };- }-- const lastMessage = messages[messages.length - 1];- if (lastMessage?.role !== "assistant") {- return {- agentStatus: agentStatusData,- currentToolCall: null,- hasTextContent: false- };- }-- // Check if we have text content streaming- const textParts = lastMessage.parts.filter((part) => part.type === "text");- const hasTextContent = textParts.some((part) => {- const textPart = part as { text?: string };- return textPart.text?.trim();- });-- // Find active tool calls - check ALL tool-related parts- const allParts = lastMessage.parts;-- const toolParts = allParts.filter((part) => {- const type = part.type;- return type.startsWith("tool-");- }) as ToolUIPart[];-- let currentToolCall: string | null = null;- let _toolMetadata: Record<string, unknown> | null = null;-- // Check if any web search is still pending (no output yet)- const hasPendingWebSearch = toolParts.some((part) => {- const type = part.type as string;- const toolWithOutput = part as Record<string, unknown>;- return type === "tool-webSearch" && !toolWithOutput.output;- });-- // If web searches are active, prioritize showing that- if (hasPendingWebSearch) {- // Find the most recent web search for the query text- for (let i = toolParts.length - 1; i >= 0; i--) {- const tool = toolParts[i];- const type = tool?.type as string;- if (type === "tool-webSearch") {- const toolWithMeta = tool as Record<string, unknown>;- currentToolCall = "webSearch";- _toolMetadata = toolWithMeta;- break;- }- }- } else if (toolParts.length > 0) {- // No web searches active, get the most recent tool- const tool = toolParts[toolParts.length - 1];- const toolWithMeta = tool as Record<string, unknown>;- const type = tool?.type as string;-- // Extract tool name from type (e.g., "tool-cashFlow" -> "cashFlow")- const toolName =- type === "dynamic-tool"- ? (toolWithMeta.toolName as string)- : type.replace(/^tool-/, "");-- currentToolCall = toolName;- _toolMetadata = toolWithMeta;- }-- // Hide tool when text starts streaming or when complete- if (currentToolCall && (hasTextContent || status === "ready")) {- currentToolCall = null;- _toolMetadata = null;- }-- // Hide agent status when streaming text, when complete, or when tool is showing- const agentStatus =- status === "ready" || hasTextContent || currentToolCall- ? null- : agentStatusData;-- return {- agentStatus,- currentToolCall,- hasTextContent- };- }, [messages, status, agentStatusData]);-- return result;-}diff --git a/apps/erp/app/components/Chat/index.tsx b/apps/erp/app/components/Chat/index.tsxdeleted file mode 100644index f58ec009ee..0000000000--- a/apps/erp/app/components/Chat/index.tsx+++ /dev/null@@ -1,7 +0,0 @@-export { ChatHeader } from "./ChatHeader";-export { ChatInput, type ChatInputMessage } from "./ChatInput";-export { ChatInterface } from "./ChatInterface";-export { ChatMessages } from "./ChatMessages";-export { ChatNavigation } from "./ChatNavigation";-export { ChatStatusIndicators } from "./ChatStatusIndicators";-export { ChatTitle } from "./ChatTitle";diff --git a/apps/erp/app/components/Chat/lib/agent.tsx b/apps/erp/app/components/Chat/lib/agent.tsxdeleted file mode 100644index eecde3a13e..0000000000--- a/apps/erp/app/components/Chat/lib/agent.tsx+++ /dev/null@@ -1,25 +0,0 @@-import type { AgentStatus } from "./types";--// Generate user-friendly status messages-export const getStatusMessage = (status?: AgentStatus | null) => {- if (!status) {- return null;- }-- const { agent, status: state } = status;-- if (state === "executing") {- const messages: Record<AgentStatus["agent"], string> = {- triage: "Thinking...",-- general: "Searching the web...",- purchasing: "Calling the purchasing agent...",- parts: "Calling the parts agent...",- suppliers: "Calling the suppliers agent..."- };-- return messages[agent];- }-- return null;-};diff --git a/apps/erp/app/components/Chat/lib/store.ts b/apps/erp/app/components/Chat/lib/store.tsdeleted file mode 100644index 09e44395d4..0000000000--- a/apps/erp/app/components/Chat/lib/store.ts+++ /dev/null@@ -1,333 +0,0 @@-// import {-// endOfMonth,-// getLocalTimeZone,-// startOfMonth,-// startOfYear,-// today,-// } from "@internationalized/date";-import { create } from "zustand";--// const getDateValues = () => {-// const todayValue = today(getLocalTimeZone());-// const localTimeZone = getLocalTimeZone();--// return {-// todayISO: todayValue.toDate(localTimeZone).toISOString(),-// startOfMonthISO: startOfMonth(todayValue).toDate(localTimeZone).toISOString(),-// endOfMonthISO: endOfMonth(todayValue).toDate(localTimeZone).toISOString(),-// startOfYearISO: startOfYear(todayValue).toDate(localTimeZone).toISOString(),-// weekAgoISO: todayValue.subtract({ days: 7 }).toDate(localTimeZone).toISOString(),-// monthAgoISO: todayValue.subtract({ months: 1 }).toDate(localTimeZone).toISOString(),-// };-// };--// const dateValues = getDateValues();--export interface CommandSuggestion {- command: string;- title: string;- toolName: string;- toolParams: Record<string, any>;- keywords: string[];-}--// Command system with / prefix - natural language suggestions-const COMMAND_SUGGESTIONS: CommandSuggestion[] = [- // {- // command: "/show",- // title: "Show latest transactions",- // toolName: "getTransactions",- // toolParams: { pageSize: 10, sort: ["date", "desc"] },- // keywords: ["show", "latest", "transactions", "recent"],- // },- // {- // command: "/show",- // title: "Show cash burn and top 3 vendor increases",- // toolName: "getBurnRateAnalysis",- // toolParams: { showCanvas: true },- // keywords: ["show", "burn", "cash", "vendor", "increases", "analysis"],- // },- // {- // command: "/show",- // title: "Show where we're spending the most this month",- // toolName: "getSpending",- // toolParams: {- // from: dateValues.startOfMonthISO,- // to: dateValues.endOfMonthISO,- // showCanvas: true,- // },- // keywords: ["show", "spending", "most", "this month", "where"],- // },- // {- // command: "/show",- // title: "Show weekly trends and insights",- // toolName: "getBurnRateAnalysis",- // toolParams: {- // from: dateValues.weekAgoISO,- // to: dateValues.todayISO,- // showCanvas: true,- // },- // keywords: ["show", "weekly", "trends", "insights"],- // },- // {- // command: "/show",- // title: "Show revenue performance",- // toolName: "getRevenue",- // toolParams: {- // from: dateValues.startOfYearISO,- // to: dateValues.endOfMonthISO,- // showCanvas: true,- // },- // keywords: ["show", "revenue", "performance", "analyze"],- // },- // {- // command: "/show",- // title: "Show expense breakdown by category",- // toolName: "getSpending",- // toolParams: { showCanvas: true },- // keywords: ["show", "expense", "breakdown", "category"],- // },- // {- // command: "/show",- // title: "Show profit margins",- // toolName: "getProfit",- // toolParams: { showCanvas: true },- // keywords: ["show", "profit", "margins"],- // },- // {- // command: "/show",- // title: "Show cash runway",- // toolName: "getRunway",- // toolParams: { showCanvas: true },- // keywords: ["show", "runway", "cash", "left"],- // },- // {- // command: "/find",- // title: "Find untagged transactions from last month",- // toolName: "getTransactions",- // toolParams: {- // from: dateValues.monthAgoISO,- // to: dateValues.todayISO,- // statuses: ["pending"],- // },- // keywords: ["find", "untagged", "transactions", "last month", "clean"],- // },- // {- // command: "/find",- // title: "Find recurring payments",- // toolName: "getTransactions",- // toolParams: { recurring: true },- // keywords: ["find", "recurring", "payments", "subscriptions"],- // },- // {- // command: "/analyze",- // title: "Analyze burn rate trends",- // toolName: "getBurnRateAnalysis",- // toolParams: { showCanvas: true },- // keywords: ["analyze", "burn", "rate", "trends"],- // },- // {- // command: "/analyze",- // title: "Analyze spending patterns",- // toolName: "getSpending",- // toolParams: { showCanvas: true },- // keywords: ["analyze", "spending", "patterns"],- // },-];--interface ChatState {- // Input state- input: string;- setInput: (input: string) => void;- clearInput: () => void;-- // Web search state- isWebSearch: boolean;- setIsWebSearch: (isWebSearch: boolean) => void;-- // Upload state- isUploading: boolean;- setIsUploading: (isUploading: boolean) => void;-- // Recording state- isRecording: boolean;- isProcessing: boolean;- setIsRecording: (isRecording: boolean) => void;- setIsProcessing: (isProcessing: boolean) => void;-- // Command suggestions state- showCommands: boolean;- setShowCommands: (showCommands: boolean) => void;- selectedCommandIndex: number;- setSelectedCommandIndex: (index: number) => void;- commandQuery: string;- setCommandQuery: (query: string) => void;- cursorPosition: number;- setCursorPosition: (position: number) => void;-- // Filtered commands (computed)- filteredCommands: CommandSuggestion[];-- // Actions- handleInputChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;- handleCommandSelect: (command: CommandSuggestion) => void;- handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;- resetCommandState: () => void;- navigateCommandUp: () => void;- navigateCommandDown: () => void;- selectCurrentCommand: () => CommandSuggestion | null;-}--export const useChatStore = create<ChatState>()((set, get) => ({- // Initial state- input: "",- isWebSearch: false,- isUploading: false,- isRecording: false,- isProcessing: false,- showCommands: false,- selectedCommandIndex: 0,- commandQuery: "",- cursorPosition: 0,- filteredCommands: COMMAND_SUGGESTIONS,-- // Basic setters- setInput: (input) => set({ input }),- clearInput: () => set({ input: "", cursorPosition: 0 }),- setIsWebSearch: (isWebSearch) => set({ isWebSearch }),- setIsUploading: (isUploading) => set({ isUploading }),- setIsRecording: (isRecording) => set({ isRecording }),- setIsProcessing: (isProcessing) => set({ isProcessing }),- setShowCommands: (showCommands) => set({ showCommands }),- setSelectedCommandIndex: (selectedCommandIndex) =>- set({ selectedCommandIndex }),- setCommandQuery: (commandQuery) => set({ commandQuery }),- setCursorPosition: (cursorPosition) => set({ cursorPosition }),-- // Input change handler- handleInputChange: (e) => {- const value = e.target.value;- const cursorPos = e.target.selectionStart;-- set({ input: value, cursorPosition: cursorPos });-- // Check if we're typing a command- const textBeforeCursor = value.substring(0, cursorPos);- const lastSlashIndex = textBeforeCursor.lastIndexOf("/");-- if (lastSlashIndex !== -1) {- const textAfterSlash = textBeforeCursor.substring(lastSlashIndex + 1);-- // Filter commands based on the query- const query = textAfterSlash.toLowerCase().trim();- const filtered = COMMAND_SUGGESTIONS.filter((command) => {- const matchesCommand = command.command.toLowerCase().includes(query);- const matchesTitle = command.title.toLowerCase().includes(query);- const matchesKeywords = command.keywords.some((keyword) =>- keyword.toLowerCase().includes(query)- );- return matchesCommand || matchesTitle || matchesKeywords;- });-- // Always show commands when typing after a slash, regardless of spaces- set({- commandQuery: textAfterSlash,- showCommands: true,- selectedCommandIndex: 0,- filteredCommands: filtered- });- return;- }-- set({- showCommands: false,- commandQuery: "",- filteredCommands: COMMAND_SUGGESTIONS- });- },-- // Command selection handler- handleCommandSelect: (command) => {- const { input, cursorPosition } = get();- const textBeforeCursor = input.substring(0, cursorPosition);- const lastSlashIndex = textBeforeCursor.lastIndexOf("/");- const textAfterCursor = input.substring(cursorPosition);-- // Replace the command with the full suggestion- const newText = `${textBeforeCursor.substring(0, lastSlashIndex)}${command.title} ${textAfterCursor}`;-- set({- input: newText,- showCommands: false,- commandQuery: ""- });- },-- // Keyboard navigation handler- handleKeyDown: (e) => {- const { showCommands, filteredCommands, selectedCommandIndex } = get();-- if (!showCommands) return;-- switch (e.key) {- case "ArrowDown":- e.preventDefault();- set({- selectedCommandIndex: Math.min(- selectedCommandIndex + 1,- filteredCommands.length - 1- )- });- break;- case "ArrowUp":- e.preventDefault();- set({- selectedCommandIndex: Math.max(selectedCommandIndex - 1, 0)- });- break;- case "Enter": {- e.preventDefault();- const currentCommand = get().selectCurrentCommand();- if (currentCommand) {- get().handleCommandSelect(currentCommand);- }- break;- }- case "Escape":- set({ showCommands: false, commandQuery: "" });- break;- }- },-- // Utility functions- resetCommandState: () => {- set({- showCommands: false,- commandQuery: "",- selectedCommandIndex: 0- });- },-- navigateCommandUp: () => {- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { selectedCommandIndex, filteredCommands } = get();- set({- selectedCommandIndex: Math.max(selectedCommandIndex - 1, 0)- });- },-- navigateCommandDown: () => {- const { selectedCommandIndex, filteredCommands } = get();- set({- selectedCommandIndex: Math.min(- selectedCommandIndex + 1,- filteredCommands.length - 1- )- });- },-- selectCurrentCommand: () => {- const { filteredCommands, selectedCommandIndex } = get();- return filteredCommands[selectedCommandIndex] || null;- }-}));diff --git a/apps/erp/app/components/Chat/lib/types.ts b/apps/erp/app/components/Chat/lib/types.tsdeleted file mode 100644index 74be1cfa46..0000000000--- a/apps/erp/app/components/Chat/lib/types.ts+++ /dev/null@@ -1,47 +0,0 @@-import type {- AgentDataParts,- AgentUIMessage as BaseAgentUIMessage-} from "@ai-sdk-tools/agents";-import type { UIMessage } from "ai";--export type UITools = Record<string, any>;--export type ChatMessageMetadata = {- webSearch?: boolean;- toolCall?: {- toolName: string;- toolParams: Record<string, any>;- };-};--export type MessageDataParts = Record<string, any> & {- toolChoice?: string;- agentChoice?: string;-};--// Define the UI chat message type with proper metadata and tool typing-export type UIChatMessage = UIMessage<- ChatMessageMetadata,- MessageDataParts,- UITools->;--/**- * Extended agent status type with application-specific agent names- */-export type AgentStatus = {- status: "routing" | "executing" | "completing";- agent: "triage" | "purchasing" | "parts" | "suppliers" | "general";-};-/**- * Extended data parts interface with application-specific data- *- * This demonstrates how to extend the base AgentDataParts with- * custom data parts for your application.- */-export interface AppDataParts extends AgentDataParts {- // Override the agent-status with our extended type- "agent-status": AgentStatus;-}--export type AgentUIMessage = BaseAgentUIMessage<never, AppDataParts>;diff --git a/apps/erp/app/components/Chat/messages/MessageActions.tsx b/apps/erp/app/components/Chat/messages/MessageActions.tsxdeleted file mode 100644index 0b288bc912..0000000000--- a/apps/erp/app/components/Chat/messages/MessageActions.tsx+++ /dev/null@@ -1,235 +0,0 @@-import { useChatActions, useChatId } from "@ai-sdk-tools/store";-import {- cn,- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { motion } from "framer-motion";-import { useState } from "react";-import {- LuCheck,- LuCopy,- LuRefreshCcw,- LuThumbsDown,- LuThumbsUp-} from "react-icons/lu";-import { useFetcher } from "react-router";--interface MessageActionsProps {- messageId: string;- messageContent: string;-}--export function MessageActions({- messageId,- messageContent-}: MessageActionsProps) {- const { t } = useLingui();- const chatId = useChatId();- const { regenerate } = useChatActions();- const [feedbackGiven, setFeedbackGiven] = useState<- "positive" | "negative" | null- >(null);- const [copied, setCopied] = useState(false);-- const feedbackFetcher = useFetcher<{}>();-- const handleRegenerate = () => {- regenerate?.();- };-- const handlePositive = () => {- if (feedbackGiven === "positive") {- // Already gave positive feedback, remove feedback- setFeedbackGiven(null);- return;- }-- setFeedbackGiven("positive");-- if (!chatId) return;-- alert(t`Positive feedback`);- };-- const handleNegative = () => {- if (feedbackGiven === "negative") {- // Already gave negative feedback, remove feedback- setFeedbackGiven(null);- return;- }-- setFeedbackGiven("negative");-- if (!chatId) return;-- alert(t`Negative feedback`);- };-- const copyToClipboard = async () => {- try {- await navigator.clipboard.writeText(messageContent);- setCopied(true);- // Reset the copied state after 2 seconds- setTimeout(() => setCopied(false), 2000);- } catch (err) {- console.error("Failed to copy to clipboard:", err);- }- };-- return (- <motion.div- className="flex items-center gap-1 mt-3"- initial={{ opacity: 0, y: 10 }}- animate={{ opacity: 1, y: 0 }}- transition={{- duration: 0.3,- ease: "easeOut",- staggerChildren: 0.05- }}- >- {/* Copy Button */}- <motion.div- initial={{ opacity: 0, scale: 0.8 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.2 }}- >- <TooltipProvider delayDuration={200}>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- onClick={copyToClipboard}- className="flex items-center justify-center w-6 h-6 transition-colors duration-200 hover:bg-muted"- >- {copied ? (- <LuCheck className="size-3.5 animate-in zoom-in-50 duration-200" />- ) : (- <LuCopy className="size-3 text-muted-foreground hover:text-foreground" />- )}- </button>- </TooltipTrigger>- <TooltipContent className="px-2 py-1 text-xs">- <p>- {copied ? <Trans>Copied!</Trans> : <Trans>Copy response</Trans>}- </p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- </motion.div>-- {/* Retry Button */}- <motion.div- initial={{ opacity: 0, scale: 0.8 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.2 }}- >- <TooltipProvider delayDuration={200}>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- onClick={handleRegenerate}- className="flex items-center justify-center w-6 h-6 transition-colors duration-200 hover:bg-muted"- >- <LuRefreshCcw className="size-3.5 text-muted-foreground hover:text-foreground" />- </button>- </TooltipTrigger>- <TooltipContent className="px-2 py-1 text-xs">- <p>- <Trans>Retry response</Trans>- </p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- </motion.div>-- {/* Positive Feedback Button */}- <motion.div- initial={{ opacity: 0, scale: 0.8 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.2 }}- >- <TooltipProvider delayDuration={200}>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- onClick={handlePositive}- disabled={feedbackFetcher.state !== "idle"}- className={cn(- "flex items-center justify-center w-6 h-6 transition-colors duration-200 hover:bg-muted",- feedbackFetcher.state !== "idle" &&- "opacity-50 cursor-not-allowed"- )}- >- <LuThumbsUp- className={cn(- "w-3 h-3",- feedbackGiven === "positive"- ? "text-emerald-600"- : "text-muted-foreground hover:text-foreground"- )}- />- </button>- </TooltipTrigger>- <TooltipContent className="px-2 py-1 text-xs">- <p>- {feedbackGiven === "positive" ? (- <Trans>Remove positive feedback</Trans>- ) : (- <Trans>Positive feedback</Trans>- )}- </p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- </motion.div>-- {/* Negative Feedback Button */}- <motion.div- initial={{ opacity: 0, scale: 0.8 }}- animate={{ opacity: 1, scale: 1 }}- transition={{ duration: 0.2 }}- >- <TooltipProvider delayDuration={200}>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- onClick={handleNegative}- disabled={feedbackFetcher.state !== "idle"}- className={cn(- "flex items-center justify-center w-6 h-6 transition-colors duration-200 hover:bg-muted",- feedbackFetcher.state !== "idle" &&- "opacity-50 cursor-not-allowed"- )}- >- <LuThumbsDown- className={cn(- "w-3 h-3",- feedbackGiven === "negative"- ? "text-red-600"- : "text-muted-foreground hover:text-foreground"- )}- />- </button>- </TooltipTrigger>- <TooltipContent className="px-2 py-1 text-xs">- <p>- {feedbackGiven === "negative" ? (- <Trans>Remove negative feedback</Trans>- ) : (- <Trans>Negative feedback</Trans>- )}- </p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- </motion.div>- </motion.div>- );-}diff --git a/apps/erp/app/components/Chat/messages/Messages.tsx b/apps/erp/app/components/Chat/messages/Messages.tsxdeleted file mode 100644index 4ec05f7739..0000000000--- a/apps/erp/app/components/Chat/messages/Messages.tsx+++ /dev/null@@ -1,119 +0,0 @@-import { useChatMessages, useChatStatus } from "@ai-sdk-tools/store";-import { TextShimmer } from "@carbon/react";-import { Fragment } from "react";-import { Message, MessageAvatar, MessageContent } from "~/components/Message";-import { useUser } from "~/hooks";-import {- Conversation,- ConversationContent,- ConversationScrollButton-} from "../Conversation";-import { Markdown } from "../Markdown/Markdown";-import type { SupportedToolName } from "../ToolCallIndicator";-import { ToolCallIndicator } from "../ToolCallIndicator";-import { WebSearchSources } from "../WebSearch";-import { MessageActions } from "./MessageActions";--export const ThinkingMessage = () => {- return (- <TextShimmer className="text-sm" duration={1}>- Thinking...- </TextShimmer>- );-};--type ActiveToolCallProps = {- toolName: string;-};--export const ActiveToolCall = ({ toolName }: ActiveToolCallProps) => {- // Type assertion to ensure compatibility with our supported tool names- const supportedToolName = toolName as SupportedToolName;-- return <ToolCallIndicator toolName={supportedToolName} />;-};--export function Messages() {- const messages = useChatMessages();- const status = useChatStatus();- const user = useUser();-- return (- <div className="w-full mx-auto relative size-full h-[calc(100vh-86px)] pb-28">- <div className="flex flex-col h-full w-full">- <Conversation className="h-full w-full">- <ConversationContent className="px-6 mx-auto mb-40 max-w-[770px]">- {messages.map((message) => (- <div key={message.id}>- {message.parts.map((part, i) => {- switch (part.type) {- case "data-canvas":- return null; // Canvas content is rendered in sidebar-- case "text":- return (- <Fragment key={`${message.id}-${i}`}>- <Message from={message.role}>- <MessageContent>- <Markdown limitedMarkdown>{part.text}</Markdown>- </MessageContent>-- {message.role === "user" && user && (- <MessageAvatar- src={user.avatarUrl!}- name={`${user.firstName!} ${user.lastName!}`}- />- )}- </Message>-- {message.role === "assistant" &&- message.parts.filter(- (part) => part.type === "source-url"- ).length > 0 && (- <WebSearchSources- sources={message.parts.filter(- (part) => part.type === "source-url"- )}- />- )}-- {message.role === "assistant" &&- status !== "streaming" && (- <MessageActions- messageContent={part.text}- messageId={message.id}- />- )}- </Fragment>- );-- default: {- if (part.type.startsWith("tool-")) {- return (- <Fragment key={`${message.id}-${i}`}>- <Message from={message.role}>- <MessageContent>- <Markdown>- {(part as any)?.output?.text}- </Markdown>- </MessageContent>- </Message>- </Fragment>- );- }-- return null;- }- }- })}- </div>- ))}-- {status === "submitted" && <ThinkingMessage />}- </ConversationContent>- <ConversationScrollButton />- </Conversation>- </div>- </div>- );-}diff --git a/apps/erp/app/modules/accounting/accounting.service.ts b/apps/erp/app/modules/accounting/accounting.service.tsindex 5414e98905..3d2fad9f90 100644--- a/apps/erp/app/modules/accounting/accounting.service.ts+++ b/apps/erp/app/modules/accounting/accounting.service.ts@@ -1862,7 +1862,7 @@ export async function reverseJournalEntry(client: SupabaseClient<Database>,id: string,data: {- journalEntryId: string;+ journalEntryId?: string;companyId: string;userId: string;}@@ -1877,11 +1877,31 @@ export async function reverseJournalEntry(};}- // 2. Create reversing entry as Posted+ // 2. Generate sequence if not provided+ let journalEntryId: string;+ if (data.journalEntryId) {+ journalEntryId = data.journalEntryId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "journalEntry",+ company_id: data.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error: seq.error ?? {+ message: "Failed to generate journalEntry sequence"+ }+ };+ }+ journalEntryId = seq.data;+ }++ // 3. Create reversing entry as Postedconst reversed = await client.from("journal").insert({- journalEntryId: data.journalEntryId,+ journalEntryId,companyId: data.companyId,description: `Reversal of ${original.data.journalEntryId}`,postingDate: new Date().toISOString().split("T")[0],@@ -2072,6 +2092,127 @@ export async function getFixedAssetsListForSale(.order("fixedAssetId");}+export async function insertFixedAsset(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ fixedAssetId?: string;+ fixedAssetClassId: string;+ name: string;+ description?: string;+ serialNumber?: string;+ depreciationMethod: string;+ usefulLifeMonths: number;+ residualValuePercent: number;+ assetLifetimeUsage?: number | null;+ locationId?: string;+ status?: string;+ taxDepreciationMethod?: string | null;+ taxUsefulLifeMonths?: number | null;+ taxResidualValuePercent?: number | null;+ macrsPropertyClass?: string | null;+ macrsConvention?: string | null;+ bonusDepreciationPercent?: number | null;+ }+): Promise<{+ data: { id: string; fixedAssetId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let fixedAssetId: string;+ if (input.fixedAssetId) {+ fixedAssetId = input.fixedAssetId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "fixedAsset",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate fixedAsset sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ fixedAssetId = seq.data;+ }++ const asset = await client+ .from("fixedAsset")+ .insert({+ fixedAssetId,+ fixedAssetClassId: input.fixedAssetClassId,+ name: input.name,+ description: input.description ?? null,+ serialNumber: input.serialNumber ?? null,+ depreciationMethod: input.depreciationMethod as any,+ usefulLifeMonths: input.usefulLifeMonths,+ residualValuePercent: input.residualValuePercent,+ assetLifetimeUsage: input.assetLifetimeUsage ?? null,+ locationId: input.locationId ?? null,+ status: (input.status as any) ?? "Draft",+ taxDepreciationMethod: (input.taxDepreciationMethod as any) ?? null,+ taxUsefulLifeMonths: input.taxUsefulLifeMonths ?? null,+ taxResidualValuePercent: input.taxResidualValuePercent ?? null,+ macrsPropertyClass: (input.macrsPropertyClass as any) ?? null,+ macrsConvention: (input.macrsConvention as any) ?? null,+ bonusDepreciationPercent: input.bonusDepreciationPercent ?? null,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, fixedAssetId")+ .single();++ if (asset.error) return { data: null, error: asset.error };++ return {+ data: { id: asset.data.id, fixedAssetId: asset.data.fixedAssetId },+ error: null+ };+}++export async function updateFixedAsset(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ fixedAssetClassId?: string;+ name?: string;+ description?: string | null;+ serialNumber?: string | null;+ depreciationMethod?: string;+ usefulLifeMonths?: number;+ residualValuePercent?: number;+ assetLifetimeUsage?: number | null;+ locationId?: string | null;+ taxDepreciationMethod?: string | null;+ taxUsefulLifeMonths?: number | null;+ taxResidualValuePercent?: number | null;+ macrsPropertyClass?: string | null;+ macrsConvention?: string | null;+ bonusDepreciationPercent?: number | null;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("fixedAsset")+ .update(sanitize(rest))+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertFixedAsset for new assets, updateFixedAsset for existing assets */export async function upsertFixedAsset(client: SupabaseClient<Database>,data:@@ -2105,6 +2246,86 @@ export async function deleteFixedAsset(return client.from("fixedAsset").delete().eq("id", id).eq("status", "Draft");}+export async function insertDepreciationRun(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ depreciationRunId?: string;+ periodEnd: string;+ lines: Array<{+ fixedAssetId: string;+ amount: number;+ taxAmount?: number;+ }>;+ }+): Promise<{+ data: { id: string; depreciationRunId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let depreciationRunId: string;+ if (input.depreciationRunId) {+ depreciationRunId = input.depreciationRunId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "depreciationRun",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate depreciationRun sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ depreciationRunId = seq.data;+ }++ const run = await client+ .from("depreciationRun")+ .insert({+ depreciationRunId,+ periodEnd: input.periodEnd,+ status: "Draft" as const,+ companyId: input.companyId,+ createdBy: input.createdBy+ })+ .select("id, depreciationRunId")+ .single();++ if (run.error) return { data: null, error: run.error };++ if (input.lines.length > 0) {+ const lineInserts = input.lines.map((line) => ({+ depreciationRunId: run.data.id,+ fixedAssetId: line.fixedAssetId,+ amount: line.amount,+ taxAmount: line.taxAmount,+ companyId: input.companyId+ }));++ const lineResult = await client+ .from("depreciationRunLine")+ .insert(lineInserts);++ if (lineResult.error) {+ await client.from("depreciationRun").delete().eq("id", run.data.id);+ return { data: null, error: lineResult.error };+ }+ }++ return {+ data: {+ id: run.data.id,+ depreciationRunId: run.data.depreciationRunId+ },+ error: null+ };+}+export async function deleteDepreciationRun(client: SupabaseClient<Database>,id: stringdiff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.tsindex d1dd3c8f3c..cc5b1c4964 100644--- a/apps/erp/app/modules/inventory/inventory.service.ts+++ b/apps/erp/app/modules/inventory/inventory.service.ts@@ -2126,3 +2126,240 @@ export async function getTrackedEntityExpirations({});}++export async function insertStockTransfer(+ client: SupabaseClient<Database>,+ input: {+ locationId: string;+ lines: Array<{+ itemId: string;+ fromStorageUnitId?: string | null;+ toStorageUnitId?: string | null;+ quantity?: number;+ requiresSerialTracking?: boolean;+ requiresBatchTracking?: boolean;+ }>;+ companyId: string;+ createdBy: string;+ stockTransferId?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; stockTransferId: string } | null;+ error: PostgrestError | { message: string } | null;+}> {+ const { locationId, lines, companyId, createdBy, customFields } = input;++ let stockTransferId = input.stockTransferId;+ if (!stockTransferId) {+ const sequence = await client.rpc("get_next_sequence", {+ sequence_name: "stockTransfer",+ company_id: companyId+ });+ if (sequence.error || !sequence.data) {+ return {+ data: null,+ error: sequence.error ?? { message: "Failed to get sequence" }+ };+ }+ stockTransferId = sequence.data;+ }++ const linesWithExpandedSerialTracking = lines.reduce<typeof lines>(+ (acc, line) => {+ if (line.quantity && !Number.isInteger(line.quantity)) {+ return acc;+ }+ if (line.requiresSerialTracking && line.quantity && line.quantity > 1) {+ acc.push(+ ...Array.from({ length: line.quantity }, () => ({+ ...line,+ quantity: 1+ }))+ );+ } else {+ acc.push(line);+ }+ return acc;+ },+ []+ );++ const createTransfer = await client+ .from("stockTransfer")+ .insert({+ stockTransferId,+ locationId,+ status: "Released",+ companyId,+ createdBy,+ customFields+ })+ .select("id")+ .single();++ if (createTransfer.error || !createTransfer.data) {+ return { data: null, error: createTransfer.error };+ }++ const createLines = await client.from("stockTransferLine").insert(+ linesWithExpandedSerialTracking.map((line) => ({+ ...line,+ stockTransferId: createTransfer.data.id,+ companyId,+ createdBy+ }))+ );++ if (createLines.error) {+ await client+ .from("stockTransfer")+ .delete()+ .eq("id", createTransfer.data.id);+ return { data: null, error: createLines.error };+ }++ return {+ data: { id: createTransfer.data.id, stockTransferId: stockTransferId! },+ error: null+ };+}++export async function insertWarehouseTransfer(+ client: SupabaseClient<Database>,+ input: {+ fromLocationId: string;+ toLocationId: string;+ companyId: string;+ createdBy: string;+ transferId?: string;+ status?: Database["public"]["Enums"]["warehouseTransferStatus"];+ transferDate?: string;+ expectedReceiptDate?: string;+ notes?: string;+ reference?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; transferId: string } | null;+ error: PostgrestError | { message: string } | null;+}> {+ const {+ fromLocationId,+ toLocationId,+ companyId,+ createdBy,+ status = "Draft",+ transferDate,+ expectedReceiptDate,+ notes,+ reference,+ customFields+ } = input;++ let transferId = input.transferId;+ if (!transferId) {+ const sequence = await client.rpc("get_next_sequence", {+ sequence_name: "warehouseTransfer",+ company_id: companyId+ });+ if (sequence.error || !sequence.data) {+ return {+ data: null,+ error: sequence.error ?? { message: "Failed to get sequence" }+ };+ }+ transferId = sequence.data;+ }++ const createTransfer = await client+ .from("warehouseTransfer")+ .insert({+ transferId,+ fromLocationId,+ toLocationId,+ status,+ transferDate: transferDate || null,+ expectedReceiptDate: expectedReceiptDate || null,+ notes: notes || null,+ reference: reference || null,+ companyId,+ createdBy,+ customFields+ })+ .select("id")+ .single();++ if (createTransfer.error || !createTransfer.data) {+ return { data: null, error: createTransfer.error };+ }++ return {+ data: { id: createTransfer.data.id, transferId: transferId! },+ error: null+ };+}++export async function updateStockTransfer(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ locationId?: string;+ stockTransferId?: string;+ updatedBy: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: PostgrestError | null;+}> {+ const { id, updatedBy, customFields, ...fields } = input;+ return client+ .from("stockTransfer")+ .update(+ sanitize({+ ...fields,+ customFields,+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ )+ .eq("id", id)+ .select("id")+ .single();+}++export async function updateWarehouseTransfer(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ fromLocationId?: string;+ toLocationId?: string;+ transferId?: string;+ status?: Database["public"]["Enums"]["warehouseTransferStatus"];+ transferDate?: string;+ expectedReceiptDate?: string;+ notes?: string;+ reference?: string;+ updatedBy: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: PostgrestError | null;+}> {+ const { id, updatedBy, customFields, ...fields } = input;+ return client+ .from("warehouseTransfer")+ .update(+ sanitize({+ ...fields,+ customFields,+ updatedBy,+ updatedAt: today(getLocalTimeZone()).toString()+ })+ )+ .eq("id", id)+ .select("id")+ .single();+}diff --git a/apps/erp/app/modules/invoicing/invoicing.service.ts b/apps/erp/app/modules/invoicing/invoicing.service.tsindex a9ad196128..31bff017cd 100644--- a/apps/erp/app/modules/invoicing/invoicing.service.ts+++ b/apps/erp/app/modules/invoicing/invoicing.service.ts@@ -381,6 +381,178 @@ export async function updateSalesInvoiceStatus(return client.from("salesInvoice").update(updateData).eq("id", update.id);}+export async function insertPurchaseInvoice(+ client: SupabaseClient<Database>,+ input: {+ supplierId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ invoiceId?: string;+ supplierReference?: string;+ paymentTermId?: string;+ currencyCode?: string;+ locationId?: string;+ invoiceSupplierId?: string;+ invoiceSupplierContactId?: string;+ invoiceSupplierLocationId?: string;+ dateIssued?: string;+ dateDue?: string;+ exchangeRate?: number;+ exchangeRateUpdatedAt?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; invoiceId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let invoiceId: string;+ if (input.invoiceId) {+ invoiceId = input.invoiceId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "purchaseInvoice",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate purchaseInvoice sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ invoiceId = seq.data;+ }++ const [supplierInteraction, supplierPayment, supplierShipping, purchaser] =+ await Promise.all([+ insertSupplierInteraction(client, input.companyId, input.supplierId),+ getSupplierPayment(client, input.supplierId),+ getSupplierShipping(client, input.supplierId),+ getEmployeeJob(client, input.createdBy, input.companyId)+ ]);++ if (supplierInteraction.error)+ return { data: null, error: supplierInteraction.error };+ if (supplierPayment.error)+ return { data: null, error: supplierPayment.error };+ if (supplierShipping.error)+ return { data: null, error: supplierShipping.error };++ const { paymentTermId, invoiceSupplierId } = supplierPayment.data;+ const { shippingMethodId, shippingTermId, incoterm, incotermLocation } =+ supplierShipping.data;++ let exchangeRate = input.exchangeRate ?? 1;+ let exchangeRateUpdatedAt =+ input.exchangeRateUpdatedAt ?? new Date().toISOString();++ if (input.currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ input.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const locationId = input.locationId ?? purchaser?.data?.locationId ?? null;++ const invoice = await client+ .from("purchaseInvoice")+ .insert({+ invoiceId,+ supplierId: input.supplierId,+ supplierReference: input.supplierReference ?? null,+ invoiceSupplierId:+ input.invoiceSupplierId ?? invoiceSupplierId ?? input.supplierId,+ invoiceSupplierContactId: input.invoiceSupplierContactId ?? null,+ invoiceSupplierLocationId: input.invoiceSupplierLocationId ?? null,+ supplierInteractionId: supplierInteraction.data?.id,+ currencyCode: input.currencyCode ?? "USD",+ exchangeRate,+ exchangeRateUpdatedAt,+ paymentTermId: input.paymentTermId ?? paymentTermId,+ dateIssued: input.dateIssued ?? today(getLocalTimeZone()).toString(),+ dateDue: input.dateDue ?? null,+ locationId,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, invoiceId")+ .single();++ if (invoice.error) return { data: null, error: invoice.error };++ const delivery = await client.from("purchaseInvoiceDelivery").insert({+ id: invoice.data.id,+ locationId,+ shippingMethodId,+ shippingTermId,+ incoterm,+ incotermLocation,+ companyId: input.companyId+ });++ if (delivery.error) {+ await client.from("purchaseInvoice").delete().eq("id", invoice.data.id);+ return { data: null, error: delivery.error };+ }++ return {+ data: { id: invoice.data.id, invoiceId: invoice.data.invoiceId },+ error: null+ };+}++export async function updatePurchaseInvoice(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ invoiceId?: string;+ supplierId?: string;+ supplierReference?: string | null;+ paymentTermId?: string | null;+ currencyCode?: string;+ locationId?: string;+ invoiceSupplierId?: string | null;+ invoiceSupplierContactId?: string | null;+ invoiceSupplierLocationId?: string | null;+ dateIssued?: string | null;+ dateDue?: string | null;+ exchangeRate?: number;+ exchangeRateUpdatedAt?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("purchaseInvoice")+ .update({+ ...sanitize(rest),+ updatedAt: today(getLocalTimeZone()).toString()+ })+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertPurchaseInvoice for new invoices, updatePurchaseInvoice for existing invoices */export async function upsertPurchaseInvoice(client: SupabaseClient<Database>,purchaseInvoice:@@ -576,6 +748,185 @@ export async function updatePurchaseInvoiceLineOrder(});}+export async function insertSalesInvoice(+ client: SupabaseClient<Database>,+ input: {+ customerId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ invoiceId?: string;+ customerReference?: string;+ paymentTermId?: string;+ currencyCode?: string;+ locationId?: string;+ invoiceCustomerId?: string;+ invoiceCustomerContactId?: string;+ invoiceCustomerLocationId?: string;+ dateIssued?: string;+ dateDue?: string;+ exchangeRate?: number;+ exchangeRateUpdatedAt?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; invoiceId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let invoiceId: string;+ if (input.invoiceId) {+ invoiceId = input.invoiceId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "salesInvoice",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate salesInvoice sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ invoiceId = seq.data;+ }++ const [opportunity, customerPayment, customerShipping, salesPerson] =+ await Promise.all([+ client+ .from("opportunity")+ .insert({+ companyId: input.companyId,+ customerId: input.customerId+ })+ .select("id")+ .single(),+ getCustomerPayment(client, input.customerId),+ getCustomerShipping(client, input.customerId),+ getEmployeeJob(client, input.createdBy, input.companyId)+ ]);++ if (opportunity.error) return { data: null, error: opportunity.error };+ if (customerPayment.error)+ return { data: null, error: customerPayment.error };+ if (customerShipping.error)+ return { data: null, error: customerShipping.error };++ const { paymentTermId, invoiceCustomerId } = customerPayment.data;+ const { shippingMethodId, shippingTermId, incoterm, incotermLocation } =+ customerShipping.data;++ let exchangeRate = input.exchangeRate ?? 1;+ let exchangeRateUpdatedAt =+ input.exchangeRateUpdatedAt ?? new Date().toISOString();++ if (input.currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ input.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const locationId = input.locationId ?? salesPerson?.data?.locationId ?? null;++ const invoice = await client+ .from("salesInvoice")+ .insert({+ invoiceId,+ customerId: input.customerId,+ customerReference: input.customerReference ?? null,+ invoiceCustomerId:+ input.invoiceCustomerId ?? invoiceCustomerId ?? input.customerId,+ invoiceCustomerContactId: input.invoiceCustomerContactId ?? null,+ invoiceCustomerLocationId: input.invoiceCustomerLocationId ?? null,+ opportunityId: opportunity.data?.id,+ currencyCode: input.currencyCode ?? "USD",+ exchangeRate,+ exchangeRateUpdatedAt,+ paymentTermId: input.paymentTermId ?? paymentTermId,+ dateIssued: input.dateIssued ?? today(getLocalTimeZone()).toString(),+ dateDue: input.dateDue ?? null,+ locationId,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, invoiceId")+ .single();++ if (invoice.error) return { data: null, error: invoice.error };++ const delivery = await client.from("salesInvoiceShipment").insert({+ id: invoice.data.id,+ locationId,+ shippingMethodId,+ shippingTermId,+ incoterm,+ incotermLocation,+ companyId: input.companyId,+ createdBy: input.createdBy+ });++ if (delivery.error) {+ await client.from("salesInvoice").delete().eq("id", invoice.data.id);+ return { data: null, error: delivery.error };+ }++ return {+ data: { id: invoice.data.id, invoiceId: invoice.data.invoiceId },+ error: null+ };+}++export async function updateSalesInvoice(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ invoiceId?: string;+ customerId?: string;+ customerReference?: string | null;+ paymentTermId?: string | null;+ currencyCode?: string;+ locationId?: string;+ invoiceCustomerId?: string | null;+ invoiceCustomerContactId?: string | null;+ invoiceCustomerLocationId?: string | null;+ dateIssued?: string | null;+ dateDue?: string | null;+ exchangeRate?: number;+ exchangeRateUpdatedAt?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("salesInvoice")+ .update({+ ...sanitize(rest),+ updatedAt: today(getLocalTimeZone()).toString()+ })+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertSalesInvoice for new invoices, updateSalesInvoice for existing invoices */export async function upsertSalesInvoice(client: SupabaseClient<Database>,salesInvoice:diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.tsindex d7abda17e5..eb5613f4ef 100644--- a/apps/erp/app/modules/production/production.service.ts+++ b/apps/erp/app/modules/production/production.service.ts@@ -10,6 +10,7 @@ import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import { getDefaultStorageUnitForJob } from "../inventory";+import { getEmployeeJob } from "../people";import type {operationParameterValidator,operationStepValidator,@@ -2159,6 +2160,279 @@ export async function upsertProductionQuantity(}}+export async function insertJob(+ client: SupabaseClient<Database>,+ input: {+ itemId: string;+ quantity: number;+ companyId: string;+ createdBy: string;+ jobId?: string;+ locationId?: string;+ dueDate?: string;+ startDate?: string;+ priority?: number;+ status?: (typeof jobStatus)[number];+ deadlineType?: (typeof deadlineTypes)[number];+ storageUnitId?: string;+ unitOfMeasureCode?: string;+ customerId?: string;+ salesOrderId?: string;+ salesOrderLineId?: string;+ quoteId?: string;+ quoteLineId?: string;+ parentJobId?: string;+ modelUploadId?: string;+ notes?: string;+ customFields?: Json;+ configuration?: Record<string, unknown>;+ },+ options?: {+ skipMethod?: boolean;+ skipRecalculate?: boolean;+ methodSource?: "item" | "quoteLine";+ }+): Promise<{+ data: { id: string; jobId: string } | null;+ error: PostgrestError | null;+}> {+ let jobId: string;+ if (input.jobId) {+ jobId = input.jobId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "job",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({ message: "Failed to generate job sequence" } as PostgrestError)+ };+ }+ jobId = seq.data;+ }++ let locationId = input.locationId;+ if (!locationId) {+ const employeeJob = await getEmployeeJob(+ client,+ input.createdBy,+ input.companyId+ );+ locationId = employeeJob.data?.locationId ?? undefined;++ if (!locationId) {+ const defaultLocation = await client+ .from("location")+ .select("id")+ .eq("companyId", input.companyId)+ .limit(1)+ .single();+ locationId = defaultLocation.data?.id ?? undefined;+ }++ if (!locationId) {+ return {+ data: null,+ error: { message: "No location found for job" } as PostgrestError+ };+ }+ }++ const replenishment = await client+ .from("itemReplenishment")+ .select("leadTime, scrapPercentage, lotSize")+ .eq("itemId", input.itemId)+ .eq("companyId", input.companyId)+ .maybeSingle();++ const leadTime = replenishment.data?.leadTime ?? 7;+ const scrapPercentage = replenishment.data?.scrapPercentage ?? 0;++ const dueDate = input.dueDate ?? null;+ const startDate =+ input.startDate ??+ (dueDate+ ? parseDate(dueDate).subtract({ days: leadTime }).toString()+ : null);++ const deadlineType =+ input.deadlineType ?? (dueDate ? "Hard Deadline" : "No Deadline");++ const priority =+ input.priority ??+ (await calculateJobPriority(client, {+ dueDate,+ deadlineType,+ companyId: input.companyId,+ locationId+ }));++ const storageUnitId =+ input.storageUnitId ??+ (await getDefaultStorageUnitForJob(+ client,+ input.itemId,+ locationId,+ input.companyId+ ));++ const scrapQuantity =+ scrapPercentage > 0 ? Math.ceil(input.quantity * scrapPercentage) : 0;++ const job = await client+ .from("job")+ .insert({+ jobId,+ itemId: input.itemId,+ quantity: input.quantity,+ scrapQuantity,+ locationId,+ dueDate,+ startDate,+ deadlineType,+ priority,+ status: input.status ?? "Draft",+ storageUnitId,+ unitOfMeasureCode: input.unitOfMeasureCode ?? "EA",+ customerId: input.customerId,+ salesOrderId: input.salesOrderId,+ salesOrderLineId: input.salesOrderLineId,+ quoteId: input.quoteId,+ quoteLineId: input.quoteLineId,+ parentJobId: input.parentJobId,+ modelUploadId: input.modelUploadId,+ notes: input.notes,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id")+ .single();++ if (job.error) {+ return { data: null, error: job.error };+ }++ const createdJobId = job.data.id;++ if (!options?.skipMethod) {+ const methodSource =+ options?.methodSource ??+ (input.quoteId && input.quoteLineId ? "quoteLine" : "item");++ if (methodSource === "quoteLine" && input.quoteId && input.quoteLineId) {+ const body: Record<string, unknown> = {+ type: "quoteLineToJob",+ sourceId: `${input.quoteId}:${input.quoteLineId}`,+ targetId: createdJobId,+ companyId: input.companyId,+ userId: input.createdBy+ };+ if (input.configuration) body.configuration = input.configuration;+ const { error } = await client.functions.invoke("get-method", { body });+ if (error) {+ console.error("Failed to copy method from quote line:", error);+ }+ } else {+ const body: Record<string, unknown> = {+ type: "itemToJob",+ sourceId: input.itemId,+ targetId: createdJobId,+ companyId: input.companyId,+ userId: input.createdBy+ };+ if (input.configuration) body.configuration = input.configuration;+ const { error } = await client.functions.invoke("get-method", { body });+ if (error) {+ console.error("Failed to copy method from item:", error);+ }+ }+ }++ if (!options?.skipRecalculate) {+ await client.functions.invoke("recalculate", {+ body: {+ type: "jobRequirements",+ id: createdJobId,+ companyId: input.companyId,+ userId: input.createdBy+ }+ });+ }++ return { data: { id: createdJobId, jobId }, error: null };+}++export async function updateJob(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ quantity?: number;+ dueDate?: string | null;+ startDate?: string | null;+ status?: (typeof jobStatus)[number];+ priority?: number;+ deadlineType?: (typeof deadlineTypes)[number];+ locationId?: string;+ storageUnitId?: string;+ unitOfMeasureCode?: string;+ customerId?: string | null;+ salesOrderId?: string | null;+ salesOrderLineId?: string | null;+ quoteId?: string | null;+ quoteLineId?: string | null;+ parentJobId?: string | null;+ modelUploadId?: string | null;+ notes?: string | null;+ customFields?: Json;+ scrapQuantity?: number;+ itemId?: string;+ }+): Promise<{ data: { id: string } | null; error: PostgrestError | null }> {+ const { id, updatedBy, ...updates } = input;++ let priority = updates.priority;+ if (+ (updates.dueDate !== undefined || updates.deadlineType !== undefined) &&+ priority === undefined+ ) {+ const existing = await client+ .from("job")+ .select("dueDate, deadlineType, companyId, locationId")+ .eq("id", id)+ .single();++ if (existing.data) {+ priority = await calculateJobPriority(client, {+ jobId: id,+ dueDate: updates.dueDate ?? existing.data.dueDate,+ deadlineType: updates.deadlineType ?? existing.data.deadlineType,+ companyId: existing.data.companyId,+ locationId: existing.data.locationId+ });+ }+ }++ return client+ .from("job")+ .update({+ ...sanitize(updates),+ ...(priority !== undefined && { priority }),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertJob for new jobs, updateJob for existing jobs */export async function upsertJob(client: SupabaseClient<Database>,job:diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.tsindex 0d821d501a..057107a08f 100644--- a/apps/erp/app/modules/purchasing/purchasing.models.ts+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts@@ -133,11 +133,14 @@ export const purchaseOrderValidator = z.object({message: "Type is required"})}),+ status: z.enum(purchaseOrderStatusType).optional(),supplierId: z.string().min(1, { message: "Supplier is required" }),locationId: zfd.text(z.string().optional()),supplierLocationId: zfd.text(z.string().optional()),supplierContactId: zfd.text(z.string().optional()),supplierReference: zfd.text(z.string().optional()),+ orderDate: zfd.text(z.string().optional()),+ notes: z.any().optional(),currencyCode: zfd.text(z.string().optional()),exchangeRate: zfd.numeric(z.number().optional()),exchangeRateUpdatedAt: zfd.text(z.string().optional())diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.tsindex 069465a91e..465824cb3c 100644--- a/apps/erp/app/modules/purchasing/purchasing.service.ts+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts@@ -1038,7 +1038,8 @@ export async function sendSupplierQuote(return { data: null, error: null };}-export async function updatePurchaseOrder(+/** @deprecated Use updatePurchaseOrderStatus or the new updatePurchaseOrder instead */+export async function updatePurchaseOrderStatusLegacy(client: SupabaseClient<Database>,purchaseOrder: {id: string;@@ -1282,6 +1283,203 @@ export async function updateSupplierTax(.eq("supplierId", supplierTax.supplierId);}+export async function insertPurchaseOrder(+ client: SupabaseClient<Database>,+ input: {+ supplierId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ purchaseOrderId?: string;+ purchaseOrderType?: "Purchase" | "Return" | "Outside Processing";+ locationId?: string;+ status?: (typeof purchaseOrderStatusType)[number];+ currencyCode?: string;+ orderDate?: string;+ supplierContactId?: string;+ supplierLocationId?: string;+ supplierQuoteId?: string;+ receiptRequestedDate?: string;+ supplierReference?: string;+ notes?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; purchaseOrderId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let purchaseOrderId: string;+ if (input.purchaseOrderId) {+ purchaseOrderId = input.purchaseOrderId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "purchaseOrder",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate PO sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ purchaseOrderId = seq.data;+ }++ const [supplierInteraction, supplierPayment, supplierShipping, purchaser] =+ await Promise.all([+ insertSupplierInteraction(client, input.companyId, input.supplierId),+ getSupplierPayment(client, input.supplierId),+ getSupplierShipping(client, input.supplierId),+ getEmployeeJob(client, input.createdBy, input.companyId)+ ]);++ if (supplierInteraction.error)+ return { data: null, error: supplierInteraction.error };+ if (supplierPayment.error)+ return { data: null, error: supplierPayment.error };+ if (supplierShipping.error)+ return { data: null, error: supplierShipping.error };++ const {+ paymentTermId,+ invoiceSupplierId,+ invoiceSupplierContactId,+ invoiceSupplierLocationId+ } = supplierPayment.data;++ const { shippingMethodId, shippingTermId, incoterm, incotermLocation } =+ supplierShipping.data;++ let exchangeRate = 1;+ let exchangeRateUpdatedAt = new Date().toISOString();+ if (input.currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ input.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const locationId = input.locationId ?? purchaser?.data?.locationId ?? null;++ const order = await client+ .from("purchaseOrder")+ .insert({+ purchaseOrderId,+ purchaseOrderType: input.purchaseOrderType,+ supplierId: input.supplierId,+ supplierContactId: input.supplierContactId,+ supplierLocationId: input.supplierLocationId,+ supplierInteractionId: supplierInteraction.data?.id,+ status: input.status ?? "Draft",+ orderDate: input.orderDate ?? new Date().toISOString().split("T")[0],+ currencyCode: input.currencyCode,+ exchangeRate,+ exchangeRateUpdatedAt,+ supplierReference: input.supplierReference ?? null,+ internalNotes: input.notes ?? null,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, purchaseOrderId")+ .single();++ if (order.error) return { data: null, error: order.error };++ const orderId = order.data.id;++ const [delivery, payment] = await Promise.all([+ client.from("purchaseOrderDelivery").insert({+ id: orderId,+ locationId,+ receiptRequestedDate: input.receiptRequestedDate ?? null,+ shippingMethodId,+ shippingTermId,+ incoterm,+ incotermLocation,+ companyId: input.companyId+ }),+ client.from("purchaseOrderPayment").insert({+ id: orderId,+ paymentTermId,+ invoiceSupplierId: invoiceSupplierId ?? input.supplierId,+ invoiceSupplierContactId,+ invoiceSupplierLocationId,+ companyId: input.companyId+ })+ ]);++ if (delivery.error || payment.error) {+ await deletePurchaseOrder(client, orderId);+ return { data: null, error: delivery.error ?? payment.error };+ }++ return { data: { id: orderId, purchaseOrderId }, error: null };+}++export async function updatePurchaseOrder(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ status?: (typeof purchaseOrderStatusType)[number];+ currencyCode?: string;+ orderDate?: string;+ supplierId?: string;+ supplierContactId?: string | null;+ supplierLocationId?: string | null;+ supplierReference?: string;+ purchaseOrderType?: string;+ notes?: string | null;+ customFields?: Json;+ },+ companyGroupId?: string+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, updatedBy, notes, ...updates } = input;++ let exchangeRate: number | undefined;+ let exchangeRateUpdatedAt: string | undefined;+ if (updates.currencyCode && companyGroupId) {+ const currency = await getCurrencyByCode(+ client,+ companyGroupId,+ updates.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ return client+ .from("purchaseOrder")+ .update({+ ...sanitize(updates),+ ...(exchangeRate !== undefined && { exchangeRate }),+ ...(exchangeRateUpdatedAt && { exchangeRateUpdatedAt }),+ ...(notes !== undefined && { internalNotes: notes }),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertPurchaseOrder for new orders, updatePurchaseOrder for existing orders */export async function upsertPurchaseOrder(client: SupabaseClient<Database>,purchaseOrder:@@ -1591,6 +1789,186 @@ export async function upsertSupplierProcess(.single();}+export async function insertSupplierQuote(+ client: SupabaseClient<Database>,+ input: {+ supplierId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ supplierQuoteId?: string;+ locationId?: string;+ status?: (typeof supplierQuoteStatusType)[number];+ currencyCode?: string;+ expirationDate?: string;+ supplierContactId?: string;+ supplierLocationId?: string;+ notes?: string;+ customFields?: Json;+ quotedDate?: string;+ supplierReference?: string;+ supplierQuoteType?: string;+ }+): Promise<{+ data: { id: string; supplierQuoteId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let supplierQuoteId: string;+ if (input.supplierQuoteId) {+ supplierQuoteId = input.supplierQuoteId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "supplierQuote",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate supplier quote sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ supplierQuoteId = seq.data;+ }++ let exchangeRate = 1;+ let exchangeRateUpdatedAt = new Date().toISOString();+ if (input.currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ input.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const supplierInteraction = await insertSupplierInteraction(+ client,+ input.companyId,+ input.supplierId+ );++ if (supplierInteraction.error)+ return { data: null, error: supplierInteraction.error };++ const quote = await client+ .from("supplierQuote")+ .insert({+ supplierQuoteId,+ supplierId: input.supplierId,+ supplierContactId: input.supplierContactId,+ supplierLocationId: input.supplierLocationId,+ supplierInteractionId: supplierInteraction.data?.id,+ status: input.status ?? "Draft",+ expirationDate: input.expirationDate,+ currencyCode: input.currencyCode,+ exchangeRate,+ exchangeRateUpdatedAt,+ internalNotes: input.notes,+ customFields: input.customFields,+ quotedDate: input.quotedDate ?? new Date().toISOString(),+ supplierReference: input.supplierReference ?? null,+ supplierQuoteType: input.supplierQuoteType ?? "Purchase",+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, supplierQuoteId, externalLinkId")+ .single();++ if (quote.error) return { data: null, error: quote.error };++ const createdQuoteId = quote.data.id;++ if (!quote.data.externalLinkId) {+ const externalLink = await upsertExternalLink(client, {+ documentType: "SupplierQuote",+ documentId: createdQuoteId,+ supplierId: input.supplierId,+ expiresAt: input.expirationDate,+ companyId: input.companyId+ });++ if (externalLink.data) {+ await client+ .from("supplierQuote")+ .update({ externalLinkId: externalLink.data.id })+ .eq("id", createdQuoteId);+ }+ }++ return { data: { id: createdQuoteId, supplierQuoteId }, error: null };+}++export async function updateSupplierQuote(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ status?: (typeof supplierQuoteStatusType)[number];+ currencyCode?: string;+ expirationDate?: string | null;+ supplierContactId?: string | null;+ supplierLocationId?: string | null;+ notes?: string | null;+ customFields?: Json;+ },+ companyGroupId?: string+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, updatedBy, notes, ...updates } = input;++ let exchangeRate: number | undefined;+ let exchangeRateUpdatedAt: string | undefined;++ const existing = await client+ .from("supplierQuote")+ .select("currencyCode")+ .eq("id", id)+ .single();++ if (existing.error) return { data: null, error: existing.error };++ if (+ updates.currencyCode &&+ companyGroupId &&+ existing.data.currencyCode !== updates.currencyCode+ ) {+ const currency = await getCurrencyByCode(+ client,+ companyGroupId,+ updates.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ return client+ .from("supplierQuote")+ .update({+ ...sanitize(updates),+ ...(exchangeRate !== undefined && { exchangeRate }),+ ...(exchangeRateUpdatedAt && { exchangeRateUpdatedAt }),+ ...(notes !== undefined && { internalNotes: notes }),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertSupplierQuote for new quotes, updateSupplierQuote for existing quotes */export async function upsertSupplierQuote(client: SupabaseClient<Database>,supplierQuote:@@ -1897,6 +2275,100 @@ export async function getPurchasingRFQSuppliers(.eq("purchasingRfqId", purchasingRfqId);}+export async function insertPurchasingRFQ(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ rfqId?: string;+ rfqDate?: string;+ expirationDate?: string;+ locationId?: string;+ employeeId?: string;+ status?: (typeof purchasingRfqStatusType)[number];+ notes?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; rfqId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let rfqId: string;+ if (input.rfqId) {+ rfqId = input.rfqId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "purchasingRfq",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate purchasingRfq sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ rfqId = seq.data;+ }++ const rfq = await client+ .from("purchasingRfq")+ .insert({+ rfqId,+ rfqDate: input.rfqDate ?? today(getLocalTimeZone()).toString(),+ expirationDate: input.expirationDate,+ locationId: input.locationId,+ employeeId: input.employeeId,+ status: input.status ?? "Draft",+ notes: input.notes,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, rfqId")+ .single();++ if (rfq.error) return { data: null, error: rfq.error };++ return { data: { id: rfq.data.id, rfqId: rfq.data.rfqId }, error: null };+}++export async function updatePurchasingRFQ(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ rfqDate?: string;+ expirationDate?: string | null;+ locationId?: string;+ employeeId?: string | null;+ status?: (typeof purchasingRfqStatusType)[number];+ notes?: string | null;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, updatedBy, ...updates } = input;++ return client+ .from("purchasingRfq")+ .update({+ ...sanitize(updates),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertPurchasingRFQ for new RFQs, updatePurchasingRFQ for existing RFQs */export async function upsertPurchasingRFQ(client: SupabaseClient<Database>,purchasingRfq: {diff --git a/apps/erp/app/modules/quality/quality.service.ts b/apps/erp/app/modules/quality/quality.service.tsindex 35df0110bf..0492498af3 100644--- a/apps/erp/app/modules/quality/quality.service.ts+++ b/apps/erp/app/modules/quality/quality.service.ts@@ -20,6 +20,7 @@ import type { inspectionStatus } from "../shared";import type {gaugeCalibrationRecordValidator,gaugeCalibrationStatus,+ gaugeRole,gaugeTypeValidator,gaugeValidator,inspectionDocumentValidator,@@ -1312,6 +1313,123 @@ export async function updateRiskStatus(return client.from("riskRegister").update({ status }).eq("id", riskId);}+export async function insertGauge(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ gaugeId?: string;+ gaugeTypeId: string;+ gaugeRole: (typeof gaugeRole)[number];+ gaugeCalibrationStatus: (typeof gaugeCalibrationStatus)[number];+ supplierId?: string;+ modelNumber?: string;+ serialNumber?: string;+ description?: string;+ dateAcquired?: string;+ lastCalibrationDate?: string;+ nextCalibrationDate?: string;+ locationId?: string;+ storageUnitId?: string;+ calibrationIntervalInMonths?: number;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; gaugeId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let gaugeId: string;+ if (input.gaugeId) {+ gaugeId = input.gaugeId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "gauge",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate gauge sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ gaugeId = seq.data;+ }++ const gauge = await client+ .from("gauges")+ .insert({+ gaugeId,+ gaugeTypeId: input.gaugeTypeId,+ gaugeRole: input.gaugeRole,+ gaugeCalibrationStatus: input.gaugeCalibrationStatus,+ supplierId: input.supplierId ?? null,+ modelNumber: input.modelNumber ?? null,+ serialNumber: input.serialNumber ?? null,+ description: input.description ?? null,+ dateAcquired: input.dateAcquired ?? null,+ lastCalibrationDate: input.lastCalibrationDate ?? null,+ nextCalibrationDate: input.nextCalibrationDate ?? null,+ locationId: input.locationId ?? null,+ storageUnitId: input.storageUnitId ?? null,+ calibrationIntervalInMonths: input.calibrationIntervalInMonths ?? 6,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, gaugeId")+ .single();++ if (gauge.error) return { data: null, error: gauge.error };++ return {+ data: { id: gauge.data.id, gaugeId: gauge.data.gaugeId },+ error: null+ };+}++export async function updateGauge(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ gaugeId?: string;+ gaugeTypeId?: string;+ gaugeRole?: (typeof gaugeRole)[number];+ gaugeCalibrationStatus?: (typeof gaugeCalibrationStatus)[number];+ supplierId?: string | null;+ modelNumber?: string | null;+ serialNumber?: string | null;+ description?: string | null;+ dateAcquired?: string | null;+ lastCalibrationDate?: string | null;+ nextCalibrationDate?: string | null;+ locationId?: string | null;+ storageUnitId?: string | null;+ calibrationIntervalInMonths?: number;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("gauges")+ .update(sanitize(rest))+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertGauge for new gauges, updateGauge for existing gauges */export async function upsertGauge(client: SupabaseClient<Database>,gauge:@@ -1445,6 +1563,249 @@ export async function upsertGaugeType(}}+export async function insertIssue(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ nonConformanceId?: string;+ name: string;+ priority: "Low" | "Medium" | "High" | "Critical";+ source: "Internal" | "External";+ locationId: string;+ nonConformanceTypeId: string;+ openDate: string;+ description?: string;+ nonConformanceWorkflowId?: string;+ dueDate?: string;+ closeDate?: string;+ quantity?: number;+ requiredActionIds?: string[];+ approvalRequirements?: string[];+ items?: string[];+ jobOperationId?: string;+ customerId?: string;+ salesOrderLineId?: string;+ operationSupplierProcessId?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; nonConformanceId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let nonConformanceId: string;+ if (input.nonConformanceId) {+ nonConformanceId = input.nonConformanceId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "nonConformance",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate nonConformance sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ nonConformanceId = seq.data;+ }++ const {+ items,+ jobOperationId,+ customerId,+ salesOrderLineId,+ operationSupplierProcessId,+ ...data+ } = input;++ const result = await client+ .from("nonConformance")+ .insert({+ nonConformanceId,+ name: data.name,+ priority: data.priority,+ source: data.source,+ locationId: data.locationId,+ nonConformanceTypeId: data.nonConformanceTypeId,+ openDate: data.openDate,+ description: data.description ?? null,+ nonConformanceWorkflowId: data.nonConformanceWorkflowId ?? null,+ dueDate: data.dueDate ?? null,+ closeDate: data.closeDate ?? null,+ quantity: data.quantity ?? 1,+ requiredActionIds: data.requiredActionIds ?? [],+ approvalRequirements: data.approvalRequirements ?? [],+ customFields: data.customFields,+ companyId: data.companyId,+ createdBy: data.createdBy+ })+ .select("id, nonConformanceId")+ .single();++ if (result.error || !result.data) {+ return { data: null, error: result.error };+ }++ const ncrId = result.data.id;++ if (items && items.length > 0) {+ const itemInsert = await client.from("nonConformanceItem").insert(+ items.map((item) => ({+ nonConformanceId: ncrId,+ itemId: item,+ companyId: input.companyId,+ createdBy: input.createdBy+ }))+ );+ if (itemInsert.error) {+ console.error(itemInsert);+ }+ }++ if (jobOperationId) {+ const jobOperation = await client+ .from("jobOperation")+ .select("*")+ .eq("id", jobOperationId)+ .single();+ if (jobOperation?.data) {+ const job = await client+ .from("job")+ .select("*")+ .eq("id", jobOperation.data.jobId)+ .single();+ if (job.data) {+ const jobOperationInsert = await client+ .from("nonConformanceJobOperation")+ .insert([+ {+ jobId: jobOperation.data.jobId,+ jobOperationId,+ nonConformanceId: ncrId,+ jobReadableId: job.data?.jobId,+ companyId: input.companyId,+ createdBy: input.createdBy+ }+ ]);+ if (jobOperationInsert.error) {+ console.error(jobOperationInsert);+ }+ }+ }+ }++ if (customerId) {+ const customerInsert = await client.from("nonConformanceCustomer").insert([+ {+ companyId: input.companyId,+ createdBy: input.createdBy,+ customerId: customerId,+ nonConformanceId: ncrId+ }+ ]);+ if (customerInsert.error) {+ console.error(customerInsert);+ }+ }++ if (salesOrderLineId) {+ const salesOrderLine = await client+ .from("salesOrderLine")+ .select("*, salesOrder(salesOrderId)")+ .eq("id", salesOrderLineId)+ .single();+ if (salesOrderLine.data) {+ const salesOrderLineInsert = await client+ .from("nonConformanceSalesOrderLine")+ .insert([+ {+ companyId: input.companyId,+ createdBy: input.createdBy,+ salesOrderLineId: salesOrderLineId,+ salesOrderId: salesOrderLine.data.salesOrderId,+ salesOrderReadableId: salesOrderLine.data.salesOrder.salesOrderId,+ nonConformanceId: ncrId+ }+ ]);+ if (salesOrderLineInsert.error) {+ console.error(salesOrderLineInsert);+ }+ }+ }++ if (operationSupplierProcessId) {+ const operationSupplierProcess = await client+ .from("supplierProcess")+ .select("*")+ .eq("id", operationSupplierProcessId)+ .single();++ if (operationSupplierProcess.data) {+ const nonConformanceSupplierInsert = await client+ .from("nonConformanceSupplier")+ .insert([+ {+ companyId: input.companyId,+ createdBy: input.createdBy,+ supplierId: operationSupplierProcess.data.supplierId,+ nonConformanceId: ncrId+ }+ ]);+ if (nonConformanceSupplierInsert.error) {+ console.error(nonConformanceSupplierInsert);+ }+ }+ }++ return {+ data: { id: ncrId, nonConformanceId: result.data.nonConformanceId },+ error: null+ };+}++export async function updateIssue(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ nonConformanceId?: string;+ name?: string;+ priority?: "Low" | "Medium" | "High" | "Critical";+ source?: "Internal" | "External";+ locationId?: string;+ nonConformanceTypeId?: string;+ nonConformanceWorkflowId?: string | null;+ openDate?: string;+ dueDate?: string | null;+ closeDate?: string | null;+ description?: string | null;+ quantity?: number | null;+ requiredActionIds?: string[];+ approvalRequirements?: string[];+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("nonConformance")+ .update(sanitize(rest))+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertIssue for new issues, updateIssue for existing issues */export async function upsertIssue(client: SupabaseClient<Database>,nonConformance:diff --git a/apps/erp/app/modules/resources/resources.service.ts b/apps/erp/app/modules/resources/resources.service.tsindex 49bb49d0c4..f3a9f1991a 100644--- a/apps/erp/app/modules/resources/resources.service.ts+++ b/apps/erp/app/modules/resources/resources.service.ts@@ -10,6 +10,8 @@ import type {maintenanceDispatchCommentValidator,maintenanceDispatchEventValidator,maintenanceDispatchItemValidator,+ maintenanceDispatchPriority,+ maintenanceDispatchStatus,maintenanceDispatchValidator,maintenanceDispatchWorkCenterValidator,maintenanceScheduleItemValidator,@@ -1287,6 +1289,127 @@ export async function upsertLocation(return client.from("location").insert([location]).select("*").single();}+export async function insertMaintenanceDispatch(+ client: SupabaseClient<Database>,+ input: {+ companyId: string;+ createdBy: string;+ maintenanceDispatchId?: string;+ status?: (typeof maintenanceDispatchStatus)[number];+ priority?: (typeof maintenanceDispatchPriority)[number];+ severity?:+ | "Preventive"+ | "Operator Performed"+ | "Support Required"+ | "OEM Required";+ source?: "Scheduled" | "Reactive" | "Non-Conformance";+ oeeImpact?: "Down" | "Planned" | "Impact" | "No Impact";+ workCenterId?: string;+ locationId: string;+ assignee?: string;+ suspectedFailureModeId?: string;+ plannedStartTime?: string;+ plannedEndTime?: string;+ content?: Json;+ }+): Promise<{+ data: { id: string; maintenanceDispatchId: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ let maintenanceDispatchId: string;+ if (input.maintenanceDispatchId) {+ maintenanceDispatchId = input.maintenanceDispatchId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "maintenanceDispatch",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate maintenanceDispatch sequence"+ } as import("@supabase/supabase-js").PostgrestError)+ };+ }+ maintenanceDispatchId = seq.data;+ }++ const dispatch = await client+ .from("maintenanceDispatch")+ .insert({+ maintenanceDispatchId,+ status: input.status ?? "Open",+ priority: input.priority ?? "Medium",+ severity: input.severity ?? "Support Required",+ source: input.source ?? "Reactive",+ oeeImpact: input.oeeImpact ?? "No Impact",+ workCenterId: input.workCenterId ?? null,+ locationId: input.locationId,+ assignee: input.assignee ?? null,+ suspectedFailureModeId: input.suspectedFailureModeId ?? null,+ plannedStartTime: input.plannedStartTime ?? null,+ plannedEndTime: input.plannedEndTime ?? null,+ content: input.content,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, maintenanceDispatchId")+ .single();++ if (dispatch.error) return { data: null, error: dispatch.error };++ return {+ data: {+ id: dispatch.data.id,+ maintenanceDispatchId: dispatch.data.maintenanceDispatchId+ },+ error: null+ };+}++export async function updateMaintenanceDispatch(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ status?: string;+ priority?: string;+ severity?: string;+ source?: string;+ oeeImpact?: string;+ workCenterId?: string | null;+ locationId?: string;+ assignee?: string | null;+ suspectedFailureModeId?: string | null;+ actualFailureModeId?: string | null;+ procedureId?: string | null;+ plannedStartTime?: string | null;+ plannedEndTime?: string | null;+ actualStartTime?: string | null;+ actualEndTime?: string | null;+ content?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: import("@supabase/supabase-js").PostgrestError | null;+}> {+ const { id, ...rest } = input;+ const result = await client+ .from("maintenanceDispatch")+ .update(sanitize(rest))+ .eq("id", id)+ .select("id")+ .single();++ if (result.error) return { data: null, error: result.error };+ return { data: { id: result.data.id }, error: null };+}++/** @deprecated Use insertMaintenanceDispatch for new dispatches, updateMaintenanceDispatch for existing dispatches */export async function upsertMaintenanceDispatch(client: SupabaseClient<Database>,dispatch:diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.tsindex 379751d63f..02965f56a1 100644--- a/apps/erp/app/modules/sales/sales.models.ts+++ b/apps/erp/app/modules/sales/sales.models.ts@@ -289,6 +289,7 @@ export const quoteStatusType = [export const quoteValidator = z.object({id: zfd.text(z.string().optional()),quoteId: zfd.text(z.string().optional()),+ name: zfd.text(z.string().optional()),salesPersonId: zfd.text(z.string().optional()),estimatorId: zfd.text(z.string().optional()),customerId: z.string().min(1, { message: "Customer is required" }),@@ -706,6 +707,7 @@ export const salesConfirmValidator = zexport const salesOrderValidator = z.object({id: zfd.text(z.string().optional()),salesOrderId: zfd.text(z.string().optional()),+ orderDate: zfd.text(z.string().optional()),requestedDate: zfd.text(z.string().optional()),promisedDate: zfd.text(z.string().optional()),status: z.enum(salesOrderStatusType).optional(),diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.tsindex 0ac26a37a6..3d26fb9005 100644--- a/apps/erp/app/modules/sales/sales.service.ts+++ b/apps/erp/app/modules/sales/sales.service.ts@@ -3305,6 +3305,256 @@ export async function upsertMakeMethodFromQuoteMethod(return { data: null, error: null };}+export async function insertQuote(+ client: SupabaseClient<Database>,+ input: {+ customerId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ quoteId?: string;+ locationId?: string;+ status?: (typeof quoteStatusType)[number];+ currencyCode?: string;+ expirationDate?: string;+ customerContactId?: string;+ customerLocationId?: string;+ customerEngineeringContactId?: string;+ customerReference?: string;+ salesPersonId?: string;+ estimatorId?: string;+ dueDate?: string;+ opportunityId?: string;+ notes?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; quoteId: string } | null;+ error: PostgrestError | null;+}> {+ let quoteId: string;+ if (input.quoteId) {+ quoteId = input.quoteId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "quote",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({ message: "Failed to generate quote sequence" } as PostgrestError)+ };+ }+ quoteId = seq.data;+ }++ let opportunityId = input.opportunityId;+ if (!opportunityId) {+ const opportunity = await client+ .from("opportunity")+ .insert({+ customerId: input.customerId,+ companyId: input.companyId+ })+ .select("id")+ .single();++ if (opportunity.error) return { data: null, error: opportunity.error };+ opportunityId = opportunity.data.id;+ }++ const [customerPayment, customerShipping, seller] = await Promise.all([+ getCustomerPayment(client, input.customerId),+ getCustomerShipping(client, input.customerId),+ getEmployeeJob(client, input.createdBy, input.companyId)+ ]);++ if (customerPayment.error)+ return { data: null, error: customerPayment.error };+ if (customerShipping.error)+ return { data: null, error: customerShipping.error };++ const {+ paymentTermId,+ invoiceCustomerId,+ invoiceCustomerContactId,+ invoiceCustomerLocationId+ } = customerPayment.data;+ const { shippingMethodId, shippingTermId, incoterm, incotermLocation } =+ customerShipping.data;++ let exchangeRate = 1;+ let exchangeRateUpdatedAt = new Date().toISOString();+ if (input.currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ input.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const locationId = input.locationId ?? seller?.data?.locationId ?? null;++ const quote = await client+ .from("quote")+ .insert({+ quoteId,+ customerId: input.customerId,+ customerContactId: input.customerContactId,+ customerLocationId: input.customerLocationId,+ customerEngineeringContactId: input.customerEngineeringContactId,+ customerReference: input.customerReference,+ salesPersonId: input.salesPersonId,+ estimatorId: input.estimatorId,+ dueDate: input.dueDate,+ opportunityId,+ status: input.status ?? "Draft",+ expirationDate: input.expirationDate,+ currencyCode: input.currencyCode,+ exchangeRate,+ exchangeRateUpdatedAt,+ locationId,+ internalNotes: input.notes,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, quoteId")+ .single();++ if (quote.error) return { data: null, error: quote.error };++ const createdQuoteId = quote.data.id;++ const [payment, shipment, externalLink] = await Promise.all([+ client.from("quotePayment").insert({+ id: createdQuoteId,+ paymentTermId,+ invoiceCustomerId,+ invoiceCustomerContactId,+ invoiceCustomerLocationId,+ companyId: input.companyId+ }),+ client.from("quoteShipment").insert({+ id: createdQuoteId,+ locationId,+ shippingMethodId,+ shippingTermId,+ incoterm,+ incotermLocation,+ companyId: input.companyId+ }),+ upsertExternalLink(client, {+ documentType: "Quote",+ documentId: createdQuoteId,+ customerId: input.customerId,+ expiresAt: input.expirationDate,+ companyId: input.companyId+ })+ ]);++ if (payment.error || shipment.error) {+ await deleteQuote(client, createdQuoteId);+ return { data: null, error: payment.error ?? shipment.error };+ }++ if (externalLink.data) {+ await client+ .from("quote")+ .update({ externalLinkId: externalLink.data.id })+ .eq("id", createdQuoteId);+ }++ return { data: { id: createdQuoteId, quoteId }, error: null };+}++export async function updateQuote(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ status?: (typeof quoteStatusType)[number];+ currencyCode?: string;+ expirationDate?: string | null;+ customerContactId?: string | null;+ customerLocationId?: string | null;+ customerEngineeringContactId?: string | null;+ customerReference?: string | null;+ customerId?: string;+ salesPersonId?: string | null;+ estimatorId?: string | null;+ locationId?: string;+ dueDate?: string | null;+ digitalQuoteAcceptedBy?: string | null;+ digitalQuoteAcceptedByEmail?: string | null;+ notes?: string | null;+ customFields?: Json;+ },+ companyGroupId?: string+): Promise<{+ data: { id: string } | null;+ error: PostgrestError | null;+}> {+ const { id, updatedBy, notes, ...updates } = input;++ let exchangeRate: number | undefined;+ let exchangeRateUpdatedAt: string | undefined;++ const existing = await client+ .from("quote")+ .select("currencyCode, opportunityId")+ .eq("id", id)+ .single();++ if (existing.error) return { data: null, error: existing.error };++ if (+ updates.currencyCode &&+ companyGroupId &&+ existing.data.currencyCode !== updates.currencyCode+ ) {+ const currency = await getCurrencyByCode(+ client,+ companyGroupId,+ updates.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ if (updates.customerId && existing.data.opportunityId) {+ await client+ .from("opportunity")+ .update({ customerId: updates.customerId })+ .eq("id", existing.data.opportunityId);+ }++ return client+ .from("quote")+ .update({+ ...sanitize(updates),+ ...(exchangeRate !== undefined && { exchangeRate }),+ ...(exchangeRateUpdatedAt && { exchangeRateUpdatedAt }),+ ...(notes !== undefined && { internalNotes: notes }),+ updatedBy,+ updatedAt: today(getLocalTimeZone()).toString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertQuote for new quotes, updateQuote for existing quotes */export async function upsertQuote(client: SupabaseClient<Database>,quote:@@ -4650,6 +4900,241 @@ export async function updateSalesOrderStatus(return client.from("salesOrder").update(updateData).eq("id", update.id);}+export async function insertSalesOrder(+ client: SupabaseClient<Database>,+ input: {+ customerId: string;+ companyId: string;+ companyGroupId: string;+ createdBy: string;+ salesOrderId?: string;+ locationId?: string;+ status?: (typeof salesOrderStatusType)[number];+ currencyCode?: string;+ orderDate?: string;+ customerContactId?: string;+ customerLocationId?: string;+ quoteId?: string;+ opportunityId?: string;+ requestedDate?: string;+ promisedDate?: string;+ notes?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; salesOrderId: string } | null;+ error: PostgrestError | null;+}> {+ let salesOrderId: string;+ if (input.salesOrderId) {+ salesOrderId = input.salesOrderId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "salesOrder",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({ message: "Failed to generate SO sequence" } as PostgrestError)+ };+ }+ salesOrderId = seq.data;+ }++ let opportunityId = input.opportunityId;+ if (!opportunityId) {+ const opportunity = await client+ .from("opportunity")+ .insert({+ customerId: input.customerId,+ companyId: input.companyId+ })+ .select("id")+ .single();++ if (opportunity.error) return { data: null, error: opportunity.error };+ opportunityId = opportunity.data.id;+ }++ const [customerPayment, customerShipping, seller] = await Promise.all([+ getCustomerPayment(client, input.customerId),+ getCustomerShipping(client, input.customerId),+ getEmployeeJob(client, input.createdBy, input.companyId)+ ]);++ if (customerPayment.error)+ return { data: null, error: customerPayment.error };+ if (customerShipping.error)+ return { data: null, error: customerShipping.error };++ const {+ paymentTermId,+ invoiceCustomerId,+ invoiceCustomerContactId,+ invoiceCustomerLocationId+ } = customerPayment.data;++ const { shippingMethodId, shippingTermId, incoterm, incotermLocation } =+ customerShipping.data;++ // Look up the base currency if none was provided+ let currencyCode = input.currencyCode;+ if (!currencyCode) {+ const companyResult = await client+ .from("company")+ .select("baseCurrencyCode")+ .eq("id", input.companyId)+ .single();+ currencyCode = companyResult.data?.baseCurrencyCode ?? "USD";+ }++ let exchangeRate = 1;+ let exchangeRateUpdatedAt = new Date().toISOString();+ if (currencyCode) {+ const currency = await getCurrencyByCode(+ client,+ input.companyGroupId,+ currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ const locationId = input.locationId ?? seller?.data?.locationId ?? null;++ const order = await client+ .from("salesOrder")+ .insert({+ salesOrderId,+ customerId: input.customerId,+ customerContactId: input.customerContactId,+ customerLocationId: input.customerLocationId,+ opportunityId,+ status: input.status ?? "Draft",+ orderDate: input.orderDate ?? new Date().toISOString().split("T")[0],+ currencyCode,+ exchangeRate,+ exchangeRateUpdatedAt,+ locationId,+ internalNotes: input.notes ?? null,+ customFields: input.customFields,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, salesOrderId")+ .single();++ if (order.error) return { data: null, error: order.error };++ const orderId = order.data.id;++ const [shipment, payment] = await Promise.all([+ client.from("salesOrderShipment").insert({+ id: orderId,+ locationId,+ receiptRequestedDate: input.requestedDate ?? null,+ receiptPromisedDate: input.promisedDate ?? null,+ shippingMethodId,+ shippingTermId,+ incoterm,+ incotermLocation,+ companyId: input.companyId+ }),+ client.from("salesOrderPayment").insert({+ id: orderId,+ paymentTermId,+ invoiceCustomerId: invoiceCustomerId ?? input.customerId,+ invoiceCustomerContactId,+ invoiceCustomerLocationId,+ companyId: input.companyId+ })+ ]);++ if (shipment.error || payment.error) {+ await deleteSalesOrder(client, orderId);+ return { data: null, error: shipment.error ?? payment.error };+ }++ return { data: { id: orderId, salesOrderId }, error: null };+}++export async function updateSalesOrder(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ status?: (typeof salesOrderStatusType)[number];+ currencyCode?: string;+ orderDate?: string;+ customerContactId?: string | null;+ customerLocationId?: string | null;+ customerId?: string;+ notes?: string | null;+ customFields?: Json;+ },+ companyGroupId?: string+): Promise<{+ data: { id: string } | null;+ error: PostgrestError | null;+}> {+ const { id, updatedBy, notes, ...updates } = input;++ let exchangeRate: number | undefined;+ let exchangeRateUpdatedAt: string | undefined;++ const existing = await client+ .from("salesOrder")+ .select("currencyCode, opportunityId")+ .eq("id", id)+ .single();++ if (existing.error) return { data: null, error: existing.error };++ if (+ updates.currencyCode &&+ companyGroupId &&+ existing.data.currencyCode !== updates.currencyCode+ ) {+ const currency = await getCurrencyByCode(+ client,+ companyGroupId,+ updates.currencyCode+ );+ if (currency.data) {+ exchangeRate = currency.data.exchangeRate ?? 1;+ exchangeRateUpdatedAt = new Date().toISOString();+ }+ }++ if (updates.customerId && existing.data.opportunityId) {+ await client+ .from("opportunity")+ .update({ customerId: updates.customerId })+ .eq("id", existing.data.opportunityId);+ }++ return client+ .from("salesOrder")+ .update({+ ...sanitize(updates),+ ...(exchangeRate !== undefined && { exchangeRate }),+ ...(exchangeRateUpdatedAt && { exchangeRateUpdatedAt }),+ ...(notes !== undefined && { internalNotes: notes }),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertSalesOrder for new orders, updateSalesOrder for existing orders */export async function upsertSalesOrder(client: SupabaseClient<Database>,salesOrder:@@ -4946,6 +5431,139 @@ export async function upsertSalesOrderPayment(.single();}+export async function insertSalesRFQ(+ client: SupabaseClient<Database>,+ input: {+ customerId: string;+ companyId: string;+ createdBy: string;+ rfqId?: string;+ rfqDate?: string;+ expirationDate?: string;+ locationId?: string;+ salesPersonId?: string;+ customerContactId?: string;+ customerReference?: string;+ status?: "Draft" | "Ready for Quote" | "Quoted" | "Closed";+ notes?: string;+ customFields?: Json;+ }+): Promise<{+ data: { id: string; rfqId: string } | null;+ error: PostgrestError | null;+}> {+ let rfqId: string;+ if (input.rfqId) {+ rfqId = input.rfqId;+ } else {+ const seq = await client.rpc("get_next_sequence", {+ sequence_name: "salesRfq",+ company_id: input.companyId+ });+ if (seq.error || !seq.data) {+ return {+ data: null,+ error:+ seq.error ??+ ({+ message: "Failed to generate salesRfq sequence"+ } as PostgrestError)+ };+ }+ rfqId = seq.data;+ }++ const opportunity = await client+ .from("opportunity")+ .insert({+ companyId: input.companyId,+ customerId: input.customerId+ })+ .select("id")+ .single();++ if (opportunity.error) return { data: null, error: opportunity.error };++ const rfq = await client+ .from("salesRfq")+ .insert({+ rfqId,+ customerId: input.customerId,+ customerContactId: input.customerContactId,+ customerReference: input.customerReference,+ rfqDate: input.rfqDate ?? today(getLocalTimeZone()).toString(),+ expirationDate: input.expirationDate,+ locationId: input.locationId,+ salesPersonId: input.salesPersonId,+ status: input.status ?? "Draft",+ internalNotes: input.notes ?? null,+ customFields: input.customFields,+ opportunityId: opportunity.data.id,+ companyId: input.companyId,+ createdBy: input.createdBy,+ updatedBy: input.createdBy+ })+ .select("id, rfqId")+ .single();++ if (rfq.error) return { data: null, error: rfq.error };++ return { data: { id: rfq.data.id, rfqId: rfq.data.rfqId }, error: null };+}++export async function updateSalesRFQ(+ client: SupabaseClient<Database>,+ input: {+ id: string;+ updatedBy: string;+ customerId?: string;+ customerContactId?: string | null;+ customerReference?: string | null;+ rfqDate?: string;+ expirationDate?: string | null;+ locationId?: string;+ salesPersonId?: string | null;+ status?: "Draft" | "Ready for Quote" | "Quoted" | "Closed";+ notes?: string | null;+ customFields?: Json;+ }+): Promise<{+ data: { id: string } | null;+ error: PostgrestError | null;+}> {+ const { id, updatedBy, customerId, notes, ...updates } = input;++ // If customerId is being updated, also update the opportunity's customerId+ if (customerId) {+ const existingRfq = await client+ .from("salesRfq")+ .select("opportunityId")+ .eq("id", id)+ .single();++ if (existingRfq.data?.opportunityId) {+ await client+ .from("opportunity")+ .update({ customerId })+ .eq("id", existingRfq.data.opportunityId);+ }+ }++ return client+ .from("salesRfq")+ .update({+ ...sanitize(updates),+ ...(customerId && { customerId }),+ ...(notes !== undefined && { internalNotes: notes }),+ updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", id)+ .select("id")+ .single();+}++/** @deprecated Use insertSalesRFQ for new RFQs, updateSalesRFQ for existing RFQs */export async function upsertSalesRFQ(client: SupabaseClient<Database>,rfq:diff --git a/apps/erp/app/routes/[.]well-known.oauth-authorization-server.ts b/apps/erp/app/routes/[.]well-known.oauth-authorization-server.tsnew file mode 100644index 0000000000..5853c7724a--- /dev/null+++ b/apps/erp/app/routes/[.]well-known.oauth-authorization-server.ts@@ -0,0 +1,30 @@+import { VERCEL_URL } from "@carbon/auth";+import type { LoaderFunctionArgs } from "react-router";++export async function loader({ request }: LoaderFunctionArgs) {+ const url = new URL(request.url);+ const issuer = VERCEL_URL || url.origin;++ const metadata = {+ issuer,+ authorization_endpoint: `${issuer}/oauth/authorize`,+ token_endpoint: `${issuer}/oauth/token`,+ registration_endpoint: `${issuer}/oauth/register`,+ token_endpoint_auth_methods_supported: ["client_secret_post", "none"],+ grant_types_supported: ["authorization_code", "refresh_token"],+ response_types_supported: ["code"],+ code_challenge_methods_supported: ["S256"],+ scopes_supported: ["mcp:tools"],+ service_documentation: `${issuer}/docs/api`+ };++ return new Response(JSON.stringify(metadata), {+ status: 200,+ headers: {+ "Content-Type": "application/json",+ "Access-Control-Allow-Origin": "*",+ "Access-Control-Allow-Methods": "GET, OPTIONS",+ "Cache-Control": "public, max-age=3600"+ }+ });+}diff --git a/apps/erp/app/routes/api+/ai+/chat+/_index.ts b/apps/erp/app/routes/api+/ai+/chat+/_index.tsdeleted file mode 100644index 9a97d53517..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/_index.ts+++ /dev/null@@ -1,55 +0,0 @@-import { requirePermissions } from "@carbon/auth/auth.server";-import { smoothStream } from "ai";-import type { ActionFunctionArgs } from "react-router";-import { orchestrationAgent } from "./agents/orchestration-agent";-import { createChatContext } from "./agents/shared/context";--export async function action({ request }: ActionFunctionArgs) {- const { client, userId, companyId, companyGroupId } =- await requirePermissions(request, {});-- const payload = await request.json();-- const {- message,- id,- timezone,- locale,- agentChoice,- toolChoice,- country,- city,- fullName,- companyName,- baseCurrency- } = payload;-- const context = createChatContext({- userId,- companyId,- companyGroupId,- client,- fullName,- companyName,- country,- city,- chatId: id,- timezone,- locale,- baseCurrency- });-- return orchestrationAgent.toUIMessageStream({- message,- context,- agentChoice,- toolChoice,- strategy: "auto",- maxRounds: 5,- maxSteps: 20,- experimental_transform: smoothStream({- chunking: "word"- }),- sendSources: true- });-}diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/config.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/config.tsdeleted file mode 100644index 5f7d78da8f..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/config.ts+++ /dev/null@@ -1,19 +0,0 @@-import type { AgentConfig } from "./shared/tools";--// Dynamically import all agent configs-const agentModules = import.meta.glob("./*-agent.ts", {- eager: true-}) as Record<string, { config: AgentConfig }>;--// Export agent configs as a record keyed by agent name-export const agentConfigs: Record<string, AgentConfig> = Object.values(- agentModules-).reduce(- (acc, module) => {- if (module.config) {- acc[module.config.name] = module.config;- }- return acc;- },- {} as Record<string, AgentConfig>-);diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/orchestration-agent.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/orchestration-agent.tsdeleted file mode 100644index dfc140b314..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/orchestration-agent.ts+++ /dev/null@@ -1,39 +0,0 @@-import { openai } from "@ai-sdk/openai";-import { purchasingAgent } from "./purchasing-agent";-import { searchAgent } from "./search-agent";-import { createAgent } from "./shared/agent";-import { formatContextForLLM } from "./shared/prompts";-import type { AgentConfig } from "./shared/tools";--export const config: AgentConfig = {- name: "triage",- displayName: "Triage Agent",- description: "Routes user requests to the appropriate specialist",- executingMessage: "Thinking..."-};--export const orchestrationAgent = createAgent({- name: "triage",- model: openai("gpt-4o"),- temperature: 0.1,- modelSettings: {- toolChoice: {- type: "tool",- toolName: "handoff_to_agent"- }- },- instructions: (ctx) => `Route user requests to the appropriate specialist.--<background-data>-${formatContextForLLM(ctx)}--<agent-capabilities>-general: General questions, greetings, web search-parts: Search for parts by description or readable ID-suppliers: Search for suppliers, find suppliers for parts-purchasing: creating purchase orders or getting quotes from suppliers-</agent-capabilities>-</background-data>`,- handoffs: [purchasingAgent, searchAgent],- maxTurns: 1-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.tsdeleted file mode 100644index 1e57db5b29..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/purchasing-agent.ts+++ /dev/null@@ -1,75 +0,0 @@-import { openai } from "@ai-sdk/openai";-import { createPurchaseOrderTool } from "../tools/create-purchase-order.server";-import { getPartTool } from "../tools/get-part";-import { getSupplierTool } from "../tools/get-supplier";-import { getSupplierForPartsTool } from "../tools/get-supplier-for-parts";-import { createAgent } from "./shared/agent";-import { COMMON_AGENT_RULES, formatContextForLLM } from "./shared/prompts";-import type { AgentConfig } from "./shared/tools";--export const config: AgentConfig = {- name: "purchasing",- displayName: "Purchasing Agent",- description: "Creates purchase orders and gets quotes from suppliers",- executingMessage: "Calling the purchasing agent..."-};--export const purchasingAgent = createAgent({- name: "purchasing",- model: openai("gpt-4o"),- temperature: 0.3,- instructions: (ctx) => `You are a purchasing specialist for ${- ctx.companyName- }. Create purchase orders or get quotes from suppliers.---When handling purchase order requests:-1. First identify the part details (including quantities and measurements)-2. Use getPart to look up the part ID-3. If no supplier is explicitly specified in the prompt:- - Use getSupplierForParts to get recommended suppliers- - Ask the user to confirm which supplier they want to use-4. Only proceed with createPurchaseOrder when both part and supplier are confirmed-5. If there are multiple options for a part or supplier, ask the user to confirm which one they want to use-6. If there are no options, ask the user for clarification--For example:-- If user says "create a purchase order for 5lb of 1/4" steel":- 1. First look up the part ID for "1/4" steel"- 2. Then ask user to specify a supplier, potentially offering suggestions- 3. Only create the PO once supplier is confirmed--- If user says "create a purchase order for 5lb of 1/4" steel from MetalCorp":- 1. Look up part ID for "1/4" steel"- 2. Look up supplier ID for "MetalCorp"- 3. Create the PO with both IDs---Key capabilities:-- Create and update purchase orders-- Search for suppliers and parts-- Suggest suppliers for parts-- Search for existing purchase orders-- Search for open purchase orders-- Search for purchase order history--<background-data>-${formatContextForLLM(ctx)}-</background-data>--${COMMON_AGENT_RULES}--<guidelines>-- For direct queries: lead with results, add context-- ALWAYS use the actual IDs when passing part IDs to tools.-- ALWAYS show the readable ID when showing part details to the user.-</guidelines>`,- tools: {- getPart: getPartTool,- getSupplierForParts: getSupplierForPartsTool,- getSupplier: getSupplierTool,- createPurchaseOrder: createPurchaseOrderTool- },- handoffs: [],- maxTurns: 10-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/search-agent.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/search-agent.tsdeleted file mode 100644index 6f98270269..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/search-agent.ts+++ /dev/null@@ -1,39 +0,0 @@-import { openai } from "@ai-sdk/openai";-import { webSearchTool } from "../tools/web-search";-import { purchasingAgent } from "./purchasing-agent";-import { createAgent } from "./shared/agent";-import { COMMON_AGENT_RULES, formatContextForLLM } from "./shared/prompts";-import type { AgentConfig } from "./shared/tools";--export const config: AgentConfig = {- name: "general",- displayName: "General Agent",- description: "Handles general questions and web searches",- executingMessage: "Searching the web..."-};--export const searchAgent = createAgent({- name: "general",- model: openai("gpt-4o"),- temperature: 0.8,- instructions: (ctx) => `You are a helpful assistant for ${- ctx.companyName- }. Handle general questions and web searches.--<background-data>-${formatContextForLLM(ctx)}-</background-data>--${COMMON_AGENT_RULES}--<capabilities>-- Answer simple questions directly-- Use webSearch for current information, news, external data-- Route to specialists for business-specific data-</capabilities>`,- tools: {- webSearch: webSearchTool- },- handoffs: [purchasingAgent],- maxTurns: 5-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/agent.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/shared/agent.tsdeleted file mode 100644index dd77ed42d6..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/agent.ts+++ /dev/null@@ -1,43 +0,0 @@-import { openai } from "@ai-sdk/openai";-import type { AgentConfig } from "@ai-sdk-tools/agents";-import { Agent } from "@ai-sdk-tools/agents";-import { RedisProvider } from "@ai-sdk-tools/memory/redis";-import { redis } from "@carbon/kv";-import type { ChatContext } from "./context";-import { PROFILE_PROMPT, SUGGESTION_PROMPT, TITLE_PROMPT } from "./prompts";--export const memoryProvider = new RedisProvider(redis);--export const createAgent = (config: AgentConfig<ChatContext>) => {- return new Agent({- modelSettings: {- parallel_tool_calls: true- },- ...config,- memory: {- provider: memoryProvider,- history: {- enabled: true,- limit: 10- },- workingMemory: {- enabled: false, // Disabled to prevent multiple system messages in multi-agent handoffs- template: PROFILE_PROMPT,- scope: "user"- },- chats: {- enabled: true,- generateTitle: {- model: openai("gpt-4.1-nano"),- instructions: TITLE_PROMPT- },- generateSuggestions: {- enabled: true,- model: openai("gpt-4.1-nano"),- limit: 5,- instructions: SUGGESTION_PROMPT- }- }- }- });-};diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/context.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/shared/context.tsdeleted file mode 100644index f80551ed88..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/context.ts+++ /dev/null@@ -1,52 +0,0 @@-import type { Database } from "@carbon/database";-import type { SupabaseClient } from "@supabase/supabase-js";--export interface ChatContext {- client: SupabaseClient<Database>;- userId: string;- companyId: string;- companyGroupId: string;- fullName: string;- companyName: string;- baseCurrency: string;- locale: string;- currentDateTime: string;- country?: string;- city?: string;- timezone: string;- chatId: string;- // Allow additional properties to satisfy Record<string, unknown> constraint- [key: string]: unknown;-}--export function createChatContext(params: {- userId: string;- companyId: string;- companyGroupId: string;- client: SupabaseClient<Database>;- fullName: string;- companyName: string;- country?: string;- city?: string;- chatId: string;- baseCurrency?: string;- locale?: string;- timezone?: string;-}) {- return {- userId: params.userId,- companyId: params.companyId,- companyGroupId: params.companyGroupId,- client: params.client,- fullName: params.fullName,- companyName: params.companyName,- country: params.country,- city: params.city,- chatId: params.chatId,- baseCurrency: params.baseCurrency || "USD",- locale: params.locale || "en-US",- currentDateTime: new Date().toISOString(),- timezone:- params.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone- };-}diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/prompts.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/shared/prompts.tsdeleted file mode 100644index 600ea4af6d..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/prompts.ts+++ /dev/null@@ -1,104 +0,0 @@-import type { ChatContext } from "./context";--export const PROFILE_PROMPT = `<user_profile>-Name: [Learn from conversation]-Role: [CFO, purchasing, production manager, salesman, etc.]-</user_profile>--<financial_focus>-Key Metrics: [Revenue, purchase orders, lead time, on time deliveries, etc.]-Recent Concerns: [Outstanding accounts payable]-</financial_focus>--<business_context>-Industry: [If mentioned]-Company Size: [SMB, startup, mid-market, public company]-</business_context>--<communication_preferences>-Style: [Formal vs casual, technical vs simplified]-Tone: [Professional, friendly, analytical, etc.]-</communication_preferences>`;--export const TITLE_PROMPT = `Generate a concise title that reflects the user's main focus.--- Identify the core subject or objective, not the specific question - Use descriptive phrases (e.g., "Budget Travel Tips" not "How to Travel on a Budget") Use title case (capitalize all principal words) - Exclude periods unless for abbreviations - Apply appropriate abbreviations (FYI, ASAP, etc.) Create a title for the discussion. Only return the title. Maximum 60 characters.`;--export const SUGGESTION_PROMPT = `<instructions>-Generate 5 brief follow-up suggestions (2-3 words each, max 5 words).--<suggestion_guidelines>-After showing data/metrics:-- Compare periods or categories-- Show related metrics-- Visualize trends (charts/graphs)-- Drill into details-- Analyze patterns--After analysis/reports:-- Check underlying data-- Create visualizations-- Compare benchmarks-- Explore segments--After lists/tables:-- Filter or sort-- Show details-- Visualize distribution-- Analyze patterns-</suggestion_guidelines>--<visualization_support>-When data would benefit from visual representation, suggest creating artifacts:-- "Visualize trends" → Line chart of time series-- "Chart distribution" → Bar/pie chart-- "Graph comparison" → Multi-series chart-- "Plot forecast" → Projection visualization-</visualization_support>--<examples>-<example>-After showing purchase orders:-"Compare suppliers", "Show lead times", "Chart volumes", "Analyze delays", "Track deliveries"-</example>--<example>-After displaying inventory levels:-"Show turnover", "Chart movements", "Compare locations", "Analyze shortages", "Plot forecasts"-</example>--<example>-After presenting financial metrics:-"Compare periods", "Show cash flow", "Analyze ratios", "Chart performance", "Track budgets"-</example>-</examples>--<rules>-What NOT to suggest:-- "Tell me more" (too generic)-- "What else can you do?" (not contextual)-- Repeating what was just shown-</rules>-</instructions>`;--export function formatContextForLLM(context: ChatContext): string {- return `<company_info>-<current_date>${context.currentDateTime}</current_date>-<timezone>${context.timezone}</timezone>-<company_name>${context.companyName}</company_name>-<base_currency>${context.baseCurrency}</base_currency>-<locale>${context.locale}</locale>-</company_info>--Important: Use the current date/time above for time-sensitive operations. User-specific information is maintained in your working memory.`;-}--export const COMMON_AGENT_RULES = `<behavior_rules>-- Call tools immediately without explanatory text-- Use parallel tool calls when possible-- Provide specific numbers and actionable insights-- Explain your reasoning-- Lead with the most important information first-- When presenting repeated structured data (lists of items, multiple entries, time series), always use markdown tables-- Tables make data scannable and easier to compare - use them for any data with 2+ rows-</behavior_rules>`;diff --git a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/tools.ts b/apps/erp/app/routes/api+/ai+/chat+/agents/shared/tools.tsdeleted file mode 100644index b3d804a485..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/agents/shared/tools.ts+++ /dev/null@@ -1,15 +0,0 @@-import type { IconType } from "react-icons";--export interface ToolConfig {- name: string;- icon: IconType;- displayText: string;- message: string;-}--export interface AgentConfig {- name: string;- displayName: string;- description: string;- executingMessage: string;-}diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/config.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/config.tsdeleted file mode 100644index ec03bfabb3..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/config.ts+++ /dev/null@@ -1,28 +0,0 @@-import type { ToolConfig } from "../agents/shared/tools";--// Dynamically import all tool configs from sibling files-// Exclude config.ts itself to avoid circular imports-const toolModules = import.meta.glob(["./*.ts", "!./*.server.ts"], {- eager: true-}) as Record<string, { config: ToolConfig }>;--// Create the config object from imported tool modules-export const toolConfigs: Record<- string,- Pick<ToolConfig, "icon" | "displayText" | "message">-> = Object.entries(toolModules).reduce(- (acc, [path, module]) => {- // Skip config.ts itself to avoid circular imports- if (path.includes("config.ts")) return acc;-- if (module.config) {- acc[module.config.name] = {- icon: module.config.icon,- displayText: module.config.displayText,- message: module.config.message- };- }- return acc;- },- {} as Record<string, Pick<ToolConfig, "icon" | "displayText" | "message">>-);diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.server.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.server.tsdeleted file mode 100644index edbe47a088..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.server.ts+++ /dev/null@@ -1,244 +0,0 @@-import { getAppUrl } from "@carbon/auth";-import { getCarbonServiceRole } from "@carbon/auth/client.server";-import { tool } from "ai";-import { getCurrencyByCode } from "~/modules/accounting/accounting.service";-import { getEmployeeJob } from "~/modules/people/people.service";-import {- deletePurchaseOrder,- getSupplier as getSupplierById,- getSupplierPayment,- getSupplierShipping,- insertSupplierInteraction-} from "~/modules/purchasing/purchasing.service";-import { getNextSequence } from "~/modules/settings";-import { path } from "~/utils/path";-import type { ChatContext } from "../agents/shared/context";-import { createPurchaseOrderSchema } from "./create-purchase-order";--export const createPurchaseOrderTool = tool({- description: "Create a purchase order from a list of parts and a supplier",- inputSchema: createPurchaseOrderSchema,- execute: async function (args, executionOptions) {- const context = executionOptions.experimental_context as ChatContext;-- console.log(- "[createPurchaseOrderTool] Starting purchase order creation with args:",- args- );-- const [- nextSequence,- supplierInteraction,- supplier,- supplierPayment,- supplierShipping,- employeeJob- ] = await Promise.all([- getNextSequence(- getCarbonServiceRole(),- "purchaseOrder",- context.companyId- ),- insertSupplierInteraction(- context.client,- context.companyId,- args.supplierId- ),- getSupplierById(context.client, args.supplierId),- getSupplierPayment(context.client, args.supplierId),- getSupplierShipping(context.client, args.supplierId),- getEmployeeJob(context.client, context.userId, context.companyId)- ]);-- if (!supplierInteraction.data) {- return {- error: "Failed to create supplier interaction"- };- }-- if (!supplier.data) {- return {- error: "Supplier not found"- };- }- if (!supplierPayment.data) {- return {- error: "Supplier payment not found"- };- }- if (!supplierShipping.data) {- return {- error: "Supplier shipping not found"- };- }-- const purchaseOrder = {- purchaseOrderId: nextSequence.data ?? "",- supplierId: args.supplierId,- supplierInteractionId: supplierInteraction.data?.id ?? null,- exchangeRate: 1,- exchangeRateUpdatedAt: new Date().toISOString(),- companyId: context.companyId,- createdBy: context.userId- };-- const {- paymentTermId,- invoiceSupplierId,- invoiceSupplierContactId,- invoiceSupplierLocationId- } = supplierPayment.data;-- const { shippingMethodId, shippingTermId } = supplierShipping.data;-- if (supplier.data?.currencyCode) {- const currency = await getCurrencyByCode(- context.client,- context.companyGroupId,- supplier.data?.currencyCode ?? ""- );- if (currency.data) {- purchaseOrder.exchangeRate = currency.data.exchangeRate ?? 1;- purchaseOrder.exchangeRateUpdatedAt = new Date().toISOString();- }- }-- const order = await context.client- .from("purchaseOrder")- .insert(purchaseOrder)- .select("id, purchaseOrderId");-- if (!order) {- return {- error: "Failed to create purchase order"- };- }-- const purchaseOrderId = order.data?.[0]?.id ?? "";- const locationId = employeeJob.data?.locationId ?? null;-- if (!purchaseOrderId) {- return {- error: "Failed to create purchase order"- };- }-- try {- await Promise.all([- context.client- .from("purchaseOrderDelivery")- .insert({- id: purchaseOrderId,- locationId: locationId,- shippingMethodId: shippingMethodId ?? null,- shippingTermId: shippingTermId ?? null,- companyId: context.companyId- })- .select("id")- .single(),- context.client- .from("purchaseOrderPayment")- .insert({- id: purchaseOrderId,- invoiceSupplierId: invoiceSupplierId,- invoiceSupplierContactId: invoiceSupplierContactId,- invoiceSupplierLocationId: invoiceSupplierLocationId,- paymentTermId: paymentTermId,- companyId: context.companyId- })- .select("id")- .single()- ]);-- // Create purchase order lines for each part- await Promise.all(- args.parts.map(async (part: { partId: string; quantity: number }) => {- // Get item details- const [item, supplierPart] = await Promise.all([- context.client- .from("item")- .select("*")- .eq("id", part.partId)- .eq("companyId", context.companyId)- .single(),- context.client- .from("supplierPart")- .select("*")- .eq("itemId", part.partId)- .eq("companyId", context.companyId)- .eq("supplierId", args.supplierId)- .single()- ]);-- if (!item.data) {- throw new Error(`Item with ID ${part.partId} not found`);- }-- // Get item cost and replenishment info- const [itemCost, itemReplenishment] = await Promise.all([- context.client- .from("itemCost")- .select("*")- .eq("itemId", part.partId)- .eq("companyId", context.companyId)- .single(),- context.client- .from("itemReplenishment")- .select("*")- .eq("itemId", part.partId)- .eq("companyId", context.companyId)- .single()- ]);-- const lineData = {- purchaseOrderId: purchaseOrderId,- itemId: part.partId,- description: item.data?.name,- purchaseOrderLineType: item.data?.type,- purchaseQuantity: part.quantity,- supplierUnitPrice:- (supplierPart?.data?.unitPrice ?? itemCost?.data?.unitCost ?? 0) /- purchaseOrder.exchangeRate,- supplierShippingCost: 0,- purchaseUnitOfMeasureCode:- supplierPart?.data?.supplierUnitOfMeasureCode ??- itemReplenishment?.data?.purchasingUnitOfMeasureCode ??- item.data?.unitOfMeasureCode ??- "EA",- inventoryUnitOfMeasureCode: item.data?.unitOfMeasureCode ?? "EA",- conversionFactor:- supplierPart?.data?.conversionFactor ??- itemReplenishment?.data?.conversionFactor ??- 1,- locationId: locationId,- storageUnitId: null,- supplierTaxAmount: 0,- companyId: context.companyId,- createdBy: context.userId- };-- // Create the purchase order line- return context.client- .from("purchaseOrderLine")- .insert(lineData)- .select("id")- .single();- })- );-- return {- ...order.data,- link: `${getAppUrl()}${path.to.purchaseOrder(purchaseOrderId)}`- };- } catch (error) {- if (purchaseOrderId) {- await deletePurchaseOrder(context.client, purchaseOrderId);- }- return {- error: `Failed to create purchase order details: ${- error instanceof Error ? error.message : String(error)- }`- };- }- }-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.tsdeleted file mode 100644index ca50a3ee1e..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/create-purchase-order.ts+++ /dev/null@@ -1,20 +0,0 @@-import { LuShoppingCart } from "react-icons/lu";-import { z } from "zod";-import type { ToolConfig } from "../agents/shared/tools";--export const config: ToolConfig = {- name: "createPurchaseOrder",- icon: LuShoppingCart,- displayText: "Creating a Purchase Order",- message: "Creating a purchase order..."-};--export const createPurchaseOrderSchema = z.object({- supplierId: z.string(),- parts: z.array(- z.object({- partId: z.string(),- quantity: z.number().positive().default(1)- })- )-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/get-part.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/get-part.tsdeleted file mode 100644index fc64da7761..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/get-part.ts+++ /dev/null@@ -1,130 +0,0 @@-import { tool } from "ai";-import { LuSearch } from "react-icons/lu";-import { z } from "zod";-import { generateEmbedding } from "~/modules/shared/shared.service";-import type { ChatContext } from "../agents/shared/context";-import type { ToolConfig } from "../agents/shared/tools";--export const config: ToolConfig = {- name: "getPart",- icon: LuSearch,- displayText: "Getting Part",- message: "Searching for a part..."-};--export const getPartSchema = z- .object({- readableId: z.string().optional(),- description: z.string().optional()- })- .refine((data) => data.readableId || data.description, {- message: "Either readableId or description must be provided"- });--export const getPartTool = tool({- description: "Search for a part by description or readable id",- inputSchema: getPartSchema,- execute: async function (args, executionOptions) {- const context = executionOptions.experimental_context as ChatContext;- let { readableId, description } = args;-- console.log("[getPartTool] args:", JSON.stringify(args));- console.log("[getPartTool] companyId:", context.companyId);-- if (readableId) {- console.log("[getPartTool] searching by readableId:", readableId);- const [part, supplierPart] = await Promise.all([- context.client- .from("item")- .select("id, name, description, revision")- .or(- `readableId.eq.${readableId},readableIdWithRevision.eq.${readableId}`- )- .eq("companyId", context.companyId)- .order("revision", { ascending: false })- .limit(1),- context.client- .from("supplierPart")- .select("*, item(id, name, description, revision)")- .eq("supplierPartId", readableId)- .eq("companyId", context.companyId)- .single()- ]);-- console.log(- "[getPartTool] item query result:",- JSON.stringify({ data: part.data, error: part.error })- );- console.log(- "[getPartTool] supplierPart query result:",- JSON.stringify({ data: supplierPart.data, error: supplierPart.error })- );-- if (supplierPart.data) {- console.log("[getPartTool] returning supplierPart match");- return {- id: supplierPart.data.itemId,- name: supplierPart.data.item?.name,- description: supplierPart.data.item?.description,- supplierId: supplierPart.data.supplierId- };- }- if (part.data?.[0]) {- console.log("[getPartTool] returning item match");- return {- id: part.data[0].id,- name: part.data[0].name,- description: part.data[0].description- };- }-- if (!description) {- console.log(- "[getPartTool] no direct match found, falling through to embedding search with readableId as description"- );- description = readableId;- } else {- console.log(- "[getPartTool] no direct match found for readableId, returning null"- );- return null;- }- }-- if (description) {- console.log(- "[getPartTool] searching by embedding for description:",- description- );- const embedding = await generateEmbedding(context.client, description);- console.log(- "[getPartTool] embedding generated, length:",- embedding?.length- );-- const search = await context.client.rpc("items_search", {- query_embedding: JSON.stringify(embedding),- match_threshold: 0.7,- match_count: 10,- p_company_id: context.companyId- });-- console.log(- "[getPartTool] embedding search result:",- JSON.stringify({ data: search.data, error: search.error })- );-- if (search.data && search.data.length > 0) {- console.log(- "[getPartTool] returning",- search.data.length,- "embedding matches"- );- return search.data;- }- }-- console.log("[getPartTool] no results found, returning null");- return null;- }-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier-for-parts.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier-for-parts.tsdeleted file mode 100644index 73d3a1af1a..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier-for-parts.ts+++ /dev/null@@ -1,144 +0,0 @@-import { getAppUrl } from "@carbon/auth";-import type { Database } from "@carbon/database";-import type { SupabaseClient } from "@supabase/supabase-js";-import { tool } from "ai";-import { LuSearch } from "react-icons/lu";-import { z } from "zod";-import { path } from "~/utils/path";-import type { ChatContext } from "../agents/shared/context";-import type { ToolConfig } from "../agents/shared/tools";--export const config: ToolConfig = {- name: "getSupplierForParts",- icon: LuSearch,- displayText: "Getting Supplier for Parts",- message: "Searching for suppliers for parts..."-};--export const getSupplierForPartsSchema = z.object({- partIds: z.array(z.string())-});--export const getSupplierForPartsTool = tool({- description: "Suggest a list of suppliers for a given list of parts",- inputSchema: getSupplierForPartsSchema,- execute: async function (args, executionOptions) {- const context = executionOptions.experimental_context as ChatContext;- console.log("[getSupplierForPartsTool]", args);- return await getSuppliersForParts(context.client, args.partIds, context);- }-});--export async function getSuppliersForParts(- client: SupabaseClient<Database>,- partIds: string[],- context: { companyId: string }-) {- // Find suppliers that provide these parts- const [supplierParts, preferredSuppliers] = await Promise.all([- client- .from("supplierPart")- .select("itemId, supplierId, unitPrice, supplierUnitOfMeasureCode")- .in("itemId", partIds)- .eq("companyId", context.companyId),- client- .from("itemReplenishment")- .select("itemId, preferredSupplierId")- .in("itemId", partIds)- .eq("companyId", context.companyId)- ]);-- if (partIds.length === 1) {- const preferredSupplier = preferredSuppliers.data?.find(- (p) => p.itemId === partIds[0]- );- if (preferredSupplier && preferredSupplier.preferredSupplierId) {- return {- id: preferredSupplier.preferredSupplierId- };- }-- const firstSupplier = supplierParts.data?.find(- (p) => p.itemId === partIds[0]- );- if (firstSupplier) {- return {- link: `${getAppUrl()}${path.to.supplier(firstSupplier.supplierId)}`,- id: firstSupplier.supplierId- };- }- }-- // Count occurrences of each supplier in preferred suppliers- const preferredSupplierCounts =- preferredSuppliers.data?.reduce(- (counts, item) => {- if (item.preferredSupplierId) {- counts[item.preferredSupplierId] =- (counts[item.preferredSupplierId] || 0) + 1;- }- return counts;- },- {} as Record<string, number>- ) || {};-- // Find the most frequent preferred supplier- let mostFrequentPreferredSupplierId: string | null = null;- let maxPreferredCount = 0;-- for (const [supplierId, count] of Object.entries(preferredSupplierCounts)) {- if (count > maxPreferredCount) {- maxPreferredCount = count;- mostFrequentPreferredSupplierId = supplierId;- }- }-- // If we found a preferred supplier, return it- if (mostFrequentPreferredSupplierId) {- return {- link: `${getAppUrl()}${path.to.supplier(- mostFrequentPreferredSupplierId- )}`,- id: mostFrequentPreferredSupplierId- };- }-- // If no preferred supplier, count occurrences in supplierParts- const supplierPartCounts =- supplierParts.data?.reduce(- (counts, item) => {- if (item.supplierId) {- counts[item.supplierId] = (counts[item.supplierId] || 0) + 1;- }- return counts;- },- {} as Record<string, number>- ) || {};-- // Find the most frequent supplier from supplierParts- let mostFrequentSupplierId: string | null = null;- let maxCount = 0;-- for (const [supplierId, count] of Object.entries(supplierPartCounts)) {- if (count > maxCount) {- maxCount = count;- mostFrequentSupplierId = supplierId;- }- }-- // Return the most frequent supplier if found- if (mostFrequentSupplierId) {- const supplier = supplierParts.data?.find(- (p) => p.supplierId === mostFrequentSupplierId- );- return {- link: `${getAppUrl()}${path.to.supplier(mostFrequentSupplierId)}`,- id: mostFrequentSupplierId,- unitPrice: supplier?.unitPrice,- supplierUnitOfMeasureCode: supplier?.supplierUnitOfMeasureCode- };- }-- // Return null if no supplier was found- return null;-}diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier.tsdeleted file mode 100644index 07bafb1a55..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/get-supplier.ts+++ /dev/null@@ -1,93 +0,0 @@-import { getAppUrl } from "@carbon/auth";-import { tool } from "ai";-import { LuSearch } from "react-icons/lu";-import { z } from "zod";-import { generateEmbedding } from "~/modules/shared/shared.service";-import { path } from "~/utils/path";-import type { ChatContext } from "../agents/shared/context";-import type { ToolConfig } from "../agents/shared/tools";-import { getSuppliersForParts } from "./get-supplier-for-parts";--export const config: ToolConfig = {- name: "getSupplier",- icon: LuSearch,- displayText: "Getting Supplier",- message: "Searching for a supplier..."-};--export const getSupplierSchema = z- .object({- id: z.string().optional(),- name: z.string().optional(),- description: z.string().optional(),- partIds: z.array(z.string()).optional()- })- .refine((data) => data.id || data.name || data.description || data.partIds, {- message: "Either id, name, description, orpartIds must be provided"- });--export const getSupplierTool = tool({- description:- "Search for suppliers by a specific name as specified by the user, a deduced description, or a list of part ids",- inputSchema: getSupplierSchema,- execute: async function (args, executionOptions) {- const context = executionOptions.experimental_context as ChatContext;- let { name, description, partIds } = args;-- if (args.id) {- const supplier = await context.client- .from("supplier")- .select("*")- .eq("id", args.id)- .eq("companyId", context.companyId)- .single();-- if (supplier.data) {- return {- link: `${getAppUrl()}${path.to.supplier(supplier.data.id)}`,- id: supplier.data.id,- name: supplier.data.name- };- }- }-- if (partIds && partIds.length > 0) {- return getSuppliersForParts(context.client, partIds, context);- }-- if (args.name) {- const supplier = await context.client- .from("supplier")- .select("*")- .eq("name", args.name)- .eq("companyId", context.companyId)- .single();-- if (supplier.data) {- return {- id: supplier.data.id- };- }- if (!description) {- description = name;- }- }-- if (description) {- const embedding = await generateEmbedding(context.client, description);-- const search = await context.client.rpc("suppliers_search", {- query_embedding: JSON.stringify(embedding),- match_threshold: 0.8,- match_count: 10,- p_company_id: context.companyId- });-- if (search.data && search.data.length > 0) {- return search.data;- }- }-- return null;- }-});diff --git a/apps/erp/app/routes/api+/ai+/chat+/tools/web-search.ts b/apps/erp/app/routes/api+/ai+/chat+/tools/web-search.tsdeleted file mode 100644index e036e14a69..0000000000--- a/apps/erp/app/routes/api+/ai+/chat+/tools/web-search.ts+++ /dev/null@@ -1,97 +0,0 @@-import { openai } from "@ai-sdk/openai";-import type { Tool } from "ai";-import { generateText, stepCountIs, tool } from "ai";-import { LuGlobe } from "react-icons/lu";-import { z } from "zod";-import type { ChatContext } from "../agents/shared/context";-import type { ToolConfig } from "../agents/shared/tools";--export const config: ToolConfig = {- name: "webSearch",- icon: LuGlobe,- displayText: "Searching the Web",- message: "Searching the web..."-};--// Static tool that uses context at execution time via experimental_context-export const webSearchTool = tool({- description:- "Search the web for current information, prices, news, and external data. Returns concise factual data for analysis.",- inputSchema: z.object({- query: z- .string()- .describe("Search query (2-4 words max for faster results)")- }),- execute: async ({ query }, executionOptions) => {- const appContext = executionOptions.experimental_context as ChatContext;-- try {- const result = await generateText({- model: openai("gpt-4o-mini"),- prompt: `<search-request>- Search for: ${query}- Current date: ${appContext.currentDateTime}- Focus on recent information.- </search-request>`,- stopWhen: stepCountIs(1),- tools: {- webSearch: openai.tools.webSearch({- searchContextSize: "low",- userLocation: {- type: "approximate" as const,- country: appContext.country,- timezone: appContext.timezone- }- }) as Tool- },- temperature: 0- });-- const rawSources: Array<{ url: string; title?: string }> = [];-- if (result.steps?.[0]?.content) {- const content = result.steps[0].content;- if (Array.isArray(content)) {- for (const item of content) {- if (item.type === "source" && item.sourceType === "url") {- rawSources.push({- url: item.url,- title: item.title || item.url- });- }- }- }- }-- const formattedSources: SourceItem[] = rawSources- .slice(0, 3)- .map((source) => ({- url: source.url,- title: source.title || source.url- }));-- const contextData = result.text || "";-- return {- query,- found: formattedSources.length,- context: contextData,- sources: formattedSources- };- } catch (error) {- return {- query,- found: 0,- context: null,- sources: [],- error: error instanceof Error ? error.message : "Search failed"- };- }- }-});--export interface SourceItem {- url: string;- title: string;- publishedDate?: string;-}diff --git a/apps/erp/app/routes/api+/integrations.slack.interactive.ts b/apps/erp/app/routes/api+/integrations.slack.interactive.tsindex b1fa999591..eeae3f706c 100644--- a/apps/erp/app/routes/api+/integrations.slack.interactive.ts+++ b/apps/erp/app/routes/api+/integrations.slack.interactive.ts@@ -14,10 +14,8 @@ import { z } from "zod";import {getIssueTypesList,getIssueWorkflowsList,- upsertIssue+ insertIssue} from "~/modules/quality/quality.service";--import { getNextSequence } from "~/modules/settings/settings.service";import { path } from "~/utils/path";const slackInteractivePayloadSchema = z.object({@@ -400,23 +398,19 @@ async function handleViewSubmission(throw new Error("No channel configured for Slack integration");}- const [nextSequence, employee] = await Promise.all([- getNextSequence(serviceRole, "nonConformance", companyId),- getCarbonEmployeeFromSlackId(serviceRole, slackToken, user_id, companyId)- ]);-- if (nextSequence.error || !nextSequence.data) {- throw new Error("Failed to get next sequence number");- }+ const employee = await getCarbonEmployeeFromSlackId(+ serviceRole,+ slackToken,+ user_id,+ companyId+ );if (employee.error || !employee.data) {console.error(employee.error);throw new Error("Failed to get employee");}- const createResult = await upsertIssue(serviceRole, {- nonConformanceId: nextSequence.data,- approvalRequirements: [],+ const createResult = await insertIssue(serviceRole, {companyId,createdBy: employee.data?.id,description,@@ -426,7 +420,6 @@ async function handleViewSubmission(nonConformanceWorkflowId: workflowId,openDate: new Date().toISOString(),priority: severity,- requiredActionIds: [],source: "Internal"});@@ -445,7 +438,7 @@ async function handleViewSubmission(companyId,description,id: ncrId,- nonConformanceId: nextSequence.data,+ nonConformanceId: createResult.data.nonConformanceId,severity,title,userId: employee.data?.iddiff --git a/apps/erp/app/routes/api+/kanban.$id.tsx b/apps/erp/app/routes/api+/kanban.$id.tsxindex 79563369ff..2add652fa9 100644--- a/apps/erp/app/routes/api+/kanban.$id.tsx+++ b/apps/erp/app/routes/api+/kanban.$id.tsx@@ -15,16 +15,15 @@ import { getDefaultStorageUnitForJob, getKanban } from "~/modules/inventory";import { getItemReplenishment } from "~/modules/items";import {getActiveJobOperationByJobId,+ insertJob,runMRP,updateKanbanJob,- upsertJob,upsertJobMethod} from "~/modules/production";import {- upsertPurchaseOrder,+ insertPurchaseOrder,upsertPurchaseOrderLine} from "~/modules/purchasing";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";async function handleKanban({@@ -73,61 +72,44 @@ async function handleKanban({};}- const [nextSequence, manufacturing, defaultStorageUnit] = await Promise.all(- [- getNextSequence(client, "job", companyId),- getItemReplenishment(client, kanban.data.itemId!, companyId),- getDefaultStorageUnitForJob(- client,- kanban.data.itemId!,- kanban.data.locationId!,- companyId- )- ]- );-- if (nextSequence.error) {- console.error(nextSequence.error);- return {- data: null,- error: "Failed to create job"- };- }-- let jobReadableId = nextSequence.data;- let leadTime = manufacturing.data?.leadTime ?? 7;+ const [manufacturing, defaultStorageUnit] = await Promise.all([+ getItemReplenishment(client, kanban.data.itemId!, companyId),+ getDefaultStorageUnitForJob(+ client,+ kanban.data.itemId!,+ kanban.data.locationId!,+ companyId+ )+ ]);+ const leadTime = manufacturing.data?.leadTime ?? 7;const startDate = today(getLocalTimeZone());const dueDate = startDate.add({ days: leadTime }).toString();- if (!jobReadableId) {- console.error("Failed to get next job id");- return {- data: null,- error: "Failed to create job"- };- }-// Use storage unit from kanban if it exists, otherwise use default storage unitconst storageUnitId =kanban.data.storageUnitId || defaultStorageUnit || undefined;- const createdJob = await upsertJob(client, {- jobId: jobReadableId,- itemId: kanban.data.itemId!,- quantity: kanban.data.quantity!,- locationId: kanban.data.locationId!,- storageUnitId,- unitOfMeasureCode: kanban.data.purchaseUnitOfMeasureCode!,- deadlineType: "Hard Deadline",- scrapQuantity: 0,- startDate: startDate.toString(),- dueDate,- companyId,- createdBy: userId- });+ const serviceRole = getCarbonServiceRole();++ const createdJob = await insertJob(+ serviceRole,+ {+ itemId: kanban.data.itemId!,+ quantity: kanban.data.quantity!,+ locationId: kanban.data.locationId!,+ storageUnitId,+ unitOfMeasureCode: kanban.data.purchaseUnitOfMeasureCode!,+ deadlineType: "Hard Deadline",+ startDate: startDate.toString(),+ dueDate,+ companyId,+ createdBy: userId+ },+ { skipMethod: true, skipRecalculate: true }+ );- const id = createdJob.data?.id!;+ const id = createdJob.data?.id;if (createdJob.error || !id) {console.error(createdJob.error);return {@@ -136,8 +118,6 @@ async function handleKanban({};}- const serviceRole = getCarbonServiceRole();-const [upsertMethod, associateKanban] = await Promise.all([upsertJobMethod(serviceRole, "itemToJob", {sourceId: kanban.data.itemId!,@@ -190,7 +170,7 @@ async function handleKanban({.update({status: "Ready" as const})- .eq("id", jobReadableId)+ .eq("id", id)]);} else if (upsertMethod.error) {console.error(upsertMethod.error);@@ -245,21 +225,7 @@ async function handleKanban({let purchaseOrderId = existingPurchaseOrder.data?.id;if (!purchaseOrderId) {- const nextSequence = await getNextSequence(- client,- "purchaseOrder",- companyId- );- if (nextSequence.error) {- console.error(nextSequence.error);- return {- data: null,- error: "Failed to get next purchase order sequence"- };- }-- const newPurchaseOrder = await upsertPurchaseOrder(client, {- purchaseOrderId: nextSequence.data!,+ const newPurchaseOrder = await insertPurchaseOrder(client, {supplierId: kanban.data.supplierId!,status: "Draft",purchaseOrderType: "Purchase",@@ -268,7 +234,7 @@ async function handleKanban({createdBy: userId});- if (newPurchaseOrder.error || !newPurchaseOrder.data?.[0]) {+ if (newPurchaseOrder.error || !newPurchaseOrder.data) {console.error(newPurchaseOrder.error);return {data: null,@@ -276,7 +242,7 @@ async function handleKanban({};}- purchaseOrderId = newPurchaseOrder.data[0].id;+ purchaseOrderId = newPurchaseOrder.data.id;}const [item, supplierPart, inventory] = await Promise.all([diff --git a/apps/erp/app/routes/api+/mcp+/_index.ts b/apps/erp/app/routes/api+/mcp+/_index.tsindex 02ce0fe282..8285538821 100644--- a/apps/erp/app/routes/api+/mcp+/_index.ts+++ b/apps/erp/app/routes/api+/mcp+/_index.ts@@ -1,55 +1,126 @@-import { requirePermissions } from "@carbon/auth/auth.server";+import { hashOAuthSecret, requirePermissions } from "@carbon/auth/auth.server";+import {+ getCarbonServiceRole,+ getUserScopedClient+} from "@carbon/auth/client.server";import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";+import type { SupabaseClient } from "@supabase/supabase-js";import type { ActionFunctionArgs } from "react-router";import { createMcpServer } from "./lib/server";-export async function action({ request }: ActionFunctionArgs) {- console.log("[MCP] Received request:", {- method: request.method,- url: request.url,- headers: Object.fromEntries(request.headers.entries())+const corsHeaders = {+ "Access-Control-Allow-Origin": "*",+ "Access-Control-Allow-Methods": "POST, OPTIONS",+ "Access-Control-Allow-Headers": "Content-Type, Authorization",+ "Content-Type": "application/json"+};++function addCorsHeaders(response: Response): Response {+ const headers = new Headers(response.headers);+ headers.set("Access-Control-Allow-Origin", "*");+ headers.set("Access-Control-Allow-Methods", "POST, OPTIONS");+ headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization");+ return new Response(response.body, {+ status: response.status,+ headers});+}++type McpContext = {+ client: SupabaseClient;+ companyId: string;+ companyGroupId: string;+ userId: string;+};++async function authenticateOAuthToken(+ accessToken: string+): Promise<{ userId: string; companyId: string } | null> {+ const serviceRole = getCarbonServiceRole();+ const tokenResult = await serviceRole+ .from("oauthToken")+ .select("userId, companyId, expiresAt")+ .eq("accessToken", hashOAuthSecret(accessToken))+ .single();+ if (!tokenResult.data) return null;+ if (new Date(tokenResult.data.expiresAt) < new Date()) return null;++ return {+ userId: tokenResult.data.userId,+ companyId: tokenResult.data.companyId+ };+}++async function resolveAuth(request: Request): Promise<{+ ctx: McpContext;+ request: Request;+}> {const authHeader = request.headers.get("Authorization");const hasCarbonKey = request.headers.has("carbon-key");if (authHeader?.startsWith("Bearer ") && !hasCarbonKey) {const token = authHeader.slice(7);++ // Try OAuth for non-API-key tokens+ if (!token.startsWith("crbn_")) {+ const oauthAuth = await authenticateOAuthToken(token);+ if (oauthAuth) {+ const client = await getUserScopedClient(oauthAuth.userId);+ const companyResult = await client+ .from("company")+ .select("companyGroupId")+ .eq("id", oauthAuth.companyId)+ .single();++ return {+ ctx: {+ client,+ companyId: oauthAuth.companyId,+ companyGroupId:+ companyResult.data?.companyGroupId ?? oauthAuth.companyId,+ userId: oauthAuth.userId+ },+ request+ };+ }+ }++ // Fall back to carbon-key authconst headers = new Headers(request.headers);headers.set("carbon-key", token);request = new Request(request, { headers });- console.log("[MCP] Added carbon-key header from Bearer token");}const { client, companyId, companyGroupId, userId } =await requirePermissions(request, {});- console.log("[MCP] Auth successful:", { companyId, userId });- const server = createMcpServer({ client, companyId, companyGroupId, userId });+ return {+ ctx: { client, companyId, companyGroupId, userId },+ request+ };+}++export async function action({ request }: ActionFunctionArgs) {+ const { ctx, request: authedRequest } = await resolveAuth(request);++ const server = createMcpServer(ctx);const transport = new WebStandardStreamableHTTPServerTransport({sessionIdGenerator: undefined,enableJsonResponse: true});await server.connect(transport);- console.log("[MCP] Server connected");-- const response = await transport.handleRequest(request);- console.log("[MCP] Response status:", response.status);-- // Log response body for debugging- const clonedResponse = response.clone();- try {- const responseBody = await clonedResponse.text();- console.log("[MCP] Response body:", responseBody.substring(0, 500));- } catch (_e) {- console.log("[MCP] Could not read response body");- }+ const response = await transport.handleRequest(authedRequest);- return response;+ return addCorsHeaders(response);}-export async function loader() {+export async function loader({ request }: { request: Request }) {+ if (request.method === "OPTIONS") {+ return new Response(null, { status: 204, headers: corsHeaders });+ }+return new Response(JSON.stringify({jsonrpc: "2.0",@@ -58,7 +129,7 @@ export async function loader() {}),{status: 405,- headers: { "Content-Type": "application/json" }+ headers: corsHeaders});}diff --git a/apps/erp/app/routes/api+/mcp+/lib/direct-executor.ts b/apps/erp/app/routes/api+/mcp+/lib/direct-executor.tsindex 47fa4a23b1..00b145b54e 100644--- a/apps/erp/app/routes/api+/mcp+/lib/direct-executor.ts+++ b/apps/erp/app/routes/api+/mcp+/lib/direct-executor.ts@@ -43,6 +43,7 @@ const functionRegistry = {export interface ExecutorContext {client: SupabaseClient<Database>;companyId: string;+ companyGroupId: string;userId: string;}@@ -70,6 +71,9 @@ function enrichWithAuthContext(if (fields.includes("companyId")) {enriched.companyId = context.companyId;}+ if (fields.includes("companyGroupId")) {+ enriched.companyGroupId = context.companyGroupId;+ }return enriched;}@@ -151,11 +155,11 @@ export async function executeFunction(if (paramName === "client") {functionArgs.push(context.client);} else if (paramName === "userId") {- const userIdValue = normalizedArgs?.userId || context.userId;- functionArgs.push(userIdValue);+ functionArgs.push(context.userId);} else if (paramName === "companyId") {- const companyIdValue = normalizedArgs?.companyId || context.companyId;- functionArgs.push(companyIdValue);+ functionArgs.push(context.companyId);+ } else if (paramName === "companyGroupId") {+ functionArgs.push(context.companyGroupId);} else if (paramName === "args") {// For 'args' parameter, pass the entire args object or a default// This is the parameter that most service functions expect@@ -168,13 +172,22 @@ export async function executeFunction(} else if (normalizedArgs &&Object.keys(normalizedArgs).length === 1 &&- !paramNames.some((p: string) => p in normalizedArgs)+ !paramNames.some((p: string) => p in normalizedArgs) &&+ typeof Object.values(normalizedArgs)[0] === "object" &&+ Object.values(normalizedArgs)[0] !== null) {// Single-key payload whose name doesn't match any parameter — unwrap// and use as positional. Hits the documented `{ args: {...} }` wrapper// and any LLM that guesses a key name (e.g. `{ item: {...} }`).const value = Object.values(normalizedArgs)[0];functionArgs.push(enrichWithAuthContext(value, context, injectAuth));+ } else if (normalizedArgs && Object.keys(normalizedArgs).length > 0) {+ // No key matched — pass the entire args object as a positional param.+ // Handles functions like upsertPart(client, part) where the caller+ // passes flat fields instead of nesting under the param name.+ functionArgs.push(+ enrichWithAuthContext({ ...normalizedArgs }, context, injectAuth)+ );} else {// Skip optional parameterscontinue;diff --git a/apps/erp/app/routes/api+/mcp+/lib/server.ts b/apps/erp/app/routes/api+/mcp+/lib/server.tsindex 5325648bb3..dc6b76e64f 100644--- a/apps/erp/app/routes/api+/mcp+/lib/server.ts+++ b/apps/erp/app/routes/api+/mcp+/lib/server.ts@@ -1,5 +1,4 @@// @ts-nocheck-// MCP server with single search tool that dynamically registers othersimport { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import type { McpContext } from "./types";import { z } from "zod";@@ -8,8 +7,6 @@ import toolMetadata from "./tool-metadata.json";import { isMcpBlockedTool } from "./mcp-blocked-tools";import { executeFunction } from "./direct-executor";-// Tool modules are no longer imported - using direct execution instead-function getServerInstructions(): string {const today = new Date().toISOString().split("T")[0];diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.jsonindex 34ce76833e..5b4373da1e 100644--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json@@ -1,6 +1,6 @@{- "generated": "2026-06-03T15:49:36.429Z",- "totalTools": 1084,+ "generated": "2026-06-07T14:53:04.230Z",+ "totalTools": 1179,"modules": 15,"tools": [{@@ -8,14 +8,29 @@"module": "account","classification": "DESTRUCTIVE","description": "delete user attribute value",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "userAttributeId": {+ "type": "string"+ },+ "userAttributeValueId": {+ "type": "string"+ }+ },+ "required": [+ "userAttributeId",+ "userAttributeValueId"+ ]+ }},{"name": "account_getAccount",@@ -29,7 +44,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "account_getAttributes",@@ -45,7 +71,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "isPublic": {+ "type": "boolean"+ }+ },+ "required": [+ "isPublic"+ ]+ }},{"name": "account_getPrivateAttributes",@@ -60,7 +97,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "account_getPublicAttributes",@@ -75,7 +116,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "account_getAllAttributeCategories",@@ -90,7 +135,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "account_getAttributeCategoryWithValues",@@ -106,7 +155,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "categoryId": {+ "type": "string"+ }+ },+ "required": [+ "categoryId"+ ]+ }},{"name": "account_updateAvatar",@@ -122,7 +182,21 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "avatarUrl": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "avatarUrl"+ ]+ }},{"name": "account_updatePublicAccount",@@ -137,14 +211,39 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "firstName": {+ "type": "string"+ },+ "lastName": {+ "type": "string"+ },+ "about": {+ "type": "string"+ },+ "phone": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "firstName",+ "lastName"+ ]+ }},{"name": "account_upsertUserAttributeValue","module": "account","classification": "WRITE","description": "upsert user attribute value",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","update"@@ -153,14 +252,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "userAttributeValueId": {},+ "userAttributeId": {+ "type": "string"+ },+ "value": {},+ "type": {+ "type": "string"+ }+ },+ "required": [+ "userAttributeId",+ "value",+ "type"+ ]+ }},{"name": "accounting_getTrialBalance","module": "accounting","classification": "READ","description": "get trial balance",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","companyGroupId",@@ -169,14 +286,35 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "startDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "endDate": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "startDate",+ "endDate"+ ]+ }},{"name": "accounting_getFinancialStatementBalances","module": "accounting","classification": "READ","description": "get financial statement balances",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","companyGroupId",@@ -185,7 +323,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "startDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "endDate": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "startDate",+ "endDate"+ ]+ }},{"name": "accounting_getCompaniesInGroup",@@ -199,7 +358,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_deleteAccount",@@ -213,29 +376,18 @@],"injectAuth": ["companyId"- ]- },- {- "name": "accounting_deleteAccountCategory",- "module": "accounting",- "classification": "DESTRUCTIVE",- "description": "delete account category",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_deleteAccountSubcategory",- "module": "accounting",- "classification": "DESTRUCTIVE",- "description": "delete account subcategory",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "accountId": {+ "type": "string"+ }+ },+ "required": [+ "accountId"+ ]+ }},{"name": "accounting_deletePaymentTerm",@@ -249,7 +401,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "paymentTermId"+ ]+ }},{"name": "accounting_getAccount",@@ -263,14 +426,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "accountId": {+ "type": "string"+ }+ },+ "required": [+ "accountId"+ ]+ }},{"name": "accounting_getAccounts","module": "accounting","classification": "READ","description": "get accounts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -278,14 +452,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getAccountsList","module": "accounting","classification": "READ","description": "get accounts list",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -293,76 +491,41 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "isGroup": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "incomeBalance": {},+ "classes": {+ "type": "array",+ "items": {}+ }+ }+ }},{"name": "accounting_getGroupAccounts","module": "accounting","classification": "READ",- "description": "get account categories",- "paramCount": 4,+ "description": "get group accounts",+ "paramCount": 0,"serviceParams": ["client","companyGroupId"],"injectAuth": ["companyId"- ]- },- {- "name": "accounting_getAccountCategoriesList",- "module": "accounting",- "classification": "READ",- "description": "get account categories list",- "paramCount": 0,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getAccountCategory",- "module": "accounting",- "classification": "READ",- "description": "get account category",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getAccountSubcategories",- "module": "accounting",- "classification": "READ",- "description": "get account subcategories",- "paramCount": 4,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getAccountSubcategoriesByCategory",- "module": "accounting",- "classification": "READ",- "description": "get account subcategories by category",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getAccountSubcategory",- "module": "accounting",- "classification": "READ",- "description": "get account subcategory",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getBaseCurrency",@@ -376,14 +539,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getChartOfAccounts","module": "accounting","classification": "READ","description": "get chart of accounts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -391,7 +558,39 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "incomeBalance": {+ "type": [+ "string",+ "null"+ ],+ "enum": [+ "Income Statement",+ "Balance Sheet"+ ]+ },+ "startDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "endDate": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "incomeBalance",+ "startDate",+ "endDate"+ ]+ }},{"name": "accounting_getCurrency",@@ -405,7 +604,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "currencyId": {+ "type": "string"+ }+ },+ "required": [+ "currencyId"+ ]+ }},{"name": "accounting_getCurrencyByCode",@@ -420,14 +630,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "currencyCode": {+ "type": "string"+ }+ },+ "required": [+ "currencyCode"+ ]+ }},{"name": "accounting_getCurrencies","module": "accounting","classification": "READ","description": "get currencies",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -435,7 +656,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getCurrenciesList",@@ -448,7 +693,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getCurrentAccountingPeriod",@@ -463,27 +712,50 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "date": {+ "type": "string"+ }+ },+ "required": [+ "date"+ ]+ }},{- "name": "accounting_getDefaultAccounts",+ "name": "accounting_getOrCreateAccountingPeriod","module": "accounting","classification": "READ",- "description": "get default accounts",- "paramCount": 0,+ "description": "get or create accounting period",+ "paramCount": 1,"serviceParams": ["client",- "companyId"+ "companyId",+ "date"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "date": {+ "type": "string"+ }+ },+ "required": [+ "date"+ ]+ }},{- "name": "accounting_getFiscalYearSettings",+ "name": "accounting_getDefaultAccounts","module": "accounting","classification": "READ",- "description": "get fiscal year settings",+ "description": "get default accounts","paramCount": 0,"serviceParams": ["client",@@ -491,29 +763,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "accounting_getInventoryPostingGroup",+ "name": "accounting_getFiscalYearSettings","module": "accounting","classification": "READ",- "description": "get inventory posting group",- "paramCount": 3,- "serviceParams": [],- "injectAuth": [+ "description": "get fiscal year settings",+ "paramCount": 0,+ "serviceParams": [+ "client","companyId"- ]- },- {- "name": "accounting_getInventoryPostingGroups",- "module": "accounting",- "classification": "READ",- "description": "get inventory posting groups",- "paramCount": 3,- "serviceParams": [],+ ],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getPaymentTerm",@@ -527,14 +799,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "paymentTermId"+ ]+ }},{"name": "accounting_getPaymentTerms","module": "accounting","classification": "READ","description": "get payment terms",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -542,7 +825,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getPaymentTermsList",@@ -556,58 +863,18 @@],"injectAuth": ["companyId"- ]- },- {- "name": "accounting_getPurchasingPostingGroup",- "module": "accounting",- "classification": "READ",- "description": "get purchasing posting group",- "paramCount": 3,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getPurchasingPostingGroups",- "module": "accounting",- "classification": "READ",- "description": "get purchasing posting groups",- "paramCount": 3,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getPurchasingSalesGroup",- "module": "accounting",- "classification": "READ",- "description": "get purchasing sales group",- "paramCount": 3,- "serviceParams": [],- "injectAuth": [- "companyId"- ]- },- {- "name": "accounting_getSalesPostingGroups",- "module": "accounting",- "classification": "READ",- "description": "get sales posting groups",- "paramCount": 3,- "serviceParams": [],- "injectAuth": [- "companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_updateDefaultBalanceSheetAccounts","module": "accounting","classification": "WRITE","description": "update default balance sheet accounts",- "paramCount": 0,+ "paramCount": 20,"serviceParams": ["client","defaultAccounts"@@ -615,14 +882,101 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "inventoryAccount": {+ "type": "string"+ },+ "goodsReceivedNotInvoicedAccount": {+ "type": "string"+ },+ "inventoryShippedNotInvoicedAccount": {+ "type": "string"+ },+ "workInProgressAccount": {+ "type": "string"+ },+ "receivablesAccount": {+ "type": "string"+ },+ "bankCashAccount": {+ "type": "string"+ },+ "bankLocalCurrencyAccount": {+ "type": "string"+ },+ "bankForeignCurrencyAccount": {+ "type": "string"+ },+ "assetAquisitionCostAccount": {+ "type": "string"+ },+ "assetAquisitionCostOnDisposalAccount": {+ "type": "string"+ },+ "accumulatedDepreciationAccount": {+ "type": "string"+ },+ "accumulatedDepreciationOnDisposalAccount": {+ "type": "string"+ },+ "prepaymentAccount": {+ "type": "string"+ },+ "payablesAccount": {+ "type": "string"+ },+ "salesTaxPayableAccount": {+ "type": "string"+ },+ "purchaseTaxPayableAccount": {+ "type": "string"+ },+ "reverseChargeSalesTaxPayableAccount": {+ "type": "string"+ },+ "retainedEarningsAccount": {+ "type": "string"+ },+ "currencyTranslationAccount": {+ "type": "string"+ },+ "deferredTaxLiabilityAccountId": {+ "type": "string"+ }+ },+ "required": [+ "inventoryAccount",+ "goodsReceivedNotInvoicedAccount",+ "inventoryShippedNotInvoicedAccount",+ "workInProgressAccount",+ "receivablesAccount",+ "bankCashAccount",+ "bankLocalCurrencyAccount",+ "bankForeignCurrencyAccount",+ "assetAquisitionCostAccount",+ "assetAquisitionCostOnDisposalAccount",+ "accumulatedDepreciationAccount",+ "accumulatedDepreciationOnDisposalAccount",+ "prepaymentAccount",+ "payablesAccount",+ "salesTaxPayableAccount",+ "purchaseTaxPayableAccount",+ "reverseChargeSalesTaxPayableAccount",+ "retainedEarningsAccount",+ "currencyTranslationAccount",+ "deferredTaxLiabilityAccountId"+ ]+ }},{"name": "accounting_updateDefaultIncomeAccounts","module": "accounting","classification": "WRITE","description": "update default income accounts",- "paramCount": 0,+ "paramCount": 21,"serviceParams": ["client","defaultAccounts"@@ -630,14 +984,105 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesAccount": {+ "type": "string"+ },+ "salesDiscountAccount": {+ "type": "string"+ },+ "costOfGoodsSoldAccount": {+ "type": "string"+ },+ "purchaseVarianceAccount": {+ "type": "string"+ },+ "inventoryAdjustmentVarianceAccount": {+ "type": "string"+ },+ "materialVarianceAccount": {+ "type": "string"+ },+ "laborAndMachineVarianceAccount": {+ "type": "string"+ },+ "overheadVarianceAccount": {+ "type": "string"+ },+ "lotSizeVarianceAccount": {+ "type": "string"+ },+ "subcontractingVarianceAccount": {+ "type": "string"+ },+ "laborAbsorptionAccount": {+ "type": "string"+ },+ "indirectCostAccount": {+ "type": "string"+ },+ "maintenanceAccount": {+ "type": "string"+ },+ "assetDepreciationExpenseAccount": {+ "type": "string"+ },+ "assetGainsAndLossesAccount": {+ "type": "string"+ },+ "serviceChargeAccount": {+ "type": "string"+ },+ "interestAccount": {+ "type": "string"+ },+ "supplierPaymentDiscountAccount": {+ "type": "string"+ },+ "customerPaymentDiscountAccount": {+ "type": "string"+ },+ "roundingAccount": {+ "type": "string"+ },+ "deferredTaxExpenseAccountId": {+ "type": "string"+ }+ },+ "required": [+ "salesAccount",+ "salesDiscountAccount",+ "costOfGoodsSoldAccount",+ "purchaseVarianceAccount",+ "inventoryAdjustmentVarianceAccount",+ "materialVarianceAccount",+ "laborAndMachineVarianceAccount",+ "overheadVarianceAccount",+ "lotSizeVarianceAccount",+ "subcontractingVarianceAccount",+ "laborAbsorptionAccount",+ "indirectCostAccount",+ "maintenanceAccount",+ "assetDepreciationExpenseAccount",+ "assetGainsAndLossesAccount",+ "serviceChargeAccount",+ "interestAccount",+ "supplierPaymentDiscountAccount",+ "customerPaymentDiscountAccount",+ "roundingAccount",+ "deferredTaxExpenseAccountId"+ ]+ }},{"name": "accounting_updateFiscalYearSettings","module": "accounting","classification": "WRITE","description": "update fiscal year settings",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","fiscalYearSettings"@@ -645,14 +1090,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "startMonth": {+ "type": "string"+ }+ },+ "required": [+ "startMonth"+ ]+ }},{"name": "accounting_upsertAccount","module": "accounting","classification": "WRITE","description": "upsert account",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","account"@@ -661,40 +1117,23 @@"companyId","createdBy","updatedBy"- ]- },- {- "name": "accounting_upsertAccountCategory",- "module": "accounting",- "classification": "WRITE",- "description": "upsert account category",- "paramCount": 0,- "serviceParams": [],- "injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]- },- {- "name": "accounting_upsertAccountSubcategory",- "module": "accounting",- "classification": "WRITE",- "description": "upsert account subcategory",- "paramCount": 0,- "serviceParams": [],- "injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "account": {}+ },+ "required": [+ "account"+ ]+ }},{"name": "accounting_upsertCurrency","module": "accounting","classification": "WRITE","description": "upsert currency",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","currency"@@ -703,14 +1142,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "code": {+ "type": "string"+ },+ "decimalPlaces": {+ "type": "number"+ },+ "exchangeRate": {+ "type": "number"+ },+ "historicalExchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "code"+ ]+ }},{"name": "accounting_upsertPaymentTerm","module": "accounting","classification": "WRITE","description": "upsert payment term",- "paramCount": 0,+ "paramCount": 6,"serviceParams": ["client","paymentTerm"@@ -719,42 +1181,91 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "daysDue": {+ "type": "number"+ },+ "daysDiscount": {+ "type": "number"+ },+ "discountPercentage": {+ "type": "number"+ },+ "calculationMethod": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "calculationMethod"+ ]+ }},{"name": "accounting_deleteCostCenter","module": "accounting","classification": "DESTRUCTIVE","description": "delete cost center",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","costCenterId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "costCenterId": {+ "type": "string"+ }+ },+ "required": [+ "costCenterId"+ ]+ }},{"name": "accounting_getCostCenter","module": "accounting","classification": "READ","description": "get cost center",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","costCenterId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "costCenterId": {+ "type": "string"+ }+ },+ "required": [+ "costCenterId"+ ]+ }},{"name": "accounting_getCostCenters","module": "accounting","classification": "READ","description": "get cost centers",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -762,7 +1273,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getCostCentersList",@@ -776,7 +1311,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getCostCentersTree",@@ -790,14 +1329,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_upsertCostCenter","module": "accounting","classification": "WRITE","description": "upsert cost center",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","costCenter"@@ -806,14 +1349,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "parentCostCenterId": {+ "type": "string"+ },+ "ownerId": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "ownerId"+ ]+ }},{"name": "accounting_getDimensions","module": "accounting","classification": "READ","description": "get dimensions",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -821,28 +1385,63 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getDimension","module": "accounting","classification": "READ","description": "get dimension",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","dimensionId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dimensionId": {+ "type": "string"+ }+ },+ "required": [+ "dimensionId"+ ]+ }},{"name": "accounting_upsertDimension","module": "accounting","classification": "WRITE","description": "upsert dimension",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","dimension",@@ -852,21 +1451,47 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dimension": {},+ "dimensionValues": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "dimension"+ ]+ }},{"name": "accounting_deleteDimension","module": "accounting","classification": "DESTRUCTIVE","description": "delete dimension",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","dimensionId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dimensionId": {+ "type": "string"+ }+ },+ "required": [+ "dimensionId"+ ]+ }},{"name": "accounting_getActiveDimensionsWithValues",@@ -881,28 +1506,46 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getJournalLineDimensions","module": "accounting","classification": "READ","description": "get journal line dimensions",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","journalLineIds"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "journalLineIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "journalLineIds"+ ]+ }},{"name": "accounting_saveJournalLineDimensions","module": "accounting","classification": "WRITE","description": "save journal line dimensions",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","journalLineId",@@ -911,14 +1554,27 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "journalLineId": {+ "type": "string"+ },+ "dimensions": {}+ },+ "required": [+ "journalLineId",+ "dimensions"+ ]+ }},{"name": "accounting_translateCompanyBalances","module": "accounting","classification": "WRITE","description": "translate company balances",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -929,14 +1585,32 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "targetCurrency": {+ "type": "string"+ },+ "periodEnd": {+ "type": "string"+ },+ "periodStart": {+ "type": "string"+ }+ },+ "required": [+ "targetCurrency",+ "periodEnd"+ ]+ }},{"name": "accounting_getConsolidatedBalances","module": "accounting","classification": "READ","description": "get consolidated balances",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","companyGroupId",@@ -947,14 +1621,39 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "companyIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "targetCurrency": {+ "type": "string"+ },+ "periodEnd": {+ "type": "string"+ },+ "periodStart": {+ "type": "string"+ }+ },+ "required": [+ "companyIds",+ "targetCurrency",+ "periodEnd"+ ]+ }},{"name": "accounting_getIntercompanyTransactions","module": "accounting","classification": "READ","description": "get intercompany transactions",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","companyGroupId",@@ -962,14 +1661,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_createIntercompanyTransaction","module": "accounting","classification": "WRITE","description": "create intercompany transaction",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","input"@@ -978,7 +1701,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "input": {}+ },+ "required": [+ "input"+ ]+ }},{"name": "accounting_runIntercompanyMatching",@@ -991,8 +1723,13 @@"companyGroupId"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_generateEliminations",@@ -1009,7 +1746,11 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getIntercompanyBalance",@@ -1023,14 +1764,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "accounting_getExchangeRateHistory","module": "accounting","classification": "READ","description": "get exchange rate history",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyGroupId",@@ -1038,14 +1783,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "currencyCode": {+ "type": "string"+ }+ },+ "required": [+ "currencyCode"+ ]+ }},{"name": "accounting_getJournalEntries","module": "accounting","classification": "READ","description": "get journal entries",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -1053,28 +1809,69 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "accounting_getJournalEntry","module": "accounting","classification": "READ","description": "get journal entry",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "accounting_createJournalEntry","module": "accounting","classification": "WRITE","description": "create journal entry",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","data"@@ -1083,14 +1880,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "postingDate": {+ "type": "string"+ }+ },+ "required": [+ "postingDate"+ ]+ }},{"name": "accounting_updateJournalEntry","module": "accounting","classification": "WRITE","description": "update journal entry",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","id",@@ -1099,28 +1913,52 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "data": {}+ },+ "required": [+ "id",+ "data"+ ]+ }},{"name": "accounting_deleteJournalEntry","module": "accounting","classification": "DESTRUCTIVE","description": "delete journal entry",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "accounting_upsertJournalEntryLine","module": "accounting","classification": "WRITE","description": "upsert journal entry line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","data"@@ -1129,42 +1967,81 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{"name": "accounting_deleteJournalEntryLine","module": "accounting","classification": "DESTRUCTIVE","description": "delete journal entry line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "accounting_saveJournalEntryWithLines","module": "accounting","classification": "WRITE","description": "save journal entry with lines",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","data"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "journalEntryId": {+ "type": "string"+ },+ "postingDate": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "lines: Array<{\n accountId: string;\n description": {}+ },+ "required": [+ "journalEntryId",+ "postingDate"+ ]+ }},{"name": "accounting_postJournalEntry","module": "accounting","classification": "WRITE","description": "post journal entry",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","id",@@ -1172,14 +2049,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "accounting_reverseJournalEntry","module": "accounting","classification": "WRITE","description": "reverse journal entry",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","id",@@ -1187,13 +2075,72 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "data": {+ "type": "object",+ "properties": {+ "journalEntryId": {+ "type": "string"+ }+ }+ }+ },+ "required": [+ "id",+ "data"+ ]+ }},{- "name": "documents_deleteDocument",- "module": "documents",- "classification": "DESTRUCTIVE",- "description": "delete document",+ "name": "accounting_getFixedAssetClasses",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset classes",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "accounting_getFixedAssetClass",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset class","paramCount": 1,"serviceParams": ["client",@@ -1201,58 +2148,93 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "documents_deleteDocumentFavorite",- "module": "documents",- "classification": "DESTRUCTIVE",- "description": "delete document favorite",- "paramCount": 1,+ "name": "accounting_getFixedAssetClassesList",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset classes list",+ "paramCount": 0,"serviceParams": ["client",- "id",- "userId"+ "companyId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "documents_deleteDocumentLabel",- "module": "documents",- "classification": "DESTRUCTIVE",- "description": "delete document label",- "paramCount": 2,+ "name": "accounting_upsertFixedAssetClass",+ "module": "accounting",+ "classification": "WRITE",+ "description": "upsert fixed asset class",+ "paramCount": 1,"serviceParams": ["client",- "id",- "label"+ "data"],"injectAuth": [- "companyId"- ]+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{- "name": "documents_getDocument",- "module": "documents",- "classification": "READ",- "description": "get document",+ "name": "accounting_deleteFixedAssetClass",+ "module": "accounting",+ "classification": "DESTRUCTIVE",+ "description": "delete fixed asset class","paramCount": 1,"serviceParams": ["client",- "documentId"+ "id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "documents_getDocuments",- "module": "documents",+ "name": "accounting_getFixedAssets",+ "module": "accounting","classification": "READ",- "description": "get documents",- "paramCount": 7,+ "description": "get fixed assets",+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -1260,152 +2242,445 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {}+ }+ }+ }+ }+ },+ {+ "name": "accounting_getFixedAsset",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "documents_getDocumentExtensions",- "module": "documents",+ "name": "accounting_getFixedAssetsList",+ "module": "accounting","classification": "READ",- "description": "get document extensions",+ "description": "get fixed assets list","paramCount": 0,"serviceParams": [- "client"+ "client",+ "companyId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "documents_getDocumentLabels",- "module": "documents",+ "name": "accounting_getFixedAssetsListForSale",+ "module": "accounting","classification": "READ",- "description": "get document labels",+ "description": "get fixed assets list for sale","paramCount": 0,"serviceParams": ["client",- "userId"+ "companyId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "documents_insertDocumentFavorite",- "module": "documents",+ "name": "accounting_insertFixedAsset",+ "module": "accounting","classification": "WRITE",- "description": "insert document favorite",- "paramCount": 1,+ "description": "insert fixed asset",+ "paramCount": 17,"serviceParams": ["client",- "id",- "userId"+ "input"],"injectAuth": ["companyId","createdBy","updatedBy"- ]- },- {- "name": "documents_insertDocumentLabel",- "module": "documents",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fixedAssetId": {+ "type": "string"+ },+ "fixedAssetClassId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "serialNumber": {+ "type": "string"+ },+ "depreciationMethod": {+ "type": "string"+ },+ "usefulLifeMonths": {+ "type": "number"+ },+ "residualValuePercent": {+ "type": "number"+ },+ "assetLifetimeUsage": {+ "type": [+ "number",+ "null"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "taxDepreciationMethod": {+ "type": [+ "string",+ "null"+ ]+ },+ "taxUsefulLifeMonths": {+ "type": [+ "number",+ "null"+ ]+ },+ "taxResidualValuePercent": {+ "type": [+ "number",+ "null"+ ]+ },+ "macrsPropertyClass": {+ "type": [+ "string",+ "null"+ ]+ },+ "macrsConvention": {+ "type": [+ "string",+ "null"+ ]+ },+ "bonusDepreciationPercent": {+ "type": [+ "number",+ "null"+ ]+ }+ },+ "required": [+ "fixedAssetClassId",+ "name",+ "depreciationMethod",+ "usefulLifeMonths",+ "residualValuePercent"+ ]+ }+ },+ {+ "name": "accounting_updateFixedAsset",+ "module": "accounting","classification": "WRITE",- "description": "insert document label",- "paramCount": 2,+ "description": "update fixed asset",+ "paramCount": 16,"serviceParams": ["client",- "id",- "label",- "userId"+ "input"],"injectAuth": ["companyId",- "createdBy","updatedBy"- ]- },- {- "name": "documents_moveDocumentToTrash",- "module": "documents",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "fixedAssetClassId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "serialNumber": {+ "type": [+ "string",+ "null"+ ]+ },+ "depreciationMethod": {+ "type": "string"+ },+ "usefulLifeMonths": {+ "type": "number"+ },+ "residualValuePercent": {+ "type": "number"+ },+ "assetLifetimeUsage": {+ "type": [+ "number",+ "null"+ ]+ },+ "locationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "taxDepreciationMethod": {+ "type": [+ "string",+ "null"+ ]+ },+ "taxUsefulLifeMonths": {+ "type": [+ "number",+ "null"+ ]+ },+ "taxResidualValuePercent": {+ "type": [+ "number",+ "null"+ ]+ },+ "macrsPropertyClass": {+ "type": [+ "string",+ "null"+ ]+ },+ "macrsConvention": {+ "type": [+ "string",+ "null"+ ]+ },+ "bonusDepreciationPercent": {+ "type": [+ "number",+ "null"+ ]+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "accounting_upsertFixedAsset",+ "module": "accounting","classification": "WRITE",- "description": "move document to trash",+ "description": "upsert fixed asset","paramCount": 1,"serviceParams": ["client",- "id",- "userId"+ "data"],"injectAuth": ["companyId",+ "createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{- "name": "documents_restoreDocument",- "module": "documents",- "classification": "WRITE",- "description": "restore document",+ "name": "accounting_deleteFixedAsset",+ "module": "accounting",+ "classification": "DESTRUCTIVE",+ "description": "delete fixed asset","paramCount": 1,"serviceParams": ["client",- "id",- "userId"+ "id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "documents_upsertDocument",- "module": "documents",+ "name": "accounting_insertDepreciationRun",+ "module": "accounting","classification": "WRITE",- "description": "upsert document",- "paramCount": 0,+ "description": "insert depreciation run",+ "paramCount": 3,"serviceParams": ["client",- "document"+ "input"],"injectAuth": ["companyId","createdBy","updatedBy"- ]- },- {- "name": "documents_updateDocumentFavorite",- "module": "documents",- "classification": "WRITE",- "description": "update document favorite",- "paramCount": 3,+ ],+ "schema": {+ "type": "object",+ "properties": {+ "depreciationRunId": {+ "type": "string"+ },+ "periodEnd": {+ "type": "string"+ },+ "lines: Array<{\n fixedAssetId: string;\n amount: number;\n taxAmount": {}+ },+ "required": [+ "periodEnd"+ ]+ }+ },+ {+ "name": "accounting_deleteDepreciationRun",+ "module": "accounting",+ "classification": "DESTRUCTIVE",+ "description": "delete depreciation run",+ "paramCount": 1,"serviceParams": ["client",- "args"+ "id"],"injectAuth": [- "companyId",- "updatedBy"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "documents_updateDocumentLabels",- "module": "documents",- "classification": "WRITE",- "description": "update document labels",- "paramCount": 0,+ "name": "accounting_getDepreciationRuns",+ "module": "accounting",+ "classification": "READ",+ "description": "get depreciation runs",+ "paramCount": 3,"serviceParams": ["client",- "document"+ "companyId",+ "args"],"injectAuth": [- "companyId",- "updatedBy"- ]- },- {- "name": "inventory_deleteBatchProperty",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete batch property",+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "accounting_getDepreciationRun",+ "module": "accounting",+ "classification": "READ",+ "description": "get depreciation run","paramCount": 1,"serviceParams": ["client",@@ -1413,105 +2688,778 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "inventory_deleteKanban",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete kanban",+ "name": "accounting_getDepreciationRunLines",+ "module": "accounting",+ "classification": "READ",+ "description": "get depreciation run lines","paramCount": 1,"serviceParams": ["client",- "kanbanId"+ "depreciationRunId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "depreciationRunId": {+ "type": "string"+ }+ },+ "required": [+ "depreciationRunId"+ ]+ }},{- "name": "inventory_deleteReceipt",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete receipt",+ "name": "accounting_getAssetDepreciationHistory",+ "module": "accounting",+ "classification": "READ",+ "description": "get asset depreciation history","paramCount": 1,"serviceParams": ["client",- "receiptId"+ "fixedAssetId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fixedAssetId": {+ "type": "string"+ }+ },+ "required": [+ "fixedAssetId"+ ]+ }},{- "name": "inventory_deleteReceiptLine",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete receipt line",+ "name": "accounting_getFixedAssetDisposal",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset disposal","paramCount": 1,"serviceParams": ["client",- "receiptLineId"+ "fixedAssetId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fixedAssetId": {+ "type": "string"+ }+ },+ "required": [+ "fixedAssetId"+ ]+ }},{- "name": "inventory_deleteStorageUnit",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete storage unit",+ "name": "accounting_getFixedAssetUsageLogs",+ "module": "accounting",+ "classification": "READ",+ "description": "get fixed asset usage logs","paramCount": 1,"serviceParams": ["client",- "storageUnitId"+ "fixedAssetId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fixedAssetId": {+ "type": "string"+ }+ },+ "required": [+ "fixedAssetId"+ ]+ }},{- "name": "inventory_deleteShipment",- "module": "inventory",- "classification": "DESTRUCTIVE",- "description": "delete shipment",+ "name": "accounting_upsertFixedAssetUsageLog",+ "module": "accounting",+ "classification": "WRITE",+ "description": "upsert fixed asset usage log","paramCount": 1,"serviceParams": ["client",- "shipmentId"+ "data"],"injectAuth": [- "companyId"- ]+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{- "name": "inventory_deleteShipmentLine",- "module": "inventory",+ "name": "documents_deleteDocument",+ "module": "documents","classification": "DESTRUCTIVE",- "description": "delete shipment line",+ "description": "delete document","paramCount": 1,"serviceParams": ["client",- "shipmentLineId"+ "id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "inventory_deleteShippingMethod",- "module": "inventory",+ "name": "documents_deleteDocumentFavorite",+ "module": "documents","classification": "DESTRUCTIVE",- "description": "delete shipping method",+ "description": "delete document favorite","paramCount": 1,"serviceParams": ["client",- "shippingMethodId"- ],+ "id",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "documents_deleteDocumentLabel",+ "module": "documents",+ "classification": "DESTRUCTIVE",+ "description": "delete document label",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "id",+ "label"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "label": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "label"+ ]+ }+ },+ {+ "name": "documents_getDocument",+ "module": "documents",+ "classification": "READ",+ "description": "get document",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "documentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "documentId"+ ]+ }+ },+ {+ "name": "documents_getDocuments",+ "module": "documents",+ "classification": "READ",+ "description": "get documents",+ "paramCount": 6,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "favorite": {+ "type": "boolean"+ },+ "recent": {+ "type": "boolean"+ },+ "active": {+ "type": "boolean"+ }+ }+ }+ }+ }+ },+ {+ "name": "documents_getDocumentExtensions",+ "module": "documents",+ "classification": "READ",+ "description": "get document extensions",+ "paramCount": 0,+ "serviceParams": [+ "client"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }+ },+ {+ "name": "documents_getDocumentLabels",+ "module": "documents",+ "classification": "READ",+ "description": "get document labels",+ "paramCount": 0,+ "serviceParams": [+ "client",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }+ },+ {+ "name": "documents_insertDocumentFavorite",+ "module": "documents",+ "classification": "WRITE",+ "description": "insert document favorite",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "userId"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "documents_insertDocumentLabel",+ "module": "documents",+ "classification": "WRITE",+ "description": "insert document label",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "id",+ "label",+ "userId"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "label": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "label"+ ]+ }+ },+ {+ "name": "documents_moveDocumentToTrash",+ "module": "documents",+ "classification": "WRITE",+ "description": "move document to trash",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "userId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "documents_restoreDocument",+ "module": "documents",+ "classification": "WRITE",+ "description": "restore document",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "documents_upsertDocument",+ "module": "documents",+ "classification": "WRITE",+ "description": "upsert document",+ "paramCount": 7,+ "serviceParams": [+ "client",+ "document"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "extension": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "labels": {+ "type": "array"+ },+ "readGroups": {+ "type": "string"+ },+ "writeGroups": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "name",+ "readGroups",+ "writeGroups"+ ]+ }+ },+ {+ "name": "documents_updateDocumentFavorite",+ "module": "documents",+ "classification": "WRITE",+ "description": "update document favorite",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }+ },+ {+ "name": "documents_updateDocumentLabels",+ "module": "documents",+ "classification": "WRITE",+ "description": "update document labels",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "document"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentId": {+ "type": "string"+ },+ "labels": {+ "type": "array"+ }+ },+ "required": [+ "documentId"+ ]+ }+ },+ {+ "name": "inventory_deleteBatchProperty",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete batch property",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "inventory_deleteKanban",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete kanban",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "kanbanId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "kanbanId": {+ "type": "string"+ }+ },+ "required": [+ "kanbanId"+ ]+ }+ },+ {+ "name": "inventory_deleteReceipt",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete receipt",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "receiptId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptId": {+ "type": "string"+ }+ },+ "required": [+ "receiptId"+ ]+ }+ },+ {+ "name": "inventory_deleteReceiptLine",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete receipt line",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "receiptLineId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptLineId": {+ "type": "string"+ }+ },+ "required": [+ "receiptLineId"+ ]+ }+ },+ {+ "name": "inventory_deleteStorageUnit",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete storage unit",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "storageUnitId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "storageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "storageUnitId"+ ]+ }+ },+ {+ "name": "inventory_deleteStorageUnitCascade",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete storage unit cascade",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "storageUnitId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "storageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "storageUnitId"+ ]+ }+ },+ {+ "name": "inventory_deleteShipment",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete shipment",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "shipmentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }+ },+ {+ "name": "inventory_deleteShipmentLine",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete shipment line",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "shipmentLineId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentLineId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentLineId"+ ]+ }+ },+ {+ "name": "inventory_deleteShippingMethod",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete shipping method",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "shippingMethodId"+ ],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shippingMethodId": {+ "type": "string"+ }+ },+ "required": [+ "shippingMethodId"+ ]+ }},{"name": "inventory_deleteStockTransfer",@@ -1525,7 +3473,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferId"+ ]+ }},{"name": "inventory_deleteStockTransferLine",@@ -1539,7 +3498,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferLineId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferLineId"+ ]+ }},{"name": "inventory_deleteWarehouseTransfer",@@ -1553,7 +3523,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferId": {+ "type": "string"+ }+ },+ "required": [+ "transferId"+ ]+ }},{"name": "inventory_deleteWarehouseTransferLine",@@ -1567,7 +3548,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferLineId": {+ "type": "string"+ }+ },+ "required": [+ "transferLineId"+ ]+ }},{"name": "inventory_getItemLedgerPage",@@ -1585,7 +3577,26 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "sortDescending": {},+ "page": {}+ },+ "required": [+ "itemId",+ "locationId",+ "sortDescending",+ "page"+ ]+ }},{"name": "inventory_getBatchProperties",@@ -1600,14 +3611,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemIds"+ ]+ }},{"name": "inventory_getInventoryItems","module": "inventory","classification": "READ","description": "get inventory items",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","locationId",@@ -1616,14 +3641,45 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "args"+ ]+ }},{"name": "inventory_getInventoryItemsCount","module": "inventory","classification": "READ","description": "get inventory items count",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","locationId",@@ -1632,14 +3688,45 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "args"+ ]+ }},{"name": "inventory_getKanbans","module": "inventory","classification": "READ","description": "get kanbans",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","locationId",@@ -1648,7 +3735,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "args"+ ]+ }},{"name": "inventory_getKanban",@@ -1662,7 +3780,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "kanbanId": {+ "type": "string"+ }+ },+ "required": [+ "kanbanId"+ ]+ }},{"name": "inventory_getStockTransfer",@@ -1676,7 +3805,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferId"+ ]+ }},{"name": "inventory_getStockTransferLine",@@ -1690,7 +3830,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferLineId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferLineId"+ ]+ }},{"name": "inventory_getStockTransferLines",@@ -1704,7 +3855,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferId"+ ]+ }},{"name": "inventory_getStockTransferTracking",@@ -1719,14 +3881,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransferId": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferId"+ ]+ }},{"name": "inventory_getStockTransfers","module": "inventory","classification": "READ","description": "get stock transfers",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -1734,7 +3907,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getDefaultStorageUnitOrStorageUnitWithHighestQuantity",@@ -1750,14 +3953,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "inventory_getReceipts","module": "inventory","classification": "READ","description": "get receipts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -1765,7 +3983,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getReceipt",@@ -1779,7 +4021,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptId": {+ "type": "string"+ }+ },+ "required": [+ "receiptId"+ ]+ }},{"name": "inventory_getReceiptLines",@@ -1793,7 +4046,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptId": {+ "type": "string"+ }+ },+ "required": [+ "receiptId"+ ]+ }},{"name": "inventory_getReceiptTracking",@@ -1808,7 +4072,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptId": {+ "type": "string"+ }+ },+ "required": [+ "receiptId"+ ]+ }},{"name": "inventory_getReceiptLineTracking",@@ -1823,7 +4098,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptLineId": {+ "type": "string"+ }+ },+ "required": [+ "receiptLineId"+ ]+ }},{"name": "inventory_getReceiptFiles",@@ -1838,35 +4124,74 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "lineIds"+ ]+ }},{"name": "inventory_getSerialNumbersForItem","module": "inventory","classification": "READ","description": "get serial numbers for item",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "inventory_getBatchNumbersForItem","module": "inventory","classification": "READ","description": "get batch numbers for item",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "isReadOnly": {+ "type": "boolean"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "inventory_getStorageUnitsList",@@ -1880,7 +4205,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "inventory_getStorageUnitsListForLocation",@@ -1895,14 +4224,51 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitsTreeForLocation",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage units tree for location",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "locationId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "inventory_getStorageUnits","module": "inventory","classification": "READ","description": "get storage units",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","locationId",@@ -1911,7 +4277,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "args"+ ]+ }},{"name": "inventory_getStorageUnit",@@ -1925,14 +4322,154 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "storageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "storageUnitId"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitRoots",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage unit roots",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "companyId",+ "locationId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "args"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitChildren",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage unit children",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "parentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "parentId": {+ "type": "string"+ }+ },+ "required": [+ "parentId"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitParentIdsWithChildren",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage unit parent ids with children",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "locationId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_searchStorageUnitsWithAncestors",+ "module": "inventory",+ "classification": "READ",+ "description": "search storage units with ancestors",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "companyId",+ "locationId",+ "search"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "search": {+ "type": "string"+ }+ },+ "required": [+ "locationId",+ "search"+ ]+ }},{"name": "inventory_getShipments","module": "inventory","classification": "READ","description": "get shipments",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -1940,7 +4477,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getShipment",@@ -1954,7 +4515,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }},{"name": "inventory_getShipmentLines",@@ -1968,7 +4540,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }},{"name": "inventory_getShipmentLinesWithDetails",@@ -1982,7 +4565,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }},{"name": "inventory_getShipmentFiles",@@ -1997,7 +4591,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "lineIds"+ ]+ }},{"name": "inventory_getShipmentRelatedItems",@@ -2012,7 +4620,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ },+ "sourceDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId",+ "sourceDocumentId"+ ]+ }},{"name": "inventory_getShipmentTracking",@@ -2027,7 +4650,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }},{"name": "inventory_getShipmentLineTracking",@@ -2042,7 +4676,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentLineId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentLineId"+ ]+ }},{"name": "inventory_getShippingMethod",@@ -2056,14 +4701,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shippingMethodId": {+ "type": "string"+ }+ },+ "required": [+ "shippingMethodId"+ ]+ }},{"name": "inventory_getShippingMethods","module": "inventory","classification": "READ","description": "get shipping methods",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -2071,7 +4727,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getShippingMethodsList",@@ -2085,7 +4765,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "inventory_getShippingTermsList",@@ -2099,14 +4783,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "inventory_getTrackedEntities","module": "inventory","classification": "READ","description": "get tracked entities",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -2114,7 +4802,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getTrackedEntitiesByMakeMethodId",@@ -2128,7 +4840,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "jobMakeMethodId"+ ]+ }},{"name": "inventory_getTrackedEntity",@@ -2141,8 +4864,59 @@"trackedEntityId"],"injectAuth": [- "companyId"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trackedEntityId": {+ "type": "string"+ }+ },+ "required": [+ "trackedEntityId"+ ]+ }+ },+ {+ "name": "inventory_updateTrackedEntityExpiry",+ "module": "inventory",+ "classification": "WRITE",+ "description": "update tracked entity expiry",+ "paramCount": 4,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trackedEntityId": {+ "type": "string"+ },+ "expirationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "reason": {+ "type": "string"+ },+ "source": {+ "type": "string"+ }+ },+ "required": [+ "trackedEntityId",+ "expirationDate",+ "reason"+ ]+ }},{"name": "inventory_getTrackedEntitiesByOperationId",@@ -2156,14 +4930,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "operationId": {+ "type": "string"+ }+ },+ "required": [+ "operationId"+ ]+ }},{"name": "inventory_getWarehouseTransfers","module": "inventory","classification": "READ","description": "get warehouse transfers",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -2171,7 +4956,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "inventory_getWarehouseTransfer",@@ -2185,7 +4994,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferId": {+ "type": "string"+ }+ },+ "required": [+ "transferId"+ ]+ }},{"name": "inventory_getWarehouseTransferLine",@@ -2200,7 +5020,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferId": {+ "type": "string"+ },+ "lineId": {+ "type": "string"+ }+ },+ "required": [+ "transferId",+ "lineId"+ ]+ }},{"name": "inventory_getWarehouseTransferLines",@@ -2214,14 +5049,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferId": {+ "type": "string"+ }+ },+ "required": [+ "transferId"+ ]+ }},{"name": "inventory_insertManualInventoryAdjustment","module": "inventory","classification": "WRITE","description": "insert manual inventory adjustment",- "paramCount": 0,+ "paramCount": 10,"serviceParams": ["client","inventoryAdjustment"@@ -2230,14 +5076,58 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ },+ "originalStorageUnitId": {+ "type": "string"+ },+ "adjustmentType": {+ "type": "string",+ "enum": [+ "...itemLedgerTypes",+ "Set Quantity"+ ]+ },+ "quantity": {+ "type": "number"+ },+ "trackedEntityId": {+ "type": "string"+ },+ "readableId": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "comment": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId",+ "adjustmentType"+ ]+ }},{"name": "inventory_updateBatchPropertyOrder","module": "inventory","classification": "WRITE","description": "update batch property order",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","data"@@ -2245,14 +5135,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "inventory_updateStockTransferStatus","module": "inventory","classification": "WRITE","description": "update stock transfer status",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","args"@@ -2260,14 +5164,40 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {},+ "assignee": {+ "type": [+ "string",+ "null"+ ]+ },+ "completedAt": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "status",+ "completedAt"+ ]+ }},{"name": "inventory_upsertBatchProperty","module": "inventory","classification": "WRITE","description": "upsert batch property",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","batchProperty"@@ -2276,14 +5206,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "batchProperty": {}+ },+ "required": [+ "batchProperty"+ ]+ }},{"name": "inventory_upsertKanban","module": "inventory","classification": "WRITE","description": "upsert kanban",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","kanban"@@ -2292,14 +5231,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "kanban": {}+ },+ "required": [+ "kanban"+ ]+ }},{"name": "inventory_upsertReceipt","module": "inventory","classification": "WRITE","description": "upsert receipt",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","receipt"@@ -2308,168 +5256,847 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "receiptId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "sourceDocument": {+ "type": "string"+ },+ "sourceDocumentId": {+ "type": "string"+ },+ "externalDocumentId": {+ "type": "string"+ },+ "sourceDocumentReadableId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "receiptId"+ ]+ }},{"name": "inventory_upsertStorageUnit","module": "inventory",- "classification": "WRITE",- "description": "upsert storage unit",- "paramCount": 0,+ "classification": "WRITE",+ "description": "upsert storage unit",+ "paramCount": 6,+ "serviceParams": [+ "client",+ "storageUnit"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "warehouseId": {+ "type": "string"+ },+ "parentId": {+ "type": "string"+ },+ "storageTypeIds": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_upsertShippingMethod",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert shipping method",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "shippingMethod"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "carrier": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }+ },+ {+ "name": "inventory_upsertShipment",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert shipment",+ "paramCount": 9,+ "serviceParams": [+ "client",+ "shipment"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "shipmentId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "sourceDocument": {+ "type": "string"+ },+ "sourceDocumentId": {+ "type": "string"+ },+ "trackingNumber": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "sourceDocumentReadableId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "shipmentId"+ ]+ }+ },+ {+ "name": "inventory_upsertStockTransfer",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert stock transfer",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "stockTransfer"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stockTransfer": {}+ },+ "required": [+ "stockTransfer"+ ]+ }+ },+ {+ "name": "inventory_upsertStockTransferLine",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert stock transfer line",+ "paramCount": 8,+ "serviceParams": [+ "client",+ "stockTransferLine"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "stockTransferId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "fromStorageUnitId": {+ "type": "string"+ },+ "toStorageUnitId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "pickedQuantity": {+ "type": "number"+ },+ "requiresBatchTracking": {+ "type": "string"+ }+ },+ "required": [+ "stockTransferId",+ "itemId"+ ]+ }+ },+ {+ "name": "inventory_upsertStockTransferLines",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert stock transfer lines",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "lines": {+ "type": "number"+ }+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_upsertWarehouseTransfer",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert warehouse transfer",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "transfer"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transfer": {}+ },+ "required": [+ "transfer"+ ]+ }+ },+ {+ "name": "inventory_updateWarehouseTransferStatus",+ "module": "inventory",+ "classification": "WRITE",+ "description": "update warehouse transfer status",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "transferId",+ "status",+ "updatedBy"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "transferId": {+ "type": "string"+ },+ "status": {}+ },+ "required": [+ "transferId",+ "status"+ ]+ }+ },+ {+ "name": "inventory_upsertWarehouseTransferLine",+ "module": "inventory",+ "classification": "WRITE",+ "description": "upsert warehouse transfer line",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "line"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "line": {}+ },+ "required": [+ "line"+ ]+ }+ },+ {+ "name": "inventory_getDefaultStorageUnitForJob",+ "module": "inventory",+ "classification": "READ",+ "description": "get default storage unit for job",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "itemId",+ "locationId",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitTree",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage unit tree",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "locationId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_getStorageUnitDescendants",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage unit descendants",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "storageUnitId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "storageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "storageUnitId"+ ]+ }+ },+ {+ "name": "inventory_expandStorageUnitIdsWithDescendants",+ "module": "inventory",+ "classification": "WRITE",+ "description": "expand storage unit ids with descendants",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "storageUnitIds"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "storageUnitIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "storageUnitIds"+ ]+ }+ },+ {+ "name": "inventory_getStorageTypeUsage",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage type usage",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "inventory_deleteStorageTypeWithCascade",+ "module": "inventory",+ "classification": "DESTRUCTIVE",+ "description": "delete storage type with cascade",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "inventory_getStorageTypes",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage types",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "inventory_getStorageType",+ "module": "inventory",+ "classification": "READ",+ "description": "get storage type",+ "paramCount": 1,"serviceParams": ["client",- "storageUnit"+ "id"],"injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "inventory_upsertShippingMethod",+ "name": "inventory_getStorageTypesList","module": "inventory",- "classification": "WRITE",- "description": "upsert shipping method",+ "classification": "READ",+ "description": "get storage types list","paramCount": 0,"serviceParams": ["client",- "shippingMethod"+ "companyId"],"injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "inventory_upsertShipment",+ "name": "inventory_upsertStorageType","module": "inventory","classification": "WRITE",- "description": "upsert shipment",- "paramCount": 0,+ "description": "upsert storage type",+ "paramCount": 2,"serviceParams": ["client",- "shipment"+ "storageType"],"injectAuth": ["companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{- "name": "inventory_upsertStockTransfer",+ "name": "inventory_getShelfLifeForItems","module": "inventory",- "classification": "WRITE",- "description": "upsert stock transfer",+ "classification": "READ",+ "description": "get shelf life for items","paramCount": 1,"serviceParams": ["client",- "stockTransfer"+ "itemIds"],"injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemIds"+ ]+ }},{- "name": "inventory_upsertStockTransferLine",+ "name": "inventory_getTrackedEntityExpirations","module": "inventory",- "classification": "WRITE",- "description": "upsert stock transfer line",- "paramCount": 0,+ "classification": "READ",+ "description": "get tracked entity expirations",+ "paramCount": 1,"serviceParams": ["client",- "stockTransferLine"+ "trackedEntityIds"],"injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trackedEntityIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "trackedEntityIds"+ ]+ }},{- "name": "inventory_upsertStockTransferLines",+ "name": "inventory_insertStockTransfer","module": "inventory","classification": "WRITE",- "description": "upsert stock transfer lines",- "paramCount": 0,+ "description": "Create a stock transfer with lines. Generates sequence ID automatically.",+ "paramCount": 4,"serviceParams": ["client",- "args"+ "input"],"injectAuth": ["companyId","createdBy","updatedBy"- ]- },- {- "name": "inventory_upsertWarehouseTransfer",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "lines: Array<{\n itemId: string;\n fromStorageUnitId": {},+ "stockTransferId": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "inventory_insertWarehouseTransfer","module": "inventory","classification": "WRITE",- "description": "upsert warehouse transfer",- "paramCount": 0,+ "description": "Create a warehouse transfer between locations. Generates sequence ID automatically.",+ "paramCount": 9,"serviceParams": ["client",- "transfer"+ "input"],"injectAuth": ["companyId","createdBy","updatedBy"- ]- },- {- "name": "inventory_updateWarehouseTransferStatus",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fromLocationId": {+ "type": "string"+ },+ "toLocationId": {+ "type": "string"+ },+ "transferId": {+ "type": "string"+ },+ "status": {},+ "transferDate": {+ "type": "string"+ },+ "expectedReceiptDate": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "reference": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "fromLocationId",+ "toLocationId"+ ]+ }+ },+ {+ "name": "inventory_updateStockTransfer","module": "inventory","classification": "WRITE",- "description": "update warehouse transfer status",- "paramCount": 2,+ "description": "Update an existing stock transfer",+ "paramCount": 4,"serviceParams": ["client",- "transferId",- "status",- "updatedBy"+ "input"],"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "stockTransferId": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{- "name": "inventory_upsertWarehouseTransferLine",+ "name": "inventory_updateWarehouseTransfer","module": "inventory","classification": "WRITE",- "description": "upsert warehouse transfer line",- "paramCount": 1,+ "description": "Update an existing warehouse transfer",+ "paramCount": 10,"serviceParams": ["client",- "line"+ "input"],"injectAuth": ["companyId",- "createdBy","updatedBy"- ]- },- {- "name": "inventory_getDefaultStorageUnitForJob",- "module": "inventory",- "classification": "READ",- "description": "get default storage unit for job",- "paramCount": 2,- "serviceParams": [- "client",- "itemId",- "locationId",- "companyId"],- "injectAuth": [- "companyId"- ]+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "fromLocationId": {+ "type": "string"+ },+ "toLocationId": {+ "type": "string"+ },+ "transferId": {+ "type": "string"+ },+ "status": {},+ "transferDate": {+ "type": "string"+ },+ "expectedReceiptDate": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "reference": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "invoicing_createPurchaseInvoiceFromPurchaseOrder",@@ -2487,7 +6114,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "invoicing_createSalesInvoiceFromSalesOrder",@@ -2505,7 +6143,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "invoicing_createSalesInvoiceFromShipment",@@ -2523,7 +6172,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shipmentId": {+ "type": "string"+ }+ },+ "required": [+ "shipmentId"+ ]+ }},{"name": "invoicing_deletePurchaseInvoice",@@ -2537,7 +6197,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceId"+ ]+ }},{"name": "invoicing_deletePurchaseInvoiceLine",@@ -2551,7 +6222,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceLineId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceLineId"+ ]+ }},{"name": "invoicing_deleteSalesInvoice",@@ -2565,7 +6247,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceId"+ ]+ }},{"name": "invoicing_deleteSalesInvoiceLine",@@ -2579,7 +6272,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceLineId"+ ]+ }},{"name": "invoicing_getPurchaseInvoice",@@ -2593,14 +6297,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceId"+ ]+ }},{"name": "invoicing_getPurchaseInvoices","module": "invoicing","classification": "READ","description": "get purchase invoices",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -2608,7 +6323,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "invoicing_getPurchaseInvoiceDelivery",@@ -2622,7 +6367,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceId"+ ]+ }},{"name": "invoicing_getPurchaseInvoiceLines",@@ -2636,7 +6392,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceId"+ ]+ }},{"name": "invoicing_getPurchaseInvoiceLine",@@ -2650,7 +6417,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceLineId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseInvoiceLineId"+ ]+ }},{"name": "invoicing_getSalesInvoice",@@ -2664,7 +6442,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceId"+ ]+ }},{"name": "invoicing_getSalesInvoiceCustomerDetails",@@ -2678,14 +6467,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceId"+ ]+ }},{"name": "invoicing_getSalesInvoices","module": "invoicing","classification": "READ","description": "get sales invoices",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -2693,7 +6493,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "invoicing_getSalesInvoiceShipment",@@ -2707,7 +6537,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceId"+ ]+ }},{"name": "invoicing_getSalesInvoiceLines",@@ -2721,7 +6562,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceId"+ ]+ }},{"name": "invoicing_getSalesInvoiceLine",@@ -2735,14 +6587,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesInvoiceLineId"+ ]+ }},{"name": "invoicing_updatePurchaseInvoiceExchangeRate","module": "invoicing","classification": "WRITE","description": "update purchase invoice exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -2750,14 +6613,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "invoicing_updatePurchaseInvoiceStatus","module": "invoicing","classification": "WRITE","description": "update purchase invoice status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -2765,14 +6643,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }},{"name": "invoicing_updateSalesInvoiceExchangeRate","module": "invoicing","classification": "WRITE","description": "update sales invoice exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -2780,14 +6675,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "invoicing_updateSalesInvoiceStatus","module": "invoicing","classification": "WRITE","description": "update sales invoice status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -2795,14 +6705,182 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }+ },+ {+ "name": "invoicing_insertPurchaseInvoice",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "insert purchase invoice",+ "paramCount": 14,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "supplierReference": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceSupplierId": {+ "type": "string"+ },+ "invoiceSupplierContactId": {+ "type": "string"+ },+ "invoiceSupplierLocationId": {+ "type": "string"+ },+ "dateIssued": {+ "type": "string"+ },+ "dateDue": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "supplierId"+ ]+ }+ },+ {+ "name": "invoicing_updatePurchaseInvoice",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "update purchase invoice",+ "paramCount": 15,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "supplierReference": {+ "type": [+ "string",+ "null"+ ]+ },+ "paymentTermId": {+ "type": [+ "string",+ "null"+ ]+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceSupplierId": {+ "type": [+ "string",+ "null"+ ]+ },+ "invoiceSupplierContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "invoiceSupplierLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "dateIssued": {+ "type": [+ "string",+ "null"+ ]+ },+ "dateDue": {+ "type": [+ "string",+ "null"+ ]+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "invoicing_upsertPurchaseInvoice","module": "invoicing","classification": "WRITE","description": "upsert purchase invoice",- "paramCount": 0,+ "paramCount": 15,"serviceParams": ["client","purchaseInvoice"@@ -2811,14 +6889,68 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "supplierReference": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceSupplierId": {+ "type": "string"+ },+ "invoiceSupplierContactId": {+ "type": "string"+ },+ "invoiceSupplierLocationId": {+ "type": "string"+ },+ "dateIssued": {+ "type": "string"+ },+ "dateDue": {+ "type": "string"+ },+ "supplierShippingCost": {+ "type": "number"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ }+ },+ "required": [+ "supplierId",+ "locationId"+ ]+ }},{"name": "invoicing_upsertPurchaseInvoiceDelivery","module": "invoicing","classification": "WRITE","description": "upsert purchase invoice delivery",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","purchaseInvoiceDelivery"@@ -2827,14 +6959,44 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "shippingTermId": {+ "type": "string"+ },+ "supplierShippingCost": {+ "type": "number"+ },+ "incoterm": {+ "type": "string"+ },+ "incotermLocation": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "invoicing_upsertPurchaseInvoiceLine","module": "invoicing","classification": "WRITE","description": "upsert purchase invoice line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","purchaseInvoiceLine"@@ -2843,14 +7005,204 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseInvoiceLine": {}+ },+ "required": [+ "purchaseInvoiceLine"+ ]+ }+ },+ {+ "name": "invoicing_updatePurchaseInvoiceLineOrder",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "update purchase invoice line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }+ },+ {+ "name": "invoicing_insertSalesInvoice",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "insert sales invoice",+ "paramCount": 14,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": "string"+ },+ "invoiceCustomerContactId": {+ "type": "string"+ },+ "invoiceCustomerLocationId": {+ "type": "string"+ },+ "dateIssued": {+ "type": "string"+ },+ "dateDue": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "invoicing_updateSalesInvoice",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "update sales invoice",+ "paramCount": 15,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerReference": {+ "type": [+ "string",+ "null"+ ]+ },+ "paymentTermId": {+ "type": [+ "string",+ "null"+ ]+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": [+ "string",+ "null"+ ]+ },+ "invoiceCustomerContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "invoiceCustomerLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "dateIssued": {+ "type": [+ "string",+ "null"+ ]+ },+ "dateDue": {+ "type": [+ "string",+ "null"+ ]+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "invoicing_upsertSalesInvoice","module": "invoicing","classification": "WRITE","description": "upsert sales invoice",- "paramCount": 0,+ "paramCount": 15,"serviceParams": ["client","salesInvoice"@@ -2859,14 +7211,68 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": "string"+ },+ "invoiceCustomerContactId": {+ "type": "string"+ },+ "invoiceCustomerLocationId": {+ "type": "string"+ },+ "dateIssued": {+ "type": "string"+ },+ "dateDue": {+ "type": "string"+ },+ "supplierShippingCost": {+ "type": "number"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "locationId"+ ]+ }},{"name": "invoicing_upsertSalesInvoiceShipment","module": "invoicing","classification": "WRITE","description": "upsert sales invoice shipment",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","salesInvoiceShipment"@@ -2875,14 +7281,44 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "shippingTermId": {+ "type": "string"+ },+ "shippingCost": {+ "type": "number"+ },+ "incoterm": {+ "type": "string"+ },+ "incotermLocation": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "invoicing_upsertSalesInvoiceLine","module": "invoicing","classification": "WRITE","description": "upsert sales invoice line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","salesInvoiceLine"@@ -2891,28 +7327,78 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesInvoiceLine": {}+ },+ "required": [+ "salesInvoiceLine"+ ]+ }+ },+ {+ "name": "invoicing_updateSalesInvoiceLineOrder",+ "module": "invoicing",+ "classification": "WRITE",+ "description": "update sales invoice line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "items_activateMethodVersion","module": "items","classification": "WRITE","description": "activate method version",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","payload"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_copyItem","module": "items","classification": "WRITE","description": "copy item",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","args"@@ -2921,14 +7407,53 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "targetId": {+ "type": "string"+ },+ "sourceId": {+ "type": "string"+ },+ "billOfMaterial": {+ "type": "string"+ },+ "billOfProcess": {+ "type": "string"+ },+ "parameters": {+ "type": "string"+ },+ "tools": {+ "type": "string"+ },+ "steps": {+ "type": "string"+ },+ "workInstructions": {+ "type": "string"+ }+ },+ "required": [+ "targetId",+ "sourceId",+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }},{"name": "items_copyMakeMethod","module": "items","classification": "WRITE","description": "copy make method",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","args"@@ -2937,14 +7462,53 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "targetId": {+ "type": "string"+ },+ "sourceId": {+ "type": "string"+ },+ "billOfMaterial": {+ "type": "string"+ },+ "billOfProcess": {+ "type": "string"+ },+ "parameters": {+ "type": "string"+ },+ "tools": {+ "type": "string"+ },+ "steps": {+ "type": "string"+ },+ "workInstructions": {+ "type": "string"+ }+ },+ "required": [+ "targetId",+ "sourceId",+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }},{"name": "items_createRevision","module": "items","classification": "WRITE","description": "create revision",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -2953,7 +7517,20 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "item": {},+ "revision": {+ "type": "string"+ }+ },+ "required": [+ "item",+ "revision"+ ]+ }},{"name": "items_deleteConfigurationParameter",@@ -2967,7 +7544,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteConfigurationRule",@@ -2982,7 +7570,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "field": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "field",+ "itemId"+ ]+ }},{"name": "items_deleteItemCustomerPart",@@ -2997,7 +7600,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteConfigurationParameterGroup",@@ -3011,7 +7625,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteItem",@@ -3025,7 +7650,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteItemPostingGroup",@@ -3039,7 +7675,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMaterialDimension",@@ -3053,7 +7700,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMaterialFinish",@@ -3067,7 +7725,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMaterialForm",@@ -3081,7 +7750,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMaterialGrade",@@ -3095,7 +7775,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMaterialSubstance",@@ -3109,7 +7800,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMethodMaterial",@@ -3123,7 +7825,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_assertMethodOperationIsDraft",@@ -3137,7 +7850,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "operationId": {+ "type": "string"+ }+ },+ "required": [+ "operationId"+ ]+ }},{"name": "items_deleteMethodOperation",@@ -3151,7 +7875,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "methodOperationId": {+ "type": "string"+ }+ },+ "required": [+ "methodOperationId"+ ]+ }},{"name": "items_deleteMethodOperationStep",@@ -3165,7 +7900,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMethodOperationParameter",@@ -3179,7 +7925,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteMethodOperationTool",@@ -3193,7 +7950,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_deleteUnitOfMeasure",@@ -3207,7 +7975,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getConfigurationParameters",@@ -3222,7 +8001,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getConfigurationRules",@@ -3237,7 +8027,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getConsumable",@@ -3252,14 +8053,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getConsumables","module": "items","classification": "READ","description": "get consumables",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -3267,7 +8079,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getConsumablesList",@@ -3281,7 +8123,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getItem",@@ -3295,7 +8141,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getItemCost",@@ -3310,7 +8167,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getItemCostHistory",@@ -3325,7 +8193,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getItemCustomerPart",@@ -3340,7 +8219,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getItemCustomerParts",@@ -3355,21 +8245,90 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getItemDemand","module": "items","classification": "READ","description": "get item demand",- "paramCount": 4,+ "paramCount": 3,+ "serviceParams": [+ "client",+ "{\n itemId,\n locationId,\n periods,\n companyId\n }"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "periods"+ ]+ }+ },+ {+ "name": "items_getDemandForecastSources",+ "module": "items",+ "classification": "READ",+ "description": "get demand forecast sources",+ "paramCount": 3,"serviceParams": ["client",- "{"+ "{\n itemId,\n locationId,\n periods,\n companyId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "periods"+ ]+ }},{"name": "items_getItemFiles",@@ -3384,7 +8343,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getItemPostingGroup",@@ -3398,14 +8368,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getItemPostingGroups","module": "items","classification": "READ","description": "get item posting groups",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3413,7 +8394,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getItemPostingGroupsList",@@ -3427,7 +8432,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getItemManufacturing",@@ -3442,7 +8451,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getItemPlanning",@@ -3458,7 +8478,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getItemQuantities",@@ -3474,7 +8509,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getItemReplenishment",@@ -3489,7 +8539,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getItemStorageUnitQuantities",@@ -3505,21 +8566,58 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getItemSupply","module": "items","classification": "READ","description": "get item supply",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client",- "{"+ "{\n itemId,\n locationId,\n periods,\n companyId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "periods"+ ]+ }},{"name": "items_getItemUnitSalePrice",@@ -3534,7 +8632,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "items_getJobMaterialUsageForItem",+ "module": "items",+ "classification": "READ",+ "description": "get job material usage for item",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "{ itemId, companyId }"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getMaterialUsedIn",@@ -3549,7 +8683,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getMakeMethods",@@ -3564,7 +8709,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getMakeMethodById",@@ -3579,7 +8735,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "makeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "makeMethodId"+ ]+ }},{"name": "items_getMaterial",@@ -3594,14 +8761,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getMaterials","module": "items","classification": "READ","description": "get materials",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -3609,7 +8787,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialsList",@@ -3623,7 +8831,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getMaterialDimension",@@ -3637,14 +8849,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialDimensions","module": "items","classification": "READ","description": "get material dimensions",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -3652,7 +8875,34 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "isMetric": {+ "type": "boolean"+ }+ }+ }+ }+ }},{"name": "items_getMaterialDimensionList",@@ -3668,7 +8918,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialFormId": {+ "type": "string"+ },+ "isMetric": {+ "type": "boolean"+ }+ },+ "required": [+ "materialFormId",+ "isMetric"+ ]+ }},{"name": "items_getMaterialFinish",@@ -3682,14 +8947,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialFinishes","module": "items","classification": "READ","description": "get material finishes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3697,7 +8973,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialFinishList",@@ -3712,7 +9012,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialSubstanceId": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId"+ ]+ }},{"name": "items_getMaterialForm",@@ -3726,14 +9037,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialForms","module": "items","classification": "READ","description": "get material forms",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3741,7 +9063,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialFormsList",@@ -3755,14 +9101,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getMaterialGrades","module": "items","classification": "READ","description": "get material grades",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3770,7 +9120,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialGrade",@@ -3784,7 +9158,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialGradeList",@@ -3799,7 +9184,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialSubstanceId": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId"+ ]+ }},{"name": "items_getMaterialSubstance",@@ -3813,14 +9209,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialSubstances","module": "items","classification": "READ","description": "get material substances",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3828,7 +9235,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialSubstancesList",@@ -3842,7 +9273,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getMethodMaterial",@@ -3856,14 +9291,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialId": {+ "type": "string"+ }+ },+ "required": [+ "materialId"+ ]+ }},{"name": "items_getMethodMaterials","module": "items","classification": "READ","description": "get method materials",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3871,7 +9317,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMethodMaterialsByMakeMethod",@@ -3885,14 +9355,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "makeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "makeMethodId"+ ]+ }},{"name": "items_getMethodOperations","module": "items","classification": "READ","description": "get method operations",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -3900,7 +9381,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMethodOperationsByMakeMethodId",@@ -3914,7 +9419,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "makeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "makeMethodId"+ ]+ }},{"name": "items_getMethodTree",@@ -3928,7 +9444,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "makeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "makeMethodId"+ ]+ }},{"name": "items_getMethodTreeArray",@@ -3942,63 +9469,134 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "makeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "makeMethodId"+ ]+ }},{"name": "items_getOpenJobMaterials","module": "items","classification": "READ","description": "get open job materials",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{\n itemId,\n companyId,\n locationId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getOpenProductionOrders","module": "items","classification": "READ","description": "get open production orders",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{\n itemId,\n companyId,\n locationId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getOpenPurchaseOrderLines","module": "items","classification": "READ","description": "get open purchase order lines",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{\n itemId,\n companyId,\n locationId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getOpenSalesOrderLines","module": "items","classification": "READ","description": "get open sales order lines",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{\n itemId,\n companyId,\n locationId\n }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getPart",@@ -4013,14 +9611,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getParts","module": "items","classification": "READ","description": "get parts",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -4028,7 +9637,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getPartsList",@@ -4042,7 +9681,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getPartUsedIn",@@ -4057,7 +9700,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getPickMethod",@@ -4073,7 +9727,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_getPickMethods",@@ -4088,14 +9757,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getServices","module": "items","classification": "READ","description": "get services",- "paramCount": 7,+ "paramCount": 6,"serviceParams": ["client","companyId",@@ -4103,7 +9783,49 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "type": {+ "type": [+ "string",+ "null"+ ]+ },+ "group": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getService",@@ -4118,7 +9840,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getServicesList",@@ -4132,7 +9865,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getSupplierParts",@@ -4147,7 +9884,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getTool",@@ -4162,14 +9910,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_getTools","module": "items","classification": "READ","description": "get tools",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -4177,7 +9936,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getToolsList",@@ -4191,7 +9980,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_getUnitOfMeasure",@@ -4206,14 +9999,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getUnitOfMeasures","module": "items","classification": "READ","description": "get unit of measures",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -4221,7 +10025,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getUnitOfMeasuresList",@@ -4235,14 +10063,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "items_updateConfigurationParameterGroupOrder","module": "items","classification": "WRITE","description": "update configuration parameter group order",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","data"@@ -4250,14 +10082,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_updateDefaultRevision","module": "items","classification": "WRITE","description": "update default revision",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","data"@@ -4265,14 +10111,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_updateConfigurationParameterOrder","module": "items","classification": "WRITE","description": "update configuration parameter order",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","data"@@ -4280,14 +10137,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ },+ "configurationParameterGroupId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_updateItemCost","module": "items","classification": "WRITE","description": "update item cost",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","itemId",@@ -4296,14 +10170,37 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "cost": {+ "type": "object",+ "properties": {+ "unitCost": {+ "type": "number"+ }+ },+ "required": [+ "unitCost"+ ]+ }+ },+ "required": [+ "itemId",+ "cost"+ ]+ }},{"name": "items_updateMaterialOrder","module": "items","classification": "WRITE","description": "update material order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -4311,14 +10208,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "items_updateOperationOrder","module": "items","classification": "WRITE","description": "update operation order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -4326,14 +10238,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "items_updateRevision","module": "items","classification": "WRITE","description": "update revision",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","revision"@@ -4341,14 +10268,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "revision": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "revision"+ ]+ }},{"name": "items_upsertConfigurationParameter","module": "items","classification": "WRITE","description": "upsert configuration parameter",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","configurationParameter"@@ -4357,7 +10299,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "configurationParameter": {}+ },+ "required": [+ "configurationParameter"+ ]+ }},{"name": "items_upsertConfigurationParameterGroup",@@ -4373,14 +10324,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "configurationParameterGroup": {}+ },+ "required": [+ "configurationParameterGroup"+ ]+ }},{"name": "items_upsertConfigurationRule","module": "items","classification": "WRITE","description": "upsert configuration rule",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","configurationRule"@@ -4389,14 +10349,248 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "field": {+ "type": "string"+ },+ "code": {+ "type": "string"+ }+ },+ "required": [+ "field",+ "code"+ ]+ }+ },+ {+ "name": "items_upsertItemDefaultPickMethod",+ "module": "items",+ "classification": "WRITE",+ "description": "upsert item default pick method",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }+ },+ {+ "name": "items_getRecipeProcessIdsForItem",+ "module": "items",+ "classification": "READ",+ "description": "get recipe process ids for item",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "itemId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }+ },+ {+ "name": "items_getItemShelfLife",+ "module": "items",+ "classification": "READ",+ "description": "get item shelf life",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "itemId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }+ },+ {+ "name": "items_getBomHasShelfLifeManagedInput",+ "module": "items",+ "classification": "READ",+ "description": "get bom has shelf life managed input",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "itemId",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }+ },+ {+ "name": "items_upsertItemShelfLife",+ "module": "items",+ "classification": "WRITE",+ "description": "upsert item shelf life",+ "paramCount": 6,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "mode": {+ "type": "string"+ },+ "days": {+ "type": "number"+ },+ "triggerProcessId": {+ "type": "string"+ },+ "triggerTiming": {+ "type": "string"+ },+ "calculateFromBom": {+ "type": "boolean"+ }+ },+ "required": [+ "itemId"+ ]+ }+ },+ {+ "name": "items_upsertPickMethodWithShelfLife",+ "module": "items",+ "classification": "WRITE",+ "description": "upsert pick method with shelf life",+ "paramCount": 5,+ "serviceParams": [+ "db",+ "args"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "defaultStorageUnitId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {},+ "shelfLife: {\n mode": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }+ },+ {+ "name": "items_cascadeItemTrackingType",+ "module": "items",+ "classification": "WRITE",+ "description": "cascade item tracking type",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "newType": {}+ },+ "required": [+ "itemIds",+ "newType"+ ]+ }},{"name": "items_upsertConsumable","module": "items","classification": "WRITE","description": "upsert consumable",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","consumable"@@ -4405,14 +10599,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "consumable": {}+ },+ "required": [+ "consumable"+ ]+ }},{"name": "items_upsertPart","module": "items","classification": "WRITE","description": "upsert part",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","part"@@ -4421,14 +10624,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "part": {}+ },+ "required": [+ "part"+ ]+ }},{"name": "items_updateItem","module": "items","classification": "WRITE","description": "update item",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","item"@@ -4436,14 +10648,39 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "readableId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "replenishmentSystem": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "name",+ "replenishmentSystem"+ ]+ }},{"name": "items_upsertItemCost","module": "items","classification": "WRITE","description": "upsert item cost",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","itemCost"@@ -4452,14 +10689,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "itemPostingGroupId": {+ "type": "string"+ },+ "costingMethod": {+ "type": "number"+ }+ },+ "required": [+ "itemId",+ "costingMethod"+ ]+ }},{"name": "items_upsertPickMethod","module": "items","classification": "WRITE","description": "upsert pick method",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","pickMethod"@@ -4468,14 +10723,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "defaultStorageUnitId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "locationId"+ ]+ }},{"name": "items_upsertItemManufacturing","module": "items","classification": "WRITE","description": "upsert item manufacturing",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","partManufacturing"@@ -4484,14 +10757,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "requiresConfiguration": {+ "type": "string"+ },+ "lotSize": {+ "type": "number"+ },+ "scrapPercentage": {+ "type": "number"+ },+ "leadTime": {+ "type": "number"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_upsertItemPlanning","module": "items","classification": "WRITE","description": "upsert item planning",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","partPlanning"@@ -4500,14 +10796,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "partPlanning": {}+ },+ "required": [+ "partPlanning"+ ]+ }},{"name": "items_upsertItemPurchasing","module": "items","classification": "WRITE","description": "upsert item purchasing",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","itemPurchasing"@@ -4516,14 +10821,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "preferredSupplierId": {+ "type": "string"+ },+ "conversionFactor": {+ "type": "number"+ },+ "leadTime": {+ "type": "number"+ },+ "purchasingUnitOfMeasureCode": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_upsertItemPostingGroup","module": "items","classification": "WRITE","description": "upsert item posting group",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","itemPostingGroup"@@ -4532,14 +10860,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "items_upsertSupplierPart","module": "items","classification": "WRITE","description": "upsert supplier part",- "paramCount": 0,+ "paramCount": 9,"serviceParams": ["client","supplierPart"@@ -4548,14 +10893,50 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "supplierPartId": {+ "type": "string"+ },+ "supplierUnitOfMeasureCode": {+ "type": "string"+ },+ "minimumOrderQuantity": {+ "type": "number"+ },+ "orderMultiple": {+ "type": "number"+ },+ "conversionFactor": {+ "type": "number"+ },+ "unitPrice": {+ "type": "number"+ }+ },+ "required": [+ "itemId",+ "supplierId"+ ]+ }},{"name": "items_upsertItemCustomerPart","module": "items","classification": "WRITE","description": "upsert item customer part",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","customerPart"@@ -4564,14 +10945,39 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerPartId": {+ "type": "string"+ },+ "customerPartRevision": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "customerId",+ "customerPartId"+ ]+ }},{"name": "items_upsertItemUnitSalePrice","module": "items","classification": "WRITE","description": "upsert item unit sale price",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","itemUnitSalePrice"@@ -4580,14 +10986,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "unitSalePrice": {+ "type": "number"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "items_upsertMakeMethodVersion","module": "items","classification": "WRITE","description": "upsert make method version",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","makeMethodVersion"@@ -4596,14 +11016,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "copyFromId": {+ "type": "string"+ },+ "activeVersionId": {+ "type": "string"+ },+ "version": {+ "type": "number"+ }+ },+ "required": [+ "copyFromId"+ ]+ }},{"name": "items_upsertMethodMaterial","module": "items","classification": "WRITE","description": "upsert method material",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","methodMaterial"@@ -4612,14 +11049,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "makeMethodId": {+ "type": "string"+ },+ "order": {+ "type": "number"+ },+ "itemType": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "makeMethodId"+ ]+ }},{"name": "items_upsertMethodOperation","module": "items","classification": "WRITE","description": "upsert method operation",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","methodOperation"@@ -4628,14 +11086,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "methodOperation": {}+ },+ "required": [+ "methodOperation"+ ]+ }},{"name": "items_upsertMethodOperationStep","module": "items","classification": "WRITE","description": "upsert method operation step",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","methodOperationStep"@@ -4644,14 +11111,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "methodOperationStep": {}+ },+ "required": [+ "methodOperationStep"+ ]+ }},{"name": "items_upsertMethodOperationParameter","module": "items","classification": "WRITE","description": "upsert method operation parameter",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","methodOperationParameter"@@ -4660,14 +11136,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "methodOperationParameter": {}+ },+ "required": [+ "methodOperationParameter"+ ]+ }},{"name": "items_upsertMethodOperationTool","module": "items","classification": "WRITE","description": "upsert method operation tool",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","methodOperationTool"@@ -4676,14 +11161,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "methodOperationTool": {}+ },+ "required": [+ "methodOperationTool"+ ]+ }},{"name": "items_upsertMaterial","module": "items","classification": "WRITE","description": "upsert material",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","material"@@ -4692,14 +11186,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "material": {}+ },+ "required": [+ "material"+ ]+ }},{"name": "items_upsertMaterialDimension","module": "items","classification": "WRITE","description": "upsert material dimension",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","materialDimension"@@ -4708,14 +11211,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "materialFormId": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "materialFormId"+ ]+ }},{"name": "items_upsertMaterialFinish","module": "items","classification": "WRITE","description": "upsert material finish",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","materialFinish"@@ -4724,14 +11245,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "materialSubstanceId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId",+ "name"+ ]+ }},{"name": "items_upsertMaterialForm","module": "items","classification": "WRITE","description": "upsert material form",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","materialForm"@@ -4740,14 +11279,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "code": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "code"+ ]+ }},{"name": "items_upsertMaterialGrade","module": "items","classification": "WRITE","description": "upsert material grade",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","materialGrade"@@ -4756,7 +11313,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "materialSubstanceId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId",+ "name"+ ]+ }},{"name": "items_deleteMaterialType",@@ -4770,14 +11345,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialTypes","module": "items","classification": "READ","description": "get material types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -4785,7 +11371,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "items_getMaterialType",@@ -4799,7 +11409,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "items_getMaterialTypeList",@@ -4815,14 +11436,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialSubstanceId": {+ "type": "string"+ },+ "materialFormId": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId",+ "materialFormId"+ ]+ }},{"name": "items_upsertMaterialType","module": "items","classification": "WRITE","description": "upsert material type",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","materialType"@@ -4831,14 +11467,40 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "materialSubstanceId": {+ "type": "string"+ },+ "materialFormId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "code": {+ "type": "string"+ }+ },+ "required": [+ "materialSubstanceId",+ "materialFormId",+ "name",+ "code"+ ]+ }},{"name": "items_upsertMaterialSubstance","module": "items","classification": "WRITE","description": "upsert material substance",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","materialSubstance"@@ -4847,14 +11509,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "code": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "code"+ ]+ }},{"name": "items_upsertService","module": "items","classification": "WRITE","description": "upsert service",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","service"@@ -4863,14 +11543,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "service": {}+ },+ "required": [+ "service"+ ]+ }},{"name": "items_upsertUnitOfMeasure","module": "items","classification": "WRITE","description": "upsert unit of measure",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","unitOfMeasure"@@ -4879,14 +11568,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "code": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "code",+ "name"+ ]+ }},{"name": "items_upsertTool","module": "items","classification": "WRITE","description": "upsert tool",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","tool"@@ -4895,7 +11602,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "tool": {}+ },+ "required": [+ "tool"+ ]+ }},{"name": "items_getSupplierPriceBreaksForItems",@@ -4909,7 +11625,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemIds"+ ]+ }},{"name": "items_lookupBuyPrice",@@ -4925,7 +11655,26 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "qty": {+ "type": "number"+ },+ "fallbackCost": {+ "type": "number"+ }+ },+ "required": [+ "itemId",+ "qty",+ "fallbackCost"+ ]+ }},{"name": "items_getSupplierPartPriceBreaks",@@ -4939,7 +11688,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierPartId": {+ "type": "string"+ }+ },+ "required": [+ "supplierPartId"+ ]+ }},{"name": "people_deleteAttribute",@@ -4953,7 +11713,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "attributeId": {+ "type": "string"+ }+ },+ "required": [+ "attributeId"+ ]+ }},{"name": "people_deleteAttributeCategory",@@ -4967,7 +11738,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "attributeCategoryId": {+ "type": "string"+ }+ },+ "required": [+ "attributeCategoryId"+ ]+ }},{"name": "people_deleteDepartment",@@ -4981,7 +11763,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "departmentId": {+ "type": "string"+ }+ },+ "required": [+ "departmentId"+ ]+ }},{"name": "people_deleteHoliday",@@ -4995,7 +11788,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "holidayId": {+ "type": "string"+ }+ },+ "required": [+ "holidayId"+ ]+ }},{"name": "people_deleteShift",@@ -5009,7 +11813,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shiftId": {+ "type": "string"+ }+ },+ "required": [+ "shiftId"+ ]+ }},{"name": "people_getAttribute",@@ -5023,14 +11838,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "attributeId": {+ "type": "string"+ }+ },+ "required": [+ "attributeId"+ ]+ }},{"name": "people_getAttributeCategories","module": "people","classification": "READ","description": "get attribute categories",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -5038,7 +11864,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "people_getAttributeCategory",@@ -5052,7 +11899,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "people_getAttributeDataTypes",@@ -5065,7 +11923,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getDepartment",@@ -5079,14 +11941,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "departmentId": {+ "type": "string"+ }+ },+ "required": [+ "departmentId"+ ]+ }},{"name": "people_getDepartments","module": "people","classification": "READ","description": "get departments",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5094,7 +11967,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "people_getDepartmentsList",@@ -5108,7 +12005,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getDepartmentsTree",@@ -5122,7 +12023,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getEmployeeJob",@@ -5137,7 +12042,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_getEmployeeSummary",@@ -5152,7 +12068,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_getHoliday",@@ -5166,14 +12093,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "holidayId": {+ "type": "string"+ }+ },+ "required": [+ "holidayId"+ ]+ }},{"name": "people_getHolidays","module": "people","classification": "READ","description": "get holidays",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5181,14 +12119,56 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "people_getHolidayYears",+ "module": "people",+ "classification": "READ",+ "description": "get holiday years",+ "paramCount": 0,+ "serviceParams": [+ "client",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getPeople","module": "people","classification": "READ","description": "get people",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5196,14 +12176,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "people_getContacts","module": "people","classification": "READ","description": "get contacts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5211,7 +12215,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "people_getShift",@@ -5225,14 +12253,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shiftId": {+ "type": "string"+ }+ },+ "required": [+ "shiftId"+ ]+ }},{"name": "people_getShifts","module": "people","classification": "READ","description": "get shifts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5240,7 +12279,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "people_getShiftsList",@@ -5254,14 +12317,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "people_insertAttribute","module": "people","classification": "WRITE","description": "insert attribute",- "paramCount": 6,+ "paramCount": 5,"serviceParams": ["client","attribute"@@ -5270,14 +12347,43 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "attributeDataTypeId": {+ "type": "number"+ },+ "userAttributeCategoryId": {+ "type": "string"+ },+ "listOptions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "canSelfManage": {+ "type": "boolean"+ }+ },+ "required": [+ "name",+ "attributeDataTypeId",+ "userAttributeCategoryId",+ "canSelfManage"+ ]+ }},{"name": "people_insertAttributeCategory","module": "people","classification": "WRITE","description": "insert attribute category",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","attributeCategory"@@ -5286,14 +12392,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "emoji": {+ "type": "string"+ },+ "public": {+ "type": "boolean"+ }+ },+ "required": [+ "name",+ "public"+ ]+ }},{"name": "people_insertEmployeeJob","module": "people","classification": "WRITE","description": "insert employee job",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","job"@@ -5302,14 +12426,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "people_updateAttribute","module": "people","classification": "WRITE","description": "update attribute",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","attribute"@@ -5317,14 +12455,38 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "listOptions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "canSelfManage": {+ "type": "boolean"+ }+ },+ "required": [+ "name",+ "canSelfManage"+ ]+ }},{"name": "people_updateAttributeCategory","module": "people","classification": "WRITE","description": "update attribute category",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","attributeCategory"@@ -5332,14 +12494,36 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "emoji": {+ "type": "string"+ },+ "public": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "name",+ "public"+ ]+ }},{"name": "people_updateAttributeSortOrder","module": "people","classification": "WRITE","description": "update attribute sort order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -5347,14 +12531,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "people_updateEmployeeJob","module": "people","classification": "WRITE","description": "update employee job",- "paramCount": 1,+ "paramCount": 2,"serviceParams": ["client","employeeId",@@ -5363,14 +12562,27 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ },+ "employeeJob": {}+ },+ "required": [+ "employeeId",+ "employeeJob"+ ]+ }},{"name": "people_upsertDepartment","module": "people","classification": "WRITE","description": "upsert department",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","department"@@ -5379,14 +12591,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "parentDepartmentId": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "people_upsertHoliday","module": "people","classification": "WRITE","description": "upsert holiday",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","holiday"@@ -5395,14 +12624,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "date": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "date"+ ]+ }},{"name": "people_upsertShift","module": "people","classification": "WRITE","description": "upsert shift",- "paramCount": 0,+ "paramCount": 12,"serviceParams": ["client","shift"@@ -5411,42 +12658,124 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "startTime": {+ "type": "string"+ },+ "endTime": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "monday": {+ "type": "string"+ },+ "tuesday": {+ "type": "string"+ },+ "wednesday": {+ "type": "string"+ },+ "thursday": {+ "type": "string"+ },+ "friday": {+ "type": "string"+ },+ "saturday": {+ "type": "string"+ },+ "sunday": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "startTime",+ "endTime",+ "locationId",+ "monday",+ "tuesday",+ "wednesday",+ "thursday",+ "friday",+ "saturday",+ "sunday"+ ]+ }},{"name": "people_clockIn","module": "people","classification": "WRITE","description": "clock in",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_clockOut","module": "people","classification": "WRITE","description": "clock out",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ },+ "clockOut": {+ "type": "string"+ },+ "note": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_createTimeCardEntry","module": "people","classification": "WRITE","description": "create time card entry",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","entry"@@ -5455,7 +12784,34 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ },+ "clockIn": {+ "type": "string"+ },+ "clockOut": {+ "type": [+ "string",+ "null"+ ]+ },+ "note": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "employeeId",+ "clockIn"+ ]+ }},{"name": "people_deleteTimeCardEntry",@@ -5469,7 +12825,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "entryId": {+ "type": "string"+ }+ },+ "required": [+ "entryId"+ ]+ }},{"name": "people_getClockedInEmployees",@@ -5483,7 +12850,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getOpenClockEntry",@@ -5498,7 +12869,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_getRecentTimecards",@@ -5512,7 +12894,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getScheduledEmployeesToday",@@ -5526,7 +12912,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "people_getTimeCardEntry",@@ -5540,28 +12930,56 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "entryId": {+ "type": "string"+ }+ },+ "required": [+ "entryId"+ ]+ }},{"name": "people_getTimeCardEntries","module": "people","classification": "READ","description": "get time card entries",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ },+ "from": {+ "type": "string"+ },+ "to": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "people_getTimecardEntries","module": "people","classification": "READ","description": "get timecard entries",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -5569,7 +12987,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "people_getWeeklyHoursForEmployees",@@ -5584,14 +13026,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "employeeIds"+ ]+ }},{"name": "people_updateTimeCardEntry","module": "people","classification": "WRITE","description": "update time card entry",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","args"@@ -5599,63 +13055,170 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "entryId": {+ "type": "string"+ },+ "clockIn": {+ "type": "string"+ },+ "clockOut": {+ "type": [+ "string",+ "null"+ ]+ },+ "note": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "entryId"+ ]+ }},{"name": "production_convertSalesOrderLinesToJobs","module": "production","classification": "WRITE","description": "convert sales order lines to jobs",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client",- "{"+ "{\n orderId,\n companyId,\n userId\n }"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "orderId": {+ "type": "string"+ }+ },+ "required": [+ "orderId"+ ]+ }},{"name": "production_calculateJobPriority","module": "production","classification": "WRITE","description": "calculate job priority",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","params"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ },+ "// Optional - if updating an existing job\n dueDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "deadlineType": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "// Optional - if updating an existing job\n dueDate",+ "deadlineType",+ "locationId"+ ]+ }},{"name": "production_deleteDemandForecasts","module": "production","classification": "DESTRUCTIVE","description": "delete demand forecasts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","params"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "futurePeriodIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "futurePeriodIds"+ ]+ }},{"name": "production_deleteDemandProjections","module": "production","classification": "DESTRUCTIVE","description": "delete demand projections",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","params"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "futurePeriodIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "futurePeriodIds"+ ]+ }},{"name": "production_deleteJob",@@ -5669,7 +13232,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_deleteJobMaterial",@@ -5683,7 +13257,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMaterialId": {+ "type": "string"+ }+ },+ "required": [+ "jobMaterialId"+ ]+ }},{"name": "production_deleteJobOperation",@@ -5697,7 +13282,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationId": {+ "type": "string"+ }+ },+ "required": [+ "jobOperationId"+ ]+ }},{"name": "production_deleteJobOperationStep",@@ -5711,7 +13307,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_deleteJobOperationParameter",@@ -5725,7 +13332,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_deleteJobOperationTool",@@ -5739,7 +13357,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_deleteProcedure",@@ -5753,7 +13382,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureId": {+ "type": "string"+ }+ },+ "required": [+ "procedureId"+ ]+ }},{"name": "production_deleteProcedureStep",@@ -5768,7 +13408,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureStepId": {+ "type": "string"+ }+ },+ "required": [+ "procedureStepId"+ ]+ }},{"name": "production_deleteProcedureParameter",@@ -5783,7 +13434,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureParameterId": {+ "type": "string"+ }+ },+ "required": [+ "procedureParameterId"+ ]+ }},{"name": "production_deleteProductionEvent",@@ -5797,7 +13459,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "productionEventId": {+ "type": "string"+ }+ },+ "required": [+ "productionEventId"+ ]+ }},{"name": "production_deleteProductionQuantity",@@ -5811,7 +13484,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "productionQuantityId": {+ "type": "string"+ }+ },+ "required": [+ "productionQuantityId"+ ]+ }},{"name": "production_getActiveJobOperationByJobId",@@ -5826,7 +13510,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getActiveJobOperationsByLocation",@@ -5841,7 +13536,23 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "workCenterIds": {+ "type": "array",+ "items": {}+ }+ },+ "required": [+ "locationId",+ "workCenterIds"+ ]+ }},{"name": "production_getJobsByDateRange",@@ -5857,7 +13568,26 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "startDate": {+ "type": "string"+ },+ "endDate": {+ "type": "string"+ }+ },+ "required": [+ "locationId",+ "startDate",+ "endDate"+ ]+ }},{"name": "production_getUnscheduledJobs",@@ -5871,7 +13601,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "production_getActiveProductionEvents",@@ -5885,7 +13626,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "production_deleteScrapReason",@@ -5899,7 +13644,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scrapReasonId": {+ "type": "string"+ }+ },+ "required": [+ "scrapReasonId"+ ]+ }},{"name": "production_deleteFailureMode",@@ -5913,7 +13669,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "failureModeId": {+ "type": "string"+ }+ },+ "required": [+ "failureModeId"+ ]+ }},{"name": "production_deleteMaintenanceDispatch",@@ -5927,7 +13694,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_deleteMaintenanceDispatchComment",@@ -5941,7 +13719,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "commentId": {+ "type": "string"+ }+ },+ "required": [+ "commentId"+ ]+ }},{"name": "production_deleteMaintenanceDispatchEvent",@@ -5955,7 +13744,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "eventId": {+ "type": "string"+ }+ },+ "required": [+ "eventId"+ ]+ }},{"name": "production_deleteMaintenanceDispatchItem",@@ -5969,7 +13769,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "production_deleteMaintenanceDispatchWorkCenter",@@ -5983,7 +13794,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "workCenterId": {+ "type": "string"+ }+ },+ "required": [+ "workCenterId"+ ]+ }},{"name": "production_deleteMaintenanceSchedule",@@ -5997,7 +13819,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "production_deleteMaintenanceScheduleItem",@@ -6011,42 +13844,97 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "production_getDemandForecasts","module": "production","classification": "READ","description": "get demand forecasts",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","params"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "periodIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "periodIds"+ ]+ }},{"name": "production_getDemandProjections","module": "production","classification": "READ","description": "get demand projections",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","params"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "periodIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemId",+ "locationId",+ "periodIds"+ ]+ }},{"name": "production_getJobDocuments","module": "production","classification": "READ","description": "get job documents",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -6054,7 +13942,39 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": [+ "string",+ "null"+ ]+ },+ "salesOrderLineId": {+ "type": [+ "string",+ "null"+ ]+ },+ "quoteLineId": {+ "type": [+ "string",+ "null"+ ]+ },+ "itemId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_getJobDocumentsWithItemId",@@ -6070,7 +13990,20 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "job": {},+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "job",+ "itemId"+ ]+ }},{"name": "production_getJob",@@ -6084,7 +14017,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_getJobByOperationId",@@ -6098,7 +14042,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "operationId": {+ "type": "string"+ }+ },+ "required": [+ "operationId"+ ]+ }},{"name": "production_getJobPurchaseOrderLines",@@ -6112,14 +14067,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobs","module": "production","classification": "READ","description": "get jobs",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -6127,7 +14093,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "production_getJobsBySalesOrderLine",@@ -6141,7 +14128,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderLineId"+ ]+ }},{"name": "production_getJobsList",@@ -6155,7 +14153,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "production_getJobMakeMethodById",@@ -6170,7 +14172,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "jobMakeMethodId"+ ]+ }},{"name": "production_getRootMakeMethod",@@ -6185,14 +14198,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobMaterialsWithQuantityOnHand","module": "production","classification": "READ","description": "get job materials with quantity on hand",- "paramCount": 5,+ "paramCount": 3,"serviceParams": ["client","jobId",@@ -6202,7 +14226,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }+ },+ "required": [+ "jobId",+ "locationId"+ ]+ }},{"name": "production_getJobMethodTree",@@ -6216,7 +14276,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobMethodTreeArray",@@ -6230,7 +14301,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobMaterial",@@ -6244,7 +14326,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialId": {+ "type": "string"+ }+ },+ "required": [+ "materialId"+ ]+ }},{"name": "production_getJobMaterialsByMethodId",@@ -6258,7 +14351,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "jobMakeMethodId"+ ]+ }},{"name": "production_getJobOperation",@@ -6272,22 +14376,90 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationId": {+ "type": "string"+ }+ },+ "required": [+ "jobOperationId"+ ]+ }},{"name": "production_getJobOperations","module": "production","classification": "READ",- "description": "get job operations",- "paramCount": 4,+ "description": "get job operations",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "jobId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }+ },+ "required": [+ "jobId"+ ]+ }+ },+ {+ "name": "production_getJobOperationDependencies",+ "module": "production",+ "classification": "READ",+ "description": "get job operation dependencies",+ "paramCount": 1,"serviceParams": ["client",- "jobId",- "args"+ "jobId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobOperationsAssignedToEmployee",@@ -6302,7 +14474,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "production_getJobOperationAttachments",@@ -6316,7 +14499,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "jobOperationIds"+ ]+ }},{"name": "production_getJobOperationsList",@@ -6330,7 +14527,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getJobOperationsByMethodId",@@ -6344,14 +14552,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "jobMakeMethodId"+ ]+ }},{"name": "production_getJobOperationStepRecords","module": "production","classification": "READ","description": "get job operation step records",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","jobId",@@ -6359,7 +14578,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "jobId",+ "args"+ ]+ }},{"name": "production_getOutsideOperationsByJobId",@@ -6374,7 +14624,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getProcedure",@@ -6388,7 +14649,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_getProcedureSteps",@@ -6402,7 +14674,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureId": {+ "type": "string"+ }+ },+ "required": [+ "procedureId"+ ]+ }},{"name": "production_getProcedureParameters",@@ -6416,14 +14699,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureId": {+ "type": "string"+ }+ },+ "required": [+ "procedureId"+ ]+ }},{"name": "production_getProcedureVersions","module": "production","classification": "READ","description": "get procedure versions",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","procedure",@@ -6431,14 +14725,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "version": {+ "type": "number"+ }+ },+ "required": [+ "name",+ "version"+ ]+ }},{"name": "production_getProcedures","module": "production","classification": "READ","description": "get procedures",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -6446,7 +14755,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "production_getProceduresList",@@ -6460,7 +14790,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "production_getProductionEvent",@@ -6474,14 +14808,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_getProductionEvents","module": "production","classification": "READ","description": "get production events",- "paramCount": 4,+ "paramCount": 2,"serviceParams": ["client","jobOperationIds",@@ -6489,7 +14834,42 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "args": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }+ },+ "required": [+ "jobOperationIds"+ ]+ }},{"name": "production_getProductionEventsPage",@@ -6506,7 +14886,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationId": {+ "type": "string"+ },+ "sortDescending": {},+ "page": {}+ },+ "required": [+ "jobOperationId",+ "sortDescending",+ "page"+ ]+ }},{"name": "production_getProductionEventsByOperations",@@ -6520,14 +14915,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "jobOperationIds"+ ]+ }},{"name": "production_getProductionPlanning","module": "production","classification": "READ","description": "get production planning",- "paramCount": 6,+ "paramCount": 3,"serviceParams": ["client","locationId",@@ -6537,14 +14946,52 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "periods",+ "args"+ ]+ }},{"name": "production_getProductionProjections","module": "production","classification": "READ","description": "get production projections",- "paramCount": 6,+ "paramCount": 3,"serviceParams": ["client","locationId",@@ -6554,7 +15001,45 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "periods",+ "args"+ ]+ }},{"name": "production_getProductionQuantity",@@ -6568,14 +15053,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_getProductionQuantities","module": "production","classification": "READ","description": "get production quantities",- "paramCount": 4,+ "paramCount": 2,"serviceParams": ["client","jobOperationIds",@@ -6583,7 +15079,42 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "args": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }+ },+ "required": [+ "jobOperationIds"+ ]+ }},{"name": "production_getProductionDataByOperations",@@ -6597,7 +15128,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "jobOperationIds"+ ]+ }},{"name": "production_getScrapReasonsList",@@ -6611,7 +15156,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "production_getScrapReason",@@ -6625,14 +15174,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scrapReasonId": {+ "type": "string"+ }+ },+ "required": [+ "scrapReasonId"+ ]+ }},{"name": "production_getScrapReasons","module": "production","classification": "READ","description": "get scrap reasons",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -6640,7 +15200,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "production_getFailureMode",@@ -6654,14 +15238,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "failureModeId": {+ "type": "string"+ }+ },+ "required": [+ "failureModeId"+ ]+ }},{"name": "production_getFailureModes","module": "production","classification": "READ","description": "get failure modes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -6669,7 +15264,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "production_getFailureModesList",@@ -6683,7 +15302,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "production_getMaintenanceDispatch",@@ -6697,14 +15320,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_getMaintenanceDispatches","module": "production","classification": "READ","description": "get maintenance dispatches",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -6712,7 +15346,34 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string"+ }+ }+ }+ }+ }},{"name": "production_getMaintenanceDispatchComments",@@ -6726,7 +15387,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_getMaintenanceDispatchEvents",@@ -6740,7 +15412,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_getMaintenanceDispatchItems",@@ -6754,7 +15437,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_getMaintenanceDispatchWorkCenters",@@ -6768,7 +15462,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "production_getMaintenanceSchedule",@@ -6782,14 +15487,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "production_getMaintenanceSchedules","module": "production","classification": "READ","description": "get maintenance schedules",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -6797,7 +15513,34 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "active": {+ "type": "boolean"+ }+ }+ }+ }+ }},{"name": "production_getMaintenanceScheduleItems",@@ -6811,7 +15554,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "production_getTrackedEntityByJobId",@@ -6825,7 +15579,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_getTrackedEntitiesByJobId",@@ -6839,14 +15604,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_recalculateJobOperationDependencies","module": "production","classification": "WRITE","description": "recalculate job operation dependencies",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","params"@@ -6854,7 +15630,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ }+ },+ "required": [+ "jobId"+ ]+ }},{"name": "production_recalculateJobRequirements",@@ -6869,7 +15656,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "// job id\n companyId": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "// job id\n companyId"+ ]+ }},{"name": "production_recalculateJobMakeMethodRequirements",@@ -6884,21 +15686,50 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "// job make method id\n companyId": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "// job make method id\n companyId"+ ]+ }},{"name": "production_runMRP","module": "production","classification": "WRITE","description": "run m r p",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","params"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "type": {},+ "id": {+ "type": "string"+ }+ },+ "required": [+ "type",+ "id"+ ]+ }},{"name": "production_updateJobBatchNumber",@@ -6914,14 +15745,32 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trackedEntityId": {+ "type": "string"+ },+ "value": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "trackedEntityId",+ "value"+ ]+ }},{"name": "production_updateJobStatus","module": "production","classification": "WRITE","description": "update job status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","params"@@ -6929,14 +15778,35 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "status"+ ]+ }},{"name": "production_updateJobMaterialOrder","module": "production","classification": "WRITE","description": "update job material order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -6944,14 +15814,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "production_updateJobOperationOrder","module": "production","classification": "WRITE","description": "update job operation order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -6959,14 +15844,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "production_updateJobOperationStepOrder","module": "production","classification": "WRITE","description": "update job operation step order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -6974,14 +15874,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "production_updateKanbanJob","module": "production","classification": "WRITE","description": "update kanban job",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","params"@@ -6989,14 +15904,32 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "jobId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "jobId"+ ]+ }},{"name": "production_updateQuoteOperationStepOrder","module": "production","classification": "WRITE","description": "update quote operation step order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -7004,14 +15937,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "production_updateMethodOperationStepOrder","module": "production","classification": "WRITE","description": "update method operation step order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -7019,7 +15967,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "production_updateJobOperationStatus",@@ -7036,7 +15999,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "status"+ ]+ }},{"name": "production_updateJobOperationDueDate",@@ -7053,14 +16031,32 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "dueDate"+ ]+ }},{"name": "production_updateProcedureStepOrder","module": "production","classification": "WRITE","description": "update procedure step order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -7068,14 +16064,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "production_upsertProductionEvent","module": "production","classification": "WRITE","description": "upsert production event",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","productionEvent"@@ -7084,14 +16095,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "productionEvent": {}+ },+ "required": [+ "productionEvent"+ ]+ }},{"name": "production_updateProductionQuantity","module": "production","classification": "WRITE","description": "update production quantity",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","productionQuantity"@@ -7099,14 +16119,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "jobOperationId": {+ "type": "string"+ },+ "type": {+ "type": "number"+ }+ },+ "required": [+ "jobOperationId"+ ]+ }},{"name": "production_upsertProductionQuantity","module": "production","classification": "WRITE","description": "upsert production quantity",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","productionQuantity"@@ -7115,14 +16152,256 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "jobOperationId": {+ "type": "string"+ },+ "type": {+ "type": "number"+ }+ },+ "required": [+ "jobOperationId"+ ]+ }+ },+ {+ "name": "production_insertJob",+ "module": "production",+ "classification": "WRITE",+ "description": "Create a new job with all business logic - generates sequence, resolves location, copies method from item, recalculates requirements. LLM can create a job with just itemId and quantity.",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "input",+ "options"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "input": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "jobId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "startDate": {+ "type": "string"+ },+ "priority": {+ "type": "number"+ },+ "status": {+ "type": "string"+ },+ "deadlineType": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ },+ "unitOfMeasureCode": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "salesOrderId": {+ "type": "string"+ },+ "salesOrderLineId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "parentJobId": {+ "type": "string"+ },+ "modelUploadId": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {},+ "configuration": {}+ },+ "required": [+ "itemId",+ "quantity"+ ]+ },+ "options": {+ "type": "object",+ "properties": {+ "skipMethod": {+ "type": "boolean"+ },+ "skipRecalculate": {+ "type": "boolean"+ },+ "methodSource": {+ "type": "string",+ "enum": [+ "item",+ "quoteLine"+ ]+ }+ }+ }+ },+ "required": [+ "input"+ ]+ }+ },+ {+ "name": "production_updateJob",+ "module": "production",+ "classification": "WRITE",+ "description": "Update an existing job - handles priority recalculation when deadline changes",+ "paramCount": 21,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "startDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "number"+ },+ "deadlineType": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ },+ "unitOfMeasureCode": {+ "type": "string"+ },+ "customerId": {+ "type": [+ "string",+ "null"+ ]+ },+ "salesOrderId": {+ "type": [+ "string",+ "null"+ ]+ },+ "salesOrderLineId": {+ "type": [+ "string",+ "null"+ ]+ },+ "quoteId": {+ "type": [+ "string",+ "null"+ ]+ },+ "quoteLineId": {+ "type": [+ "string",+ "null"+ ]+ },+ "parentJobId": {+ "type": [+ "string",+ "null"+ ]+ },+ "modelUploadId": {+ "type": [+ "string",+ "null"+ ]+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {},+ "scrapQuantity": {+ "type": "number"+ },+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "production_upsertJob","module": "production","classification": "WRITE","description": "upsert job",- "paramCount": 1,+ "paramCount": 2,"serviceParams": ["client","job",@@ -7132,14 +16411,26 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "job": {},+ "status": {+ "type": "string"+ }+ },+ "required": [+ "job"+ ]+ }},{"name": "production_upsertJobMaterial","module": "production","classification": "WRITE","description": "upsert job material",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","jobMaterial"@@ -7148,14 +16439,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobMaterial": {}+ },+ "required": [+ "jobMaterial"+ ]+ }},{"name": "production_upsertJobOperation","module": "production","classification": "WRITE","description": "upsert job operation",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","jobOperation"@@ -7164,14 +16464,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperation": {}+ },+ "required": [+ "jobOperation"+ ]+ }},{"name": "production_upsertJobOperationStep","module": "production","classification": "WRITE","description": "upsert job operation step",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","jobOperationStep"@@ -7180,14 +16489,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationStep": {}+ },+ "required": [+ "jobOperationStep"+ ]+ }},{"name": "production_upsertJobOperationParameter","module": "production","classification": "WRITE","description": "upsert job operation parameter",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","jobOperationParameter"@@ -7196,14 +16514,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationParameter": {}+ },+ "required": [+ "jobOperationParameter"+ ]+ }},{"name": "production_upsertJobOperationTool","module": "production","classification": "WRITE","description": "upsert job operation tool",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","jobOperationTool"@@ -7212,14 +16539,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobOperationTool": {}+ },+ "required": [+ "jobOperationTool"+ ]+ }},{"name": "production_upsertJobMethod","module": "production","classification": "WRITE","description": "upsert job method",- "paramCount": 12,+ "paramCount": 2,"serviceParams": ["client","type",@@ -7229,14 +16565,77 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "type": {+ "type": "string",+ "enum": [+ "itemToJob",+ "quoteLineToJob"+ ]+ },+ "jobMethod": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "configuration": {},+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }+ },+ "required": [+ "type",+ "jobMethod"+ ]+ }},{"name": "production_upsertJobMaterialMakeMethod","module": "production","classification": "WRITE","description": "upsert job material make method",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","jobMaterial"@@ -7245,14 +16644,61 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "configuration": {},+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }},{"name": "production_upsertMakeMethodFromJob","module": "production","classification": "WRITE","description": "upsert make method from job",- "paramCount": 10,+ "paramCount": 3,"serviceParams": ["client","jobMethod"@@ -7261,14 +16707,60 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }},{"name": "production_upsertMakeMethodFromJobMethod","module": "production","classification": "WRITE","description": "upsert make method from job method",- "paramCount": 10,+ "paramCount": 3,"serviceParams": ["client","jobMethod"@@ -7277,14 +16769,60 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }},{"name": "production_upsertProcedure","module": "production","classification": "WRITE","description": "upsert procedure",- "paramCount": 0,+ "paramCount": 6,"serviceParams": ["client","procedure"@@ -7293,14 +16831,40 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "version": {+ "type": "number"+ },+ "processId": {+ "type": "string"+ },+ "content": {+ "type": "string"+ },+ "copyFromId": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "production_upsertProcedureStep","module": "production","classification": "WRITE","description": "upsert procedure step",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","procedureStep"@@ -7309,14 +16873,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "procedureStep": {}+ },+ "required": [+ "procedureStep"+ ]+ }},{"name": "production_upsertProcedureParameter","module": "production","classification": "WRITE","description": "upsert procedure parameter",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","procedureParameter"@@ -7325,14 +16898,36 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "procedureId": {+ "type": "string"+ },+ "key": {+ "type": "string"+ },+ "value": {+ "type": "string"+ }+ },+ "required": [+ "procedureId",+ "key",+ "value"+ ]+ }},{"name": "production_upsertScrapReason","module": "production","classification": "WRITE","description": "upsert scrap reason",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","scrapReason"@@ -7341,14 +16936,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "production_upsertFailureMode","module": "production","classification": "WRITE","description": "upsert failure mode",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","failureMode"@@ -7357,14 +16966,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "production_upsertMaintenanceDispatch","module": "production","classification": "WRITE","description": "upsert maintenance dispatch",- "paramCount": 0,+ "paramCount": 12,"serviceParams": ["client","dispatch"@@ -7373,14 +16996,59 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "severity": {+ "type": "string"+ },+ "source": {+ "type": "string"+ },+ "oeeImpact": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ },+ "suspectedFailureModeId": {+ "type": "string"+ },+ "plannedStartTime": {+ "type": "string"+ },+ "plannedEndTime": {+ "type": "string"+ },+ "assignee": {+ "type": "string"+ },+ "content": {+ "type": "string"+ }+ },+ "required": [+ "status",+ "priority"+ ]+ }},{"name": "production_upsertMaintenanceDispatchComment","module": "production","classification": "WRITE","description": "upsert maintenance dispatch comment",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","comment"@@ -7389,14 +17057,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "comment": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "comment"+ ]+ }},{"name": "production_upsertMaintenanceDispatchEvent","module": "production","classification": "WRITE","description": "upsert maintenance dispatch event",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","event"@@ -7405,14 +17091,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "event": {}+ },+ "required": [+ "event"+ ]+ }},{"name": "production_upsertMaintenanceDispatchItem","module": "production","classification": "WRITE","description": "upsert maintenance dispatch item",- "paramCount": 0,+ "paramCount": 6,"serviceParams": ["client","item"@@ -7421,14 +17116,42 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "unitOfMeasureCode": {+ "type": "string"+ },+ "unitCost": {+ "type": "number"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "itemId",+ "unitOfMeasureCode"+ ]+ }},{"name": "production_upsertMaintenanceDispatchWorkCenter","module": "production","classification": "WRITE","description": "upsert maintenance dispatch work center",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","workCenter"@@ -7437,14 +17160,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "workCenterId"+ ]+ }},{"name": "production_upsertMaintenanceSchedule","module": "production","classification": "WRITE","description": "upsert maintenance schedule",- "paramCount": 0,+ "paramCount": 8,"serviceParams": ["client","schedule"@@ -7453,14 +17194,50 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ },+ "frequency": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "estimatedDuration": {+ "type": "number"+ },+ "active": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "workCenterId",+ "frequency",+ "priority",+ "active"+ ]+ }},{"name": "production_upsertMaintenanceScheduleItem","module": "production","classification": "WRITE","description": "upsert maintenance schedule item",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","item"@@ -7469,7 +17246,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceScheduleId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "unitOfMeasureCode": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceScheduleId",+ "itemId",+ "unitOfMeasureCode"+ ]+ }},{"name": "production_upsertDemandForecasts",@@ -7485,7 +17287,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "forecasts": {}+ },+ "required": [+ "forecasts"+ ]+ }},{"name": "production_upsertDemandProjections",@@ -7501,7 +17312,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "forecasts": {}+ },+ "required": [+ "forecasts"+ ]+ }},{"name": "production_triggerJobSchedule",@@ -7518,7 +17338,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "jobId": {+ "type": "string"+ },+ "mode": {},+ "direction": {}+ },+ "required": [+ "jobId",+ "mode",+ "direction"+ ]+ }},{"name": "purchasing_closePurchaseOrder",@@ -7532,22 +17367,48 @@"userId"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_convertSupplierQuoteToOrder","module": "purchasing","classification": "WRITE","description": "convert supplier quote to order",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","payload"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "selectedLines": {}+ },+ "required": [+ "id",+ "selectedLines"+ ]+ }},{"name": "purchasing_deletePurchaseOrder",@@ -7561,7 +17422,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_deletePurchaseOrderLine",@@ -7575,7 +17447,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderLineId"+ ]+ }},{"name": "purchasing_deleteSupplier",@@ -7589,7 +17472,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_deleteSupplierContact",@@ -7604,7 +17498,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "supplierContactId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId",+ "supplierContactId"+ ]+ }},{"name": "purchasing_deleteSupplierLocation",@@ -7619,7 +17528,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "supplierLocationId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId",+ "supplierLocationId"+ ]+ }},{"name": "purchasing_deleteSupplierProcess",@@ -7633,7 +17557,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierProcessId": {+ "type": "string"+ }+ },+ "required": [+ "supplierProcessId"+ ]+ }},{"name": "purchasing_deleteSupplierQuote",@@ -7647,7 +17582,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_deleteSupplierQuoteLine",@@ -7661,7 +17607,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_deleteSupplierType",@@ -7675,7 +17632,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierTypeId": {+ "type": "string"+ }+ },+ "required": [+ "supplierTypeId"+ ]+ }},{"name": "purchasing_getPurchaseOrder",@@ -7689,7 +17657,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_finalizeSupplierQuote",@@ -7705,14 +17684,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getPurchaseOrders","module": "purchasing","classification": "READ","description": "get purchase orders",- "paramCount": 6,+ "paramCount": 5,"serviceParams": ["client","companyId",@@ -7720,7 +17710,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "purchasing_getPurchaseOrderDelivery",@@ -7734,7 +17760,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_getPurchaseOrderLocations",@@ -7748,7 +17785,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_getPurchaseOrderPayment",@@ -7762,7 +17810,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_getPurchaseOrderLines",@@ -7776,7 +17835,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_getPurchaseOrderLine",@@ -7790,7 +17860,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderLineId"+ ]+ }},{"name": "purchasing_getPurchaseOrderSuppliers",@@ -7804,7 +17885,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_getPurchasingDocumentsAssignedToMe",@@ -7819,14 +17904,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_getPurchasingPlanning","module": "purchasing","classification": "READ","description": "get purchasing planning",- "paramCount": 6,+ "paramCount": 3,"serviceParams": ["client","locationId",@@ -7836,7 +17925,45 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "periods": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "locationId",+ "periods",+ "args"+ ]+ }},{"name": "purchasing_getPurchasingTerms",@@ -7850,7 +17977,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_getSupplier",@@ -7864,14 +17995,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierApprovalContext","module": "purchasing","classification": "READ","description": "get supplier approval context",- "paramCount": 2,+ "paramCount": 3,"serviceParams": ["serviceRole","supplierId",@@ -7881,7 +18023,27 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "serviceRole": {},+ "supplierId": {+ "type": "string"+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "serviceRole",+ "supplierId",+ "status"+ ]+ }},{"name": "purchasing_getSupplierContact",@@ -7895,7 +18057,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierContactId": {+ "type": "string"+ }+ },+ "required": [+ "supplierContactId"+ ]+ }},{"name": "purchasing_getSupplierContacts",@@ -7909,7 +18082,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierInteraction",@@ -7923,7 +18107,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "opportunityId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "opportunityId"+ ]+ }},{"name": "purchasing_getSupplierInteractionDocuments",@@ -7938,7 +18136,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "interactionId": {+ "type": "string"+ }+ },+ "required": [+ "interactionId"+ ]+ }},{"name": "purchasing_getSupplierInteractionLineDocuments",@@ -7953,7 +18162,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineId": {+ "type": "string"+ }+ },+ "required": [+ "lineId"+ ]+ }},{"name": "purchasing_getSupplierLocations",@@ -7967,7 +18187,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierLocation",@@ -7981,7 +18212,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierContactId": {+ "type": "string"+ }+ },+ "required": [+ "supplierContactId"+ ]+ }},{"name": "purchasing_getSupplierPayment",@@ -7995,7 +18237,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierProcessById",@@ -8009,7 +18262,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierProcessId": {+ "type": "string"+ }+ },+ "required": [+ "supplierProcessId"+ ]+ }},{"name": "purchasing_getSupplierProcessesByProcess",@@ -8023,7 +18287,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "processId": {+ "type": "string"+ }+ },+ "required": [+ "processId"+ ]+ }},{"name": "purchasing_getSupplierProcessesBySupplier",@@ -8037,7 +18312,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierQuote",@@ -8051,7 +18337,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getSupplierQuoteByInteractionId",@@ -8065,7 +18362,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "interactionId": {+ "type": "string"+ }+ },+ "required": [+ "interactionId"+ ]+ }},{"name": "purchasing_getSupplierQuoteByExternalLinkId",@@ -8079,14 +18387,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "externalLinkId": {+ "type": "string"+ }+ },+ "required": [+ "externalLinkId"+ ]+ }},{"name": "purchasing_getSupplierQuotes","module": "purchasing","classification": "READ","description": "get supplier quotes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -8094,7 +18413,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "purchasing_getSupplierQuoteLine",@@ -8108,7 +18451,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteLineId"+ ]+ }},{"name": "purchasing_getSupplierQuoteLines",@@ -8122,7 +18476,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getSupplierQuoteLinePrices",@@ -8136,7 +18501,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteLineId"+ ]+ }},{"name": "purchasing_getSupplierQuoteLinePricesByQuoteId",@@ -8150,7 +18526,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getSupplierQuotesList",@@ -8164,7 +18551,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_getSupplierShipping",@@ -8178,14 +18569,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSuppliers","module": "purchasing","classification": "READ","description": "get suppliers",- "paramCount": 6,+ "paramCount": 5,"serviceParams": ["client","companyId",@@ -8193,7 +18595,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "type": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "purchasing_getSuppliersList",@@ -8207,7 +18645,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_getSupplierType",@@ -8221,14 +18663,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierTypeId": {+ "type": "string"+ }+ },+ "required": [+ "supplierTypeId"+ ]+ }},{"name": "purchasing_getSupplierTypes","module": "purchasing","classification": "READ","description": "get supplier types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -8236,7 +18689,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "purchasing_getSupplierTypesList",@@ -8250,14 +18727,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "purchasing_insertSupplier","module": "purchasing","classification": "WRITE","description": "insert supplier",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","supplier"@@ -8266,14 +18747,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "readableId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "supplierStatus": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "supplierStatus"+ ]+ }},{"name": "purchasing_insertSupplierContact","module": "purchasing","classification": "WRITE","description": "insert supplier contact",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","supplierContact"@@ -8282,7 +18784,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierLocationId": {+ "type": "string"+ }+ }+ }},{"name": "purchasing_insertSupplierInteraction",@@ -8299,14 +18812,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_insertSupplierLocation","module": "purchasing","classification": "WRITE","description": "insert supplier location",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","supplierLocation"@@ -8315,7 +18839,24 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "address: {\n addressLine1": {},+ "customFields": {}+ },+ "required": [+ "supplierId",+ "name"+ ]+ }},{"name": "purchasing_finalizePurchaseOrder",@@ -8331,7 +18872,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_sendSupplierQuote",@@ -8345,15 +18897,27 @@"userId"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{- "name": "purchasing_updatePurchaseOrder",+ "name": "purchasing_updatePurchaseOrderStatusLegacy","module": "purchasing","classification": "WRITE",- "description": "update purchase order",- "paramCount": 3,+ "description": "update purchase order status legacy",+ "paramCount": 2,"serviceParams": ["client","purchaseOrder"@@ -8361,14 +18925,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "status"+ ]+ }},{"name": "purchasing_updatePurchaseOrderExchangeRate","module": "purchasing","classification": "WRITE","description": "update purchase order exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -8376,14 +18955,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "purchasing_updatePurchaseOrderFavorite","module": "purchasing","classification": "WRITE","description": "update purchase order favorite",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -8391,14 +18985,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }},{"name": "purchasing_updatePurchaseOrderStatus","module": "purchasing","classification": "WRITE","description": "update purchase order status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -8406,14 +19015,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }},{"name": "purchasing_updateSupplierAccounting","module": "purchasing","classification": "WRITE","description": "update supplier accounting",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","supplierAccounting"@@ -8421,14 +19047,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierTypeId": {+ "type": "string"+ }+ }+ }},{"name": "purchasing_updateSupplierContact","module": "purchasing","classification": "WRITE","description": "update supplier contact",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","supplierContact"@@ -8436,14 +19073,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierLocationId": {+ "type": "string"+ }+ }+ }},{"name": "purchasing_updateSupplierLocation","module": "purchasing","classification": "WRITE","description": "update supplier location",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","supplierLocation"@@ -8451,14 +19099,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "addressId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "address: {\n addressLine1": {},+ "customFields": {}+ },+ "required": [+ "addressId",+ "name"+ ]+ }},{"name": "purchasing_updateSupplierPayment","module": "purchasing","classification": "WRITE","description": "update supplier payment",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","supplierPayment"@@ -8466,14 +19131,37 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "invoiceSupplierId": {+ "type": "string"+ },+ "invoiceSupplierLocationId": {+ "type": "string"+ },+ "invoiceSupplierContactId": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_updateSupplierQuoteExchangeRate","module": "purchasing","classification": "WRITE","description": "update supplier quote exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -8481,14 +19169,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "purchasing_updateSupplierQuoteFavorite","module": "purchasing","classification": "WRITE","description": "update supplier quote favorite",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -8496,14 +19199,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }},{"name": "purchasing_updateSupplierQuoteStatus","module": "purchasing","classification": "WRITE","description": "update supplier quote status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -8511,14 +19229,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }},{"name": "purchasing_updateSupplierShipping","module": "purchasing","classification": "WRITE","description": "update supplier shipping",- "paramCount": 0,+ "paramCount": 7,"serviceParams": ["client","supplierShipping"@@ -8526,28 +19261,68 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "shippingSupplierId": {+ "type": "string"+ },+ "shippingSupplierLocationId": {+ "type": "string"+ },+ "shippingSupplierContactId": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "incoterm": {+ "type": "string"+ },+ "incotermLocation": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_getSupplierTax","module": "purchasing","classification": "READ","description": "get supplier tax",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","supplierId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }},{"name": "purchasing_updateSupplierTax","module": "purchasing","classification": "WRITE","description": "update supplier tax",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","supplierTax"@@ -8555,14 +19330,156 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierTax": {}+ },+ "required": [+ "supplierTax"+ ]+ }+ },+ {+ "name": "purchasing_insertPurchaseOrder",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "Create a new purchase order with all business logic - generates sequence, creates supplier interaction, resolves payment/shipping defaults from supplier. LLM can create a PO with just supplierId.",+ "paramCount": 14,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "purchaseOrderId": {+ "type": "string"+ },+ "purchaseOrderType": {+ "type": "string",+ "enum": [+ "Purchase",+ "Return",+ "Outside Processing"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "orderDate": {+ "type": "string"+ },+ "supplierContactId": {+ "type": "string"+ },+ "supplierLocationId": {+ "type": "string"+ },+ "supplierQuoteId": {+ "type": "string"+ },+ "receiptRequestedDate": {+ "type": "string"+ },+ "supplierReference": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "supplierId"+ ]+ }+ },+ {+ "name": "purchasing_updatePurchaseOrder",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "Update an existing purchase order - handles exchange rate updates when currency changes",+ "paramCount": 11,+ "serviceParams": [+ "client",+ "input",+ "companyGroupId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "orderDate": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "supplierContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierReference": {+ "type": "string"+ },+ "purchaseOrderType": {+ "type": "string"+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_upsertPurchaseOrder","module": "purchasing","classification": "WRITE","description": "upsert purchase order",- "paramCount": 1,+ "paramCount": 2,"serviceParams": ["client","purchaseOrder",@@ -8572,14 +19489,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrder": {+ "type": "string"+ },+ "receiptRequestedDate": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrder"+ ]+ }},{"name": "purchasing_upsertPurchaseOrderDelivery","module": "purchasing","classification": "WRITE","description": "upsert purchase order delivery",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","purchaseOrderDelivery"@@ -8588,14 +19519,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderDelivery": {}+ },+ "required": [+ "purchaseOrderDelivery"+ ]+ }},{"name": "purchasing_upsertPurchaseOrderLine","module": "purchasing","classification": "WRITE","description": "upsert purchase order line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","purchaseOrderLine"@@ -8604,14 +19544,53 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderLine": {}+ },+ "required": [+ "purchaseOrderLine"+ ]+ }+ },+ {+ "name": "purchasing_updatePurchaseOrderLineOrder",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "update purchase order line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "purchasing_upsertPurchaseOrderPayment","module": "purchasing","classification": "WRITE","description": "upsert purchase order payment",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","purchaseOrderPayment"@@ -8620,14 +19599,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceSupplierId": {+ "type": "string"+ },+ "invoiceSupplierLocationId": {+ "type": "string"+ },+ "invoiceSupplierContactId": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_upsertSupplier","module": "purchasing","classification": "WRITE","description": "upsert supplier",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","supplier"@@ -8636,14 +19638,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "readableId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "supplierStatus": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "supplierStatus"+ ]+ }},{"name": "purchasing_upsertSupplierProcess","module": "purchasing","classification": "WRITE","description": "upsert supplier process",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","supplierProcess"@@ -8652,14 +19675,157 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "processId": {+ "type": "string"+ },+ "minimumCost": {+ "type": "number"+ },+ "leadTime": {+ "type": "number"+ }+ },+ "required": [+ "supplierId",+ "processId"+ ]+ }+ },+ {+ "name": "purchasing_insertSupplierQuote",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "Create a new supplier quote with all business logic - generates sequence, creates supplier interaction, sets up external link. LLM can create a quote with just supplierId.",+ "paramCount": 13,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": "string"+ },+ "supplierQuoteId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "supplierContactId": {+ "type": "string"+ },+ "supplierLocationId": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {},+ "quotedDate": {+ "type": "string"+ },+ "supplierReference": {+ "type": "string"+ },+ "supplierQuoteType": {+ "type": "string"+ }+ },+ "required": [+ "supplierId"+ ]+ }+ },+ {+ "name": "purchasing_updateSupplierQuote",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "Update an existing supplier quote - handles exchange rate updates when currency changes",+ "paramCount": 8,+ "serviceParams": [+ "client",+ "input",+ "companyGroupId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "expirationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "supplierLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_upsertSupplierQuote","module": "purchasing","classification": "WRITE","description": "upsert supplier quote",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","supplierQuote"@@ -8668,14 +19834,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuote": {}+ },+ "required": [+ "supplierQuote"+ ]+ }},{"name": "purchasing_upsertSupplierQuoteLine","module": "purchasing","classification": "WRITE","description": "upsert supplier quote line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","supplierQuoteLine"@@ -8684,14 +19859,53 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteLine": {}+ },+ "required": [+ "supplierQuoteLine"+ ]+ }+ },+ {+ "name": "purchasing_updateSupplierQuoteLineOrder",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "update supplier quote line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "purchasing_upsertSupplierType","module": "purchasing","classification": "WRITE","description": "upsert supplier type",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","supplierType"@@ -8700,7 +19914,21 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "purchasing_deletePurchasingRFQ",@@ -8714,7 +19942,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }},{"name": "purchasing_deletePurchasingRFQLine",@@ -8728,7 +19967,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqLineId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqLineId"+ ]+ }},{"name": "purchasing_getPurchasingRFQ",@@ -8742,14 +19992,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_getPurchasingRFQs","module": "purchasing","classification": "READ","description": "get purchasing r f qs",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -8757,7 +20018,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "purchasing_getPurchasingRFQLine",@@ -8771,7 +20056,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineId": {+ "type": "string"+ }+ },+ "required": [+ "lineId"+ ]+ }},{"name": "purchasing_getPurchasingRFQLines",@@ -8785,7 +20081,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }},{"name": "purchasing_getPurchasingRFQSuppliers",@@ -8799,14 +20106,122 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }+ },+ {+ "name": "purchasing_insertPurchasingRFQ",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "insert purchasing r f q",+ "paramCount": 8,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "rfqId": {+ "type": "string"+ },+ "rfqDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "employeeId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {}+ }+ }+ },+ {+ "name": "purchasing_updatePurchasingRFQ",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "update purchasing r f q",+ "paramCount": 8,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "rfqDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "employeeId": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string"+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "purchasing_upsertPurchasingRFQ","module": "purchasing","classification": "WRITE","description": "upsert purchasing r f q",- "paramCount": 9,+ "paramCount": 8,"serviceParams": ["client","purchasingRfq"@@ -8815,7 +20230,38 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "rfqId": {+ "type": "string"+ },+ "rfqDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "employeeId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "rfqId",+ "rfqDate"+ ]+ }},{"name": "purchasing_upsertPurchasingRFQLine",@@ -8831,7 +20277,46 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqLine": {}+ },+ "required": [+ "purchasingRfqLine"+ ]+ }+ },+ {+ "name": "purchasing_updatePurchasingRFQLineOrder",+ "module": "purchasing",+ "classification": "WRITE",+ "description": "update purchasing r f q line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "purchasing_upsertPurchasingRFQSuppliers",@@ -8850,14 +20335,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ },+ "supplierIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "purchasingRfqId",+ "supplierIds"+ ]+ }},{"name": "purchasing_updatePurchasingRFQStatus","module": "purchasing","classification": "WRITE","description": "update purchasing r f q status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","args"@@ -8865,7 +20368,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "status"+ ]+ }},{"name": "purchasing_getLinkedSupplierQuotes",@@ -8879,7 +20403,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }},{"name": "purchasing_getLinkedPurchasingRfqs",@@ -8893,7 +20428,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getLinkedPurchasingRfqsForInteraction",@@ -8907,7 +20453,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierInteractionId": {+ "type": "string"+ }+ },+ "required": [+ "supplierInteractionId"+ ]+ }},{"name": "purchasing_getSiblingQuotesForQuote",@@ -8921,7 +20478,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "supplierQuoteId"+ ]+ }},{"name": "purchasing_getLinkedPurchasingRfqsForOrder",@@ -8935,7 +20503,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchaseOrderId": {+ "type": "string"+ }+ },+ "required": [+ "purchaseOrderId"+ ]+ }},{"name": "purchasing_getSupplierQuotesForComparison",@@ -8949,7 +20528,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }},{"name": "purchasing_getPurchasingRFQSuppliersWithLinks",@@ -8963,7 +20553,53 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasingRfqId": {+ "type": "string"+ }+ },+ "required": [+ "purchasingRfqId"+ ]+ }+ },+ {+ "name": "purchasing_getDefaultAttachmentsForPO",+ "module": "purchasing",+ "classification": "READ",+ "description": "get default attachments for p o",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ },+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "supplierId",+ "itemIds"+ ]+ }},{"name": "quality_activateGauge",@@ -8977,7 +20613,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeId"+ ]+ }},{"name": "quality_deactivateGauge",@@ -8991,7 +20638,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeId"+ ]+ }},{"name": "quality_deleteGauge",@@ -9005,7 +20663,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeId"+ ]+ }},{"name": "quality_deleteGaugeCalibrationRecord",@@ -9019,7 +20688,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeCalibrationRecordId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeCalibrationRecordId"+ ]+ }},{"name": "quality_deleteGaugeType",@@ -9033,7 +20713,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeTypeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeTypeId"+ ]+ }},{"name": "quality_deleteIssue",@@ -9047,7 +20738,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceId"+ ]+ }},{"name": "quality_deleteIssueAssociation",@@ -9062,7 +20764,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "type": {+ "type": "string"+ },+ "associationId": {+ "type": "string"+ }+ },+ "required": [+ "type",+ "associationId"+ ]+ }},{"name": "quality_deleteIssueType",@@ -9076,7 +20793,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceTypeId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceTypeId"+ ]+ }},{"name": "quality_deleteIssueWorkflow",@@ -9090,7 +20818,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceWorkflowId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceWorkflowId"+ ]+ }},{"name": "quality_deleteRequiredAction",@@ -9104,7 +20843,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "requiredActionId": {+ "type": "string"+ }+ },+ "required": [+ "requiredActionId"+ ]+ }},{"name": "quality_deleteQualityDocument",@@ -9118,7 +20868,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "qualityDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "qualityDocumentId"+ ]+ }},{"name": "quality_deleteQualityDocumentStep",@@ -9133,7 +20894,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "qualityDocumentStepId": {+ "type": "string"+ }+ },+ "required": [+ "qualityDocumentStepId"+ ]+ }},{"name": "quality_deleteRisk",@@ -9147,7 +20919,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "riskId": {+ "type": "string"+ }+ },+ "required": [+ "riskId"+ ]+ }},{"name": "quality_getIssueFromExternalLink",@@ -9161,7 +20944,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getGauge",@@ -9175,14 +20969,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeId"+ ]+ }},{"name": "quality_getGauges","module": "quality","classification": "READ","description": "get gauges",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9190,7 +20995,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getGaugesList",@@ -9204,7 +21033,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getGaugeCalibrationRecord",@@ -9218,14 +21051,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getGaugeCalibrationRecords","module": "quality","classification": "READ","description": "get gauge calibration records",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9233,7 +21077,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getGaugeCalibrationRecordsByGaugeId",@@ -9247,7 +21115,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeId"+ ]+ }},{"name": "quality_getGaugeTypesList",@@ -9261,7 +21140,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getGaugeType",@@ -9275,14 +21158,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeTypeId": {+ "type": "string"+ }+ },+ "required": [+ "gaugeTypeId"+ ]+ }},{"name": "quality_getGaugeTypes","module": "quality","classification": "READ","description": "get gauge types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9290,7 +21184,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getIssue",@@ -9304,14 +21222,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceId"+ ]+ }},{"name": "quality_getIssues","module": "quality","classification": "READ","description": "get issues",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9319,7 +21248,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getIssueWorkflow",@@ -9333,7 +21286,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceWorkflowId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceWorkflowId"+ ]+ }},{"name": "quality_getIssueAction",@@ -9347,7 +21311,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueActionTasks",@@ -9363,7 +21338,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueApprovalTasks",@@ -9378,7 +21367,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueItems",@@ -9393,7 +21393,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueAssociations",@@ -9408,7 +21419,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceId"+ ]+ }},{"name": "quality_getIssueReviewers",@@ -9423,7 +21445,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueSuppliers",@@ -9438,7 +21471,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueTasks",@@ -9453,7 +21497,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getIssueType",@@ -9467,14 +21522,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceTypeId": {+ "type": "string"+ }+ },+ "required": [+ "nonConformanceTypeId"+ ]+ }},{"name": "quality_getIssueTypes","module": "quality","classification": "READ","description": "get issue types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9482,14 +21548,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getIssueWorkflows","module": "quality","classification": "READ","description": "get issue workflows",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9497,7 +21587,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getIssueWorkflowsList",@@ -9511,7 +21625,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getIssueTypesList",@@ -9525,14 +21643,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getQualityActions","module": "quality","classification": "READ","description": "get quality actions",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9540,7 +21662,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getQualityDocument",@@ -9554,7 +21700,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getQualityDocumentSteps",@@ -9568,14 +21725,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "qualityDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "qualityDocumentId"+ ]+ }},{"name": "quality_getQualityDocumentVersions","module": "quality","classification": "READ","description": "get quality document versions",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","qualityDocument",@@ -9583,14 +21751,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "version": {+ "type": "number"+ }+ },+ "required": [+ "name",+ "version"+ ]+ }},{"name": "quality_getQualityDocuments","module": "quality","classification": "READ","description": "get quality documents",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -9598,7 +21781,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "quality_getQualityDocumentsList",@@ -9612,7 +21816,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getQualityFiles",@@ -9627,7 +21835,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_getRequiredActionsList",@@ -9641,14 +21860,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "quality_getRequiredActions","module": "quality","classification": "READ","description": "get required actions",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -9656,7 +21879,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "quality_getRequiredAction",@@ -9670,7 +21917,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "requiredActionId": {+ "type": "string"+ }+ },+ "required": [+ "requiredActionId"+ ]+ }},{"name": "quality_getRisk",@@ -9684,14 +21942,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "riskId": {+ "type": "string"+ }+ },+ "required": [+ "riskId"+ ]+ }},{"name": "quality_getRisks","module": "quality","classification": "READ","description": "get risks",- "paramCount": 7,+ "paramCount": 6,"serviceParams": ["client","companyId",@@ -9699,14 +21968,46 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {},+ "source": {},+ "// might be needed later for filtering by assignee\n assignee": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ }+ }+ }+ }},{"name": "quality_insertIssueReviewer","module": "quality","classification": "WRITE","description": "insert issue reviewer",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","reviewer"@@ -9715,14 +22016,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "title": {+ "type": "string"+ }+ },+ "required": [+ "title"+ ]+ }},{"name": "quality_updateIssueActionProcesses","module": "quality","classification": "WRITE","description": "update issue action processes",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -9730,14 +22042,32 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "actionTaskId": {+ "type": "string"+ },+ "processIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "actionTaskId",+ "processIds"+ ]+ }},{"name": "quality_updateIssueStatus","module": "quality","classification": "WRITE","description": "update issue status",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","update"@@ -9745,14 +22075,33 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {},+ "closeDate": {}+ },+ "required": [+ "id",+ "status",+ "assignee",+ "closeDate"+ ]+ }},{"name": "quality_updateIssueTaskStatus","module": "quality","classification": "WRITE","description": "update issue task status",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","args"@@ -9760,14 +22109,51 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string",+ "enum": [+ "Pending",+ "Completed",+ "Skipped",+ "In Progress"+ ]+ },+ "type": {+ "type": "string",+ "enum": [+ "investigation",+ "action",+ "approval",+ "review"+ ]+ },+ "assignee": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "id",+ "status",+ "type"+ ]+ }},{"name": "quality_updateIssueTaskContent","module": "quality","classification": "WRITE","description": "update issue task content",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","args"@@ -9775,14 +22161,36 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "type": {+ "type": "string",+ "enum": [+ "action",+ "approval",+ "review"+ ]+ },+ "content": {}+ },+ "required": [+ "id",+ "type",+ "content"+ ]+ }},{"name": "quality_updateQualityDocumentStepOrder","module": "quality","classification": "WRITE","description": "update quality document step order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -9790,7 +22198,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "quality_updateRiskStatus",@@ -9806,14 +22229,194 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "riskId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ },+ "required": [+ "riskId",+ "status"+ ]+ }+ },+ {+ "name": "quality_insertGauge",+ "module": "quality",+ "classification": "WRITE",+ "description": "insert gauge",+ "paramCount": 15,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "gaugeId": {+ "type": "string"+ },+ "gaugeTypeId": {+ "type": "string"+ },+ "gaugeRole": {+ "type": "string"+ },+ "gaugeCalibrationStatus": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "modelNumber": {+ "type": "string"+ },+ "serialNumber": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "dateAcquired": {+ "type": "string"+ },+ "lastCalibrationDate": {+ "type": "string"+ },+ "nextCalibrationDate": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ },+ "calibrationIntervalInMonths": {+ "type": "number"+ },+ "customFields": {}+ },+ "required": [+ "gaugeTypeId",+ "gaugeRole",+ "gaugeCalibrationStatus"+ ]+ }+ },+ {+ "name": "quality_updateGauge",+ "module": "quality",+ "classification": "WRITE",+ "description": "update gauge",+ "paramCount": 16,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "gaugeId": {+ "type": "string"+ },+ "gaugeTypeId": {+ "type": "string"+ },+ "gaugeRole": {+ "type": "string"+ },+ "gaugeCalibrationStatus": {+ "type": "string"+ },+ "supplierId": {+ "type": [+ "string",+ "null"+ ]+ },+ "modelNumber": {+ "type": [+ "string",+ "null"+ ]+ },+ "serialNumber": {+ "type": [+ "string",+ "null"+ ]+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "dateAcquired": {+ "type": [+ "string",+ "null"+ ]+ },+ "lastCalibrationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "nextCalibrationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "storageUnitId": {+ "type": [+ "string",+ "null"+ ]+ },+ "calibrationIntervalInMonths": {+ "type": "number"+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_upsertGauge","module": "quality","classification": "WRITE","description": "upsert gauge",- "paramCount": 0,+ "paramCount": 14,"serviceParams": ["client","gauge"@@ -9822,14 +22425,65 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "gaugeId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "modelNumber": {+ "type": "string"+ },+ "serialNumber": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "dateAcquired": {+ "type": "string"+ },+ "gaugeTypeId": {+ "type": "string"+ },+ "gaugeRole": {+ "type": "string"+ },+ "lastCalibrationDate": {+ "type": "string"+ },+ "nextCalibrationDate": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "storageUnitId": {+ "type": "string"+ },+ "calibrationIntervalInMonths": {+ "type": "number"+ }+ },+ "required": [+ "gaugeTypeId",+ "gaugeRole"+ ]+ }},{"name": "quality_upsertGaugeCalibrationRecord","module": "quality","classification": "WRITE","description": "upsert gauge calibration record",- "paramCount": 0,+ "paramCount": 13,"serviceParams": ["client","gaugeCalibrationRecord"@@ -9838,14 +22492,67 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "gaugeId": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "dateCalibrated": {+ "type": "string"+ },+ "requiresAction": {+ "type": "string"+ },+ "requiresAdjustment": {+ "type": "string"+ },+ "requiresRepair": {+ "type": "string"+ },+ "temperature": {+ "type": "number"+ },+ "humidity": {+ "type": "number"+ },+ "approvedBy": {+ "type": "string"+ },+ "measurementStandard": {+ "type": "string"+ },+ "calibrationAttempts": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "gaugeId",+ "dateCalibrated",+ "requiresAction",+ "requiresAdjustment",+ "requiresRepair",+ "calibrationAttempts"+ ]+ }},{"name": "quality_upsertGaugeType","module": "quality","classification": "WRITE","description": "upsert gauge type",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","gaugeType"@@ -9854,14 +22561,234 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }+ },+ {+ "name": "quality_insertIssue",+ "module": "quality",+ "classification": "WRITE",+ "description": "insert issue",+ "paramCount": 20,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "nonConformanceId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "priority": {+ "type": "string",+ "enum": [+ "Low",+ "Medium",+ "High",+ "Critical"+ ]+ },+ "source": {+ "type": "string",+ "enum": [+ "Internal",+ "External"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "nonConformanceTypeId": {+ "type": "string"+ },+ "openDate": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "nonConformanceWorkflowId": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "closeDate": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "requiredActionIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "approvalRequirements": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "items": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "jobOperationId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "salesOrderLineId": {+ "type": "string"+ },+ "operationSupplierProcessId": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "name",+ "priority",+ "source",+ "locationId",+ "nonConformanceTypeId",+ "openDate"+ ]+ }+ },+ {+ "name": "quality_updateIssue",+ "module": "quality",+ "classification": "WRITE",+ "description": "update issue",+ "paramCount": 16,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "nonConformanceId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "priority": {+ "type": "string",+ "enum": [+ "Low",+ "Medium",+ "High",+ "Critical"+ ]+ },+ "source": {+ "type": "string",+ "enum": [+ "Internal",+ "External"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "nonConformanceTypeId": {+ "type": "string"+ },+ "nonConformanceWorkflowId": {+ "type": [+ "string",+ "null"+ ]+ },+ "openDate": {+ "type": "string"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "closeDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "quantity": {+ "type": [+ "number",+ "null"+ ]+ },+ "requiredActionIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "approvalRequirements": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "quality_upsertIssue","module": "quality","classification": "WRITE","description": "upsert issue",- "paramCount": 0,+ "paramCount": 20,"serviceParams": ["client","nonConformance"@@ -9870,14 +22797,87 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "nonConformanceId": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "source": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "requiredActionIds": {+ "type": "array"+ },+ "approvalRequirements": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "nonConformanceWorkflowId": {+ "type": "string"+ },+ "nonConformanceTypeId": {+ "type": "string"+ },+ "openDate": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "closeDate": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "items": {+ "type": "array"+ },+ "jobOperationId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "salesOrderLineId": {+ "type": "string"+ },+ "operationSupplierProcessId": {+ "type": "string"+ }+ },+ "required": [+ "priority",+ "source",+ "name",+ "locationId",+ "nonConformanceTypeId",+ "openDate"+ ]+ }},{"name": "quality_upsertIssueWorkflow","module": "quality","classification": "WRITE","description": "upsert issue workflow",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","nonConformanceWorkflow"@@ -9886,14 +22886,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "content": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "quality_upsertIssueType","module": "quality","classification": "WRITE","description": "upsert issue type",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","nonConformanceType"@@ -9902,14 +22919,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "quality_upsertRequiredAction","module": "quality","classification": "WRITE","description": "upsert required action",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","requiredAction"@@ -9918,14 +22949,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "quality_upsertQualityDocument","module": "quality","classification": "WRITE","description": "upsert quality document",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","qualityDocument"@@ -9934,14 +22979,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "version": {+ "type": "number"+ },+ "content": {+ "type": "string"+ },+ "copyFromId": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "quality_upsertQualityDocumentStep","module": "quality","classification": "WRITE","description": "upsert quality document step",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","qualityDocumentStep"@@ -9950,14 +23018,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "qualityDocumentStep": {}+ },+ "required": [+ "qualityDocumentStep"+ ]+ }},{"name": "quality_upsertRisk","module": "quality","classification": "WRITE","description": "upsert risk",- "paramCount": 0,+ "paramCount": 6,"serviceParams": ["client","risk"@@ -9966,122 +23043,430 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "assignee": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "likelihood": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ }+ },+ "required": [+ "likelihood"+ ]+ }},{"name": "quality_getInspectionDocuments","module": "quality","classification": "READ","description": "get inspection documents",- "paramCount": 0,+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }+ },+ {+ "name": "quality_getInspectionDocument",+ "module": "quality",+ "classification": "READ",+ "description": "get inspection document",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "quality_upsertInspectionDocument",+ "module": "quality",+ "classification": "WRITE",+ "description": "upsert inspection document",+ "paramCount": 7,+ "serviceParams": [+ "client",+ "diagram"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "partId": {+ "type": "string"+ },+ "drawingNumber": {+ "type": "string"+ },+ "pdfUrl": {+ "type": "string"+ },+ "annotations": {+ "type": "string"+ },+ "features": {+ "type": "string"+ }+ },+ "required": [+ "partId"+ ]+ }+ },+ {+ "name": "quality_deleteInspectionDocument",+ "module": "quality",+ "classification": "DESTRUCTIVE",+ "description": "delete inspection document",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "quality_getInspectionFeatures",+ "module": "quality",+ "classification": "READ",+ "description": "get inspection features",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "inspectionDocumentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "inspectionDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "inspectionDocumentId"+ ]+ }+ },+ {+ "name": "quality_getBalloons",+ "module": "quality",+ "classification": "READ",+ "description": "get balloons",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "inspectionDocumentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "inspectionDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "inspectionDocumentId"+ ]+ }+ },+ {+ "name": "quality_getInspectionPlan",+ "module": "quality",+ "classification": "READ",+ "description": "get inspection plan",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "inspectionDocumentId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "inspectionDocumentId": {+ "type": "string"+ }+ },+ "required": [+ "inspectionDocumentId"+ ]+ }+ },+ {+ "name": "quality_saveInspectionDocumentAtomic",+ "module": "quality",+ "classification": "WRITE",+ "description": "save inspection document atomic",+ "paramCount": 7,"serviceParams": ["client",- "companyId","args"],"injectAuth": ["companyId"- ]- },- {- "name": "quality_getInspectionDocument",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "inspectionDocumentId": {+ "type": "string"+ },+ "pdfUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "pageCount": {+ "type": "number"+ },+ "defaultPageWidth": {+ "type": "number"+ },+ "defaultPageHeight": {+ "type": "number"+ },+ "features": {},+ "balloons": {}+ },+ "required": [+ "inspectionDocumentId",+ "features",+ "balloons"+ ]+ }+ },+ {+ "name": "quality_getItemSamplingPlan","module": "quality","classification": "READ",- "description": "get inspection document",- "paramCount": 0,+ "description": "get item sampling plan",+ "paramCount": 1,"serviceParams": ["client",- "id"+ "itemId",+ "companyId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{- "name": "quality_upsertInspectionDocument",+ "name": "quality_upsertItemSamplingPlan","module": "quality","classification": "WRITE",- "description": "upsert inspection document",- "paramCount": 0,+ "description": "upsert item sampling plan",+ "paramCount": 1,"serviceParams": ["client",- "diagram"+ "plan"],"injectAuth": ["companyId","createdBy","updatedBy"- ]- },- {- "name": "quality_deleteInspectionDocument",- "module": "quality",- "classification": "DESTRUCTIVE",- "description": "delete inspection document",- "paramCount": 0,- "serviceParams": [- "client",- "id"],- "injectAuth": [- "companyId"- ]+ "schema": {+ "type": "object",+ "properties": {+ "plan": {}+ },+ "required": [+ "plan"+ ]+ }},{- "name": "quality_getBalloons",+ "name": "quality_getInboundInspections","module": "quality","classification": "READ",- "description": "get balloons",- "paramCount": 0,+ "description": "get inbound inspections",+ "paramCount": 4,"serviceParams": ["client",- "inspectionDocumentId"+ "companyId",+ "args"],"injectAuth": ["companyId"- ]- },- {- "name": "quality_getInspectionFeatures",+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "quality_getInboundInspection","module": "quality","classification": "READ",- "description": "get inspection document features (characteristics grid)",- "paramCount": 0,+ "description": "get inbound inspection",+ "paramCount": 1,"serviceParams": ["client",- "inspectionDocumentId"+ "id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{- "name": "quality_getInspectionPlan",+ "name": "quality_getInboundInspectionLotTrackedEntities","module": "quality","classification": "READ",- "description": "get inspection plan; each measurement id/featureId is inspectionFeature id, balloonId set when placed on drawing",- "paramCount": 0,+ "description": "get inbound inspection lot tracked entities",+ "paramCount": 1,"serviceParams": ["client",- "inspectionDocumentId"- ],- "injectAuth": [+ "receiptLineId","companyId"- ]- },- {- "name": "quality_saveInspectionDocumentAtomic",- "module": "quality",- "classification": "WRITE",- "description": "save inspection document; features {create,update,delete} + balloons geometry {create,update,delete} (delete = unplace)",- "paramCount": 0,- "serviceParams": [- "client",- "args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "receiptLineId": {+ "type": "string"+ }+ },+ "required": [+ "receiptLineId"+ ]+ }},{"name": "resources_activateWorkCenter",@@ -10095,7 +23480,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_deleteAbility",@@ -10106,11 +23502,24 @@"serviceParams": ["client","abilityId",- "hardDelete"+ "hardDelete = true"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "abilityId": {+ "type": "string"+ },+ "hardDelete = true": {}+ },+ "required": [+ "abilityId",+ "hardDelete = true"+ ]+ }},{"name": "resources_deleteContractor",@@ -10124,7 +23533,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "contractorId": {+ "type": "string"+ }+ },+ "required": [+ "contractorId"+ ]+ }},{"name": "resources_deleteEmployeeAbility",@@ -10138,7 +23558,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeAbilityId": {+ "type": "string"+ }+ },+ "required": [+ "employeeAbilityId"+ ]+ }},{"name": "resources_deleteFailureMode",@@ -10152,7 +23583,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "failureModeId": {+ "type": "string"+ }+ },+ "required": [+ "failureModeId"+ ]+ }},{"name": "resources_deleteLocation",@@ -10166,7 +23608,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "resources_deleteMaintenanceDispatch",@@ -10180,7 +23633,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_deleteMaintenanceDispatchComment",@@ -10194,7 +23658,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "commentId": {+ "type": "string"+ }+ },+ "required": [+ "commentId"+ ]+ }},{"name": "resources_deleteMaintenanceDispatchEvent",@@ -10208,7 +23683,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "eventId": {+ "type": "string"+ }+ },+ "required": [+ "eventId"+ ]+ }},{"name": "resources_deleteMaintenanceDispatchItem",@@ -10222,7 +23708,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "resources_deleteMaintenanceDispatchWorkCenter",@@ -10236,7 +23733,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "workCenterId": {+ "type": "string"+ }+ },+ "required": [+ "workCenterId"+ ]+ }},{"name": "resources_deleteMaintenanceSchedule",@@ -10250,7 +23758,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "resources_deleteMaintenanceScheduleItem",@@ -10264,7 +23783,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "resources_deletePartner",@@ -10278,7 +23808,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "partnerId": {+ "type": "string"+ }+ },+ "required": [+ "partnerId"+ ]+ }},{"name": "resources_activateProcess",@@ -10292,7 +23833,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "processId": {+ "type": "string"+ }+ },+ "required": [+ "processId"+ ]+ }},{"name": "resources_processDeactivate",@@ -10306,7 +23858,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "processId": {+ "type": "string"+ }+ },+ "required": [+ "processId"+ ]+ }},{"name": "resources_deleteProcess",@@ -10320,7 +23883,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "processId": {+ "type": "string"+ }+ },+ "required": [+ "processId"+ ]+ }},{"name": "resources_deleteShift",@@ -10334,7 +23908,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "shiftId": {+ "type": "string"+ }+ },+ "required": [+ "shiftId"+ ]+ }},{"name": "resources_deleteSuggestion",@@ -10348,7 +23933,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "suggestionId": {+ "type": "string"+ }+ },+ "required": [+ "suggestionId"+ ]+ }},{"name": "resources_deleteTraining",@@ -10362,7 +23958,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingId": {+ "type": "string"+ }+ },+ "required": [+ "trainingId"+ ]+ }},{"name": "resources_deleteTrainingAssignment",@@ -10376,7 +23983,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "assignmentId": {+ "type": "string"+ }+ },+ "required": [+ "assignmentId"+ ]+ }},{"name": "resources_deleteTrainingQuestion",@@ -10391,7 +24009,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingQuestionId": {+ "type": "string"+ }+ },+ "required": [+ "trainingQuestionId"+ ]+ }},{"name": "resources_deleteWorkCenter",@@ -10405,14 +24034,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_getAbilities","module": "resources","classification": "READ","description": "get abilities",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10420,7 +24060,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getAbilitiesList",@@ -10434,7 +24098,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getAbility",@@ -10448,7 +24116,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "abilityId": {+ "type": "string"+ }+ },+ "required": [+ "abilityId"+ ]+ }},{"name": "resources_getContractor",@@ -10462,14 +24141,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "contractorId": {+ "type": "string"+ }+ },+ "required": [+ "contractorId"+ ]+ }},{"name": "resources_getContractors","module": "resources","classification": "READ","description": "get contractors",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10477,7 +24167,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getEmployeeAbilities",@@ -10491,7 +24205,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "resources_getFailureMode",@@ -10505,14 +24230,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "failureModeId": {+ "type": "string"+ }+ },+ "required": [+ "failureModeId"+ ]+ }},{"name": "resources_getFailureModes","module": "resources","classification": "READ","description": "get failure modes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10520,7 +24256,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getFailureModesList",@@ -10534,7 +24294,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getLocation",@@ -10548,14 +24312,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "resources_getLocations","module": "resources","classification": "READ","description": "get locations",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10563,7 +24338,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getLocationsList",@@ -10577,7 +24376,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getMaintenanceDispatch",@@ -10591,7 +24394,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_getMaintenanceDispatchComments",@@ -10605,7 +24419,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_getMaintenanceDispatchEvents",@@ -10619,7 +24444,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_getMaintenanceDispatchItems",@@ -10633,7 +24469,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_getMaintenanceDispatchItemTrackedEntities",@@ -10647,14 +24494,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "maintenanceDispatchItemId": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceDispatchItemId"+ ]+ }},{"name": "resources_getMaintenanceDispatches","module": "resources","classification": "READ","description": "get maintenance dispatches",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -10662,14 +24520,41 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string"+ }+ }+ }+ }+ }},{"name": "resources_getMaintenanceDispatchesByLocation","module": "resources","classification": "READ","description": "get maintenance dispatches by location",- "paramCount": 6,+ "paramCount": 2,"serviceParams": ["client","companyId",@@ -10678,7 +24563,40 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string"+ }+ }+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "resources_getMaintenanceDispatchWorkCenters",@@ -10692,7 +24610,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "dispatchId": {+ "type": "string"+ }+ },+ "required": [+ "dispatchId"+ ]+ }},{"name": "resources_getMaintenanceSchedule",@@ -10706,7 +24635,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "resources_getMaintenanceScheduleItems",@@ -10720,14 +24660,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "scheduleId": {+ "type": "string"+ }+ },+ "required": [+ "scheduleId"+ ]+ }},{"name": "resources_getMaintenanceSchedules","module": "resources","classification": "READ","description": "get maintenance schedules",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -10735,14 +24686,41 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "active": {+ "type": "boolean"+ }+ }+ }+ }+ }},{"name": "resources_getMaintenanceSchedulesByLocation","module": "resources","classification": "READ","description": "get maintenance schedules by location",- "paramCount": 6,+ "paramCount": 2,"serviceParams": ["client","companyId",@@ -10751,7 +24729,40 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "active": {+ "type": "boolean"+ }+ }+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "resources_getOutstandingTrainingsForUser",@@ -10766,7 +24777,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeId"+ ]+ }},{"name": "resources_getPartner",@@ -10781,7 +24803,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "partnerId": {+ "type": "string"+ },+ "abilityId": {+ "type": "string"+ }+ },+ "required": [+ "partnerId",+ "abilityId"+ ]+ }},{"name": "resources_getPartnerBySupplierId",@@ -10795,14 +24832,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "partnerId": {+ "type": "string"+ }+ },+ "required": [+ "partnerId"+ ]+ }},{"name": "resources_getPartners","module": "resources","classification": "READ","description": "get partners",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10810,7 +24858,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getProcess",@@ -10824,14 +24896,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "processId": {+ "type": "string"+ }+ },+ "required": [+ "processId"+ ]+ }},{"name": "resources_getProcesses","module": "resources","classification": "READ","description": "get processes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10839,7 +24922,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getProcessesList",@@ -10853,7 +24960,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getSuggestion",@@ -10867,14 +24978,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "suggestionId": {+ "type": "string"+ }+ },+ "required": [+ "suggestionId"+ ]+ }},{"name": "resources_getSuggestions","module": "resources","classification": "READ","description": "get suggestions",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -10882,7 +25004,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "resources_getTraining",@@ -10896,7 +25042,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_getTrainingAssignment",@@ -10910,7 +25067,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "assignmentId": {+ "type": "string"+ }+ },+ "required": [+ "assignmentId"+ ]+ }},{"name": "resources_getTrainingAssignmentForCompletion",@@ -10924,7 +25092,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "assignmentId": {+ "type": "string"+ }+ },+ "required": [+ "assignmentId"+ ]+ }},{"name": "resources_getTrainingAssignments",@@ -10939,7 +25118,15 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingId": {+ "type": "string"+ }+ }+ }},{"name": "resources_getTrainingAssignmentStatus",@@ -10954,7 +25141,27 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingId": {+ "type": "string"+ },+ "status": {+ "type": "string",+ "enum": [+ "Completed",+ "Pending",+ "Overdue",+ "Not Required"+ ]+ },+ "search": {+ "type": "string"+ }+ }+ }},{"name": "resources_getTrainingAssignmentSummary",@@ -10968,7 +25175,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getTrainingQuestions",@@ -10982,14 +25193,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingId": {+ "type": "string"+ }+ },+ "required": [+ "trainingId"+ ]+ }},{"name": "resources_getTrainings","module": "resources","classification": "READ","description": "get trainings",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -10997,7 +25219,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "resources_getTrainingsList",@@ -11011,7 +25254,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getWorkCenter",@@ -11025,14 +25272,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_getWorkCenters","module": "resources","classification": "READ","description": "get work centers",- "paramCount": 3,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -11040,7 +25298,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "search": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ },+ "required": [+ "search"+ ]+ }},{"name": "resources_getWorkCentersByLocation",@@ -11054,7 +25333,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "locationId": {+ "type": "string"+ }+ },+ "required": [+ "locationId"+ ]+ }},{"name": "resources_getWorkCentersList",@@ -11068,7 +25358,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_getWorkCentersListWithBlockingStatus",@@ -11082,14 +25376,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "resources_insertAbility","module": "resources","classification": "WRITE","description": "insert ability",- "paramCount": 7,+ "paramCount": 3,"serviceParams": ["client","ability"@@ -11098,7 +25396,49 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "curve": {+ "type": "object",+ "properties": {+ "data": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "week": {+ "type": "number"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "week",+ "value"+ ]+ }+ }+ },+ "required": [+ "data"+ ]+ },+ "shadowWeeks": {+ "type": "number"+ }+ },+ "required": [+ "name",+ "curve",+ "shadowWeeks"+ ]+ }},{"name": "resources_insertEmployeeAbilities",@@ -11116,14 +25456,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "abilityId": {+ "type": "string"+ },+ "employeeIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "abilityId",+ "employeeIds"+ ]+ }},{"name": "resources_insertTrainingCompletion","module": "resources","classification": "WRITE","description": "insert training completion",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","completion"@@ -11132,7 +25490,33 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingAssignmentId": {+ "type": "string"+ },+ "employeeId": {+ "type": "string"+ },+ "period": {+ "type": [+ "string",+ "null"+ ]+ },+ "completedBy": {+ "type": "string"+ }+ },+ "required": [+ "trainingAssignmentId",+ "employeeId",+ "period",+ "completedBy"+ ]+ }},{"name": "resources_updateAbility",@@ -11148,7 +25532,20 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "ability": {}+ },+ "required": [+ "id",+ "ability"+ ]+ }},{"name": "resources_updateSuggestionEmoji",@@ -11164,7 +25561,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "suggestionId": {+ "type": "string"+ },+ "emoji": {+ "type": "string"+ }+ },+ "required": [+ "suggestionId",+ "emoji"+ ]+ }},{"name": "resources_updateSuggestionTags",@@ -11180,14 +25592,32 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "suggestionId": {+ "type": "string"+ },+ "tags": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "suggestionId",+ "tags"+ ]+ }},{"name": "resources_updateTrainingQuestionOrder","module": "resources","classification": "WRITE","description": "update training question order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -11195,7 +25625,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "resources_upsertContractor",@@ -11211,14 +25656,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "contractorWithAbilities": {}+ },+ "required": [+ "contractorWithAbilities"+ ]+ }},{"name": "resources_upsertEmployeeAbility","module": "resources","classification": "WRITE","description": "upsert employee ability",- "paramCount": 6,+ "paramCount": 5,"serviceParams": ["client","employeeAbility"@@ -11227,14 +25681,39 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "abilityId": {+ "type": "string"+ },+ "employeeId": {+ "type": "string"+ },+ "trainingCompleted": {+ "type": "boolean"+ },+ "trainingDays": {+ "type": "number"+ }+ },+ "required": [+ "abilityId",+ "employeeId",+ "trainingCompleted"+ ]+ }},{"name": "resources_upsertFailureMode","module": "resources","classification": "WRITE","description": "upsert failure mode",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","failureMode"@@ -11243,14 +25722,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "type": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "type"+ ]+ }},{"name": "resources_upsertLocation","module": "resources","classification": "WRITE","description": "upsert location",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","location"@@ -11259,14 +25756,192 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "location": {}+ },+ "required": [+ "location"+ ]+ }+ },+ {+ "name": "resources_insertMaintenanceDispatch",+ "module": "resources",+ "classification": "WRITE",+ "description": "insert maintenance dispatch",+ "paramCount": 13,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "maintenanceDispatchId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "severity": {},+ "source": {+ "type": "string",+ "enum": [+ "Scheduled",+ "Reactive",+ "Non-Conformance"+ ]+ },+ "oeeImpact": {+ "type": "string",+ "enum": [+ "Down",+ "Planned",+ "Impact",+ "No Impact"+ ]+ },+ "workCenterId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "assignee": {+ "type": "string"+ },+ "suspectedFailureModeId": {+ "type": "string"+ },+ "plannedStartTime": {+ "type": "string"+ },+ "plannedEndTime": {+ "type": "string"+ },+ "content": {}+ },+ "required": [+ "locationId"+ ]+ }+ },+ {+ "name": "resources_updateMaintenanceDispatch",+ "module": "resources",+ "classification": "WRITE",+ "description": "update maintenance dispatch",+ "paramCount": 17,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "severity": {+ "type": "string"+ },+ "source": {+ "type": "string"+ },+ "oeeImpact": {+ "type": "string"+ },+ "workCenterId": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "assignee": {+ "type": [+ "string",+ "null"+ ]+ },+ "suspectedFailureModeId": {+ "type": [+ "string",+ "null"+ ]+ },+ "actualFailureModeId": {+ "type": [+ "string",+ "null"+ ]+ },+ "procedureId": {+ "type": [+ "string",+ "null"+ ]+ },+ "plannedStartTime": {+ "type": [+ "string",+ "null"+ ]+ },+ "plannedEndTime": {+ "type": [+ "string",+ "null"+ ]+ },+ "actualStartTime": {+ "type": [+ "string",+ "null"+ ]+ },+ "actualEndTime": {+ "type": [+ "string",+ "null"+ ]+ },+ "content": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_upsertMaintenanceDispatch","module": "resources","classification": "WRITE","description": "upsert maintenance dispatch",- "paramCount": 0,+ "paramCount": 13,"serviceParams": ["client","dispatch"@@ -11275,14 +25950,63 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "severity": {+ "type": "string"+ },+ "source": {+ "type": "string"+ },+ "oeeImpact": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "suspectedFailureModeId": {+ "type": "string"+ },+ "plannedStartTime": {+ "type": "string"+ },+ "plannedEndTime": {+ "type": "string"+ },+ "assignee": {+ "type": "string"+ },+ "content": {+ "type": "string"+ }+ },+ "required": [+ "status",+ "priority",+ "locationId"+ ]+ }},{"name": "resources_upsertMaintenanceDispatchComment","module": "resources","classification": "WRITE","description": "upsert maintenance dispatch comment",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","comment"@@ -11291,14 +26015,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "comment": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "comment"+ ]+ }},{"name": "resources_upsertMaintenanceDispatchEvent","module": "resources","classification": "WRITE","description": "upsert maintenance dispatch event",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","event"@@ -11307,14 +26049,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "event": {}+ },+ "required": [+ "event"+ ]+ }},{"name": "resources_upsertMaintenanceDispatchItem","module": "resources","classification": "WRITE","description": "upsert maintenance dispatch item",- "paramCount": 0,+ "paramCount": 6,"serviceParams": ["client","item"@@ -11323,14 +26074,42 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "unitOfMeasureCode": {+ "type": "string"+ },+ "unitCost": {+ "type": "number"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "itemId",+ "unitOfMeasureCode"+ ]+ }},{"name": "resources_upsertMaintenanceDispatchWorkCenter","module": "resources","classification": "WRITE","description": "upsert maintenance dispatch work center",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","workCenter"@@ -11339,14 +26118,32 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceDispatchId": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceDispatchId",+ "workCenterId"+ ]+ }},{"name": "resources_upsertMaintenanceSchedule","module": "resources","classification": "WRITE","description": "upsert maintenance schedule",- "paramCount": 0,+ "paramCount": 15,"serviceParams": ["client","schedule"@@ -11355,14 +26152,78 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "workCenterId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "frequency": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "estimatedDuration": {+ "type": "number"+ },+ "active": {+ "type": "string"+ },+ "tuesday": {+ "type": "string"+ },+ "wednesday": {+ "type": "string"+ },+ "thursday": {+ "type": "string"+ },+ "friday": {+ "type": "string"+ },+ "saturday": {+ "type": "string"+ },+ "sunday": {+ "type": "string"+ }+ },+ "required": [+ "name",+ "workCenterId",+ "locationId",+ "frequency",+ "priority",+ "active",+ "tuesday",+ "wednesday",+ "thursday",+ "friday",+ "saturday",+ "sunday"+ ]+ }},{"name": "resources_upsertMaintenanceScheduleItem","module": "resources","classification": "WRITE","description": "upsert maintenance schedule item",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","item"@@ -11371,14 +26232,39 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "maintenanceScheduleId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ },+ "unitOfMeasureCode": {+ "type": "string"+ }+ },+ "required": [+ "maintenanceScheduleId",+ "itemId",+ "unitOfMeasureCode"+ ]+ }},{"name": "resources_upsertPartner","module": "resources","classification": "WRITE","description": "upsert partner",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","partner"@@ -11387,14 +26273,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "supplierId": {+ "type": "string"+ },+ "hoursPerWeek": {+ "type": "number"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "resources_upsertProcess","module": "resources","classification": "WRITE","description": "upsert process",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","process"@@ -11403,14 +26306,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "process": {}+ },+ "required": [+ "process"+ ]+ }},{"name": "resources_upsertTraining","module": "resources","classification": "WRITE","description": "upsert training",- "paramCount": 0,+ "paramCount": 3,"serviceParams": ["client","training"@@ -11419,14 +26331,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "content": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "resources_upsertTrainingAssignment","module": "resources","classification": "WRITE","description": "upsert training assignment",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","assignment"@@ -11435,14 +26364,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "trainingId": {+ "type": "string"+ },+ "groupIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "trainingId",+ "groupIds"+ ]+ }},{"name": "resources_upsertTrainingQuestion","module": "resources","classification": "WRITE","description": "upsert training question",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","trainingQuestion"@@ -11451,23 +26401,83 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "trainingQuestion": {}+ },+ "required": [+ "trainingQuestion"+ ]+ }},{"name": "resources_upsertWorkCenter","module": "resources","classification": "WRITE","description": "upsert work center",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","workCenter"],- "injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "defaultStandardFactor": {+ "type": "number"+ }+ },+ "required": [+ "name",+ "description"+ ]+ }+ },+ {+ "name": "sales_applyPriceRules",+ "module": "sales",+ "classification": "WRITE",+ "description": "apply price rules",+ "paramCount": 2,+ "serviceParams": [+ "startingPrice",+ "matchedRules"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "startingPrice": {+ "type": "number"+ },+ "matchedRules": {+ "type": "array",+ "items": {}+ }+ },+ "required": [+ "startingPrice",+ "matchedRules"+ ]+ }},{"name": "sales_closeSalesOrder",@@ -11481,43 +26491,90 @@"userId"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_convertSalesRfqToQuote","module": "sales","classification": "WRITE","description": "convert sales rfq to quote",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","payload"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_convertQuoteToOrder","module": "sales","classification": "WRITE","description": "convert quote to order",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","payload"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "selectedLines": {},+ "purchaseOrderNumber": {+ "type": "string"+ },+ "digitalQuoteAcceptedBy": {+ "type": "string"+ },+ "digitalQuoteAcceptedByEmail": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "selectedLines"+ ]+ }},{"name": "sales_copyQuoteLine","module": "sales","classification": "WRITE","description": "copy quote line",- "paramCount": 0,+ "paramCount": 9,"serviceParams": ["client","payload"@@ -11526,14 +26583,63 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "type": {+ "type": "string",+ "enum": [+ "item",+ "quoteLine",+ "method",+ "quoteToQuote"+ ]+ },+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "billOfMaterial": {+ "type": "string"+ },+ "billOfProcess": {+ "type": "string"+ },+ "parameters": {+ "type": "string"+ },+ "tools": {+ "type": "string"+ },+ "steps": {+ "type": "string"+ },+ "workInstructions": {+ "type": "string"+ }+ },+ "required": [+ "type",+ "sourceId",+ "targetId",+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }},{"name": "sales_copyQuote","module": "sales","classification": "WRITE","description": "copy quote",- "paramCount": 0,+ "paramCount": 9,"serviceParams": ["client","payload"@@ -11542,7 +26648,83 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "type": {+ "type": "string",+ "enum": [+ "item",+ "quoteLine",+ "method",+ "quoteToQuote"+ ]+ },+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "billOfMaterial": {+ "type": "string"+ },+ "billOfProcess": {+ "type": "string"+ },+ "parameters": {+ "type": "string"+ },+ "tools": {+ "type": "string"+ },+ "steps": {+ "type": "string"+ },+ "workInstructions": {+ "type": "string"+ }+ },+ "required": [+ "type",+ "sourceId",+ "targetId",+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ {+ "name": "sales_createPricingRule",+ "module": "sales",+ "classification": "WRITE",+ "description": "create pricing rule",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "userId",+ "data"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{"name": "sales_deleteCustomer",@@ -11556,7 +26738,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{"name": "sales_deleteCustomerContact",@@ -11571,7 +26764,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "customerContactId"+ ]+ }},{"name": "sales_deleteCustomerLocation",@@ -11586,7 +26794,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "customerLocationId"+ ]+ }},{"name": "sales_deleteCustomerStatus",@@ -11600,7 +26823,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerStatusId": {+ "type": "string"+ }+ },+ "required": [+ "customerStatusId"+ ]+ }},{"name": "sales_deleteCustomerType",@@ -11614,7 +26848,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerTypeId": {+ "type": "string"+ }+ },+ "required": [+ "customerTypeId"+ ]+ }},{"name": "sales_deleteNoQuoteReason",@@ -11628,7 +26873,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "noQuoteReasonId": {+ "type": "string"+ }+ },+ "required": [+ "noQuoteReasonId"+ ]+ }+ },+ {+ "name": "sales_deletePricingRule",+ "module": "sales",+ "classification": "DESTRUCTIVE",+ "description": "delete pricing rule",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "pricingRuleId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "pricingRuleId": {+ "type": "string"+ }+ },+ "required": [+ "pricingRuleId"+ ]+ }},{"name": "sales_deleteQuote",@@ -11642,7 +26923,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_deleteQuoteMakeMethod",@@ -11656,7 +26948,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "quoteMakeMethodId"+ ]+ }},{"name": "sales_deleteQuoteLine",@@ -11670,7 +26973,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_deleteQuoteMaterial",@@ -11684,7 +26998,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMaterialId": {+ "type": "string"+ }+ },+ "required": [+ "quoteMaterialId"+ ]+ }},{"name": "sales_deleteQuoteOperation",@@ -11698,7 +27023,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationId": {+ "type": "string"+ }+ },+ "required": [+ "quoteOperationId"+ ]+ }},{"name": "sales_deleteQuoteOperationStep",@@ -11712,7 +27048,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_deleteQuoteOperationParameter",@@ -11726,7 +27073,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_deleteQuoteOperationTool",@@ -11740,7 +27098,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_deleteSalesOrder",@@ -11754,7 +27123,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_deleteSalesOrderLine",@@ -11768,7 +27148,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderLineId"+ ]+ }},{"name": "sales_deleteSalesRFQ",@@ -11782,7 +27173,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesRfqId": {+ "type": "string"+ }+ },+ "required": [+ "salesRfqId"+ ]+ }},{"name": "sales_deleteSalesRFQLine",@@ -11796,7 +27198,47 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesRFQLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesRFQLineId"+ ]+ }+ },+ {+ "name": "sales_duplicatePricingRule",+ "module": "sales",+ "classification": "WRITE",+ "description": "duplicate pricing rule",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "companyId",+ "userId"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_getConfigurationParametersByQuoteLineId",@@ -11811,7 +27253,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getCustomer",@@ -11825,7 +27278,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{"name": "sales_getCustomerContact",@@ -11839,7 +27303,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerContactId": {+ "type": "string"+ }+ },+ "required": [+ "customerContactId"+ ]+ }},{"name": "sales_getCustomerContacts",@@ -11853,7 +27328,56 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_getCustomerItemPriceOverride",+ "module": "sales",+ "classification": "READ",+ "description": "get customer item price override",+ "paramCount": 4,+ "serviceParams": [+ "client",+ "customerId",+ "itemId",+ "companyId",+ "quantity",+ "date"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {},+ "date": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "itemId",+ "quantity"+ ]+ }},{"name": "sales_getCustomerLocation",@@ -11867,7 +27391,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerLocationId": {+ "type": "string"+ }+ },+ "required": [+ "customerLocationId"+ ]+ }},{"name": "sales_getCustomerLocations",@@ -11881,7 +27416,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{"name": "sales_getCustomerPayment",@@ -11895,7 +27441,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{"name": "sales_getCustomerShipping",@@ -11909,14 +27466,121 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_getCustomerTax",+ "module": "sales",+ "classification": "READ",+ "description": "get customer tax",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "customerId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_getCustomerTypeItemPriceOverride",+ "module": "sales",+ "classification": "READ",+ "description": "get customer type item price override",+ "paramCount": 4,+ "serviceParams": [+ "client",+ "customerTypeId",+ "itemId",+ "companyId",+ "quantity",+ "date"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerTypeId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "quantity": {},+ "date": {+ "type": "string"+ }+ },+ "required": [+ "customerTypeId",+ "itemId",+ "quantity"+ ]+ }+ },+ {+ "name": "sales_getAllCustomersItemPriceOverride",+ "module": "sales",+ "classification": "READ",+ "description": "get all customers item price override",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "itemId",+ "companyId",+ "quantity",+ "date"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "quantity": {},+ "date": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "quantity"+ ]+ }},{"name": "sales_getCustomers","module": "sales","classification": "READ","description": "get customers",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -11924,7 +27588,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getCustomersList",@@ -11938,7 +27626,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getCustomerStatus",@@ -11952,14 +27644,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerStatusId": {+ "type": "string"+ }+ },+ "required": [+ "customerStatusId"+ ]+ }},{"name": "sales_getCustomerStatuses","module": "sales","classification": "READ","description": "get customer statuses",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -11967,7 +27670,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getCustomerStatusesList",@@ -11981,7 +27708,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getCustomerType",@@ -11995,14 +27726,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerTypeId": {+ "type": "string"+ }+ },+ "required": [+ "customerTypeId"+ ]+ }},{"name": "sales_getCustomerTypes","module": "sales","classification": "READ","description": "get customer types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -12010,7 +27752,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getCustomerTypesList",@@ -12024,14 +27790,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getExternalSalesOrderLines","module": "sales","classification": "READ","description": "get external sales order lines",- "paramCount": 5,+ "paramCount": 2,"serviceParams": ["client","customerId",@@ -12039,7 +27809,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ },+ "required": [+ "customerId",+ "args"+ ]+ }},{"name": "sales_getModelByQuoteLineId",@@ -12053,7 +27854,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getNoQuoteReasonsList",@@ -12067,7 +27879,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getNoQuoteReason",@@ -12081,14 +27897,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "noQuoteReasonId": {+ "type": "string"+ }+ },+ "required": [+ "noQuoteReasonId"+ ]+ }},{"name": "sales_getNoQuoteReasons","module": "sales","classification": "READ","description": "get no quote reasons",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -12096,7 +27923,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getOpportunity",@@ -12110,7 +27961,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "opportunityId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "opportunityId"+ ]+ }},{"name": "sales_getOpportunityDocuments",@@ -12125,7 +27990,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "opportunityId": {+ "type": "string"+ }+ },+ "required": [+ "opportunityId"+ ]+ }},{"name": "sales_getOpportunityLineDocuments",@@ -12141,7 +28017,85 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineId": {+ "type": "string"+ },+ "itemId": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "lineId"+ ]+ }+ },+ {+ "name": "sales_getPricingRule",+ "module": "sales",+ "classification": "READ",+ "description": "get pricing rule",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "sales_getPricingRules",+ "module": "sales",+ "classification": "READ",+ "description": "get pricing rules",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": "string"+ }+ }+ }+ }+ }},{"name": "sales_getQuote",@@ -12155,7 +28109,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteFavorites",@@ -12170,14 +28135,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getQuotes","module": "sales","classification": "READ","description": "get quotes",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -12185,7 +28154,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getQuotesList",@@ -12199,7 +28192,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getQuoteAssembliesByLine",@@ -12213,7 +28210,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteAssemblies",@@ -12227,7 +28235,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteCustomerDetails",@@ -12241,7 +28260,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteLine",@@ -12255,7 +28285,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteLinesList",@@ -12269,7 +28310,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteMakeMethod",@@ -12283,7 +28335,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "quoteMakeMethodId"+ ]+ }},{"name": "sales_getRootQuoteMakeMethod",@@ -12297,7 +28360,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteMethodTrees",@@ -12311,7 +28385,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteMethodTreeArray",@@ -12325,7 +28410,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteLines",@@ -12339,7 +28435,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteByExternalId",@@ -12353,7 +28460,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "externalId": {+ "type": "string"+ }+ },+ "required": [+ "externalId"+ ]+ }},{"name": "sales_getQuoteLinePrices",@@ -12367,7 +28485,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteLinePricesByQuoteId",@@ -12381,7 +28510,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteLinePricesByItemId",@@ -12396,7 +28536,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "currentQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "currentQuoteId"+ ]+ }},{"name": "sales_getQuoteLinePricesByItemIds",@@ -12411,7 +28566,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "currentQuoteId": {+ "type": "string"+ }+ },+ "required": [+ "itemIds",+ "currentQuoteId"+ ]+ }},{"name": "sales_getQuoteMaterials",@@ -12425,7 +28598,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteMaterial",@@ -12439,7 +28623,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialId": {+ "type": "string"+ }+ },+ "required": [+ "materialId"+ ]+ }},{"name": "sales_getQuoteMaterialsByLine",@@ -12453,7 +28648,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteMaterialsByMethodId",@@ -12467,7 +28673,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "quoteMakeMethodId"+ ]+ }},{"name": "sales_getQuoteMaterialsByOperation",@@ -12481,7 +28698,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationId": {+ "type": "string"+ }+ },+ "required": [+ "quoteOperationId"+ ]+ }},{"name": "sales_getQuoteOperation",@@ -12495,7 +28723,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationId": {+ "type": "string"+ }+ },+ "required": [+ "quoteOperationId"+ ]+ }},{"name": "sales_getQuoteOperationsByLine",@@ -12509,7 +28748,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteLineId"+ ]+ }},{"name": "sales_getQuoteOperationsByMethodId",@@ -12523,7 +28773,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMakeMethodId": {+ "type": "string"+ }+ },+ "required": [+ "quoteMakeMethodId"+ ]+ }},{"name": "sales_getQuoteOperations",@@ -12537,7 +28798,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuotePayment",@@ -12551,7 +28823,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getQuoteShipment",@@ -12565,7 +28848,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_getRelatedPricesForQuoteLine",@@ -12580,7 +28874,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "quoteId"+ ]+ }},{"name": "sales_getSalesDocumentsAssignedToMe",@@ -12595,7 +28904,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getSalesOrder",@@ -12609,7 +28922,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesOrderCustomerDetails",@@ -12623,7 +28947,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesOrderFavorites",@@ -12638,7 +28973,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getSalesOrderRelatedItems",@@ -12653,14 +28992,29 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ },+ "opportunityId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId",+ "opportunityId"+ ]+ }},{"name": "sales_getSalesOrders","module": "sales","classification": "READ","description": "get sales orders",- "paramCount": 6,+ "paramCount": 5,"serviceParams": ["client","companyId",@@ -12668,21 +29022,89 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerId": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }+ },+ {+ "name": "sales_getSalesOrdersList",+ "module": "sales",+ "classification": "READ",+ "description": "get sales orders list",+ "paramCount": 0,+ "serviceParams": [+ "client",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "sales_getSalesOrdersList",+ "name": "sales_getSalesOrdersByIds","module": "sales","classification": "READ",- "description": "get sales orders list",- "paramCount": 0,+ "description": "get sales orders by ids",+ "paramCount": 1,"serviceParams": ["client",- "companyId"+ "ids"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "ids": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "ids"+ ]+ }},{"name": "sales_getSalesOrderPayment",@@ -12696,7 +29118,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesTerms",@@ -12710,7 +29143,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getSalesOrderShipment",@@ -12724,7 +29161,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesOrderCustomers",@@ -12737,7 +29185,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getSalesOrderLines",@@ -12751,7 +29203,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesOrderInvoiceLines",@@ -12765,7 +29228,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }},{"name": "sales_getSalesOrderInvoicesByIds",@@ -12779,7 +29253,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "invoiceIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "invoiceIds"+ ]+ }},{"name": "sales_getSalesOrderLinesByItemId",@@ -12793,7 +29281,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "sales_getSalesOrderLinesByItemIds",@@ -12807,7 +29306,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "itemIds"+ ]+ }},{"name": "sales_getSalesOrderLine",@@ -12821,7 +29334,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderLineId"+ ]+ }},{"name": "sales_getSalesOrderLineShipments",@@ -12835,7 +29359,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLineId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderLineId"+ ]+ }},{"name": "sales_getSalesRFQ",@@ -12849,7 +29384,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_getSalesRFQFavorites",@@ -12864,14 +29410,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "sales_getSalesRFQs","module": "sales","classification": "READ","description": "get sales r f qs",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -12879,7 +29429,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "sales_getSalesRFQLine",@@ -12893,7 +29467,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineId": {+ "type": "string"+ }+ },+ "required": [+ "lineId"+ ]+ }},{"name": "sales_getSalesRFQLines",@@ -12907,14 +29492,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesRfqId": {+ "type": "string"+ }+ },+ "required": [+ "salesRfqId"+ ]+ }},{"name": "sales_insertCustomerContact","module": "sales","classification": "WRITE","description": "insert customer contact",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","customerContact"@@ -12923,14 +29519,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ }+ }+ }},{"name": "sales_insertCustomerLocation","module": "sales","classification": "WRITE","description": "insert customer location",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","customerLocation"@@ -12939,14 +29546,31 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "address: {\n addressLine1": {},+ "customFields": {}+ },+ "required": [+ "customerId",+ "name"+ ]+ }},{"name": "sales_insertSalesOrderLines","module": "sales","classification": "WRITE","description": "insert sales order lines",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","salesOrderLines"@@ -12955,7 +29579,19 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLines": {+ "type": "array",+ "items": {}+ }+ },+ "required": [+ "salesOrderLines"+ ]+ }},{"name": "sales_finalizeQuote",@@ -12971,7 +29607,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId"+ ]+ }},{"name": "sales_releaseSalesOrder",@@ -12984,16 +29631,133 @@"salesOrderId","userId"],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderId": {+ "type": "string"+ }+ },+ "required": [+ "salesOrderId"+ ]+ }+ },+ {+ "name": "sales_resolvePrice",+ "module": "sales",+ "classification": "WRITE",+ "description": "resolve price",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "input"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "input": {}+ },+ "required": [+ "input"+ ]+ }+ },+ {+ "name": "sales_resolvePriceList",+ "module": "sales",+ "classification": "WRITE",+ "description": "resolve price list",+ "paramCount": 6,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "customerId": {+ "type": "string"+ },+ "customerTypeId": {+ "type": "string"+ },+ "search": {+ "type": "string"+ },+ "quantity": {+ "type": "number"+ }+ }+ }+ }+ }+ },+ {+ "name": "sales_getBaseCatalog",+ "module": "sales",+ "classification": "READ",+ "description": "get base catalog",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": "string"+ }+ }+ }+ }+ }},{"name": "sales_upsertCustomer","module": "sales","classification": "WRITE","description": "upsert customer",- "paramCount": 0,+ "paramCount": 10,"serviceParams": ["client","customer"@@ -13002,14 +29766,209 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "readableId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "customerStatusId": {+ "type": "string"+ },+ "customerTypeId": {+ "type": "string"+ },+ "accountManagerId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "taxPercent": {+ "type": "number"+ },+ "salesContactId": {+ "type": "string"+ },+ "website": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }+ },+ {+ "name": "sales_upsertCustomerItemPriceOverride",+ "module": "sales",+ "classification": "WRITE",+ "description": "upsert customer item price override",+ "paramCount": 10,+ "serviceParams": [+ "client",+ "companyId",+ "userId",+ "data"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerTypeId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "breaks": {+ "type": "array",+ "items": {}+ },+ "active": {+ "type": "boolean"+ },+ "applyRulesOnTop": {+ "type": "boolean"+ },+ "notes": {+ "type": "string"+ },+ "validFrom": {+ "type": "string"+ },+ "validTo": {+ "type": "string"+ }+ },+ "required": [+ "itemId",+ "breaks",+ "active",+ "applyRulesOnTop"+ ]+ }+ },+ {+ "name": "sales_deleteCustomerItemPriceOverride",+ "module": "sales",+ "classification": "DESTRUCTIVE",+ "description": "delete customer item price override",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "sales_getCustomerItemPriceOverrideById",+ "module": "sales",+ "classification": "READ",+ "description": "get customer item price override by id",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "id",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "sales_getCustomerItemPriceOverridesList",+ "module": "sales",+ "classification": "READ",+ "description": "get customer item price overrides list",+ "paramCount": 6,+ "serviceParams": [+ "client",+ "companyId",+ "args"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerTypeId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ }+ }+ }+ }+ }},{"name": "sales_updateCustomerAccounting","module": "sales","classification": "WRITE","description": "update customer accounting",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","customerAccounting"@@ -13017,14 +29976,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "customerTypeId": {+ "type": "string"+ }+ }+ }},{"name": "sales_updateCustomerContact","module": "sales","classification": "WRITE","description": "update customer contact",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","customerContact"@@ -13032,14 +30002,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ }+ }+ }},{"name": "sales_updateCustomerLocation","module": "sales","classification": "WRITE","description": "update customer location",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","customerLocation"@@ -13047,14 +30028,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "addressId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "address: {\n addressLine1": {},+ "customFields": {}+ },+ "required": [+ "addressId",+ "name"+ ]+ }},{"name": "sales_updateCustomerPayment","module": "sales","classification": "WRITE","description": "update customer payment",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","customerPayment"@@ -13062,14 +30060,37 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": "string"+ },+ "invoiceCustomerLocationId": {+ "type": "string"+ },+ "invoiceCustomerContactId": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{"name": "sales_updateCustomerShipping","module": "sales","classification": "WRITE","description": "update customer shipping",- "paramCount": 0,+ "paramCount": 7,"serviceParams": ["client","customerShipping"@@ -13077,43 +30098,97 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "shippingCustomerId": {+ "type": "string"+ },+ "shippingCustomerLocationId": {+ "type": "string"+ },+ "shippingCustomerContactId": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "incoterm": {+ "type": "string"+ },+ "incotermLocation": {+ "type": "string"+ }+ },+ "required": [+ "customerId"+ ]+ }},{- "name": "sales_getCustomerTax",+ "name": "sales_updateCustomerTax","module": "sales",- "classification": "READ",- "description": "get customer tax",- "paramCount": 0,+ "classification": "WRITE",+ "description": "update customer tax",+ "paramCount": 1,"serviceParams": ["client",- "customerId"+ "customerTax"],"injectAuth": [- "companyId"- ]+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerTax": {}+ },+ "required": [+ "customerTax"+ ]+ }},{- "name": "sales_updateCustomerTax",+ "name": "sales_updatePricingRule","module": "sales","classification": "WRITE",- "description": "update customer tax",- "paramCount": 0,+ "description": "update pricing rule",+ "paramCount": 2,"serviceParams": ["client",- "customerTax"+ "id",+ "userId",+ "data"],"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "data": {}+ },+ "required": [+ "id",+ "data"+ ]+ }},{"name": "sales_upsertCustomerStatus","module": "sales","classification": "WRITE","description": "upsert customer status",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","customerStatus"@@ -13122,14 +30197,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "sales_upsertCustomerType","module": "sales","classification": "WRITE","description": "upsert customer type",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","customerType"@@ -13138,14 +30227,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "sales_upsertNoQuoteReason","module": "sales","classification": "WRITE","description": "upsert no quote reason",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","noQuoteReason"@@ -13154,14 +30257,28 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "sales_updateSalesRFQFavorite","module": "sales","classification": "WRITE","description": "update sales r f q favorite",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -13169,29 +30286,29 @@"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "sales_updateSalesRFQLineOrder",- "module": "sales",- "classification": "WRITE",- "description": "update sales r f q line order",- "paramCount": 3,- "serviceParams": [- "db",- "updates"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }},{"name": "sales_updateQuoteExchangeRate","module": "sales","classification": "WRITE","description": "update quote exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -13199,7 +30316,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "sales_updateQuoteLinePrecision",@@ -13215,14 +30347,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ },+ "precision": {+ "type": "number"+ }+ },+ "required": [+ "quoteLineId",+ "precision"+ ]+ }},{"name": "sales_updateSalesOrderExchangeRate","module": "sales","classification": "WRITE","description": "update sales order exchange rate",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","data"@@ -13230,14 +30377,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "exchangeRate"+ ]+ }},{"name": "sales_updateQuoteFavorite","module": "sales","classification": "WRITE","description": "update quote favorite",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -13245,14 +30407,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }},{"name": "sales_updateSalesRFQStatus","module": "sales","classification": "WRITE","description": "update sales r f q status",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","update"@@ -13260,14 +30437,38 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "noQuoteReasonId": {+ "type": [+ "string",+ "null"+ ]+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "noQuoteReasonId",+ "assignee"+ ]+ }},{"name": "sales_updateQuoteMaterialOrder","module": "sales","classification": "WRITE","description": "update quote material order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -13275,14 +30476,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "sales_updateQuoteOperationOrder","module": "sales","classification": "WRITE","description": "update quote operation order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -13290,14 +30506,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "order": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "order"+ ]+ }},{"name": "sales_updateQuoteStatus","module": "sales","classification": "WRITE","description": "update quote status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -13305,14 +30536,31 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }},{"name": "sales_upsertMakeMethodFromQuoteLine","module": "sales","classification": "WRITE","description": "upsert make method from quote line",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","lineMethod"@@ -13321,14 +30569,64 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "itemId",+ "quoteId",+ "quoteLineId"+ ]+ }},{"name": "sales_upsertMakeMethodFromQuoteMethod","module": "sales","classification": "WRITE","description": "upsert make method from quote method",- "paramCount": 10,+ "paramCount": 3,"serviceParams": ["client","quoteMethod"@@ -13337,14 +30635,236 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }+ },+ {+ "name": "sales_insertQuote",+ "module": "sales",+ "classification": "WRITE",+ "description": "Create a new quote with all business logic - generates sequence, creates opportunity, resolves payment/shipping defaults from customer. LLM can create a quote with just customerId.",+ "paramCount": 16,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ },+ "customerEngineeringContactId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "salesPersonId": {+ "type": "string"+ },+ "estimatorId": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "opportunityId": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_updateQuote",+ "module": "sales",+ "classification": "WRITE",+ "description": "Update an existing quote - handles exchange rate updates when currency changes, syncs customer to opportunity",+ "paramCount": 17,+ "serviceParams": [+ "client",+ "input",+ "companyGroupId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "expirationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerEngineeringContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerReference": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerId": {+ "type": "string"+ },+ "salesPersonId": {+ "type": [+ "string",+ "null"+ ]+ },+ "estimatorId": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "digitalQuoteAcceptedBy": {+ "type": [+ "string",+ "null"+ ]+ },+ "digitalQuoteAcceptedByEmail": {+ "type": [+ "string",+ "null"+ ]+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_upsertQuote","module": "sales","classification": "WRITE","description": "upsert quote",- "paramCount": 0,+ "paramCount": 20,"serviceParams": ["client","quote"@@ -13353,14 +30873,81 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "salesPersonId": {+ "type": "string"+ },+ "estimatorId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerEngineeringContactId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "notes": {},+ "dueDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "digitalQuoteAcceptedBy": {+ "type": "string"+ },+ "digitalQuoteAcceptedByEmail": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "locationId"+ ]+ }},{"name": "sales_upsertQuoteLine","module": "sales","classification": "WRITE","description": "upsert quote line",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","quotationLine"@@ -13369,14 +30956,65 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ }+ },+ "required": [+ "quoteId",+ "itemId"+ ]+ }+ },+ {+ "name": "sales_updateQuoteLineOrder",+ "module": "sales",+ "classification": "WRITE",+ "description": "update quote line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "sales_upsertQuoteLineAdditionalCharges","module": "sales","classification": "WRITE","description": "upsert quote line additional charges",- "paramCount": 1,+ "paramCount": 2,"serviceParams": ["client","lineId",@@ -13386,14 +31024,35 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "lineId": {+ "type": "string"+ },+ "update": {+ "type": "object",+ "properties": {+ "additionalCharges": {}+ },+ "required": [+ "additionalCharges"+ ]+ }+ },+ "required": [+ "lineId",+ "update"+ ]+ }},{"name": "sales_upsertQuoteLinePrices","module": "sales","classification": "WRITE","description": "upsert quote line prices",- "paramCount": 9,+ "paramCount": 3,"serviceParams": ["client","quoteId",@@ -13404,7 +31063,51 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ },+ "lineId": {+ "type": "string"+ },+ "quoteLinePrices": {+ "type": "object",+ "properties": {+ "quoteLineId": {+ "type": "string"+ },+ "unitPrice": {+ "type": "number"+ },+ "leadTime": {+ "type": "number"+ },+ "discountPercent": {+ "type": "number"+ },+ "quantity": {+ "type": "number"+ },+ "categoryMarkups": {}+ },+ "required": [+ "quoteLineId",+ "unitPrice",+ "leadTime",+ "discountPercent",+ "quantity"+ ]+ }+ },+ "required": [+ "quoteId",+ "lineId",+ "quoteLinePrices"+ ]+ }},{"name": "sales_calculatePricesForQuantities",@@ -13421,7 +31124,109 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "quantities": {+ "type": "array",+ "items": {+ "type": "number"+ }+ }+ },+ "required": [+ "quoteId",+ "quoteLineId",+ "quantities"+ ]+ }+ },+ {+ "name": "sales_resolveQuoteLinePrices",+ "module": "sales",+ "classification": "WRITE",+ "description": "resolve quote line prices",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "quoteId",+ "quoteLineId",+ "quantities",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "quantities": {+ "type": "array",+ "items": {+ "type": "number"+ }+ }+ },+ "required": [+ "quoteId",+ "quoteLineId",+ "quantities"+ ]+ }+ },+ {+ "name": "sales_resolvePurchaseToOrderPrices",+ "module": "sales",+ "classification": "WRITE",+ "description": "resolve purchase to order prices",+ "paramCount": 3,+ "serviceParams": [+ "client",+ "companyId",+ "quoteId",+ "quoteLineId",+ "quantities",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "quantities": {+ "type": "array",+ "items": {+ "type": "number"+ }+ }+ },+ "required": [+ "quoteId",+ "quoteLineId",+ "quantities"+ ]+ }},{"name": "sales_recalculateQuoteLinePrices",@@ -13438,14 +31243,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ }+ },+ "required": [+ "quoteId",+ "quoteLineId"+ ]+ }},{"name": "sales_upsertQuoteLineMethod","module": "sales","classification": "WRITE","description": "upsert quote line method",- "paramCount": 12,+ "paramCount": 5,"serviceParams": ["client","lineMethod"@@ -13454,14 +31274,65 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "quoteLineId": {+ "type": "string"+ },+ "configuration": {},+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "itemId",+ "quoteId",+ "quoteLineId"+ ]+ }},{"name": "sales_upsertQuoteMaterial","module": "sales","classification": "WRITE","description": "upsert quote material",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","quoteMaterial"@@ -13470,14 +31341,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteMaterial": {}+ },+ "required": [+ "quoteMaterial"+ ]+ }},{"name": "sales_upsertQuoteMaterialMakeMethod","module": "sales","classification": "WRITE","description": "upsert quote material make method",- "paramCount": 11,+ "paramCount": 4,"serviceParams": ["client","quoteMethod"@@ -13486,14 +31366,61 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "sourceId": {+ "type": "string"+ },+ "targetId": {+ "type": "string"+ },+ "configuration": {},+ "parts": {+ "type": "object",+ "properties": {+ "billOfMaterial": {+ "type": "boolean"+ },+ "billOfProcess": {+ "type": "boolean"+ },+ "parameters": {+ "type": "boolean"+ },+ "tools": {+ "type": "boolean"+ },+ "steps": {+ "type": "boolean"+ },+ "workInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "billOfMaterial",+ "billOfProcess",+ "parameters",+ "tools",+ "steps",+ "workInstructions"+ ]+ }+ },+ "required": [+ "sourceId",+ "targetId"+ ]+ }},{"name": "sales_upsertQuoteOperation","module": "sales","classification": "WRITE","description": "upsert quote operation",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","operation"@@ -13502,14 +31429,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "operation": {}+ },+ "required": [+ "operation"+ ]+ }},{"name": "sales_upsertQuoteOperationStep","module": "sales","classification": "WRITE","description": "upsert quote operation step",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","quoteOperationStep"@@ -13518,14 +31454,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationStep": {}+ },+ "required": [+ "quoteOperationStep"+ ]+ }},{"name": "sales_upsertQuoteOperationParameter","module": "sales","classification": "WRITE","description": "upsert quote operation parameter",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","quoteOperationParameter"@@ -13534,14 +31479,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationParameter": {}+ },+ "required": [+ "quoteOperationParameter"+ ]+ }},{"name": "sales_upsertQuoteOperationTool","module": "sales","classification": "WRITE","description": "upsert quote operation tool",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","quoteOperationTool"@@ -13550,14 +31504,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteOperationTool": {}+ },+ "required": [+ "quoteOperationTool"+ ]+ }},{"name": "sales_upsertQuotePayment","module": "sales","classification": "WRITE","description": "upsert quote payment",- "paramCount": 0,+ "paramCount": 5,"serviceParams": ["client","quotePayment"@@ -13566,14 +31529,37 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": "string"+ },+ "invoiceCustomerLocationId": {+ "type": "string"+ },+ "invoiceCustomerContactId": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_upsertQuoteShipment","module": "sales","classification": "WRITE","description": "upsert quote shipment",- "paramCount": 0,+ "paramCount": 7,"serviceParams": ["client","quoteShipment"@@ -13582,14 +31568,43 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "shippingMethodId": {+ "type": "string"+ },+ "receiptRequestedDate": {+ "type": "string"+ },+ "shippingCost": {+ "type": "number"+ },+ "incoterm": {+ "type": "string"+ },+ "incotermLocation": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_updateSalesOrderFavorite","module": "sales","classification": "WRITE","description": "update sales order favorite",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","args"@@ -13597,14 +31612,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "favorite": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "favorite"+ ]+ }},{"name": "sales_updateSalesOrderStatus","module": "sales","classification": "WRITE","description": "update sales order status",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","update"@@ -13612,14 +31642,153 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "assignee": {}+ },+ "required": [+ "id",+ "status",+ "assignee"+ ]+ }+ },+ {+ "name": "sales_insertSalesOrder",+ "module": "sales",+ "classification": "WRITE",+ "description": "Create a new sales order with all business logic - generates sequence, creates opportunity, resolves payment/shipping defaults from customer. LLM can create a sales order with just customerId.",+ "paramCount": 14,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "salesOrderId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "orderDate": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "opportunityId": {+ "type": "string"+ },+ "requestedDate": {+ "type": "string"+ },+ "promisedDate": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_updateSalesOrder",+ "module": "sales",+ "classification": "WRITE",+ "description": "Update an existing sales order - handles exchange rate updates when currency changes, syncs customer to opportunity",+ "paramCount": 9,+ "serviceParams": [+ "client",+ "input",+ "companyGroupId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "orderDate": {+ "type": "string"+ },+ "customerContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerLocationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerId": {+ "type": "string"+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_upsertSalesOrder","module": "sales","classification": "WRITE","description": "upsert sales order",- "paramCount": 0,+ "paramCount": 18,"serviceParams": ["client","salesOrder"@@ -13628,14 +31797,77 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "salesOrderId": {+ "type": "string"+ },+ "orderDate": {+ "type": "string"+ },+ "requestedDate": {+ "type": "string"+ },+ "promisedDate": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerEngineeringContactId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "quoteId": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ },+ "exchangeRate": {+ "type": "number"+ },+ "exchangeRateUpdatedAt": {+ "type": "string"+ },+ "salesPersonId": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "locationId"+ ]+ }},{"name": "sales_upsertSalesOrderShipment","module": "sales","classification": "WRITE","description": "upsert sales order shipment",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","salesOrderShipment"@@ -13644,14 +31876,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderShipment": {}+ },+ "required": [+ "salesOrderShipment"+ ]+ }},{"name": "sales_upsertSalesOrderLine","module": "sales","classification": "WRITE","description": "upsert sales order line",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","salesOrderLine"@@ -13660,14 +31901,53 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "salesOrderLine": {}+ },+ "required": [+ "salesOrderLine"+ ]+ }+ },+ {+ "name": "sales_updateSalesOrderLineOrder",+ "module": "sales",+ "classification": "WRITE",+ "description": "update sales order line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "sales_upsertSalesOrderPayment","module": "sales","classification": "WRITE","description": "upsert sales order payment",- "paramCount": 0,+ "paramCount": 7,"serviceParams": ["client","salesOrderPayment"@@ -13676,14 +31956,180 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "invoiceCustomerId": {+ "type": "string"+ },+ "invoiceCustomerLocationId": {+ "type": "string"+ },+ "invoiceCustomerContactId": {+ "type": "string"+ },+ "paymentTermId": {+ "type": "string"+ },+ "paymentComplete": {+ "type": "string"+ },+ "currencyCode": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "paymentComplete"+ ]+ }+ },+ {+ "name": "sales_insertSalesRFQ",+ "module": "sales",+ "classification": "WRITE",+ "description": "insert sales r f q",+ "paramCount": 11,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "createdBy",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "customerId": {+ "type": "string"+ },+ "rfqId": {+ "type": "string"+ },+ "rfqDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "salesPersonId": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "status": {+ "type": "string",+ "enum": [+ "Draft",+ "Ready for Quote",+ "Quoted",+ "Closed"+ ]+ },+ "notes": {+ "type": "string"+ },+ "customFields": {}+ },+ "required": [+ "customerId"+ ]+ }+ },+ {+ "name": "sales_updateSalesRFQ",+ "module": "sales",+ "classification": "WRITE",+ "description": "update sales r f q",+ "paramCount": 11,+ "serviceParams": [+ "client",+ "input"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerContactId": {+ "type": [+ "string",+ "null"+ ]+ },+ "customerReference": {+ "type": [+ "string",+ "null"+ ]+ },+ "rfqDate": {+ "type": "string"+ },+ "expirationDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "locationId": {+ "type": "string"+ },+ "salesPersonId": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string",+ "enum": [+ "Draft",+ "Ready for Quote",+ "Quoted",+ "Closed"+ ]+ },+ "notes": {+ "type": [+ "string",+ "null"+ ]+ },+ "customFields": {}+ },+ "required": [+ "id"+ ]+ }},{"name": "sales_upsertSalesRFQ","module": "sales","classification": "WRITE","description": "upsert sales r f q",- "paramCount": 0,+ "paramCount": 14,"serviceParams": ["client","rfq"@@ -13692,14 +32138,65 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "rfqId": {+ "type": "string"+ },+ "customerLocationId": {+ "type": "string"+ },+ "customerContactId": {+ "type": "string"+ },+ "customerEngineeringContactId": {+ "type": "string"+ },+ "customerId": {+ "type": "string"+ },+ "customerReference": {+ "type": "string"+ },+ "expirationDate": {+ "type": "string"+ },+ "externalNotes": {+ "type": "string"+ },+ "internalNotes": {+ "type": "string"+ },+ "locationId": {+ "type": "string"+ },+ "rfqDate": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "salesPersonId": {+ "type": "string"+ }+ },+ "required": [+ "customerId",+ "rfqDate"+ ]+ }},{"name": "sales_upsertSalesRFQLine","module": "sales","classification": "WRITE","description": "upsert sales r f q line",- "paramCount": 0,+ "paramCount": 10,"serviceParams": ["client","salesRfqLine"@@ -13708,7 +32205,78 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "salesRfqId": {+ "type": "string"+ },+ "customerPartId": {+ "type": "string"+ },+ "customerPartRevision": {+ "type": "string"+ },+ "itemId": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "quantity": {+ "type": "array"+ },+ "unitOfMeasureCode": {+ "type": "string"+ },+ "order": {+ "type": "number"+ },+ "modelUploadId": {+ "type": "string"+ }+ },+ "required": [+ "salesRfqId",+ "customerPartId",+ "quantity",+ "unitOfMeasureCode"+ ]+ }+ },+ {+ "name": "sales_updateSalesRFQLineOrder",+ "module": "sales",+ "classification": "WRITE",+ "description": "update sales r f q line order",+ "paramCount": 2,+ "serviceParams": [+ "db",+ "updates"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }},{"name": "settings_getAccountsPayableBillingAddress",@@ -13722,7 +32290,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getAccountsReceivableBillingAddress",@@ -13736,14 +32308,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_updateAccountsPayableBillingAddress","module": "settings","classification": "WRITE","description": "update accounts payable billing address",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -13753,14 +32329,23 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{"name": "settings_updateAccountsReceivableBillingAddress","module": "settings","classification": "WRITE","description": "update accounts receivable billing address",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -13770,7 +32355,16 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "data": {}+ },+ "required": [+ "data"+ ]+ }},{"name": "settings_deactivateWebhooks",@@ -13784,7 +32378,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_deleteApiKey",@@ -13798,7 +32396,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "settings_deleteSubsidiary",@@ -13812,7 +32421,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_deleteWebhook",@@ -13826,28 +32439,25 @@],"injectAuth": ["companyId"- ]- },- {- "name": "settings_deactivateWebhooks",- "module": "settings",- "classification": "WRITE",- "description": "deactivate webhooks",- "paramCount": 0,- "serviceParams": [- "client",- "companyId"],- "injectAuth": [- "companyId"- ]+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "settings_getApiKeys","module": "settings","classification": "READ","description": "get api keys",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -13855,7 +32465,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "settings_getCompanies",@@ -13869,27 +32503,35 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getCompany",+ "name": "settings_getEmployeeCompanies","module": "settings","classification": "READ",- "description": "get company",+ "description": "get employee companies","paramCount": 0,"serviceParams": ["client",- "companyId"+ "userId"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getCompanyIntegrations",+ "name": "settings_getCompany","module": "settings","classification": "READ",- "description": "get company integrations",+ "description": "get company","paramCount": 0,"serviceParams": ["client",@@ -13897,13 +32539,17 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getCompanyPlan",+ "name": "settings_getCompanyIntegrations","module": "settings","classification": "READ",- "description": "get company plan",+ "description": "get company integrations","paramCount": 0,"serviceParams": ["client",@@ -13911,13 +32557,17 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getCompanySettings",+ "name": "settings_getCompanyPlan","module": "settings","classification": "READ",- "description": "get company settings",+ "description": "get company plan","paramCount": 0,"serviceParams": ["client",@@ -13925,13 +32575,17 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getCompanyIntegrations",+ "name": "settings_getCompanySettings","module": "settings","classification": "READ",- "description": "get company integrations",+ "description": "get company settings","paramCount": 0,"serviceParams": ["client",@@ -13939,7 +32593,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getConfig",@@ -13952,7 +32610,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getCurrentSequence",@@ -13967,7 +32629,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ }+ },+ "required": [+ "table"+ ]+ }},{"name": "settings_getCustomField",@@ -13981,7 +32654,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "settings_getCustomFields",@@ -13996,14 +32680,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ }+ },+ "required": [+ "table"+ ]+ }},{"name": "settings_getCustomFieldsTables","module": "settings","classification": "READ","description": "get custom fields tables",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -14011,7 +32706,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "settings_getIntegration",@@ -14026,7 +32745,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "settings_getIntegrations",@@ -14040,7 +32770,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getKanbanOutputSetting",@@ -14054,14 +32788,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getNextSequence","module": "settings","classification": "READ","description": "get next sequence",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","table",@@ -14069,7 +32807,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ }+ },+ "required": [+ "table"+ ]+ }},{"name": "settings_getPlanById",@@ -14083,7 +32832,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "planId": {+ "type": "string"+ }+ },+ "required": [+ "planId"+ ]+ }},{"name": "settings_getPlans",@@ -14096,22 +32856,11 @@],"injectAuth": ["companyId"- ]- },- {- "name": "settings_getNextSequence",- "module": "settings",- "classification": "READ",- "description": "get next sequence",- "paramCount": 1,- "serviceParams": [- "client",- "table",- "companyId"],- "injectAuth": [- "companyId"- ]+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getSequence",@@ -14126,14 +32875,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ }+ },+ "required": [+ "table"+ ]+ }},{"name": "settings_getSequences","module": "settings","classification": "READ","description": "get sequences",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -14141,7 +32901,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "settings_getSequencesList",@@ -14156,7 +32940,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ }+ },+ "required": [+ "table"+ ]+ }},{"name": "settings_getSubsidiaries",@@ -14170,7 +32965,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getSubsidiary",@@ -14184,7 +32983,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_getTerms",@@ -14198,41 +33001,43 @@],"injectAuth": ["companyId"- ]- },- {- "name": "settings_getWebhook",- "module": "settings",- "classification": "READ",- "description": "get webhook",- "paramCount": 1,- "serviceParams": [- "client",- "id"],- "injectAuth": [- "companyId"- ]+ "schema": {+ "type": "object",+ "properties": {}+ }},{- "name": "settings_getWebhookTables",+ "name": "settings_getWebhook","module": "settings","classification": "READ",- "description": "get webhook tables",- "paramCount": 0,+ "description": "get webhook",+ "paramCount": 1,"serviceParams": [- "client"+ "client",+ "id"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "settings_getWebhooks","module": "settings","classification": "READ","description": "get webhooks",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -14240,7 +33045,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "settings_getWebhookTables",@@ -14253,7 +33082,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "settings_insertCompany",@@ -14270,14 +33103,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "company": {}+ },+ "required": [+ "company"+ ]+ }},{"name": "settings_insertSubsidiary","module": "settings","classification": "WRITE","description": "insert subsidiary",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","subsidiary"@@ -14286,14 +33128,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "parentCompanyId": {+ "type": "string"+ }+ }+ }},{"name": "settings_updateSubsidiary","module": "settings","classification": "WRITE","description": "update subsidiary",- "paramCount": 0,+ "paramCount": 2,"serviceParams": ["client","id",@@ -14302,30 +33155,27 @@"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateCompany",- "module": "settings",- "classification": "WRITE",- "description": "update company",- "paramCount": 0,- "serviceParams": [- "client",- "companyId",- "company"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "subsidiary": {}+ },+ "required": [+ "id",+ "subsidiary"+ ]+ }},{"name": "settings_updateCompanyPlan","module": "settings","classification": "WRITE","description": "update company plan",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","data"@@ -14333,14 +33183,37 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "stripeCustomerId": {+ "type": "string"+ },+ "stripeSubscriptionId": {+ "type": "string"+ },+ "stripeSubscriptionStatus": {+ "type": "string"+ },+ "subscriptionStartDate": {+ "type": "string"+ }+ },+ "required": [+ "stripeCustomerId",+ "stripeSubscriptionId",+ "stripeSubscriptionStatus",+ "subscriptionStartDate"+ ]+ }},{"name": "settings_updateDefaultCustomerCc","module": "settings","classification": "WRITE",- "description": "seed company",- "paramCount": 0,+ "description": "update default customer cc",+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14349,71 +33222,92 @@"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateDefaultSupplierCc",- "module": "settings",- "classification": "WRITE",- "description": "update company",- "paramCount": 0,- "serviceParams": [- "client",- "companyId",- "defaultSupplierCc"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "defaultCustomerCc": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "defaultCustomerCc"+ ]+ }},{- "name": "settings_updateKanbanOutputSetting",+ "name": "settings_updateCompany","module": "settings","classification": "WRITE",- "description": "update kanban output setting",+ "description": "update company","paramCount": 1,"serviceParams": ["client","companyId",- "kanbanOutput"+ "company"],"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "company": {}+ },+ "required": [+ "company"+ ]+ }},{- "name": "settings_updateMetricSettings",+ "name": "settings_updateShelfLifeSettings","module": "settings","classification": "WRITE",- "description": "update metric settings",- "paramCount": 1,+ "description": "update shelf life settings",+ "paramCount": 4,"serviceParams": ["client","companyId",- "useMetric"+ "settings"],"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_upsertApiKey",- "module": "settings",- "classification": "WRITE",- "description": "upsert api key",- "paramCount": 0,- "serviceParams": [- "client",- "apiKey"],- "injectAuth": [- "companyId",- "createdBy",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "/** undefined disables expiry badges company-wide. */\n nearExpiryWarningDays": {},+ "/** Seed for the \"Shelf-life (days)\" input on new items. */\n defaultShelfLifeDays": {+ "type": "number"+ },+ "/** MIN expiry scope for Calculated-mode finished products. */\n calculatedInputScope": {+ "type": "string",+ "enum": [+ "AllInputs",+ "ManagedInputsOnly"+ ]+ },+ "/** Policy enforced when an operator consumes an expired entity. */\n expiredEntityPolicy": {+ "type": "string",+ "enum": [+ "Warn",+ "Block",+ "BlockWithOverride"+ ]+ }+ },+ "required": [+ "/** undefined disables expiry badges company-wide. */\n nearExpiryWarningDays",+ "/** Seed for the \"Shelf-life (days)\" input on new items. */\n defaultShelfLifeDays",+ "/** MIN expiry scope for Calculated-mode finished products. */\n calculatedInputScope",+ "/** Policy enforced when an operator consumes an expired entity. */\n expiredEntityPolicy"+ ]+ }},{"name": "settings_updateDigitalQuoteSetting",@@ -14431,14 +33325,36 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "digitalQuoteEnabled": {+ "type": "boolean"+ },+ "digitalQuoteNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "digitalQuoteIncludesPurchaseOrders": {+ "type": "boolean"+ }+ },+ "required": [+ "digitalQuoteEnabled",+ "digitalQuoteNotificationGroup",+ "digitalQuoteIncludesPurchaseOrders"+ ]+ }},{"name": "settings_updateIntegrationMetadata","module": "settings","classification": "WRITE",- "description": "update logo dark",- "paramCount": 1,+ "description": "update integration metadata",+ "paramCount": 2,"serviceParams": ["client","companyId",@@ -14449,147 +33365,108 @@"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateLogoLight",- "module": "settings",- "classification": "WRITE",- "description": "update logo light",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "logoLight"- ],- "injectAuth": [- "companyId",- "updatedBy"- ]- },- {- "name": "settings_updateLogoDarkIcon",- "module": "settings",- "classification": "WRITE",- "description": "update logo dark icon",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "logoDarkIcon"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "integrationId": {+ "type": "string"+ },+ "metadata": {}+ },+ "required": [+ "integrationId",+ "metadata"+ ]+ }},{- "name": "settings_updateLogoLightIcon",+ "name": "settings_updateJobTravelerWorkInstructions","module": "settings","classification": "WRITE",- "description": "update logo light icon",+ "description": "update job traveler work instructions","paramCount": 1,"serviceParams": ["client","companyId",- "logoLightIcon"+ "jobTravelerIncludeWorkInstructions"],"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateMaterialGeneratedIdsSetting",- "module": "settings",- "classification": "WRITE",- "description": "update material generated ids setting",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "materialGeneratedIds"],- "injectAuth": [- "companyId",- "updatedBy"- ]- },- {- "name": "settings_updateMaterialUnitsSetting",- "module": "settings",- "classification": "WRITE",- "description": "update material units setting",- "paramCount": 1,- "serviceParams": [],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "jobTravelerIncludeWorkInstructions": {+ "type": "boolean"+ }+ },+ "required": [+ "jobTravelerIncludeWorkInstructions"+ ]+ }},{- "name": "settings_updateProductLabelSize",+ "name": "settings_updateAccountingEnabledSetting","module": "settings","classification": "WRITE",- "description": "update product label size",+ "description": "update accounting enabled setting","paramCount": 1,"serviceParams": ["client","companyId",- "productLabelSize"+ "accountingEnabled"],"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updatePurchasingPdfThumbnails",- "module": "settings",- "classification": "WRITE",- "description": "update purchasing pdf thumbnails",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "includeThumbnailsOnPurchasingPdfs"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "accountingEnabled": {+ "type": "boolean"+ }+ },+ "required": [+ "accountingEnabled"+ ]+ }},{- "name": "settings_updateSalesPdfThumbnails",+ "name": "settings_updateAssetTaxDepreciationSettings","module": "settings","classification": "WRITE",- "description": "update sales pdf thumbnails",- "paramCount": 1,+ "description": "update asset tax depreciation settings",+ "paramCount": 2,"serviceParams": ["client","companyId",- "includeThumbnailsOnSalesPdfs"+ "settings"],"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateJobTravelerWorkInstructions",- "module": "settings",- "classification": "WRITE",- "description": "update job traveler work instructions",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "jobTravelerIncludeWorkInstructions"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "assetTaxDepreciationEnabled": {+ "type": "boolean"+ },+ "assetTaxRate": {+ "type": [+ "number",+ "null"+ ]+ }+ },+ "required": [+ "assetTaxDepreciationEnabled",+ "assetTaxRate"+ ]+ }},{"name": "settings_updateTimeCardSetting",@@ -14605,13 +33482,24 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "timeCardEnabled": {+ "type": "boolean"+ }+ },+ "required": [+ "timeCardEnabled"+ ]+ }},{"name": "settings_updateKanbanOutputSetting","module": "settings","classification": "WRITE",- "description": "update console setting",+ "description": "update kanban output setting","paramCount": 1,"serviceParams": ["client",@@ -14621,13 +33509,24 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "kanbanOutput": {+ "type": "string"+ }+ },+ "required": [+ "kanbanOutput"+ ]+ }},{"name": "settings_updateLogoDark","module": "settings","classification": "WRITE",- "description": "update rfq ready setting",+ "description": "update logo dark","paramCount": 1,"serviceParams": ["client",@@ -14637,13 +33536,27 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "logoDark": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "logoDark"+ ]+ }},{"name": "settings_updateLogoDarkIcon","module": "settings","classification": "WRITE",- "description": "update suggestion notification setting",+ "description": "update logo dark icon","paramCount": 1,"serviceParams": ["client",@@ -14653,14 +33566,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "logoDarkIcon": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "logoDarkIcon"+ ]+ }},{"name": "settings_updateLogoLight","module": "settings","classification": "WRITE","description": "update logo light",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14669,14 +33596,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "logoLight": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "logoLight"+ ]+ }},{"name": "settings_updateLogoLightIcon","module": "settings","classification": "WRITE","description": "update logo light icon",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14685,14 +33626,58 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "logoLightIcon": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "logoLightIcon"+ ]+ }+ },+ {+ "name": "settings_updateLogoWatermark",+ "module": "settings",+ "classification": "WRITE",+ "description": "update logo watermark",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "logoWatermark"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "logoWatermark": {+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "logoWatermark"+ ]+ }},{"name": "settings_updateMaintenanceDispatchNotificationSettings","module": "settings","classification": "WRITE","description": "update maintenance dispatch notification settings",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -14701,13 +33686,42 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "maintenanceDispatchNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "qualityDispatchNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "operationsDispatchNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "otherDispatchNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ }+ }},{"name": "settings_updateMaterialGeneratedIdsSetting","module": "settings","classification": "WRITE",- "description": "update supplier quote notification setting",+ "description": "update material generated ids setting","paramCount": 1,"serviceParams": ["client",@@ -14717,14 +33731,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "materialGeneratedIds": {+ "type": "boolean"+ }+ },+ "required": [+ "materialGeneratedIds"+ ]+ }},{"name": "settings_updateMetricSettings","module": "settings","classification": "WRITE","description": "update metric settings",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14733,14 +33758,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "useMetric": {+ "type": "boolean"+ }+ },+ "required": [+ "useMetric"+ ]+ }},{"name": "settings_updateProductLabelSize","module": "settings","classification": "WRITE","description": "update product label size",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14749,7 +33785,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "productLabelSize": {+ "type": "string"+ }+ },+ "required": [+ "productLabelSize"+ ]+ }},{"name": "settings_updatePurchasePriceUpdateTimingSetting",@@ -14765,7 +33812,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "purchasePriceUpdateTiming": {+ "type": "string"+ }+ },+ "required": [+ "purchasePriceUpdateTiming"+ ]+ }},{"name": "settings_updateLeadTimesOnReceiptSetting",@@ -14781,7 +33839,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "updateLeadTimesOnReceipt": {+ "type": "boolean"+ }+ },+ "required": [+ "updateLeadTimesOnReceipt"+ ]+ }},{"name": "settings_updateAccountsPayableAddressSetting",@@ -14797,7 +33866,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "accountsPayableAddress": {+ "type": "boolean"+ }+ },+ "required": [+ "accountsPayableAddress"+ ]+ }},{"name": "settings_updateAccountsReceivableAddressSetting",@@ -14813,7 +33893,18 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "accountsReceivableAddress": {+ "type": "boolean"+ }+ },+ "required": [+ "accountsReceivableAddress"+ ]+ }},{"name": "settings_updateAccountsPayableEmail",@@ -14829,7 +33920,16 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "accountsPayableEmail": {}+ },+ "required": [+ "accountsPayableEmail"+ ]+ }},{"name": "settings_updateAccountsReceivableEmail",@@ -14845,39 +33945,16 @@"injectAuth": ["companyId","updatedBy"- ]- },- {- "name": "settings_updateDefaultSupplierCc",- "module": "settings",- "classification": "WRITE",- "description": "update default supplier cc",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "defaultSupplierCc"- ],- "injectAuth": [- "companyId",- "updatedBy"- ]- },- {- "name": "settings_updateDefaultCustomerCc",- "module": "settings",- "classification": "WRITE",- "description": "update default customer cc",- "paramCount": 1,- "serviceParams": [- "client",- "companyId",- "defaultCustomerCc"],- "injectAuth": [- "companyId",- "updatedBy"- ]+ "schema": {+ "type": "object",+ "properties": {+ "accountsReceivableEmail": {}+ },+ "required": [+ "accountsReceivableEmail"+ ]+ }},{"name": "settings_updateQuoteLineCategoryMarkups",@@ -14893,14 +33970,23 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "quoteLineCategoryMarkups": {}+ },+ "required": [+ "quoteLineCategoryMarkups"+ ]+ }},{"name": "settings_updatePurchasingPdfThumbnails","module": "settings","classification": "WRITE","description": "update purchasing pdf thumbnails",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14909,14 +33995,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "includeThumbnailsOnPurchasingPdfs": {+ "type": "boolean"+ }+ },+ "required": [+ "includeThumbnailsOnPurchasingPdfs"+ ]+ }},{"name": "settings_updateRfqReadySetting","module": "settings","classification": "WRITE","description": "update rfq ready setting",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14925,14 +34022,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "rfqReadyNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "rfqReadyNotificationGroup"+ ]+ }},{"name": "settings_updateSalesPdfThumbnails","module": "settings","classification": "WRITE","description": "update sales pdf thumbnails",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14941,14 +34052,25 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "includeThumbnailsOnSalesPdfs": {+ "type": "boolean"+ }+ },+ "required": [+ "includeThumbnailsOnSalesPdfs"+ ]+ }},{"name": "settings_updateSequence","module": "settings","classification": "WRITE","description": "update sequence",- "paramCount": 1,+ "paramCount": 2,"serviceParams": ["client","table",@@ -14958,14 +34080,27 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ },+ "sequence": {}+ },+ "required": [+ "table",+ "sequence"+ ]+ }},{"name": "settings_updateSuggestionNotificationSetting","module": "settings","classification": "WRITE",- "description": "update integration metadata",- "paramCount": 2,+ "description": "update suggestion notification setting",+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14974,14 +34109,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "suggestionNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "suggestionNotificationGroup"+ ]+ }},{"name": "settings_updateSupplierQuoteNotificationSetting","module": "settings","classification": "WRITE","description": "update supplier quote notification setting",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -14990,14 +34139,28 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "supplierQuoteNotificationGroup": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "supplierQuoteNotificationGroup"+ ]+ }},{"name": "settings_upsertApiKey","module": "settings","classification": "WRITE","description": "upsert api key",- "paramCount": 0,+ "paramCount": 4,"serviceParams": ["client","apiKey"@@ -15006,14 +34169,34 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "scopes": {+ "type": "string"+ },+ "expiresAt": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "settings_updateConsoleSetting","module": "settings","classification": "WRITE","description": "update console setting",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","companyId",@@ -15023,14 +34206,109 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "consoleEnabled": {+ "type": "boolean"+ }+ },+ "required": [+ "consoleEnabled"+ ]+ }+ },+ {+ "name": "settings_updateDefaultSupplierCc",+ "module": "settings",+ "classification": "WRITE",+ "description": "update default supplier cc",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "defaultSupplierCc"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "defaultSupplierCc": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "defaultSupplierCc"+ ]+ }+ },+ {+ "name": "settings_updateShowSupplierReadableIdSetting",+ "module": "settings",+ "classification": "WRITE",+ "description": "update show supplier readable id setting",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "showSupplierReadableId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "showSupplierReadableId": {+ "type": "boolean"+ }+ },+ "required": [+ "showSupplierReadableId"+ ]+ }+ },+ {+ "name": "settings_updateShowCustomerReadableIdSetting",+ "module": "settings",+ "classification": "WRITE",+ "description": "update show customer readable id setting",+ "paramCount": 1,+ "serviceParams": [+ "client",+ "companyId",+ "showCustomerReadableId"+ ],+ "injectAuth": [+ "companyId",+ "updatedBy"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "showCustomerReadableId": {+ "type": "boolean"+ }+ },+ "required": [+ "showCustomerReadableId"+ ]+ }},{"name": "settings_upsertWebhook","module": "settings","classification": "WRITE","description": "upsert webhook",- "paramCount": 0,+ "paramCount": 1,"serviceParams": ["client","webhook"@@ -15039,14 +34317,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "webhook": {}+ },+ "required": [+ "webhook"+ ]+ }},{"name": "shared_approveRequest","module": "shared","classification": "WRITE","description": "approve request",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["db","id",@@ -15056,7 +34343,21 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_canApproveRequest",@@ -15071,7 +34372,16 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "approvalRequest": {}+ },+ "required": [+ "approvalRequest"+ ]+ }},{"name": "shared_canApproveRequestInWindow",@@ -15086,7 +34396,39 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "approvalRequest": {}+ },+ "required": [+ "approvalRequest"+ ]+ }+ },+ {+ "name": "shared_canCancelRequest",+ "module": "shared",+ "classification": "WRITE",+ "description": "can cancel request",+ "paramCount": 1,+ "serviceParams": [+ "approvalRequest",+ "userId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "approvalRequest": {}+ },+ "required": [+ "approvalRequest"+ ]+ }},{"name": "shared_cancelApprovalRequest",@@ -15101,7 +34443,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_canViewApprovalRequest",@@ -15116,7 +34469,16 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "approvalRequest": {}+ },+ "required": [+ "approvalRequest"+ ]+ }},{"name": "shared_createApprovalRequest",@@ -15132,7 +34494,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "request": {}+ },+ "required": [+ "request"+ ]+ }},{"name": "shared_deleteApprovalRule",@@ -15147,7 +34518,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_deleteNote",@@ -15161,7 +34543,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "noteId": {+ "type": "string"+ }+ },+ "required": [+ "noteId"+ ]+ }},{"name": "shared_deleteSavedView",@@ -15175,7 +34568,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "viewId": {+ "type": "string"+ }+ },+ "required": [+ "viewId"+ ]+ }},{"name": "shared_generateEmbedding",@@ -15191,7 +34595,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "text": {+ "type": "string"+ }+ },+ "required": [+ "text"+ ]+ }},{"name": "shared_getApprovalById",@@ -15205,7 +34620,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_getApprovalRequestsByDocument",@@ -15220,7 +34646,22 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "documentType",+ "documentId"+ ]+ }},{"name": "shared_getApprovalRuleByAmount",@@ -15236,7 +34677,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "amount": {+ "type": "number"+ }+ },+ "required": [+ "documentType"+ ]+ }},{"name": "shared_getApproverUserIdsForRule",@@ -15250,7 +34705,45 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "rule": {}+ },+ "required": [+ "rule"+ ]+ }+ },+ {+ "name": "shared_getLowerTierApproverUserIds",+ "module": "shared",+ "classification": "READ",+ "description": "get lower tier approver user ids",+ "paramCount": 2,+ "serviceParams": [+ "client",+ "documentType",+ "companyId",+ "amount"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "amount": {}+ },+ "required": [+ "documentType",+ "amount"+ ]+ }},{"name": "shared_getApprovalRuleById",@@ -15265,7 +34758,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_getApprovalRules",@@ -15279,7 +34783,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "shared_getApprovalRulesForApprover",@@ -15294,14 +34802,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ }+ },+ "required": [+ "documentType"+ ]+ }},{"name": "shared_getApprovalsForUser","module": "shared","classification": "READ","description": "get approvals for user",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","userId",@@ -15310,7 +34829,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ }+ }+ }+ }+ }},{"name": "shared_getBase64ImageFromSupabase",@@ -15324,7 +34861,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "path": {+ "type": "string"+ }+ },+ "required": [+ "path"+ ]+ }},{"name": "shared_getCountries",@@ -15337,7 +34885,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "shared_getLatestApprovalRequestForDocument",@@ -15352,7 +34904,46 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "documentType",+ "documentId"+ ]+ }+ },+ {+ "name": "shared_getDocumentType",+ "module": "shared",+ "classification": "READ",+ "description": "get document type",+ "paramCount": 1,+ "serviceParams": [+ "fileName"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "fileName": {+ "type": "string"+ }+ },+ "required": [+ "fileName"+ ]+ }},{"name": "shared_getModelByItemId",@@ -15366,7 +34957,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ }+ },+ "required": [+ "itemId"+ ]+ }},{"name": "shared_getNotes",@@ -15380,7 +34982,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "documentId"+ ]+ }},{"name": "shared_getPendingApprovalsForApprover",@@ -15395,21 +35008,40 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "shared_getPeriods","module": "shared","classification": "READ","description": "get periods",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{ startDate, endDate }"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "startDate": {+ "type": "string"+ },+ "endDate": {+ "type": "string"+ }+ },+ "required": [+ "startDate",+ "endDate"+ ]+ }},{"name": "shared_getSavedViews",@@ -15424,7 +35056,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "shared_getTagsList",@@ -15439,12 +35075,23 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }},{"name": "shared_hasPendingApproval","module": "shared",- "classification": "WRITE",+ "classification": "READ","description": "has pending approval","paramCount": 2,"serviceParams": [@@ -15454,28 +35101,61 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "documentType",+ "documentId"+ ]+ }},{"name": "shared_importCsv","module": "shared","classification": "WRITE","description": "import csv",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","args"],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "table": {+ "type": "string"+ },+ "filePath": {+ "type": "string"+ },+ "columnMappings": {},+ "enumMappings": {}+ },+ "required": [+ "table",+ "filePath",+ "columnMappings"+ ]+ }},{"name": "shared_insertNote","module": "shared","classification": "WRITE","description": "insert note",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","note"@@ -15484,7 +35164,22 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "note": {+ "type": "string"+ },+ "documentId": {+ "type": "string"+ }+ },+ "required": [+ "note",+ "documentId"+ ]+ }},{"name": "shared_insertTag",@@ -15500,12 +35195,21 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "tag": {}+ },+ "required": [+ "tag"+ ]+ }},{"name": "shared_isApprovalRequired","module": "shared",- "classification": "WRITE",+ "classification": "READ","description": "is approval required","paramCount": 2,"serviceParams": [@@ -15516,7 +35220,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "documentType": {+ "type": "string"+ },+ "amount": {+ "type": "number"+ }+ },+ "required": [+ "documentType"+ ]+ }},{"name": "shared_getExternalLink",@@ -15530,7 +35248,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_upsertExternalLink",@@ -15546,14 +35275,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "externalLink": {}+ },+ "required": [+ "externalLink"+ ]+ }},{"name": "shared_getCustomerPortals","module": "shared","classification": "READ","description": "get customer portals",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15561,7 +35299,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "shared_getCustomerPortal",@@ -15575,7 +35337,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_deleteCustomerPortal",@@ -15589,7 +35362,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_updateModelThumbnail",@@ -15605,7 +35389,22 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "modelId": {+ "type": "string"+ },+ "thumbnailPath": {+ "type": "string"+ }+ },+ "required": [+ "modelId",+ "thumbnailPath"+ ]+ }},{"name": "shared_upsertModelUpload",@@ -15621,7 +35420,16 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "upload": {}+ },+ "required": [+ "upload"+ ]+ }},{"name": "shared_updateNote",@@ -15637,14 +35445,29 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "note": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "note"+ ]+ }},{"name": "shared_rejectRequest","module": "shared","classification": "WRITE","description": "reject request",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["db","id",@@ -15654,7 +35477,21 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "notes": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }},{"name": "shared_upsertApprovalRule",@@ -15670,14 +35507,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "rule": {}+ },+ "required": [+ "rule"+ ]+ }},{"name": "shared_upsertSavedView","module": "shared","classification": "WRITE","description": "upsert saved view",- "paramCount": 11,+ "paramCount": 10,"serviceParams": ["client","view"@@ -15686,14 +35532,63 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "table": {+ "type": "string"+ },+ "type": {+ "type": "string",+ "enum": [+ "Public",+ "Private"+ ]+ },+ "filters": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "sorts": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "columnPinning": {},+ "columnVisibility": {},+ "columnOrder": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "name",+ "table",+ "type"+ ]+ }},{"name": "shared_updateSavedViewOrder","module": "shared","classification": "WRITE","description": "update saved view order",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client","updates"@@ -15701,7 +35596,134 @@"injectAuth": ["companyId","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sortOrder": {+ "type": "number"+ }+ },+ "required": [+ "id",+ "sortOrder"+ ]+ }+ },+ {+ "name": "shared_lookupPriceFromBreaks",+ "module": "shared",+ "classification": "WRITE",+ "description": "lookup price from breaks",+ "paramCount": 3,+ "serviceParams": [+ "priceBreaks",+ "requestedQty",+ "fallbackPrice"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "priceBreaks": {+ "type": "array",+ "items": {}+ },+ "requestedQty": {+ "type": "number"+ },+ "fallbackPrice": {+ "type": "number"+ }+ },+ "required": [+ "priceBreaks",+ "requestedQty",+ "fallbackPrice"+ ]+ }+ },+ {+ "name": "shared_lookupBuyPriceFromMap",+ "module": "shared",+ "classification": "WRITE",+ "description": "lookup buy price from map",+ "paramCount": 4,+ "serviceParams": [+ "itemId",+ "requestedQty",+ "priceMap",+ "fallbackCost"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "itemId": {+ "type": "string"+ },+ "requestedQty": {+ "type": "number"+ },+ "priceMap": {},+ "fallbackCost": {+ "type": "number"+ }+ },+ "required": [+ "itemId",+ "requestedQty",+ "priceMap",+ "fallbackCost"+ ]+ }+ },+ {+ "name": "shared_resolveSupplierPrice",+ "module": "shared",+ "classification": "WRITE",+ "description": "resolve supplier price",+ "paramCount": 4,+ "serviceParams": [+ "priceBreaks",+ "quantity",+ "fallbackUnitPrice",+ "exchangeRate"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {+ "priceBreaks": {+ "type": "array",+ "items": {}+ },+ "quantity": {+ "type": "number"+ },+ "fallbackUnitPrice": {+ "type": "number"+ },+ "exchangeRate": {+ "type": "number"+ }+ },+ "required": [+ "priceBreaks",+ "quantity",+ "fallbackUnitPrice",+ "exchangeRate"+ ]+ }},{"name": "users_deleteEmployeeType",@@ -15715,7 +35737,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeTypeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeTypeId"+ ]+ }},{"name": "users_deleteGroup",@@ -15729,7 +35762,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "groupId": {+ "type": "string"+ }+ },+ "required": [+ "groupId"+ ]+ }},{"name": "users_getCompaniesForUser",@@ -15743,14 +35787,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "users_getCustomers","module": "users","classification": "READ","description": "get customers",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15758,7 +35806,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getEmployee",@@ -15773,14 +35845,43 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": [+ "id"+ ]+ }+ },+ {+ "name": "users_getUnrevokedInviteEmails",+ "module": "users",+ "classification": "READ",+ "description": "get unrevoked invite emails",+ "paramCount": 0,+ "serviceParams": [+ "client",+ "companyId"+ ],+ "injectAuth": [+ "companyId"+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "users_getEmployees","module": "users","classification": "READ","description": "get employees",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15788,14 +35889,38 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getConsoleOperators","module": "users","classification": "READ","description": "get console operators",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15803,7 +35928,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getEmployeeType",@@ -15817,14 +35966,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeTypeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeTypeId"+ ]+ }},{"name": "users_getEmployeeTypes","module": "users","classification": "READ","description": "get employee types",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15832,7 +35992,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getInvitable",@@ -15846,7 +36030,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "users_getModules",@@ -15859,7 +36047,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "users_getGroup",@@ -15873,7 +36065,18 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "groupId": {+ "type": "string"+ }+ },+ "required": [+ "groupId"+ ]+ }},{"name": "users_getGroupMembers",@@ -15887,14 +36090,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "groupId": {+ "type": "string"+ }+ },+ "required": [+ "groupId"+ ]+ }},{"name": "users_getGroups","module": "users","classification": "READ","description": "get groups",- "paramCount": 5,+ "paramCount": 4,"serviceParams": ["client","companyId",@@ -15902,7 +36116,37 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ },+ "uid": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getGroupEmails",@@ -15916,7 +36160,21 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "groupIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "groupIds"+ ]+ }},{"name": "users_getPermissionsByEmployeeType",@@ -15930,14 +36188,25 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeTypeId": {+ "type": "string"+ }+ },+ "required": [+ "employeeTypeId"+ ]+ }},{"name": "users_getSuppliers","module": "users","classification": "READ","description": "get suppliers",- "paramCount": 4,+ "paramCount": 3,"serviceParams": ["client","companyId",@@ -15945,7 +36214,31 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "args": {+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "default": 100+ },+ "offset": {+ "type": "integer",+ "default": 0+ },+ "search": {+ "type": [+ "string",+ "null"+ ]+ }+ }+ }+ }+ }},{"name": "users_getUsers",@@ -15958,7 +36251,11 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {}+ }},{"name": "users_getUserEmails",@@ -15972,14 +36269,28 @@],"injectAuth": ["companyId"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "userIds": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "userIds"+ ]+ }},{"name": "users_insertEmployeeType","module": "users","classification": "WRITE","description": "insert employee type",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","employeeType"@@ -15988,14 +36299,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "users_insertGroup","module": "users","classification": "WRITE","description": "insert group",- "paramCount": 2,+ "paramCount": 1,"serviceParams": ["client","group"@@ -16004,7 +36326,18 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ }+ },+ "required": [+ "name"+ ]+ }},{"name": "users_upsertEmployeeType",@@ -16020,14 +36353,23 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeType": {}+ },+ "required": [+ "employeeType"+ ]+ }},{"name": "users_upsertEmployeeTypePermissions","module": "users","classification": "WRITE","description": "upsert employee type permissions",- "paramCount": 4,+ "paramCount": 2,"serviceParams": ["client","employeeTypeId",@@ -16038,23 +36380,66 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "employeeTypeId": {+ "type": "string"+ },+ "permissions": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "permission": {+ "type": "array",+ "items": {}+ }+ },+ "required": [+ "name",+ "permission"+ ]+ }+ },+ "required": [+ "employeeTypeId",+ "permissions"+ ]+ }},{"name": "users_upsertGroup","module": "users","classification": "WRITE","description": "upsert group",- "paramCount": 3,+ "paramCount": 2,"serviceParams": ["client",- "{"+ "{\n id,\n name,\n companyId\n }"],"injectAuth": ["companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "name"+ ]+ }},{"name": "users_upsertGroupMembers",@@ -16071,7 +36456,25 @@"companyId","createdBy","updatedBy"- ]+ ],+ "schema": {+ "type": "object",+ "properties": {+ "groupId": {+ "type": "string"+ },+ "selections": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ },+ "required": [+ "groupId",+ "selections"+ ]+ }}]}\ No newline at end of filediff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/account.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/account.tsdeleted file mode 100644index 542b015fd7..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/account.ts+++ /dev/null@@ -1,182 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- deleteUserAttributeValue,- getAccount,- getAttributes,- getPrivateAttributes,- getPublicAttributes,- getAllAttributeCategories,- getAttributeCategoryWithValues,- updateAvatar,- updatePublicAccount,- upsertUserAttributeValue,-} from "~/modules/account/account.service";--export const registerAccountTools: RegisterTools = (server, ctx) => {- server.registerTool(- "account_deleteUserAttributeValue",- {- description: "delete user attribute value",- inputSchema: z.object({- args: z.object({- userAttributeId: z.string(),- userAttributeValueId: z.string()- }),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteUserAttributeValue(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: account_deleteUserAttributeValue"),- );-- server.registerTool(- "account_getAccount",- {- description: "get account",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccount(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: account_getAccount"),- );-- server.registerTool(- "account_getAttributes",- {- description: "get attributes",- inputSchema: z.object({- isPublic: z.boolean(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttributes(ctx.client, ctx.userId, ctx.companyId, params.isPublic);- return toMcpResult(result);- }, "Failed: account_getAttributes"),- );-- server.registerTool(- "account_getPrivateAttributes",- {- description: "get private attributes",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPrivateAttributes(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: account_getPrivateAttributes"),- );-- server.registerTool(- "account_getPublicAttributes",- {- description: "get public attributes",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPublicAttributes(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: account_getPublicAttributes"),- );-- server.registerTool(- "account_getAllAttributeCategories",- {- description: "get all attribute categories",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAllAttributeCategories(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: account_getAllAttributeCategories"),- );-- server.registerTool(- "account_getAttributeCategoryWithValues",- {- description: "get attribute category with values",- inputSchema: z.object({- categoryId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttributeCategoryWithValues(ctx.client, params.categoryId, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: account_getAttributeCategoryWithValues"),- );-- server.registerTool(- "account_updateAvatar",- {- description: "update avatar",- inputSchema: z.object({- avatarUrl: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAvatar(ctx.client, ctx.userId, params.avatarUrl);- return toMcpResult(result);- }, "Failed: account_updateAvatar"),- );-- server.registerTool(- "account_updatePublicAccount",- {- description: "update public account",- inputSchema: z.object({- account: z.object({- id: z.string(),- firstName: z.string(),- lastName: z.string(),- about: z.string().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePublicAccount(ctx.client, params.account);- return toMcpResult(result);- }, "Failed: account_updatePublicAccount"),- );-- server.registerTool(- "account_upsertUserAttributeValue",- {- description: "upsert user attribute value",- inputSchema: z.object({- update: z.object({- userAttributeValueId: z.any().optional(),- userAttributeId: z.string(),- value: z.any(),- type: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertUserAttributeValue(ctx.client, { ...params.update, userId: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: account_upsertUserAttributeValue"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/accounting.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/accounting.tsdeleted file mode 100644index 659d2d5574..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/accounting.ts+++ /dev/null@@ -1,1263 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- getTrialBalance,- getFinancialStatementBalances,- getCompaniesInGroup,- deleteAccount,- deletePaymentTerm,- getAccount,- getAccounts,- getAccountsList,- getGroupAccounts,- getBaseCurrency,- getChartOfAccounts,- getCurrency,- getCurrencyByCode,- getCurrencies,- getCurrenciesList,- getCurrentAccountingPeriod,- getDefaultAccounts,- getFiscalYearSettings,- getPaymentTerm,- getPaymentTerms,- getPaymentTermsList,- updateDefaultBalanceSheetAccounts,- updateDefaultIncomeAccounts,- updateFiscalYearSettings,- upsertAccount,- upsertCurrency,- upsertPaymentTerm,- deleteCostCenter,- getCostCenter,- getCostCenters,- getCostCentersList,- getCostCentersTree,- upsertCostCenter,- getDimensions,- getDimension,- upsertDimension,- deleteDimension,- getActiveDimensionsWithValues,- getJournalLineDimensions,- saveJournalLineDimensions,- translateCompanyBalances,- getConsolidatedBalances,- getIntercompanyTransactions,- createIntercompanyTransaction,- runIntercompanyMatching,- generateEliminations,- getIntercompanyBalance,- getExchangeRateHistory,- getJournalEntries,- getJournalEntry,- createJournalEntry,- updateJournalEntry,- deleteJournalEntry,- upsertJournalEntryLine,- deleteJournalEntryLine,- saveJournalEntryWithLines,- postJournalEntry,- reverseJournalEntry,-} from "~/modules/accounting/accounting.service";-import {- defaultBalanceSheetAccountValidator,- defaultIncomeAcountValidator,- fiscalYearSettingsValidator,- accountValidator,- currencyValidator,- paymentTermValidator,- costCenterValidator,- dimensionValidator,- intercompanyTransactionValidator,- journalEntryValidator,- journalEntryLineValidator,-} from "~/modules/accounting/accounting.models";--export const registerAccountingTools: RegisterTools = (server, ctx) => {- server.registerTool(- "accounting_getTrialBalance",- {- description: "get trial balance",- inputSchema: {- companyGroupId: z.string(),- args: z.object({- startDate: z.string().nullable(),- endDate: z.string().nullable()- }),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrialBalance(ctx.client, params.companyGroupId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getTrialBalance"),- );-- server.registerTool(- "accounting_getFinancialStatementBalances",- {- description: "get financial statement balances",- inputSchema: {- companyGroupId: z.string(),- args: z.object({- startDate: z.string().nullable(),- endDate: z.string().nullable()- }),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFinancialStatementBalances(ctx.client, params.companyGroupId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getFinancialStatementBalances"),- );-- server.registerTool(- "accounting_getCompaniesInGroup",- {- description: "get companies in group",- inputSchema: {- companyGroupId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompaniesInGroup(ctx.client, params.companyGroupId);- return toMcpResult(result);- }, "Failed: accounting_getCompaniesInGroup"),- );-- server.registerTool(- "accounting_deleteAccount",- {- description: "delete account",- inputSchema: z.object({- accountId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAccount(ctx.client, params.accountId);- return toMcpResult(result);- }, "Failed: accounting_deleteAccount"),- );-- server.registerTool(- "accounting_deleteAccountCategory",- {- description: "delete account category",- inputSchema: z.object({- accountCategoryId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAccountCategory(ctx.client, params.accountCategoryId);- return toMcpResult(result);- }, "Failed: accounting_deleteAccountCategory"),- );-- server.registerTool(- "accounting_deleteAccountSubcategory",- {- description: "delete account subcategory",- inputSchema: z.object({- accountSubcategoryId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAccountSubcategory(ctx.client, params.accountSubcategoryId);- return toMcpResult(result);- }, "Failed: accounting_deleteAccountSubcategory"),- );-- server.registerTool(- "accounting_deletePaymentTerm",- {- description: "delete payment term",- inputSchema: z.object({- paymentTermId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePaymentTerm(ctx.client, params.paymentTermId);- return toMcpResult(result);- }, "Failed: accounting_deletePaymentTerm"),- );-- server.registerTool(- "accounting_getAccount",- {- description: "get account",- inputSchema: z.object({- accountId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccount(ctx.client, params.accountId);- return toMcpResult(result);- }, "Failed: accounting_getAccount"),- );-- server.registerTool(- "accounting_getAccounts",- {- description: "get accounts",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccounts(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getAccounts"),- );-- server.registerTool(- "accounting_getAccountsList",- {- description: "get accounts list",- inputSchema: z.object({- args: z.object({- isGroup: z.boolean().nullable().optional(),- incomeBalance: z.any().optional(),- classes: z.array(z.any()).optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountsList(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getAccountsList"),- );-- server.registerTool(- "accounting_getGroupAccounts",- {- description: "get account categories",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGroupAccounts(ctx.client, params.companyGroupId);- return toMcpResult(result);- }, "Failed: accounting_getAccountCategories"),- );-- server.registerTool(- "accounting_getAccountCategoriesList",- {- description: "get account categories list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountCategoriesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getAccountCategoriesList"),- );-- server.registerTool(- "accounting_getAccountCategory",- {- description: "get account category",- inputSchema: z.object({- accountCategoryId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountCategory(ctx.client, params.accountCategoryId, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getAccountCategory"),- );-- server.registerTool(- "accounting_getAccountSubcategories",- {- description: "get account subcategories",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountSubcategories(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getAccountSubcategories"),- );-- server.registerTool(- "accounting_getAccountSubcategoriesByCategory",- {- description: "get account subcategories by category",- inputSchema: z.object({- accountCategoryId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountSubcategoriesByCategory(ctx.client, params.accountCategoryId, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getAccountSubcategoriesByCategory"),- );-- server.registerTool(- "accounting_getAccountSubcategory",- {- description: "get account subcategory",- inputSchema: z.object({- accountSubcategoryId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountSubcategory(ctx.client, params.accountSubcategoryId);- return toMcpResult(result);- }, "Failed: accounting_getAccountSubcategory"),- );-- server.registerTool(- "accounting_getBaseCurrency",- {- description: "get base currency",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getBaseCurrency(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getBaseCurrency"),- );-- server.registerTool(- "accounting_getChartOfAccounts",- {- description: "get chart of accounts",- inputSchema: z.object({- args: z.object({- incomeBalance: z.enum(["Income Statement", "Balance Sheet", "null"]),- startDate: z.string().nullable(),- endDate: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getChartOfAccounts(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getChartOfAccounts"),- );-- server.registerTool(- "accounting_getCurrency",- {- description: "get currency",- inputSchema: z.object({- currencyId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrency(ctx.client, params.currencyId);- return toMcpResult(result);- }, "Failed: accounting_getCurrency"),- );-- server.registerTool(- "accounting_getCurrencyByCode",- {- description: "get currency by code",- inputSchema: z.object({- currencyCode: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrencyByCode(ctx.client, params.companyGroupId, params.currencyCode);- return toMcpResult(result);- }, "Failed: accounting_getCurrencyByCode"),- );-- server.registerTool(- "accounting_getCurrencies",- {- description: "get currencies",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrencies(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getCurrencies"),- );-- server.registerTool(- "accounting_getCurrenciesList",- {- description: "get currencies list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrenciesList(ctx.client);- return toMcpResult(result);- }, "Failed: accounting_getCurrenciesList"),- );-- server.registerTool(- "accounting_getCurrentAccountingPeriod",- {- description: "get current accounting period",- inputSchema: z.object({- date: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrentAccountingPeriod(ctx.client, ctx.companyId, params.date);- return toMcpResult(result);- }, "Failed: accounting_getCurrentAccountingPeriod"),- );-- server.registerTool(- "accounting_getDefaultAccounts",- {- description: "get default accounts",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDefaultAccounts(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getDefaultAccounts"),- );-- server.registerTool(- "accounting_getFiscalYearSettings",- {- description: "get fiscal year settings",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFiscalYearSettings(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getFiscalYearSettings"),- );-- server.registerTool(- "accounting_getInventoryPostingGroup",- {- description: "get inventory posting group",- inputSchema: z.object({- args: z.object({- itemPostingGroupId: z.string().nullable(),- locationId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInventoryPostingGroup(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getInventoryPostingGroup"),- );-- server.registerTool(- "accounting_getInventoryPostingGroups",- {- description: "get inventory posting groups",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInventoryPostingGroups(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getInventoryPostingGroups"),- );-- server.registerTool(- "accounting_getPaymentTerm",- {- description: "get payment term",- inputSchema: z.object({- paymentTermId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPaymentTerm(ctx.client, params.paymentTermId);- return toMcpResult(result);- }, "Failed: accounting_getPaymentTerm"),- );-- server.registerTool(- "accounting_getPaymentTerms",- {- description: "get payment terms",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPaymentTerms(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getPaymentTerms"),- );-- server.registerTool(- "accounting_getPaymentTermsList",- {- description: "get payment terms list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPaymentTermsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getPaymentTermsList"),- );-- server.registerTool(- "accounting_getPurchasingPostingGroup",- {- description: "get purchasing posting group",- inputSchema: z.object({- args: z.object({- itemPostingGroupId: z.string().nullable(),- supplierTypeId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingPostingGroup(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getPurchasingPostingGroup"),- );-- server.registerTool(- "accounting_getPurchasingPostingGroups",- {- description: "get purchasing posting groups",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingPostingGroups(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getPurchasingPostingGroups"),- );-- server.registerTool(- "accounting_getPurchasingSalesGroup",- {- description: "get purchasing sales group",- inputSchema: z.object({- args: z.object({- itemPostingGroupId: z.string().nullable(),- customerTypeId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingSalesGroup(ctx.client, params.args);- return toMcpResult(result);- }, "Failed: accounting_getPurchasingSalesGroup"),- );-- server.registerTool(- "accounting_getSalesPostingGroups",- {- description: "get sales posting groups",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesPostingGroups(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getSalesPostingGroups"),- );-- server.registerTool(- "accounting_updateDefaultBalanceSheetAccounts",- {- description: "update default balance sheet accounts",- inputSchema: z.object({- defaultAccounts: defaultBalanceSheetAccountValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultBalanceSheetAccounts(ctx.client, { ...params.defaultAccounts, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_updateDefaultBalanceSheetAccounts"),- );-- server.registerTool(- "accounting_updateDefaultIncomeAccounts",- {- description: "update default income accounts",- inputSchema: z.object({- defaultAccounts: defaultIncomeAcountValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultIncomeAccounts(ctx.client, { ...params.defaultAccounts, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_updateDefaultIncomeAccounts"),- );-- server.registerTool(- "accounting_updateFiscalYearSettings",- {- description: "update fiscal year settings",- inputSchema: z.object({- fiscalYearSettings: fiscalYearSettingsValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateFiscalYearSettings(ctx.client, { ...params.fiscalYearSettings, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_updateFiscalYearSettings"),- );-- server.registerTool(- "accounting_upsertAccount",- {- description: "upsert account",- inputSchema: z.object({- account: accountValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertAccount(ctx.client, { ...params.account, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertAccount"),- );-- server.registerTool(- "accounting_upsertAccountCategory",- {- description: "upsert account category",- inputSchema: z.object({- accountCategory: accountCategoryValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertAccountCategory(ctx.client, { ...params.accountCategory, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertAccountCategory"),- );-- server.registerTool(- "accounting_upsertAccountSubcategory",- {- description: "upsert account subcategory",- inputSchema: z.object({- accountSubcategory: accountSubcategoryValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertAccountSubcategory(ctx.client, { ...params.accountSubcategory, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertAccountSubcategory"),- );-- server.registerTool(- "accounting_upsertCurrency",- {- description: "upsert currency",- inputSchema: z.object({- currency: currencyValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertCurrency(ctx.client, { ...params.currency, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertCurrency"),- );-- server.registerTool(- "accounting_upsertPaymentTerm",- {- description: "upsert payment term",- inputSchema: z.object({- paymentTerm: paymentTermValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPaymentTerm(ctx.client, { ...params.paymentTerm, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertPaymentTerm"),- );-- server.registerTool(- "accounting_deleteCostCenter",- {- description: "delete cost center",- inputSchema: {- costCenterId: z.string(),- },- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCostCenter(ctx.client, params.costCenterId);- return toMcpResult(result);- }, "Failed: accounting_deleteCostCenter"),- );-- server.registerTool(- "accounting_getCostCenter",- {- description: "get cost center",- inputSchema: {- costCenterId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCostCenter(ctx.client, params.costCenterId);- return toMcpResult(result);- }, "Failed: accounting_getCostCenter"),- );-- server.registerTool(- "accounting_getCostCenters",- {- description: "get cost centers",- inputSchema: {- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCostCenters(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getCostCenters"),- );-- server.registerTool(- "accounting_getCostCentersList",- {- description: "get cost centers list",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCostCentersList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getCostCentersList"),- );-- server.registerTool(- "accounting_getCostCentersTree",- {- description: "get cost centers tree",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCostCentersTree(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getCostCentersTree"),- );-- server.registerTool(- "accounting_upsertCostCenter",- {- description: "upsert cost center",- inputSchema: {- costCenter: costCenterValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertCostCenter(ctx.client, { ...params.costCenter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertCostCenter"),- );-- server.registerTool(- "accounting_getDimensions",- {- description: "get dimensions",- inputSchema: {- companyGroupId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDimensions(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getDimensions"),- );-- server.registerTool(- "accounting_getDimension",- {- description: "get dimension",- inputSchema: {- dimensionId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDimension(ctx.client, params.dimensionId);- return toMcpResult(result);- }, "Failed: accounting_getDimension"),- );-- server.registerTool(- "accounting_upsertDimension",- {- description: "upsert dimension",- inputSchema: {- dimension: dimensionValidator,- dimensionValues: z.array(z.string()).optional(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertDimension(ctx.client, { ...params.dimension, createdBy: ctx.userId, updatedBy: ctx.userId }, params.dimensionValues);- return toMcpResult(result);- }, "Failed: accounting_upsertDimension"),- );-- server.registerTool(- "accounting_deleteDimension",- {- description: "delete dimension",- inputSchema: {- dimensionId: z.string(),- },- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDimension(ctx.client, params.dimensionId);- return toMcpResult(result);- }, "Failed: accounting_deleteDimension"),- );-- server.registerTool(- "accounting_getActiveDimensionsWithValues",- {- description: "get active dimensions with values",- inputSchema: {- companyGroupId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getActiveDimensionsWithValues(ctx.client, params.companyGroupId, ctx.companyId);- return toMcpResult(result);- }, "Failed: accounting_getActiveDimensionsWithValues"),- );-- server.registerTool(- "accounting_getJournalLineDimensions",- {- description: "get journal line dimensions",- inputSchema: {- journalLineIds: z.array(z.string()),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJournalLineDimensions(ctx.client, params.journalLineIds);- return toMcpResult(result);- }, "Failed: accounting_getJournalLineDimensions"),- );-- server.registerTool(- "accounting_saveJournalLineDimensions",- {- description: "save journal line dimensions",- inputSchema: {- journalLineId: z.string(),- dimensions: z.any(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await saveJournalLineDimensions(ctx.client, params.journalLineId, ctx.companyId, params.dimensions);- return toMcpResult(result);- }, "Failed: accounting_saveJournalLineDimensions"),- );-- server.registerTool(- "accounting_translateCompanyBalances",- {- description: "translate company balances",- inputSchema: {- companyGroupId: z.string(),- targetCurrency: z.string(),- periodEnd: z.string(),- periodStart: z.string().optional(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await translateCompanyBalances(ctx.client, params.companyGroupId, ctx.companyId, params.targetCurrency, params.periodEnd, params.periodStart);- return toMcpResult(result);- }, "Failed: accounting_translateCompanyBalances"),- );-- server.registerTool(- "accounting_getConsolidatedBalances",- {- description: "get consolidated balances",- inputSchema: {- companyGroupId: z.string(),- companyIds: z.array(z.string()),- targetCurrency: z.string(),- periodEnd: z.string(),- periodStart: z.string().optional(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConsolidatedBalances(ctx.client, params.companyGroupId, params.companyIds, params.targetCurrency, params.periodEnd, params.periodStart);- return toMcpResult(result);- }, "Failed: accounting_getConsolidatedBalances"),- );-- server.registerTool(- "accounting_getIntercompanyTransactions",- {- description: "get intercompany transactions",- inputSchema: {- companyGroupId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- status: z.string().nullable()- }),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIntercompanyTransactions(ctx.client, params.companyGroupId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getIntercompanyTransactions"),- );-- server.registerTool(- "accounting_createIntercompanyTransaction",- {- description: "create intercompany transaction",- inputSchema: {- input: intercompanyTransactionValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createIntercompanyTransaction(ctx.client, { ...params.input, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_createIntercompanyTransaction"),- );-- server.registerTool(- "accounting_runIntercompanyMatching",- {- description: "run intercompany matching",- inputSchema: {- companyGroupId: z.string(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await runIntercompanyMatching(ctx.client, params.companyGroupId);- return toMcpResult(result);- }, "Failed: accounting_runIntercompanyMatching"),- );-- server.registerTool(- "accounting_generateEliminations",- {- description: "generate eliminations",- inputSchema: {- companyGroupId: z.string(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await generateEliminations(ctx.client, params.companyGroupId, ctx.userId);- return toMcpResult(result);- }, "Failed: accounting_generateEliminations"),- );-- server.registerTool(- "accounting_getIntercompanyBalance",- {- description: "get intercompany balance",- inputSchema: {- companyGroupId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIntercompanyBalance(ctx.client, params.companyGroupId);- return toMcpResult(result);- }, "Failed: accounting_getIntercompanyBalance"),- );-- server.registerTool(- "accounting_getExchangeRateHistory",- {- description: "get exchange rate history",- inputSchema: {- companyGroupId: z.string(),- currencyCode: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getExchangeRateHistory(ctx.client, params.companyGroupId, params.currencyCode);- return toMcpResult(result);- }, "Failed: accounting_getExchangeRateHistory"),- );-- server.registerTool(- "accounting_getJournalEntries",- {- description: "get journal entries",- inputSchema: {- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().nullable()- }),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJournalEntries(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: accounting_getJournalEntries"),- );-- server.registerTool(- "accounting_getJournalEntry",- {- description: "get journal entry",- inputSchema: {- id: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJournalEntry(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: accounting_getJournalEntry"),- );-- server.registerTool(- "accounting_createJournalEntry",- {- description: "create journal entry",- inputSchema: {- data: journalEntryValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createJournalEntry(ctx.client, { ...params.data, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_createJournalEntry"),- );-- server.registerTool(- "accounting_updateJournalEntry",- {- description: "update journal entry",- inputSchema: {- id: z.string(),- data: journalEntryValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJournalEntry(ctx.client, params.id, { ...params.data, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_updateJournalEntry"),- );-- server.registerTool(- "accounting_deleteJournalEntry",- {- description: "delete journal entry",- inputSchema: {- id: z.string(),- },- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJournalEntry(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: accounting_deleteJournalEntry"),- );-- server.registerTool(- "accounting_upsertJournalEntryLine",- {- description: "upsert journal entry line",- inputSchema: {- data: journalEntryLineValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJournalEntryLine(ctx.client, { ...params.data, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_upsertJournalEntryLine"),- );-- server.registerTool(- "accounting_deleteJournalEntryLine",- {- description: "delete journal entry line",- inputSchema: {- id: z.string(),- },- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJournalEntryLine(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: accounting_deleteJournalEntryLine"),- );-- server.registerTool(- "accounting_saveJournalEntryWithLines",- {- description: "save journal entry with lines",- inputSchema: {- data: z.object({- journalEntryId: z.string(),- postingDate: z.string(),- description: z.string().optional(),- lines: z.any(),- accountId: z.string(),- debit: z.number(),- credit: z.number(),- dimensions: z.any().optional(),- valueId: z.any(),- companyGroupId: z.string()- }),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await saveJournalEntryWithLines(ctx.client, { ...params.data, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_saveJournalEntryWithLines"),- );-- server.registerTool(- "accounting_postJournalEntry",- {- description: "post journal entry",- inputSchema: {- id: z.string(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await postJournalEntry(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: accounting_postJournalEntry"),- );-- server.registerTool(- "accounting_reverseJournalEntry",- {- description: "reverse journal entry",- inputSchema: {- id: z.string(),- data: z.object({- journalEntryId: z.string()- }),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await reverseJournalEntry(ctx.client, params.id, { ...params.data, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: accounting_reverseJournalEntry"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/documents.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/documents.tsdeleted file mode 100644index 44040d082f..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/documents.ts+++ /dev/null@@ -1,251 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- deleteDocument,- deleteDocumentFavorite,- deleteDocumentLabel,- getDocument,- getDocuments,- getDocumentExtensions,- getDocumentLabels,- insertDocumentFavorite,- insertDocumentLabel,- moveDocumentToTrash,- restoreDocument,- upsertDocument,- updateDocumentFavorite,- updateDocumentLabels,-} from "~/modules/documents/documents.service";-import {- documentValidator,- documentLabelsValidator,-} from "~/modules/documents/documents.models";--export const registerDocumentsTools: RegisterTools = (server, ctx) => {- server.registerTool(- "documents_deleteDocument",- {- description: "delete document",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDocument(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: documents_deleteDocument"),- );-- server.registerTool(- "documents_deleteDocumentFavorite",- {- description: "delete document favorite",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDocumentFavorite(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_deleteDocumentFavorite"),- );-- server.registerTool(- "documents_deleteDocumentLabel",- {- description: "delete document label",- inputSchema: z.object({- id: z.string(),- label: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDocumentLabel(ctx.client, params.id, params.label);- return toMcpResult(result);- }, "Failed: documents_deleteDocumentLabel"),- );-- server.registerTool(- "documents_getDocument",- {- description: "get document",- inputSchema: z.object({- documentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDocument(ctx.client, params.documentId);- return toMcpResult(result);- }, "Failed: documents_getDocument"),- );-- server.registerTool(- "documents_getDocuments",- {- description: "get documents",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- favorite: z.boolean().optional(),- recent: z.boolean().optional(),- active: z.boolean()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDocuments(ctx.client, ctx.companyId, { ...params.args, createdBy: ctx.userId, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: documents_getDocuments"),- );-- server.registerTool(- "documents_getDocumentExtensions",- {- description: "get document extensions",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDocumentExtensions(ctx.client);- return toMcpResult(result);- }, "Failed: documents_getDocumentExtensions"),- );-- server.registerTool(- "documents_getDocumentLabels",- {- description: "get document labels",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDocumentLabels(ctx.client, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_getDocumentLabels"),- );-- server.registerTool(- "documents_insertDocumentFavorite",- {- description: "insert document favorite",- inputSchema: z.object({- id: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertDocumentFavorite(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_insertDocumentFavorite"),- );-- server.registerTool(- "documents_insertDocumentLabel",- {- description: "insert document label",- inputSchema: z.object({- id: z.string(),- label: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertDocumentLabel(ctx.client, params.id, params.label, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_insertDocumentLabel"),- );-- server.registerTool(- "documents_moveDocumentToTrash",- {- description: "move document to trash",- inputSchema: z.object({- id: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await moveDocumentToTrash(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_moveDocumentToTrash"),- );-- server.registerTool(- "documents_restoreDocument",- {- description: "restore document",- inputSchema: z.object({- id: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await restoreDocument(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: documents_restoreDocument"),- );-- server.registerTool(- "documents_upsertDocument",- {- description: "upsert document",- inputSchema: z.object({- document: documentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertDocument(ctx.client, { ...params.document, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: documents_upsertDocument"),- );-- server.registerTool(- "documents_updateDocumentFavorite",- {- description: "update document favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDocumentFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: documents_updateDocumentFavorite"),- );-- server.registerTool(- "documents_updateDocumentLabels",- {- description: "update document labels",- inputSchema: z.object({- document: documentLabelsValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDocumentLabels(ctx.client, { ...params.document, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: documents_updateDocumentLabels"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/index.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/index.tsdeleted file mode 100644index 7d88aae62a..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/index.ts+++ /dev/null@@ -1,17 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-export { registerAccountTools } from "./account";-export { registerAccountingTools } from "./accounting";-export { registerDocumentsTools } from "./documents";-export { registerInventoryTools } from "./inventory";-export { registerInvoicingTools } from "./invoicing";-export { registerItemsTools } from "./items";-export { registerPeopleTools } from "./people";-export { registerProductionTools } from "./production";-export { registerPurchasingTools } from "./purchasing";-export { registerQualityTools } from "./quality";-export { registerResourcesTools } from "./resources";-export { registerSalesTools } from "./sales";-export { registerSettingsTools } from "./settings";-export { registerSharedTools } from "./shared";-export { registerUsersTools } from "./users";diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/inventory.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/inventory.tsdeleted file mode 100644index ee2312e6df..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/inventory.ts+++ /dev/null@@ -1,1241 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- deleteBatchProperty,- deleteKanban,- deleteReceipt,- deleteReceiptLine,- deleteStorageUnit,- deleteShipment,- deleteShipmentLine,- deleteShippingMethod,- deleteStockTransfer,- deleteStockTransferLine,- deleteWarehouseTransfer,- deleteWarehouseTransferLine,- getItemLedgerPage,- getBatchProperties,- getInventoryItems,- getInventoryItemsCount,- getKanbans,- getKanban,- getStockTransfer,- getStockTransferLine,- getStockTransferLines,- getStockTransferTracking,- getStockTransfers,- getDefaultStorageUnitOrStorageUnitWithHighestQuantity,- getReceipts,- getReceipt,- getReceiptLines,- getReceiptTracking,- getReceiptLineTracking,- getReceiptFiles,- getSerialNumbersForItem,- getBatchNumbersForItem,- getStorageUnitsList,- getStorageUnitsListForLocation,- getStorageUnits,- getStorageUnit,- getShipments,- getShipment,- getShipmentLines,- getShipmentLinesWithDetails,- getShipmentFiles,- getShipmentRelatedItems,- getShipmentTracking,- getShipmentLineTracking,- getShippingMethod,- getShippingMethods,- getShippingMethodsList,- getShippingTermsList,- getTrackedEntities,- getTrackedEntitiesByMakeMethodId,- getTrackedEntity,- getTrackedEntitiesByOperationId,- getWarehouseTransfers,- getWarehouseTransfer,- getWarehouseTransferLine,- getWarehouseTransferLines,- insertManualInventoryAdjustment,- updateBatchPropertyOrder,- updateStockTransferStatus,- upsertBatchProperty,- upsertKanban,- upsertReceipt,- upsertStorageUnit,- upsertShippingMethod,- upsertShipment,- upsertStockTransfer,- upsertStockTransferLine,- upsertStockTransferLines,- upsertWarehouseTransfer,- updateWarehouseTransferStatus,- upsertWarehouseTransferLine,- getDefaultStorageUnitForJob,-} from "~/modules/inventory/inventory.service";-import {- inventoryAdjustmentValidator,- batchPropertyOrderValidator,- batchPropertyValidator,- kanbanValidator,- receiptValidator,- storageUnitValidator,- shippingMethodValidator,- shipmentValidator,- stockTransferLineValidator,- stockTransferValidator,- warehouseTransferValidator,-} from "~/modules/inventory/inventory.models";--export const registerInventoryTools: RegisterTools = (server, ctx) => {- server.registerTool(- "inventory_deleteBatchProperty",- {- description: "delete batch property",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteBatchProperty(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: inventory_deleteBatchProperty"),- );-- server.registerTool(- "inventory_deleteKanban",- {- description: "delete kanban",- inputSchema: z.object({- kanbanId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteKanban(ctx.client, params.kanbanId);- return toMcpResult(result);- }, "Failed: inventory_deleteKanban"),- );-- server.registerTool(- "inventory_deleteReceipt",- {- description: "delete receipt",- inputSchema: z.object({- receiptId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteReceipt(ctx.client, params.receiptId);- return toMcpResult(result);- }, "Failed: inventory_deleteReceipt"),- );-- server.registerTool(- "inventory_deleteReceiptLine",- {- description: "delete receipt line",- inputSchema: z.object({- receiptLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteReceiptLine(ctx.client, params.receiptLineId);- return toMcpResult(result);- }, "Failed: inventory_deleteReceiptLine"),- );-- server.registerTool(- "inventory_deleteStorageUnit",- {- description: "delete storage unit",- inputSchema: z.object({- storageUnitId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteStorageUnit(ctx.client, params.storageUnitId);- return toMcpResult(result);- }, "Failed: inventory_deleteStorageUnit"),- );-- server.registerTool(- "inventory_deleteShipment",- {- description: "delete shipment",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteShipment(ctx.client, params.shipmentId);- return toMcpResult(result);- }, "Failed: inventory_deleteShipment"),- );-- server.registerTool(- "inventory_deleteShipmentLine",- {- description: "delete shipment line",- inputSchema: z.object({- shipmentLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteShipmentLine(ctx.client, params.shipmentLineId);- return toMcpResult(result);- }, "Failed: inventory_deleteShipmentLine"),- );-- server.registerTool(- "inventory_deleteShippingMethod",- {- description: "delete shipping method",- inputSchema: z.object({- shippingMethodId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteShippingMethod(ctx.client, params.shippingMethodId);- return toMcpResult(result);- }, "Failed: inventory_deleteShippingMethod"),- );-- server.registerTool(- "inventory_deleteStockTransfer",- {- description: "delete stock transfer",- inputSchema: z.object({- stockTransferId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteStockTransfer(ctx.client, params.stockTransferId);- return toMcpResult(result);- }, "Failed: inventory_deleteStockTransfer"),- );-- server.registerTool(- "inventory_deleteStockTransferLine",- {- description: "delete stock transfer line",- inputSchema: z.object({- stockTransferLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteStockTransferLine(ctx.client, params.stockTransferLineId);- return toMcpResult(result);- }, "Failed: inventory_deleteStockTransferLine"),- );-- server.registerTool(- "inventory_deleteWarehouseTransfer",- {- description: "delete warehouse transfer",- inputSchema: z.object({- transferId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteWarehouseTransfer(ctx.client, params.transferId);- return toMcpResult(result);- }, "Failed: inventory_deleteWarehouseTransfer"),- );-- server.registerTool(- "inventory_deleteWarehouseTransferLine",- {- description: "delete warehouse transfer line",- inputSchema: z.object({- transferLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteWarehouseTransferLine(ctx.client, params.transferLineId);- return toMcpResult(result);- }, "Failed: inventory_deleteWarehouseTransferLine"),- );-- server.registerTool(- "inventory_getItemLedgerPage",- {- description: "get item ledger page",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- sortDescending: z.boolean().optional(),- page: z.number().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemLedgerPage(ctx.client, params.itemId, ctx.companyId, params.locationId, params.sortDescending, params.page);- return toMcpResult(result);- }, "Failed: inventory_getItemLedgerPage"),- );-- server.registerTool(- "inventory_getBatchProperties",- {- description: "get batch properties",- inputSchema: z.object({- itemIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getBatchProperties(ctx.client, params.itemIds, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getBatchProperties"),- );-- server.registerTool(- "inventory_getInventoryItems",- {- description: "get inventory items",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInventoryItems(ctx.client, params.locationId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getInventoryItems"),- );-- server.registerTool(- "inventory_getInventoryItemsCount",- {- description: "get inventory items count",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInventoryItemsCount(ctx.client, params.locationId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getInventoryItemsCount"),- );-- server.registerTool(- "inventory_getKanbans",- {- description: "get kanbans",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getKanbans(ctx.client, params.locationId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getKanbans"),- );-- server.registerTool(- "inventory_getKanban",- {- description: "get kanban",- inputSchema: z.object({- kanbanId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getKanban(ctx.client, params.kanbanId);- return toMcpResult(result);- }, "Failed: inventory_getKanban"),- );-- server.registerTool(- "inventory_getStockTransfer",- {- description: "get stock transfer",- inputSchema: z.object({- stockTransferId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStockTransfer(ctx.client, params.stockTransferId);- return toMcpResult(result);- }, "Failed: inventory_getStockTransfer"),- );-- server.registerTool(- "inventory_getStockTransferLine",- {- description: "get stock transfer line",- inputSchema: z.object({- stockTransferLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStockTransferLine(ctx.client, params.stockTransferLineId);- return toMcpResult(result);- }, "Failed: inventory_getStockTransferLine"),- );-- server.registerTool(- "inventory_getStockTransferLines",- {- description: "get stock transfer lines",- inputSchema: z.object({- stockTransferId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStockTransferLines(ctx.client, params.stockTransferId);- return toMcpResult(result);- }, "Failed: inventory_getStockTransferLines"),- );-- server.registerTool(- "inventory_getStockTransferTracking",- {- description: "get stock transfer tracking",- inputSchema: z.object({- stockTransferId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStockTransferTracking(ctx.client, params.stockTransferId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getStockTransferTracking"),- );-- server.registerTool(- "inventory_getStockTransfers",- {- description: "get stock transfers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- locationId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStockTransfers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getStockTransfers"),- );-- server.registerTool(- "inventory_getDefaultStorageUnitOrStorageUnitWithHighestQuantity",- {- description: "get default storage unit or storage unit with highest quantity",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDefaultStorageUnitOrStorageUnitWithHighestQuantity(ctx.client, params.itemId, params.locationId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getDefaultStorageUnitOrStorageUnitWithHighestQuantity"),- );-- server.registerTool(- "inventory_getReceipts",- {- description: "get receipts",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceipts(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getReceipts"),- );-- server.registerTool(- "inventory_getReceipt",- {- description: "get receipt",- inputSchema: z.object({- receiptId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceipt(ctx.client, params.receiptId);- return toMcpResult(result);- }, "Failed: inventory_getReceipt"),- );-- server.registerTool(- "inventory_getReceiptLines",- {- description: "get receipt lines",- inputSchema: z.object({- receiptId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceiptLines(ctx.client, params.receiptId);- return toMcpResult(result);- }, "Failed: inventory_getReceiptLines"),- );-- server.registerTool(- "inventory_getReceiptTracking",- {- description: "get receipt tracking",- inputSchema: z.object({- receiptId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceiptTracking(ctx.client, params.receiptId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getReceiptTracking"),- );-- server.registerTool(- "inventory_getReceiptLineTracking",- {- description: "get receipt line tracking",- inputSchema: z.object({- receiptLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceiptLineTracking(ctx.client, params.receiptLineId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getReceiptLineTracking"),- );-- server.registerTool(- "inventory_getReceiptFiles",- {- description: "get receipt files",- inputSchema: z.object({- lineIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getReceiptFiles(ctx.client, ctx.companyId, params.lineIds);- return toMcpResult(result);- }, "Failed: inventory_getReceiptFiles"),- );-- server.registerTool(- "inventory_getSerialNumbersForItem",- {- description: "get serial numbers for item",- inputSchema: z.object({- args: z.object({- itemId: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSerialNumbersForItem(ctx.client, { ...params.args, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: inventory_getSerialNumbersForItem"),- );-- server.registerTool(- "inventory_getBatchNumbersForItem",- {- description: "get batch numbers for item",- inputSchema: z.object({- args: z.object({- itemId: z.string(),- isReadOnly: z.boolean().optional()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getBatchNumbersForItem(ctx.client, { ...params.args, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: inventory_getBatchNumbersForItem"),- );-- server.registerTool(- "inventory_getStorageUnitsList",- {- description: "get storage units list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStorageUnitsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getStorageUnitsList"),- );-- server.registerTool(- "inventory_getStorageUnitsListForLocation",- {- description: "get storage units list for location",- inputSchema: z.object({- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStorageUnitsListForLocation(ctx.client, ctx.companyId, params.locationId);- return toMcpResult(result);- }, "Failed: inventory_getStorageUnitsListForLocation"),- );-- server.registerTool(- "inventory_getStorageUnits",- {- description: "get storage units",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStorageUnits(ctx.client, params.locationId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getStorageUnits"),- );-- server.registerTool(- "inventory_getStorageUnit",- {- description: "get storage unit",- inputSchema: z.object({- storageUnitId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getStorageUnit(ctx.client, params.storageUnitId);- return toMcpResult(result);- }, "Failed: inventory_getStorageUnit"),- );-- server.registerTool(- "inventory_getShipments",- {- description: "get shipments",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipments(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getShipments"),- );-- server.registerTool(- "inventory_getShipment",- {- description: "get shipment",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipment(ctx.client, params.shipmentId);- return toMcpResult(result);- }, "Failed: inventory_getShipment"),- );-- server.registerTool(- "inventory_getShipmentLines",- {- description: "get shipment lines",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentLines(ctx.client, params.shipmentId);- return toMcpResult(result);- }, "Failed: inventory_getShipmentLines"),- );-- server.registerTool(- "inventory_getShipmentLinesWithDetails",- {- description: "get shipment lines with details",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentLinesWithDetails(ctx.client, params.shipmentId);- return toMcpResult(result);- }, "Failed: inventory_getShipmentLinesWithDetails"),- );-- server.registerTool(- "inventory_getShipmentFiles",- {- description: "get shipment files",- inputSchema: z.object({- lineIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentFiles(ctx.client, ctx.companyId, params.lineIds);- return toMcpResult(result);- }, "Failed: inventory_getShipmentFiles"),- );-- server.registerTool(- "inventory_getShipmentRelatedItems",- {- description: "get shipment related items",- inputSchema: z.object({- shipmentId: z.string(),- sourceDocumentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentRelatedItems(ctx.client, params.shipmentId, params.sourceDocumentId);- return toMcpResult(result);- }, "Failed: inventory_getShipmentRelatedItems"),- );-- server.registerTool(- "inventory_getShipmentTracking",- {- description: "get shipment tracking",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentTracking(ctx.client, params.shipmentId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getShipmentTracking"),- );-- server.registerTool(- "inventory_getShipmentLineTracking",- {- description: "get shipment line tracking",- inputSchema: z.object({- shipmentLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShipmentLineTracking(ctx.client, params.shipmentLineId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getShipmentLineTracking"),- );-- server.registerTool(- "inventory_getShippingMethod",- {- description: "get shipping method",- inputSchema: z.object({- shippingMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShippingMethod(ctx.client, params.shippingMethodId);- return toMcpResult(result);- }, "Failed: inventory_getShippingMethod"),- );-- server.registerTool(- "inventory_getShippingMethods",- {- description: "get shipping methods",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShippingMethods(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getShippingMethods"),- );-- server.registerTool(- "inventory_getShippingMethodsList",- {- description: "get shipping methods list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShippingMethodsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getShippingMethodsList"),- );-- server.registerTool(- "inventory_getShippingTermsList",- {- description: "get shipping terms list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShippingTermsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getShippingTermsList"),- );-- server.registerTool(- "inventory_getTrackedEntities",- {- description: "get tracked entities",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntities(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getTrackedEntities"),- );-- server.registerTool(- "inventory_getTrackedEntitiesByMakeMethodId",- {- description: "get tracked entities by make method id",- inputSchema: z.object({- jobMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntitiesByMakeMethodId(ctx.client, params.jobMakeMethodId);- return toMcpResult(result);- }, "Failed: inventory_getTrackedEntitiesByMakeMethodId"),- );-- server.registerTool(- "inventory_getTrackedEntity",- {- description: "get tracked entity",- inputSchema: z.object({- trackedEntityId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntity(ctx.client, params.trackedEntityId);- return toMcpResult(result);- }, "Failed: inventory_getTrackedEntity"),- );-- server.registerTool(- "inventory_getTrackedEntitiesByOperationId",- {- description: "get tracked entities by operation id",- inputSchema: z.object({- operationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntitiesByOperationId(ctx.client, params.operationId);- return toMcpResult(result);- }, "Failed: inventory_getTrackedEntitiesByOperationId"),- );-- server.registerTool(- "inventory_getWarehouseTransfers",- {- description: "get warehouse transfers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWarehouseTransfers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: inventory_getWarehouseTransfers"),- );-- server.registerTool(- "inventory_getWarehouseTransfer",- {- description: "get warehouse transfer",- inputSchema: z.object({- transferId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWarehouseTransfer(ctx.client, params.transferId);- return toMcpResult(result);- }, "Failed: inventory_getWarehouseTransfer"),- );-- server.registerTool(- "inventory_getWarehouseTransferLine",- {- description: "get warehouse transfer line",- inputSchema: z.object({- transferId: z.string(),- lineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWarehouseTransferLine(ctx.client, params.transferId, params.lineId);- return toMcpResult(result);- }, "Failed: inventory_getWarehouseTransferLine"),- );-- server.registerTool(- "inventory_getWarehouseTransferLines",- {- description: "get warehouse transfer lines",- inputSchema: z.object({- transferId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWarehouseTransferLines(ctx.client, params.transferId);- return toMcpResult(result);- }, "Failed: inventory_getWarehouseTransferLines"),- );-- server.registerTool(- "inventory_insertManualInventoryAdjustment",- {- description: "insert manual inventory adjustment",- inputSchema: z.object({- inventoryAdjustment: inventoryAdjustmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- // TODO(item-rules): MCP path bypasses item-rule gate. This wrapper is- // dead code — actual MCP dispatch goes through direct-executor.ts- // calling the service directly. Place the gate in direct-executor or- // inside insertManualInventoryAdjustment itself.- const result = await insertManualInventoryAdjustment(ctx.client, { ...params.inventoryAdjustment, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_insertManualInventoryAdjustment"),- );-- server.registerTool(- "inventory_updateBatchPropertyOrder",- {- description: "update batch property order",- inputSchema: z.object({- data: batchPropertyOrderValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateBatchPropertyOrder(ctx.client, { ...params.data, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_updateBatchPropertyOrder"),- );-- server.registerTool(- "inventory_updateStockTransferStatus",- {- description: "update stock transfer status",- inputSchema: z.object({- args: z.object({- id: z.string(),- status: z.any(),- assignee: z.string().nullable().optional(),- completedAt: z.string().nullable()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateStockTransferStatus(ctx.client, { ...params.args, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_updateStockTransferStatus"),- );-- server.registerTool(- "inventory_upsertBatchProperty",- {- description: "upsert batch property",- inputSchema: z.object({- batchProperty: batchPropertyValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertBatchProperty(ctx.client, { ...params.batchProperty, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertBatchProperty"),- );-- server.registerTool(- "inventory_upsertKanban",- {- description: "upsert kanban",- inputSchema: z.object({- kanban: kanbanValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertKanban(ctx.client, { ...params.kanban, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertKanban"),- );-- server.registerTool(- "inventory_upsertReceipt",- {- description: "upsert receipt",- inputSchema: z.object({- receipt: receiptValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertReceipt(ctx.client, { ...params.receipt, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertReceipt"),- );-- server.registerTool(- "inventory_upsertStorageUnit",- {- description: "upsert storage unit",- inputSchema: z.object({- storageUnit: storageUnitValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertStorageUnit(ctx.client, { ...params.storageUnit, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertStorageUnit"),- );-- server.registerTool(- "inventory_upsertShippingMethod",- {- description: "upsert shipping method",- inputSchema: z.object({- shippingMethod: shippingMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertShippingMethod(ctx.client, { ...params.shippingMethod, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertShippingMethod"),- );-- server.registerTool(- "inventory_upsertShipment",- {- description: "upsert shipment",- inputSchema: z.object({- shipment: shipmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertShipment(ctx.client, { ...params.shipment, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertShipment"),- );-- server.registerTool(- "inventory_upsertStockTransfer",- {- description: "upsert stock transfer",- inputSchema: z.object({- stockTransfer: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertStockTransfer(ctx.client, { ...params.stockTransfer, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertStockTransfer"),- );-- server.registerTool(- "inventory_upsertStockTransferLine",- {- description: "upsert stock transfer line",- inputSchema: z.object({- stockTransferLine: stockTransferLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertStockTransferLine(ctx.client, { ...params.stockTransferLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertStockTransferLine"),- );-- server.registerTool(- "inventory_upsertStockTransferLines",- {- description: "upsert stock transfer lines",- inputSchema: z.object({- args: stockTransferValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertStockTransferLines(ctx.client, { ...params.args, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertStockTransferLines"),- );-- server.registerTool(- "inventory_upsertWarehouseTransfer",- {- description: "upsert warehouse transfer",- inputSchema: z.object({- transfer: warehouseTransferValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertWarehouseTransfer(ctx.client, { ...params.transfer, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: inventory_upsertWarehouseTransfer"),- );-- server.registerTool(- "inventory_updateWarehouseTransferStatus",- {- description: "update warehouse transfer status",- inputSchema: z.object({- transferId: z.string(),- status: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateWarehouseTransferStatus(ctx.client, params.transferId, params.status, ctx.userId);- return toMcpResult(result);- }, "Failed: inventory_updateWarehouseTransferStatus"),- );-- server.registerTool(- "inventory_upsertWarehouseTransferLine",- {- description: "upsert warehouse transfer line",- inputSchema: z.object({- line: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertWarehouseTransferLine(ctx.client, params.line);- return toMcpResult(result);- }, "Failed: inventory_upsertWarehouseTransferLine"),- );-- server.registerTool(- "inventory_getDefaultStorageUnitForJob",- {- description: "get default storage unit for job",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDefaultStorageUnitForJob(ctx.client, params.itemId, params.locationId, ctx.companyId);- return toMcpResult(result);- }, "Failed: inventory_getDefaultStorageUnitForJob"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/invoicing.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/invoicing.tsdeleted file mode 100644index abe65a02bd..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/invoicing.ts+++ /dev/null@@ -1,495 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- createPurchaseInvoiceFromPurchaseOrder,- createSalesInvoiceFromSalesOrder,- createSalesInvoiceFromShipment,- deletePurchaseInvoice,- deletePurchaseInvoiceLine,- deleteSalesInvoice,- deleteSalesInvoiceLine,- getPurchaseInvoice,- getPurchaseInvoices,- getPurchaseInvoiceDelivery,- getPurchaseInvoiceLines,- getPurchaseInvoiceLine,- getSalesInvoice,- getSalesInvoiceCustomerDetails,- getSalesInvoices,- getSalesInvoiceShipment,- getSalesInvoiceLines,- getSalesInvoiceLine,- updatePurchaseInvoiceExchangeRate,- updatePurchaseInvoiceStatus,- updateSalesInvoiceExchangeRate,- updateSalesInvoiceStatus,- upsertPurchaseInvoice,- upsertPurchaseInvoiceDelivery,- upsertPurchaseInvoiceLine,- upsertSalesInvoice,- upsertSalesInvoiceShipment,- upsertSalesInvoiceLine,-} from "~/modules/invoicing/invoicing.service";-import {- purchaseInvoiceValidator,- purchaseInvoiceDeliveryValidator,- purchaseInvoiceLineValidator,- salesInvoiceValidator,- salesInvoiceShipmentValidator,- salesInvoiceLineValidator,-} from "~/modules/invoicing/invoicing.models";--export const registerInvoicingTools: RegisterTools = (server, ctx) => {- server.registerTool(- "invoicing_createPurchaseInvoiceFromPurchaseOrder",- {- description: "create purchase invoice from purchase order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createPurchaseInvoiceFromPurchaseOrder(ctx.client, params.purchaseOrderId, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: invoicing_createPurchaseInvoiceFromPurchaseOrder"),- );-- server.registerTool(- "invoicing_createSalesInvoiceFromSalesOrder",- {- description: "create sales invoice from sales order",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createSalesInvoiceFromSalesOrder(ctx.client, params.salesOrderId, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: invoicing_createSalesInvoiceFromSalesOrder"),- );-- server.registerTool(- "invoicing_createSalesInvoiceFromShipment",- {- description: "create sales invoice from shipment",- inputSchema: z.object({- shipmentId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createSalesInvoiceFromShipment(ctx.client, params.shipmentId, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: invoicing_createSalesInvoiceFromShipment"),- );-- server.registerTool(- "invoicing_deletePurchaseInvoice",- {- description: "delete purchase invoice",- inputSchema: z.object({- purchaseInvoiceId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchaseInvoice(ctx.client, params.purchaseInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_deletePurchaseInvoice"),- );-- server.registerTool(- "invoicing_deletePurchaseInvoiceLine",- {- description: "delete purchase invoice line",- inputSchema: z.object({- purchaseInvoiceLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchaseInvoiceLine(ctx.client, params.purchaseInvoiceLineId);- return toMcpResult(result);- }, "Failed: invoicing_deletePurchaseInvoiceLine"),- );-- server.registerTool(- "invoicing_deleteSalesInvoice",- {- description: "delete sales invoice",- inputSchema: z.object({- salesInvoiceId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesInvoice(ctx.client, params.salesInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_deleteSalesInvoice"),- );-- server.registerTool(- "invoicing_deleteSalesInvoiceLine",- {- description: "delete sales invoice line",- inputSchema: z.object({- salesInvoiceLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesInvoiceLine(ctx.client, params.salesInvoiceLineId);- return toMcpResult(result);- }, "Failed: invoicing_deleteSalesInvoiceLine"),- );-- server.registerTool(- "invoicing_getPurchaseInvoice",- {- description: "get purchase invoice",- inputSchema: z.object({- purchaseInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseInvoice(ctx.client, params.purchaseInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getPurchaseInvoice"),- );-- server.registerTool(- "invoicing_getPurchaseInvoices",- {- description: "get purchase invoices",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseInvoices(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: invoicing_getPurchaseInvoices"),- );-- server.registerTool(- "invoicing_getPurchaseInvoiceDelivery",- {- description: "get purchase invoice delivery",- inputSchema: z.object({- purchaseInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseInvoiceDelivery(ctx.client, params.purchaseInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getPurchaseInvoiceDelivery"),- );-- server.registerTool(- "invoicing_getPurchaseInvoiceLines",- {- description: "get purchase invoice lines",- inputSchema: z.object({- purchaseInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseInvoiceLines(ctx.client, params.purchaseInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getPurchaseInvoiceLines"),- );-- server.registerTool(- "invoicing_getPurchaseInvoiceLine",- {- description: "get purchase invoice line",- inputSchema: z.object({- purchaseInvoiceLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseInvoiceLine(ctx.client, params.purchaseInvoiceLineId);- return toMcpResult(result);- }, "Failed: invoicing_getPurchaseInvoiceLine"),- );-- server.registerTool(- "invoicing_getSalesInvoice",- {- description: "get sales invoice",- inputSchema: z.object({- salesInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoice(ctx.client, params.salesInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoice"),- );-- server.registerTool(- "invoicing_getSalesInvoiceCustomerDetails",- {- description: "get sales invoice customer details",- inputSchema: z.object({- salesInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoiceCustomerDetails(ctx.client, params.salesInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoiceCustomerDetails"),- );-- server.registerTool(- "invoicing_getSalesInvoices",- {- description: "get sales invoices",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- customerId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoices(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoices"),- );-- server.registerTool(- "invoicing_getSalesInvoiceShipment",- {- description: "get sales invoice shipment",- inputSchema: z.object({- salesInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoiceShipment(ctx.client, params.salesInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoiceShipment"),- );-- server.registerTool(- "invoicing_getSalesInvoiceLines",- {- description: "get sales invoice lines",- inputSchema: z.object({- salesInvoiceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoiceLines(ctx.client, params.salesInvoiceId);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoiceLines"),- );-- server.registerTool(- "invoicing_getSalesInvoiceLine",- {- description: "get sales invoice line",- inputSchema: z.object({- salesInvoiceLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesInvoiceLine(ctx.client, params.salesInvoiceLineId);- return toMcpResult(result);- }, "Failed: invoicing_getSalesInvoiceLine"),- );-- server.registerTool(- "invoicing_updatePurchaseInvoiceExchangeRate",- {- description: "update purchase invoice exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseInvoiceExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: invoicing_updatePurchaseInvoiceExchangeRate"),- );-- server.registerTool(- "invoicing_updatePurchaseInvoiceStatus",- {- description: "update purchase invoice status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseInvoiceStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_updatePurchaseInvoiceStatus"),- );-- server.registerTool(- "invoicing_updateSalesInvoiceExchangeRate",- {- description: "update sales invoice exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesInvoiceExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: invoicing_updateSalesInvoiceExchangeRate"),- );-- server.registerTool(- "invoicing_updateSalesInvoiceStatus",- {- description: "update sales invoice status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesInvoiceStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_updateSalesInvoiceStatus"),- );-- server.registerTool(- "invoicing_upsertPurchaseInvoice",- {- description: "upsert purchase invoice",- inputSchema: z.object({- purchaseInvoice: purchaseInvoiceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseInvoice(ctx.client, { ...params.purchaseInvoice, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertPurchaseInvoice"),- );-- server.registerTool(- "invoicing_upsertPurchaseInvoiceDelivery",- {- description: "upsert purchase invoice delivery",- inputSchema: z.object({- purchaseInvoiceDelivery: purchaseInvoiceDeliveryValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseInvoiceDelivery(ctx.client, { ...params.purchaseInvoiceDelivery, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertPurchaseInvoiceDelivery"),- );-- server.registerTool(- "invoicing_upsertPurchaseInvoiceLine",- {- description: "upsert purchase invoice line",- inputSchema: z.object({- purchaseInvoiceLine: purchaseInvoiceLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseInvoiceLine(ctx.client, { ...params.purchaseInvoiceLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertPurchaseInvoiceLine"),- );-- server.registerTool(- "invoicing_upsertSalesInvoice",- {- description: "upsert sales invoice",- inputSchema: z.object({- salesInvoice: salesInvoiceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesInvoice(ctx.client, { ...params.salesInvoice, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertSalesInvoice"),- );-- server.registerTool(- "invoicing_upsertSalesInvoiceShipment",- {- description: "upsert sales invoice shipment",- inputSchema: z.object({- salesInvoiceShipment: salesInvoiceShipmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesInvoiceShipment(ctx.client, { ...params.salesInvoiceShipment, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertSalesInvoiceShipment"),- );-- server.registerTool(- "invoicing_upsertSalesInvoiceLine",- {- description: "upsert sales invoice line",- inputSchema: z.object({- salesInvoiceLine: salesInvoiceLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesInvoiceLine(ctx.client, { ...params.salesInvoiceLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: invoicing_upsertSalesInvoiceLine"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/items.tsdeleted file mode 100644index 4116787542..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts+++ /dev/null@@ -1,2342 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- activateMethodVersion,- copyItem,- copyMakeMethod,- createRevision,- deleteConfigurationParameter,- deleteConfigurationRule,- deleteItemCustomerPart,- deleteConfigurationParameterGroup,- deleteItem,- deleteItemPostingGroup,- deleteMaterialDimension,- deleteMaterialFinish,- deleteMaterialForm,- deleteMaterialGrade,- deleteMaterialSubstance,- deleteMethodMaterial,- deleteMethodOperation,- assertMethodOperationIsDraft,- deleteMethodOperationStep,- deleteMethodOperationParameter,- deleteMethodOperationTool,- deleteUnitOfMeasure,- getConfigurationParameters,- getConfigurationRules,- getConsumable,- getConsumables,- getConsumablesList,- getItem,- getItemCost,- getItemCostHistory,- getItemCustomerPart,- getItemCustomerParts,- getItemDemand,- getItemFiles,- getItemPostingGroup,- getItemPostingGroups,- getItemPostingGroupsList,- getItemManufacturing,- getItemPlanning,- getItemQuantities,- getItemReplenishment,- getItemStorageUnitQuantities,- getItemSupply,- getItemUnitSalePrice,- getMaterialUsedIn,- getMakeMethods,- getMakeMethodById,- getMaterial,- getMaterials,- getMaterialsList,- getMaterialDimension,- getMaterialDimensions,- getMaterialDimensionList,- getMaterialFinish,- getMaterialFinishes,- getMaterialFinishList,- getMaterialForm,- getMaterialForms,- getMaterialFormsList,- getMaterialGrades,- getMaterialGrade,- getMaterialGradeList,- getMaterialSubstance,- getMaterialSubstances,- getMaterialSubstancesList,- getMethodMaterial,- getMethodMaterials,- getMethodMaterialsByMakeMethod,- getMethodOperations,- getMethodOperationsByMakeMethodId,- getMethodTree,- getMethodTreeArray,- getOpenJobMaterials,- getOpenProductionOrders,- getOpenPurchaseOrderLines,- getOpenSalesOrderLines,- getPart,- getParts,- getPartsList,- getPartUsedIn,- getPickMethod,- getPickMethods,- getServices,- getService,- getServicesList,- getSupplierParts,- getTool,- getTools,- getToolsList,- getUnitOfMeasure,- getUnitOfMeasures,- getUnitOfMeasuresList,- updateConfigurationParameterGroupOrder,- updateDefaultRevision,- updateConfigurationParameterOrder,- updateItemCost,- updateMaterialOrder,- updateOperationOrder,- updateRevision,- upsertConfigurationParameter,- upsertConfigurationParameterGroup,- upsertConfigurationRule,- upsertConsumable,- upsertPart,- updateItem,- upsertItemCost,- upsertPickMethod,- upsertItemManufacturing,- upsertItemPlanning,- upsertItemPurchasing,- upsertItemPostingGroup,- upsertSupplierPart,- upsertItemCustomerPart,- upsertItemUnitSalePrice,- upsertMakeMethodVersion,- upsertMethodMaterial,- upsertMethodOperation,- upsertMethodOperationStep,- upsertMethodOperationParameter,- upsertMethodOperationTool,- upsertMaterial,- upsertMaterialDimension,- upsertMaterialFinish,- upsertMaterialForm,- upsertMaterialGrade,- deleteMaterialType,- getMaterialTypes,- getMaterialType,- getMaterialTypeList,- upsertMaterialType,- upsertMaterialSubstance,- upsertService,- upsertUnitOfMeasure,- upsertTool,- getSupplierPriceBreaksForItems,- lookupBuyPrice,- getSupplierPartPriceBreaks,-} from "~/modules/items/items.service";-import {- getMethodValidator,- configurationParameterGroupOrderValidator,- configurationParameterOrderValidator,- configurationParameterValidator,- configurationRuleValidator,- consumableValidator,- partValidator,- itemValidator,- itemCostValidator,- pickMethodValidator,- itemManufacturingValidator,- itemPlanningValidator,- itemPurchasingValidator,- itemPostingGroupValidator,- supplierPartValidator,- customerPartValidator,- itemUnitSalePriceValidator,- makeMethodVersionValidator,- methodMaterialValidator,- methodOperationValidator,- materialValidator,- materialDimensionValidator,- materialFinishValidator,- materialFormValidator,- materialGradeValidator,- materialTypeValidator,- materialSubstanceValidator,- serviceValidator,- unitOfMeasureValidator,- toolValidator,-} from "~/modules/items/items.models";-import {- operationStepValidator,- operationParameterValidator,- operationToolValidator,-} from "~/modules/shared";--export const registerItemsTools: RegisterTools = (server, ctx) => {- server.registerTool(- "items_activateMethodVersion",- {- description: "activate method version",- inputSchema: z.object({- payload: z.object({- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await activateMethodVersion(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: items_activateMethodVersion"),- );-- server.registerTool(- "items_copyItem",- {- description: "copy item",- inputSchema: z.object({- args: getMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await copyItem(ctx.client, { ...params.args, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: items_copyItem"),- );-- server.registerTool(- "items_copyMakeMethod",- {- description: "copy make method",- inputSchema: z.object({- args: getMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await copyMakeMethod(ctx.client, { ...params.args, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: items_copyMakeMethod"),- );-- server.registerTool(- "items_createRevision",- {- description: "create revision",- inputSchema: z.object({- args: z.object({- item: z.any(),- revision: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createRevision(ctx.client, { ...params.args, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_createRevision"),- );-- server.registerTool(- "items_deleteConfigurationParameter",- {- description: "delete configuration parameter",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteConfigurationParameter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteConfigurationParameter"),- );-- server.registerTool(- "items_deleteConfigurationRule",- {- description: "delete configuration rule",- inputSchema: z.object({- field: z.string(),- itemId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteConfigurationRule(ctx.client, params.field, params.itemId);- return toMcpResult(result);- }, "Failed: items_deleteConfigurationRule"),- );-- server.registerTool(- "items_deleteItemCustomerPart",- {- description: "delete item customer part",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteItemCustomerPart(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_deleteItemCustomerPart"),- );-- server.registerTool(- "items_deleteConfigurationParameterGroup",- {- description: "delete configuration parameter group",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteConfigurationParameterGroup(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteConfigurationParameterGroup"),- );-- server.registerTool(- "items_deleteItem",- {- description: "delete item",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteItem(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteItem"),- );-- server.registerTool(- "items_deleteItemPostingGroup",- {- description: "delete item posting group",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteItemPostingGroup(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteItemPostingGroup"),- );-- server.registerTool(- "items_deleteMaterialDimension",- {- description: "delete material dimension",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialDimension(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialDimension"),- );-- server.registerTool(- "items_deleteMaterialFinish",- {- description: "delete material finish",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialFinish(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialFinish"),- );-- server.registerTool(- "items_deleteMaterialForm",- {- description: "delete material form",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialForm(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialForm"),- );-- server.registerTool(- "items_deleteMaterialGrade",- {- description: "delete material grade",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialGrade(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialGrade"),- );-- server.registerTool(- "items_deleteMaterialSubstance",- {- description: "delete material substance",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialSubstance(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialSubstance"),- );-- server.registerTool(- "items_deleteMethodMaterial",- {- description: "delete method material",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMethodMaterial(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMethodMaterial"),- );-- server.registerTool(- "items_assertMethodOperationIsDraft",- {- description: "assert method operation is draft",- inputSchema: z.object({- operationId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await assertMethodOperationIsDraft(ctx.client, params.operationId);- return toMcpResult(result);- }, "Failed: items_assertMethodOperationIsDraft"),- );-- server.registerTool(- "items_deleteMethodOperation",- {- description: "delete method operation",- inputSchema: z.object({- methodOperationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMethodOperation(ctx.client, params.methodOperationId);- return toMcpResult(result);- }, "Failed: items_deleteMethodOperation"),- );-- server.registerTool(- "items_deleteMethodOperationStep",- {- description: "delete method operation step",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMethodOperationStep(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMethodOperationStep"),- );-- server.registerTool(- "items_deleteMethodOperationParameter",- {- description: "delete method operation parameter",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMethodOperationParameter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMethodOperationParameter"),- );-- server.registerTool(- "items_deleteMethodOperationTool",- {- description: "delete method operation tool",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMethodOperationTool(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMethodOperationTool"),- );-- server.registerTool(- "items_deleteUnitOfMeasure",- {- description: "delete unit of measure",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteUnitOfMeasure(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteUnitOfMeasure"),- );-- server.registerTool(- "items_getConfigurationParameters",- {- description: "get configuration parameters",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConfigurationParameters(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getConfigurationParameters"),- );-- server.registerTool(- "items_getConfigurationRules",- {- description: "get configuration rules",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConfigurationRules(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getConfigurationRules"),- );-- server.registerTool(- "items_getConsumable",- {- description: "get consumable",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConsumable(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getConsumable"),- );-- server.registerTool(- "items_getConsumables",- {- description: "get consumables",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConsumables(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getConsumables"),- );-- server.registerTool(- "items_getConsumablesList",- {- description: "get consumables list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConsumablesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getConsumablesList"),- );-- server.registerTool(- "items_getItem",- {- description: "get item",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItem(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getItem"),- );-- server.registerTool(- "items_getItemCost",- {- description: "get item cost",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemCost(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemCost"),- );-- server.registerTool(- "items_getItemCostHistory",- {- description: "get item cost history",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemCostHistory(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemCostHistory"),- );-- server.registerTool(- "items_getItemCustomerPart",- {- description: "get item customer part",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemCustomerPart(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemCustomerPart"),- );-- server.registerTool(- "items_getItemCustomerParts",- {- description: "get item customer parts",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemCustomerParts(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemCustomerParts"),- );-- server.registerTool(- "items_getItemDemand",- {- description: "get item demand",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string(),- periods: z.array(z.string())- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemDemand(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getItemDemand"),- );-- server.registerTool(- "items_getItemFiles",- {- description: "get item files",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemFiles(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemFiles"),- );-- server.registerTool(- "items_getItemPostingGroup",- {- description: "get item posting group",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemPostingGroup(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getItemPostingGroup"),- );-- server.registerTool(- "items_getItemPostingGroups",- {- description: "get item posting groups",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemPostingGroups(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getItemPostingGroups"),- );-- server.registerTool(- "items_getItemPostingGroupsList",- {- description: "get item posting groups list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemPostingGroupsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemPostingGroupsList"),- );-- server.registerTool(- "items_getItemManufacturing",- {- description: "get item manufacturing",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemManufacturing(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemManufacturing"),- );-- server.registerTool(- "items_getItemPlanning",- {- description: "get item planning",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemPlanning(ctx.client, params.itemId, ctx.companyId, params.locationId);- return toMcpResult(result);- }, "Failed: items_getItemPlanning"),- );-- server.registerTool(- "items_getItemQuantities",- {- description: "get item quantities",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemQuantities(ctx.client, params.itemId, ctx.companyId, params.locationId);- return toMcpResult(result);- }, "Failed: items_getItemQuantities"),- );-- server.registerTool(- "items_getItemReplenishment",- {- description: "get item replenishment",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemReplenishment(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemReplenishment"),- );-- server.registerTool(- "items_getItemStorageUnitQuantities",- {- description: "get item storage unit quantities",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemStorageUnitQuantities(ctx.client, params.itemId, ctx.companyId, params.locationId);- return toMcpResult(result);- }, "Failed: items_getItemStorageUnitQuantities"),- );-- server.registerTool(- "items_getItemSupply",- {- description: "get item supply",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string(),- periods: z.array(z.string())- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemSupply(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getItemSupply"),- );-- server.registerTool(- "items_getItemUnitSalePrice",- {- description: "get item unit sale price",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getItemUnitSalePrice(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getItemUnitSalePrice"),- );-- server.registerTool(- "items_getMaterialUsedIn",- {- description: "get material used in",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialUsedIn(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialUsedIn"),- );-- server.registerTool(- "items_getMakeMethods",- {- description: "get make methods",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMakeMethods(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMakeMethods"),- );-- server.registerTool(- "items_getMakeMethodById",- {- description: "get make method by id",- inputSchema: z.object({- makeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMakeMethodById(ctx.client, params.makeMethodId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMakeMethodById"),- );-- server.registerTool(- "items_getMaterial",- {- description: "get material",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterial(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterial"),- );-- server.registerTool(- "items_getMaterials",- {- description: "get materials",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterials(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterials"),- );-- server.registerTool(- "items_getMaterialsList",- {- description: "get materials list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialsList"),- );-- server.registerTool(- "items_getMaterialDimension",- {- description: "get material dimension",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialDimension(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialDimension"),- );-- server.registerTool(- "items_getMaterialDimensions",- {- description: "get material dimensions",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- isMetric: z.boolean()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialDimensions(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialDimensions"),- );-- server.registerTool(- "items_getMaterialDimensionList",- {- description: "get material dimension list",- inputSchema: z.object({- materialFormId: z.string(),- isMetric: z.boolean(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialDimensionList(ctx.client, params.materialFormId, params.isMetric, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialDimensionList"),- );-- server.registerTool(- "items_getMaterialFinish",- {- description: "get material finish",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialFinish(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialFinish"),- );-- server.registerTool(- "items_getMaterialFinishes",- {- description: "get material finishes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialFinishes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialFinishes"),- );-- server.registerTool(- "items_getMaterialFinishList",- {- description: "get material finish list",- inputSchema: z.object({- materialSubstanceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialFinishList(ctx.client, params.materialSubstanceId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialFinishList"),- );-- server.registerTool(- "items_getMaterialForm",- {- description: "get material form",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialForm(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialForm"),- );-- server.registerTool(- "items_getMaterialForms",- {- description: "get material forms",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialForms(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialForms"),- );-- server.registerTool(- "items_getMaterialFormsList",- {- description: "get material forms list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialFormsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialFormsList"),- );-- server.registerTool(- "items_getMaterialGrades",- {- description: "get material grades",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialGrades(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialGrades"),- );-- server.registerTool(- "items_getMaterialGrade",- {- description: "get material grade",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialGrade(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialGrade"),- );-- server.registerTool(- "items_getMaterialGradeList",- {- description: "get material grade list",- inputSchema: z.object({- materialSubstanceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialGradeList(ctx.client, params.materialSubstanceId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialGradeList"),- );-- server.registerTool(- "items_getMaterialSubstance",- {- description: "get material substance",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialSubstance(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialSubstance"),- );-- server.registerTool(- "items_getMaterialSubstances",- {- description: "get material substances",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialSubstances(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialSubstances"),- );-- server.registerTool(- "items_getMaterialSubstancesList",- {- description: "get material substances list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialSubstancesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialSubstancesList"),- );-- server.registerTool(- "items_getMethodMaterial",- {- description: "get method material",- inputSchema: z.object({- materialId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodMaterial(ctx.client, params.materialId);- return toMcpResult(result);- }, "Failed: items_getMethodMaterial"),- );-- server.registerTool(- "items_getMethodMaterials",- {- description: "get method materials",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodMaterials(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMethodMaterials"),- );-- server.registerTool(- "items_getMethodMaterialsByMakeMethod",- {- description: "get method materials by make method",- inputSchema: z.object({- makeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodMaterialsByMakeMethod(ctx.client, params.makeMethodId);- return toMcpResult(result);- }, "Failed: items_getMethodMaterialsByMakeMethod"),- );-- server.registerTool(- "items_getMethodOperations",- {- description: "get method operations",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodOperations(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMethodOperations"),- );-- server.registerTool(- "items_getMethodOperationsByMakeMethodId",- {- description: "get method operations by make method id",- inputSchema: z.object({- makeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodOperationsByMakeMethodId(ctx.client, params.makeMethodId);- return toMcpResult(result);- }, "Failed: items_getMethodOperationsByMakeMethodId"),- );-- server.registerTool(- "items_getMethodTree",- {- description: "get method tree",- inputSchema: z.object({- makeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodTree(ctx.client, params.makeMethodId);- return toMcpResult(result);- }, "Failed: items_getMethodTree"),- );-- server.registerTool(- "items_getMethodTreeArray",- {- description: "get method tree array",- inputSchema: z.object({- makeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMethodTreeArray(ctx.client, params.makeMethodId);- return toMcpResult(result);- }, "Failed: items_getMethodTreeArray"),- );-- server.registerTool(- "items_getOpenJobMaterials",- {- description: "get open job materials",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpenJobMaterials(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getOpenJobMaterials"),- );-- server.registerTool(- "items_getOpenProductionOrders",- {- description: "get open production orders",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpenProductionOrders(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getOpenProductionOrders"),- );-- server.registerTool(- "items_getOpenPurchaseOrderLines",- {- description: "get open purchase order lines",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpenPurchaseOrderLines(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getOpenPurchaseOrderLines"),- );-- server.registerTool(- "items_getOpenSalesOrderLines",- {- description: "get open sales order lines",- inputSchema: z.object({- arg1: z.object({- itemId: z.string(),- locationId: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpenSalesOrderLines(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_getOpenSalesOrderLines"),- );-- server.registerTool(- "items_getPart",- {- description: "get part",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPart(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getPart"),- );-- server.registerTool(- "items_getParts",- {- description: "get parts",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getParts(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getParts"),- );-- server.registerTool(- "items_getPartsList",- {- description: "get parts list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPartsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getPartsList"),- );-- server.registerTool(- "items_getPartUsedIn",- {- description: "get part used in",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPartUsedIn(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getPartUsedIn"),- );-- server.registerTool(- "items_getPickMethod",- {- description: "get pick method",- inputSchema: z.object({- itemId: z.string(),- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPickMethod(ctx.client, params.itemId, ctx.companyId, params.locationId);- return toMcpResult(result);- }, "Failed: items_getPickMethod"),- );-- server.registerTool(- "items_getPickMethods",- {- description: "get pick methods",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPickMethods(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getPickMethods"),- );-- server.registerTool(- "items_getServices",- {- description: "get services",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- type: z.string().nullable(),- group: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getServices(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getServices"),- );-- server.registerTool(- "items_getService",- {- description: "get service",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getService(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getService"),- );-- server.registerTool(- "items_getServicesList",- {- description: "get services list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getServicesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getServicesList"),- );-- server.registerTool(- "items_getSupplierParts",- {- description: "get supplier parts",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierParts(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getSupplierParts"),- );-- server.registerTool(- "items_getTool",- {- description: "get tool",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTool(ctx.client, params.itemId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getTool"),- );-- server.registerTool(- "items_getTools",- {- description: "get tools",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTools(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getTools"),- );-- server.registerTool(- "items_getToolsList",- {- description: "get tools list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getToolsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getToolsList"),- );-- server.registerTool(- "items_getUnitOfMeasure",- {- description: "get unit of measure",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUnitOfMeasure(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getUnitOfMeasure"),- );-- server.registerTool(- "items_getUnitOfMeasures",- {- description: "get unit of measures",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUnitOfMeasures(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getUnitOfMeasures"),- );-- server.registerTool(- "items_getUnitOfMeasuresList",- {- description: "get unit of measures list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUnitOfMeasuresList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getUnitOfMeasuresList"),- );-- server.registerTool(- "items_updateConfigurationParameterGroupOrder",- {- description: "update configuration parameter group order",- inputSchema: z.object({- data: configurationParameterGroupOrderValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateConfigurationParameterGroupOrder(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: items_updateConfigurationParameterGroupOrder"),- );-- server.registerTool(- "items_updateDefaultRevision",- {- description: "update default revision",- inputSchema: z.object({- data: z.object({- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultRevision(ctx.client, { ...params.data, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateDefaultRevision"),- );-- server.registerTool(- "items_updateConfigurationParameterOrder",- {- description: "update configuration parameter order",- inputSchema: z.object({- data: configurationParameterOrderValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateConfigurationParameterOrder(ctx.client, { ...params.data, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateConfigurationParameterOrder"),- );-- server.registerTool(- "items_updateItemCost",- {- description: "update item cost",- inputSchema: z.object({- itemId: z.string(),- cost: z.object({- unitCost: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateItemCost(ctx.client, params.itemId, { ...params.cost, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateItemCost"),- );-- server.registerTool(- "items_updateMaterialOrder",- {- description: "update material order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMaterialOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateMaterialOrder"),- );-- server.registerTool(- "items_updateOperationOrder",- {- description: "update operation order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateOperationOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateOperationOrder"),- );-- server.registerTool(- "items_updateRevision",- {- description: "update revision",- inputSchema: z.object({- revision: z.object({- id: z.string(),- revision: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateRevision(ctx.client, { ...params.revision, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_updateRevision"),- );-- server.registerTool(- "items_upsertConfigurationParameter",- {- description: "upsert configuration parameter",- inputSchema: z.object({- configurationParameter: configurationParameterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertConfigurationParameter(ctx.client, { ...params.configurationParameter, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertConfigurationParameter"),- );-- server.registerTool(- "items_upsertConfigurationParameterGroup",- {- description: "upsert configuration parameter group",- inputSchema: z.object({- configurationParameterGroup: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertConfigurationParameterGroup(ctx.client, { ...params.configurationParameterGroup, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertConfigurationParameterGroup"),- );-- server.registerTool(- "items_upsertConfigurationRule",- {- description: "upsert configuration rule",- inputSchema: z.object({- configurationRule: configurationRuleValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertConfigurationRule(ctx.client, { ...params.configurationRule, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertConfigurationRule"),- );-- server.registerTool(- "items_upsertConsumable",- {- description: "upsert consumable",- inputSchema: z.object({- consumable: consumableValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertConsumable(ctx.client, { ...params.consumable, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertConsumable"),- );-- server.registerTool(- "items_upsertPart",- {- description: "upsert part",- inputSchema: z.object({- part: partValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPart(ctx.client, { ...params.part, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertPart"),- );-- server.registerTool(- "items_updateItem",- {- description: "update item",- inputSchema: z.object({- item: itemValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateItem(ctx.client, { ...params.item, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_updateItem"),- );-- server.registerTool(- "items_upsertItemCost",- {- description: "upsert item cost",- inputSchema: z.object({- itemCost: itemCostValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemCost(ctx.client, { ...params.itemCost, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemCost"),- );-- server.registerTool(- "items_upsertPickMethod",- {- description: "upsert pick method",- inputSchema: z.object({- pickMethod: pickMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPickMethod(ctx.client, { ...params.pickMethod, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertPickMethod"),- );-- server.registerTool(- "items_upsertItemManufacturing",- {- description: "upsert item manufacturing",- inputSchema: z.object({- partManufacturing: itemManufacturingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemManufacturing(ctx.client, { ...params.partManufacturing, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemManufacturing"),- );-- server.registerTool(- "items_upsertItemPlanning",- {- description: "upsert item planning",- inputSchema: z.object({- partPlanning: itemPlanningValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemPlanning(ctx.client, { ...params.partPlanning, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemPlanning"),- );-- server.registerTool(- "items_upsertItemPurchasing",- {- description: "upsert item purchasing",- inputSchema: z.object({- itemPurchasing: itemPurchasingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemPurchasing(ctx.client, { ...params.itemPurchasing, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemPurchasing"),- );-- server.registerTool(- "items_upsertItemPostingGroup",- {- description: "upsert item posting group",- inputSchema: z.object({- itemPostingGroup: itemPostingGroupValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemPostingGroup(ctx.client, { ...params.itemPostingGroup, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemPostingGroup"),- );-- server.registerTool(- "items_upsertSupplierPart",- {- description: "upsert supplier part",- inputSchema: z.object({- supplierPart: supplierPartValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplierPart(ctx.client, { ...params.supplierPart, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertSupplierPart"),- );-- server.registerTool(- "items_upsertItemCustomerPart",- {- description: "upsert item customer part",- inputSchema: z.object({- customerPart: customerPartValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemCustomerPart(ctx.client, { ...params.customerPart, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertItemCustomerPart"),- );-- server.registerTool(- "items_upsertItemUnitSalePrice",- {- description: "upsert item unit sale price",- inputSchema: z.object({- itemUnitSalePrice: itemUnitSalePriceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertItemUnitSalePrice(ctx.client, { ...params.itemUnitSalePrice, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertItemUnitSalePrice"),- );-- server.registerTool(- "items_upsertMakeMethodVersion",- {- description: "upsert make method version",- inputSchema: z.object({- makeMethodVersion: makeMethodVersionValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMakeMethodVersion(ctx.client, { ...params.makeMethodVersion, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMakeMethodVersion"),- );-- server.registerTool(- "items_upsertMethodMaterial",- {- description: "upsert method material",- inputSchema: z.object({- methodMaterial: methodMaterialValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMethodMaterial(ctx.client, { ...params.methodMaterial, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMethodMaterial"),- );-- server.registerTool(- "items_upsertMethodOperation",- {- description: "upsert method operation",- inputSchema: z.object({- methodOperation: methodOperationValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMethodOperation(ctx.client, { ...params.methodOperation, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMethodOperation"),- );-- server.registerTool(- "items_upsertMethodOperationStep",- {- description: "upsert method operation step",- inputSchema: z.object({- methodOperationStep: operationStepValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMethodOperationStep(ctx.client, { ...params.methodOperationStep, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMethodOperationStep"),- );-- server.registerTool(- "items_upsertMethodOperationParameter",- {- description: "upsert method operation parameter",- inputSchema: z.object({- methodOperationParameter: operationParameterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMethodOperationParameter(ctx.client, { ...params.methodOperationParameter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMethodOperationParameter"),- );-- server.registerTool(- "items_upsertMethodOperationTool",- {- description: "upsert method operation tool",- inputSchema: z.object({- methodOperationTool: operationToolValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMethodOperationTool(ctx.client, { ...params.methodOperationTool, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMethodOperationTool"),- );-- server.registerTool(- "items_upsertMaterial",- {- description: "upsert material",- inputSchema: z.object({- material: materialValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterial(ctx.client, { ...params.material, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMaterial"),- );-- server.registerTool(- "items_upsertMaterialDimension",- {- description: "upsert material dimension",- inputSchema: z.object({- materialDimension: materialDimensionValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialDimension(ctx.client, { ...params.materialDimension, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialDimension"),- );-- server.registerTool(- "items_upsertMaterialFinish",- {- description: "upsert material finish",- inputSchema: z.object({- materialFinish: materialFinishValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialFinish(ctx.client, { ...params.materialFinish, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialFinish"),- );-- server.registerTool(- "items_upsertMaterialForm",- {- description: "upsert material form",- inputSchema: z.object({- materialForm: materialFormValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialForm(ctx.client, { ...params.materialForm, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialForm"),- );-- server.registerTool(- "items_upsertMaterialGrade",- {- description: "upsert material grade",- inputSchema: z.object({- materialGrade: materialGradeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialGrade(ctx.client, { ...params.materialGrade, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialGrade"),- );-- server.registerTool(- "items_deleteMaterialType",- {- description: "delete material type",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaterialType(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_deleteMaterialType"),- );-- server.registerTool(- "items_getMaterialTypes",- {- description: "get material types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: items_getMaterialTypes"),- );-- server.registerTool(- "items_getMaterialType",- {- description: "get material type",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialType(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: items_getMaterialType"),- );-- server.registerTool(- "items_getMaterialTypeList",- {- description: "get material type list",- inputSchema: z.object({- materialSubstanceId: z.string(),- materialFormId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaterialTypeList(ctx.client, params.materialSubstanceId, params.materialFormId, ctx.companyId);- return toMcpResult(result);- }, "Failed: items_getMaterialTypeList"),- );-- server.registerTool(- "items_upsertMaterialType",- {- description: "upsert material type",- inputSchema: z.object({- materialType: materialTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialType(ctx.client, { ...params.materialType, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialType"),- );-- server.registerTool(- "items_upsertMaterialSubstance",- {- description: "upsert material substance",- inputSchema: z.object({- materialSubstance: materialSubstanceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaterialSubstance(ctx.client, { ...params.materialSubstance, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertMaterialSubstance"),- );-- server.registerTool(- "items_upsertService",- {- description: "upsert service",- inputSchema: z.object({- service: serviceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertService(ctx.client, { ...params.service, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertService"),- );-- server.registerTool(- "items_upsertUnitOfMeasure",- {- description: "upsert unit of measure",- inputSchema: z.object({- unitOfMeasure: unitOfMeasureValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertUnitOfMeasure(ctx.client, { ...params.unitOfMeasure, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertUnitOfMeasure"),- );-- server.registerTool(- "items_upsertTool",- {- description: "upsert tool",- inputSchema: z.object({- tool: toolValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertTool(ctx.client, { ...params.tool, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: items_upsertTool"),- );-- server.registerTool(- "items_getSupplierPriceBreaksForItems",- {- description: "get supplier price breaks for items",- inputSchema: z.object({- itemIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierPriceBreaksForItems(ctx.client, params.itemIds);- return toMcpResult(result);- }, "Failed: items_getSupplierPriceBreaksForItems"),- );-- server.registerTool(- "items_lookupBuyPrice",- {- description: "lookup buy price",- inputSchema: z.object({- itemId: z.string(),- qty: z.number(),- fallbackCost: z.number(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await lookupBuyPrice(ctx.client, params.itemId, params.qty, params.fallbackCost);- return toMcpResult(result);- }, "Failed: items_lookupBuyPrice"),- );-- server.registerTool(- "items_getSupplierPartPriceBreaks",- {- description: "get supplier part price breaks",- inputSchema: z.object({- supplierPartId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierPartPriceBreaks(ctx.client, params.supplierPartId);- return toMcpResult(result);- }, "Failed: items_getSupplierPartPriceBreaks"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/people.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/people.tsdeleted file mode 100644index 6c99da7810..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/people.ts+++ /dev/null@@ -1,803 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- deleteAttribute,- deleteAttributeCategory,- deleteDepartment,- deleteHoliday,- deleteShift,- getAttribute,- getAttributeCategories,- getAttributeCategory,- getAttributeDataTypes,- getDepartment,- getDepartments,- getDepartmentsList,- getDepartmentsTree,- getEmployeeJob,- getEmployeeSummary,- getHoliday,- getHolidays,- getPeople,- getContacts,- getShift,- getShifts,- getShiftsList,- insertAttribute,- insertAttributeCategory,- insertEmployeeJob,- updateAttribute,- updateAttributeCategory,- updateAttributeSortOrder,- updateEmployeeJob,- upsertDepartment,- upsertHoliday,- upsertShift,- clockIn,- clockOut,- createTimeCardEntry,- deleteTimeCardEntry,- getClockedInEmployees,- getOpenClockEntry,- getRecentTimecards,- getScheduledEmployeesToday,- getTimeCardEntry,- getTimeCardEntries,- getTimecardEntries,- getWeeklyHoursForEmployees,- updateTimeCardEntry,-} from "~/modules/people/people.service";-import {- employeeJobValidator,- departmentValidator,- holidayValidator,- shiftValidator,-} from "~/modules/people/people.models";--export const registerPeopleTools: RegisterTools = (server, ctx) => {- server.registerTool(- "people_deleteAttribute",- {- description: "delete attribute",- inputSchema: z.object({- attributeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAttribute(ctx.client, params.attributeId);- return toMcpResult(result);- }, "Failed: people_deleteAttribute"),- );-- server.registerTool(- "people_deleteAttributeCategory",- {- description: "delete attribute category",- inputSchema: z.object({- attributeCategoryId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAttributeCategory(ctx.client, params.attributeCategoryId);- return toMcpResult(result);- }, "Failed: people_deleteAttributeCategory"),- );-- server.registerTool(- "people_deleteDepartment",- {- description: "delete department",- inputSchema: z.object({- departmentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDepartment(ctx.client, params.departmentId);- return toMcpResult(result);- }, "Failed: people_deleteDepartment"),- );-- server.registerTool(- "people_deleteHoliday",- {- description: "delete holiday",- inputSchema: z.object({- holidayId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteHoliday(ctx.client, params.holidayId);- return toMcpResult(result);- }, "Failed: people_deleteHoliday"),- );-- server.registerTool(- "people_deleteShift",- {- description: "delete shift",- inputSchema: z.object({- shiftId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteShift(ctx.client, params.shiftId);- return toMcpResult(result);- }, "Failed: people_deleteShift"),- );-- server.registerTool(- "people_getAttribute",- {- description: "get attribute",- inputSchema: z.object({- attributeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttribute(ctx.client, params.attributeId);- return toMcpResult(result);- }, "Failed: people_getAttribute"),- );-- server.registerTool(- "people_getAttributeCategories",- {- description: "get attribute categories",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttributeCategories(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getAttributeCategories"),- );-- server.registerTool(- "people_getAttributeCategory",- {- description: "get attribute category",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttributeCategory(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: people_getAttributeCategory"),- );-- server.registerTool(- "people_getAttributeDataTypes",- {- description: "get attribute data types",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAttributeDataTypes(ctx.client);- return toMcpResult(result);- }, "Failed: people_getAttributeDataTypes"),- );-- server.registerTool(- "people_getDepartment",- {- description: "get department",- inputSchema: z.object({- departmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDepartment(ctx.client, params.departmentId);- return toMcpResult(result);- }, "Failed: people_getDepartment"),- );-- server.registerTool(- "people_getDepartments",- {- description: "get departments",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDepartments(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getDepartments"),- );-- server.registerTool(- "people_getDepartmentsList",- {- description: "get departments list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDepartmentsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getDepartmentsList"),- );-- server.registerTool(- "people_getDepartmentsTree",- {- description: "get departments tree",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDepartmentsTree(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getDepartmentsTree"),- );-- server.registerTool(- "people_getEmployeeJob",- {- description: "get employee job",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployeeJob(ctx.client, params.employeeId, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getEmployeeJob"),- );-- server.registerTool(- "people_getEmployeeSummary",- {- description: "get employee summary",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployeeSummary(ctx.client, params.employeeId, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getEmployeeSummary"),- );-- server.registerTool(- "people_getHoliday",- {- description: "get holiday",- inputSchema: z.object({- holidayId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getHoliday(ctx.client, params.holidayId);- return toMcpResult(result);- }, "Failed: people_getHoliday"),- );-- server.registerTool(- "people_getHolidays",- {- description: "get holidays",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getHolidays(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getHolidays"),- );-- server.registerTool(- "people_getPeople",- {- description: "get people",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPeople(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getPeople"),- );-- server.registerTool(- "people_getContacts",- {- description: "get contacts",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getContacts(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getContacts"),- );-- server.registerTool(- "people_getShift",- {- description: "get shift",- inputSchema: z.object({- shiftId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShift(ctx.client, params.shiftId);- return toMcpResult(result);- }, "Failed: people_getShift"),- );-- server.registerTool(- "people_getShifts",- {- description: "get shifts",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShifts(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getShifts"),- );-- server.registerTool(- "people_getShiftsList",- {- description: "get shifts list",- inputSchema: z.object({- locationId: z.string().nullable(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getShiftsList(ctx.client, params.locationId);- return toMcpResult(result);- }, "Failed: people_getShiftsList"),- );-- server.registerTool(- "people_insertAttribute",- {- description: "insert attribute",- inputSchema: z.object({- attribute: z.object({- name: z.string(),- attributeDataTypeId: z.number(),- userAttributeCategoryId: z.string(),- listOptions: z.array(z.string()).optional(),- canSelfManage: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertAttribute(ctx.client, { ...params.attribute, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_insertAttribute"),- );-- server.registerTool(- "people_insertAttributeCategory",- {- description: "insert attribute category",- inputSchema: z.object({- attributeCategory: z.object({- name: z.string(),- emoji: z.string().optional(),- public: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertAttributeCategory(ctx.client, { ...params.attributeCategory, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_insertAttributeCategory"),- );-- server.registerTool(- "people_insertEmployeeJob",- {- description: "insert employee job",- inputSchema: z.object({- job: z.object({- id: z.string(),- locationId: z.string().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertEmployeeJob(ctx.client, { ...params.job, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: people_insertEmployeeJob"),- );-- server.registerTool(- "people_updateAttribute",- {- description: "update attribute",- inputSchema: z.object({- attribute: z.object({- id: z.string().optional(),- name: z.string(),- listOptions: z.array(z.string()).optional(),- canSelfManage: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAttribute(ctx.client, { ...params.attribute, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_updateAttribute"),- );-- server.registerTool(- "people_updateAttributeCategory",- {- description: "update attribute category",- inputSchema: z.object({- attributeCategory: z.object({- id: z.string(),- name: z.string(),- emoji: z.string().optional(),- public: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAttributeCategory(ctx.client, { ...params.attributeCategory, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_updateAttributeCategory"),- );-- server.registerTool(- "people_updateAttributeSortOrder",- {- description: "update attribute sort order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAttributeSortOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_updateAttributeSortOrder"),- );-- server.registerTool(- "people_updateEmployeeJob",- {- description: "update employee job",- inputSchema: z.object({- employeeId: z.string(),- employeeJob: employeeJobValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateEmployeeJob(ctx.client, params.employeeId, { ...params.employeeJob, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_updateEmployeeJob"),- );-- server.registerTool(- "people_upsertDepartment",- {- description: "upsert department",- inputSchema: z.object({- department: departmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertDepartment(ctx.client, { ...params.department, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_upsertDepartment"),- );-- server.registerTool(- "people_upsertHoliday",- {- description: "upsert holiday",- inputSchema: z.object({- holiday: holidayValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertHoliday(ctx.client, { ...params.holiday, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_upsertHoliday"),- );-- server.registerTool(- "people_upsertShift",- {- description: "upsert shift",- inputSchema: z.object({- shift: shiftValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertShift(ctx.client, { ...params.shift, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_upsertShift"),- );-- server.registerTool(- "people_clockIn",- {- description: "clock in",- inputSchema: z.object({- args: z.object({- employeeId: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await clockIn(ctx.client, { ...params.args, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_clockIn"),- );-- server.registerTool(- "people_clockOut",- {- description: "clock out",- inputSchema: z.object({- args: z.object({- employeeId: z.string(),- clockOut: z.string().optional(),- note: z.string().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await clockOut(ctx.client, { ...params.args, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_clockOut"),- );-- server.registerTool(- "people_createTimeCardEntry",- {- description: "create time card entry",- inputSchema: z.object({- entry: z.object({- employeeId: z.string(),- clockIn: z.string(),- clockOut: z.string().nullable().optional(),- note: z.string().nullable().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createTimeCardEntry(ctx.client, { ...params.entry, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_createTimeCardEntry"),- );-- server.registerTool(- "people_deleteTimeCardEntry",- {- description: "delete time card entry",- inputSchema: z.object({- entryId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteTimeCardEntry(ctx.client, params.entryId);- return toMcpResult(result);- }, "Failed: people_deleteTimeCardEntry"),- );-- server.registerTool(- "people_getClockedInEmployees",- {- description: "get clocked in employees",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getClockedInEmployees(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getClockedInEmployees"),- );-- server.registerTool(- "people_getOpenClockEntry",- {- description: "get open clock entry",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpenClockEntry(ctx.client, params.employeeId, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getOpenClockEntry"),- );-- server.registerTool(- "people_getRecentTimecards",- {- description: "get recent timecards",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRecentTimecards(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getRecentTimecards"),- );-- server.registerTool(- "people_getScheduledEmployeesToday",- {- description: "get scheduled employees today",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getScheduledEmployeesToday(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: people_getScheduledEmployeesToday"),- );-- server.registerTool(- "people_getTimeCardEntry",- {- description: "get time card entry",- inputSchema: z.object({- entryId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTimeCardEntry(ctx.client, params.entryId);- return toMcpResult(result);- }, "Failed: people_getTimeCardEntry"),- );-- server.registerTool(- "people_getTimeCardEntries",- {- description: "get time card entries",- inputSchema: z.object({- args: z.object({- employeeId: z.string(),- from: z.string().optional(),- to: z.string().optional()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTimeCardEntries(ctx.client, { ...params.args, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: people_getTimeCardEntries"),- );-- server.registerTool(- "people_getTimecardEntries",- {- description: "get timecard entries",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTimecardEntries(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: people_getTimecardEntries"),- );-- server.registerTool(- "people_getWeeklyHoursForEmployees",- {- description: "get weekly hours for employees",- inputSchema: z.object({- employeeIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWeeklyHoursForEmployees(ctx.client, ctx.companyId, params.employeeIds);- return toMcpResult(result);- }, "Failed: people_getWeeklyHoursForEmployees"),- );-- server.registerTool(- "people_updateTimeCardEntry",- {- description: "update time card entry",- inputSchema: z.object({- args: z.object({- entryId: z.string(),- clockIn: z.string().optional(),- clockOut: z.string().nullable().optional(),- note: z.string().nullable().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateTimeCardEntry(ctx.client, { ...params.args, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: people_updateTimeCardEntry"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/production.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/production.tsdeleted file mode 100644index 3706ce656c..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/production.ts+++ /dev/null@@ -1,2271 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- convertSalesOrderLinesToJobs,- calculateJobPriority,- deleteDemandForecasts,- deleteDemandProjections,- deleteJob,- deleteJobMaterial,- deleteJobOperation,- deleteJobOperationStep,- deleteJobOperationParameter,- deleteJobOperationTool,- deleteProcedure,- deleteProcedureStep,- deleteProcedureParameter,- deleteProductionEvent,- deleteProductionQuantity,- getActiveJobOperationByJobId,- getActiveJobOperationsByLocation,- getJobsByDateRange,- getUnscheduledJobs,- getActiveProductionEvents,- deleteScrapReason,- deleteFailureMode,- deleteMaintenanceDispatch,- deleteMaintenanceDispatchComment,- deleteMaintenanceDispatchEvent,- deleteMaintenanceDispatchItem,- deleteMaintenanceDispatchWorkCenter,- deleteMaintenanceSchedule,- deleteMaintenanceScheduleItem,- getDemandForecasts,- getDemandProjections,- getJobDocuments,- getJobDocumentsWithItemId,- getJob,- getJobByOperationId,- getJobPurchaseOrderLines,- getJobs,- getJobsBySalesOrderLine,- getJobsList,- getJobMakeMethodById,- getRootMakeMethod,- getJobMaterialsWithQuantityOnHand,- getJobMethodTree,- getJobMethodTreeArray,- getJobMaterial,- getJobMaterialsByMethodId,- getJobOperation,- getJobOperations,- getJobOperationsAssignedToEmployee,- getJobOperationAttachments,- getJobOperationsList,- getJobOperationsByMethodId,- getJobOperationStepRecords,- getOutsideOperationsByJobId,- getProcedure,- getProcedureSteps,- getProcedureParameters,- getProcedureVersions,- getProcedures,- getProceduresList,- getProductionEvent,- getProductionEvents,- getProductionEventsPage,- getProductionEventsByOperations,- getProductionPlanning,- getProductionProjections,- getProductionQuantity,- getProductionQuantities,- getProductionDataByOperations,- getScrapReasonsList,- getScrapReason,- getScrapReasons,- getFailureMode,- getFailureModes,- getFailureModesList,- getMaintenanceDispatch,- getMaintenanceDispatches,- getMaintenanceDispatchComments,- getMaintenanceDispatchEvents,- getMaintenanceDispatchItems,- getMaintenanceDispatchWorkCenters,- getMaintenanceSchedule,- getMaintenanceSchedules,- getMaintenanceScheduleItems,- getTrackedEntityByJobId,- getTrackedEntitiesByJobId,- recalculateJobOperationDependencies,- recalculateJobRequirements,- recalculateJobMakeMethodRequirements,- runMRP,- updateJobBatchNumber,- updateJobStatus,- updateJobMaterialOrder,- updateJobOperationOrder,- updateJobOperationStepOrder,- updateKanbanJob,- updateQuoteOperationStepOrder,- updateMethodOperationStepOrder,- updateJobOperationStatus,- updateJobOperationDueDate,- updateProcedureStepOrder,- upsertProductionEvent,- updateProductionQuantity,- upsertProductionQuantity,- upsertJob,- upsertJobMaterial,- upsertJobOperation,- upsertJobOperationStep,- upsertJobOperationParameter,- upsertJobOperationTool,- upsertJobMethod,- upsertJobMaterialMakeMethod,- upsertMakeMethodFromJob,- upsertMakeMethodFromJobMethod,- upsertProcedure,- upsertProcedureStep,- upsertProcedureParameter,- upsertScrapReason,- upsertFailureMode,- upsertMaintenanceDispatch,- upsertMaintenanceDispatchComment,- upsertMaintenanceDispatchEvent,- upsertMaintenanceDispatchItem,- upsertMaintenanceDispatchWorkCenter,- upsertMaintenanceSchedule,- upsertMaintenanceScheduleItem,- upsertDemandForecasts,- upsertDemandProjections,- triggerJobSchedule,-} from "~/modules/production/production.service";-import {- productionEventValidator,- productionQuantityValidator,- jobValidator,- jobMaterialValidator,- jobOperationValidator,- procedureValidator,- procedureStepValidator,- procedureParameterValidator,- scrapReasonValidator,- failureModeValidator,- maintenanceDispatchValidator,- maintenanceDispatchCommentValidator,- maintenanceDispatchEventValidator,- maintenanceDispatchItemValidator,- maintenanceDispatchWorkCenterValidator,- maintenanceScheduleValidator,- maintenanceScheduleItemValidator,-} from "~/modules/production/production.models";-import {- operationStepValidator,- operationParameterValidator,- operationToolValidator,-} from "~/modules/shared";--export const registerProductionTools: RegisterTools = (server, ctx) => {- server.registerTool(- "production_convertSalesOrderLinesToJobs",- {- description: "convert sales order lines to jobs",- inputSchema: z.object({- arg1: z.object({- orderId: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await convertSalesOrderLinesToJobs(ctx.client, { ...params.arg1, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_convertSalesOrderLinesToJobs"),- );-- server.registerTool(- "production_calculateJobPriority",- {- description: "calculate job priority",- inputSchema: z.object({- params: z.object({- jobId: z.string().optional(),- dueDate: z.string().nullable(),- deadlineType: z.any(),- locationId: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await calculateJobPriority(ctx.client, { ...params.params, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: production_calculateJobPriority"),- );-- server.registerTool(- "production_deleteDemandForecasts",- {- description: "delete demand forecasts",- inputSchema: z.object({- params: z.object({- itemId: z.string(),- locationId: z.string(),- futurePeriodIds: z.array(z.string())- }),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDemandForecasts(ctx.client, { ...params.params, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: production_deleteDemandForecasts"),- );-- server.registerTool(- "production_deleteDemandProjections",- {- description: "delete demand projections",- inputSchema: z.object({- params: z.object({- itemId: z.string(),- locationId: z.string(),- futurePeriodIds: z.array(z.string())- }),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteDemandProjections(ctx.client, { ...params.params, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: production_deleteDemandProjections"),- );-- server.registerTool(- "production_deleteJob",- {- description: "delete job",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJob(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_deleteJob"),- );-- server.registerTool(- "production_deleteJobMaterial",- {- description: "delete job material",- inputSchema: z.object({- jobMaterialId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJobMaterial(ctx.client, params.jobMaterialId);- return toMcpResult(result);- }, "Failed: production_deleteJobMaterial"),- );-- server.registerTool(- "production_deleteJobOperation",- {- description: "delete job operation",- inputSchema: z.object({- jobOperationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJobOperation(ctx.client, params.jobOperationId);- return toMcpResult(result);- }, "Failed: production_deleteJobOperation"),- );-- server.registerTool(- "production_deleteJobOperationStep",- {- description: "delete job operation step",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJobOperationStep(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_deleteJobOperationStep"),- );-- server.registerTool(- "production_deleteJobOperationParameter",- {- description: "delete job operation parameter",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJobOperationParameter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_deleteJobOperationParameter"),- );-- server.registerTool(- "production_deleteJobOperationTool",- {- description: "delete job operation tool",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteJobOperationTool(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_deleteJobOperationTool"),- );-- server.registerTool(- "production_deleteProcedure",- {- description: "delete procedure",- inputSchema: z.object({- procedureId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProcedure(ctx.client, params.procedureId);- return toMcpResult(result);- }, "Failed: production_deleteProcedure"),- );-- server.registerTool(- "production_deleteProcedureStep",- {- description: "delete procedure step",- inputSchema: z.object({- procedureStepId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProcedureStep(ctx.client, params.procedureStepId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_deleteProcedureStep"),- );-- server.registerTool(- "production_deleteProcedureParameter",- {- description: "delete procedure parameter",- inputSchema: z.object({- procedureParameterId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProcedureParameter(ctx.client, params.procedureParameterId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_deleteProcedureParameter"),- );-- server.registerTool(- "production_deleteProductionEvent",- {- description: "delete production event",- inputSchema: z.object({- productionEventId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProductionEvent(ctx.client, params.productionEventId);- return toMcpResult(result);- }, "Failed: production_deleteProductionEvent"),- );-- server.registerTool(- "production_deleteProductionQuantity",- {- description: "delete production quantity",- inputSchema: z.object({- productionQuantityId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProductionQuantity(ctx.client, params.productionQuantityId);- return toMcpResult(result);- }, "Failed: production_deleteProductionQuantity"),- );-- server.registerTool(- "production_getActiveJobOperationByJobId",- {- description: "get active job operation by job id",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getActiveJobOperationByJobId(ctx.client, params.jobId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getActiveJobOperationByJobId"),- );-- server.registerTool(- "production_getActiveJobOperationsByLocation",- {- description: "get active job operations by location",- inputSchema: z.object({- locationId: z.string(),- workCenterIds: z.array(z.string()).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getActiveJobOperationsByLocation(ctx.client, params.locationId, params.workCenterIds);- return toMcpResult(result);- }, "Failed: production_getActiveJobOperationsByLocation"),- );-- server.registerTool(- "production_getJobsByDateRange",- {- description: "get jobs by date range",- inputSchema: z.object({- locationId: z.string(),- startDate: z.string(),- endDate: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobsByDateRange(ctx.client, params.locationId, params.startDate, params.endDate);- return toMcpResult(result);- }, "Failed: production_getJobsByDateRange"),- );-- server.registerTool(- "production_getUnscheduledJobs",- {- description: "get unscheduled jobs",- inputSchema: z.object({- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUnscheduledJobs(ctx.client, params.locationId);- return toMcpResult(result);- }, "Failed: production_getUnscheduledJobs"),- );-- server.registerTool(- "production_getActiveProductionEvents",- {- description: "get active production events",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getActiveProductionEvents(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getActiveProductionEvents"),- );-- server.registerTool(- "production_deleteScrapReason",- {- description: "delete scrap reason",- inputSchema: z.object({- scrapReasonId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteScrapReason(ctx.client, params.scrapReasonId);- return toMcpResult(result);- }, "Failed: production_deleteScrapReason"),- );-- server.registerTool(- "production_deleteFailureMode",- {- description: "delete failure mode",- inputSchema: z.object({- failureModeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteFailureMode(ctx.client, params.failureModeId);- return toMcpResult(result);- }, "Failed: production_deleteFailureMode"),- );-- server.registerTool(- "production_deleteMaintenanceDispatch",- {- description: "delete maintenance dispatch",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatch(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceDispatch"),- );-- server.registerTool(- "production_deleteMaintenanceDispatchComment",- {- description: "delete maintenance dispatch comment",- inputSchema: z.object({- commentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchComment(ctx.client, params.commentId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceDispatchComment"),- );-- server.registerTool(- "production_deleteMaintenanceDispatchEvent",- {- description: "delete maintenance dispatch event",- inputSchema: z.object({- eventId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchEvent(ctx.client, params.eventId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceDispatchEvent"),- );-- server.registerTool(- "production_deleteMaintenanceDispatchItem",- {- description: "delete maintenance dispatch item",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchItem(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceDispatchItem"),- );-- server.registerTool(- "production_deleteMaintenanceDispatchWorkCenter",- {- description: "delete maintenance dispatch work center",- inputSchema: z.object({- workCenterId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchWorkCenter(ctx.client, params.workCenterId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceDispatchWorkCenter"),- );-- server.registerTool(- "production_deleteMaintenanceSchedule",- {- description: "delete maintenance schedule",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceSchedule(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceSchedule"),- );-- server.registerTool(- "production_deleteMaintenanceScheduleItem",- {- description: "delete maintenance schedule item",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceScheduleItem(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: production_deleteMaintenanceScheduleItem"),- );-- server.registerTool(- "production_getDemandForecasts",- {- description: "get demand forecasts",- inputSchema: z.object({- params: z.object({- itemId: z.string(),- locationId: z.string(),- periodIds: z.array(z.string())- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDemandForecasts(ctx.client, { ...params.params, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: production_getDemandForecasts"),- );-- server.registerTool(- "production_getDemandProjections",- {- description: "get demand projections",- inputSchema: z.object({- params: z.object({- itemId: z.string(),- locationId: z.string(),- periodIds: z.array(z.string())- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getDemandProjections(ctx.client, { ...params.params, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: production_getDemandProjections"),- );-- server.registerTool(- "production_getJobDocuments",- {- description: "get job documents",- inputSchema: z.object({- job: z.object({- id: z.string().nullable(),- salesOrderLineId: z.string().nullable().optional(),- quoteLineId: z.string().nullable().optional(),- itemId: z.string().nullable().optional()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobDocuments(ctx.client, ctx.companyId, params.job);- return toMcpResult(result);- }, "Failed: production_getJobDocuments"),- );-- server.registerTool(- "production_getJobDocumentsWithItemId",- {- description: "get job documents with item id",- inputSchema: z.object({- job: z.any(),- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobDocumentsWithItemId(ctx.client, ctx.companyId, params.job, params.itemId);- return toMcpResult(result);- }, "Failed: production_getJobDocumentsWithItemId"),- );-- server.registerTool(- "production_getJob",- {- description: "get job",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJob(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_getJob"),- );-- server.registerTool(- "production_getJobByOperationId",- {- description: "get job by operation id",- inputSchema: z.object({- operationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobByOperationId(ctx.client, params.operationId);- return toMcpResult(result);- }, "Failed: production_getJobByOperationId"),- );-- server.registerTool(- "production_getJobPurchaseOrderLines",- {- description: "get job purchase order lines",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobPurchaseOrderLines(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getJobPurchaseOrderLines"),- );-- server.registerTool(- "production_getJobs",- {- description: "get jobs",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobs(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getJobs"),- );-- server.registerTool(- "production_getJobsBySalesOrderLine",- {- description: "get jobs by sales order line",- inputSchema: z.object({- salesOrderLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobsBySalesOrderLine(ctx.client, params.salesOrderLineId);- return toMcpResult(result);- }, "Failed: production_getJobsBySalesOrderLine"),- );-- server.registerTool(- "production_getJobsList",- {- description: "get jobs list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getJobsList"),- );-- server.registerTool(- "production_getJobMakeMethodById",- {- description: "get job make method by id",- inputSchema: z.object({- jobMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMakeMethodById(ctx.client, params.jobMakeMethodId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getJobMakeMethodById"),- );-- server.registerTool(- "production_getRootMakeMethod",- {- description: "get root make method",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRootMakeMethod(ctx.client, params.jobId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getRootMakeMethod"),- );-- server.registerTool(- "production_getJobMaterialsWithQuantityOnHand",- {- description: "get job materials with quantity on hand",- inputSchema: z.object({- jobId: z.string(),- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMaterialsWithQuantityOnHand(ctx.client, params.jobId, ctx.companyId, params.locationId, params.args);- return toMcpResult(result);- }, "Failed: production_getJobMaterialsWithQuantityOnHand"),- );-- server.registerTool(- "production_getJobMethodTree",- {- description: "get job method tree",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMethodTree(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getJobMethodTree"),- );-- server.registerTool(- "production_getJobMethodTreeArray",- {- description: "get job method tree array",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMethodTreeArray(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getJobMethodTreeArray"),- );-- server.registerTool(- "production_getJobMaterial",- {- description: "get job material",- inputSchema: z.object({- materialId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMaterial(ctx.client, params.materialId);- return toMcpResult(result);- }, "Failed: production_getJobMaterial"),- );-- server.registerTool(- "production_getJobMaterialsByMethodId",- {- description: "get job materials by method id",- inputSchema: z.object({- jobMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobMaterialsByMethodId(ctx.client, params.jobMakeMethodId);- return toMcpResult(result);- }, "Failed: production_getJobMaterialsByMethodId"),- );-- server.registerTool(- "production_getJobOperation",- {- description: "get job operation",- inputSchema: z.object({- jobOperationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperation(ctx.client, params.jobOperationId);- return toMcpResult(result);- }, "Failed: production_getJobOperation"),- );-- server.registerTool(- "production_getJobOperations",- {- description: "get job operations",- inputSchema: z.object({- jobId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperations(ctx.client, params.jobId, params.args);- return toMcpResult(result);- }, "Failed: production_getJobOperations"),- );-- server.registerTool(- "production_getJobOperationsAssignedToEmployee",- {- description: "get job operations assigned to employee",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperationsAssignedToEmployee(ctx.client, params.employeeId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getJobOperationsAssignedToEmployee"),- );-- server.registerTool(- "production_getJobOperationAttachments",- {- description: "get job operation attachments",- inputSchema: z.object({- jobOperationIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperationAttachments(ctx.client, params.jobOperationIds);- return toMcpResult(result);- }, "Failed: production_getJobOperationAttachments"),- );-- server.registerTool(- "production_getJobOperationsList",- {- description: "get job operations list",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperationsList(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getJobOperationsList"),- );-- server.registerTool(- "production_getJobOperationsByMethodId",- {- description: "get job operations by method id",- inputSchema: z.object({- jobMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperationsByMethodId(ctx.client, params.jobMakeMethodId);- return toMcpResult(result);- }, "Failed: production_getJobOperationsByMethodId"),- );-- server.registerTool(- "production_getJobOperationStepRecords",- {- description: "get job operation step records",- inputSchema: z.object({- jobId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getJobOperationStepRecords(ctx.client, params.jobId, params.args);- return toMcpResult(result);- }, "Failed: production_getJobOperationStepRecords"),- );-- server.registerTool(- "production_getOutsideOperationsByJobId",- {- description: "get outside operations by job id",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOutsideOperationsByJobId(ctx.client, params.jobId, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getOutsideOperationsByJobId"),- );-- server.registerTool(- "production_getProcedure",- {- description: "get procedure",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcedure(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_getProcedure"),- );-- server.registerTool(- "production_getProcedureSteps",- {- description: "get procedure steps",- inputSchema: z.object({- procedureId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcedureSteps(ctx.client, params.procedureId);- return toMcpResult(result);- }, "Failed: production_getProcedureSteps"),- );-- server.registerTool(- "production_getProcedureParameters",- {- description: "get procedure parameters",- inputSchema: z.object({- procedureId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcedureParameters(ctx.client, params.procedureId);- return toMcpResult(result);- }, "Failed: production_getProcedureParameters"),- );-- server.registerTool(- "production_getProcedureVersions",- {- description: "get procedure versions",- inputSchema: z.object({- procedure: z.object({- name: z.string(),- version: z.number()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcedureVersions(ctx.client, params.procedure, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getProcedureVersions"),- );-- server.registerTool(- "production_getProcedures",- {- description: "get procedures",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcedures(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getProcedures"),- );-- server.registerTool(- "production_getProceduresList",- {- description: "get procedures list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProceduresList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getProceduresList"),- );-- server.registerTool(- "production_getProductionEvent",- {- description: "get production event",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionEvent(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_getProductionEvent"),- );-- server.registerTool(- "production_getProductionEvents",- {- description: "get production events",- inputSchema: z.object({- jobOperationIds: z.array(z.string()),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionEvents(ctx.client, params.jobOperationIds, params.args);- return toMcpResult(result);- }, "Failed: production_getProductionEvents"),- );-- server.registerTool(- "production_getProductionEventsPage",- {- description: "get production events page",- inputSchema: z.object({- jobOperationId: z.string(),- sortDescending: z.boolean().optional(),- page: z.number().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionEventsPage(ctx.client, params.jobOperationId, ctx.companyId, params.sortDescending, params.page);- return toMcpResult(result);- }, "Failed: production_getProductionEventsPage"),- );-- server.registerTool(- "production_getProductionEventsByOperations",- {- description: "get production events by operations",- inputSchema: z.object({- jobOperationIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionEventsByOperations(ctx.client, params.jobOperationIds);- return toMcpResult(result);- }, "Failed: production_getProductionEventsByOperations"),- );-- server.registerTool(- "production_getProductionPlanning",- {- description: "get production planning",- inputSchema: z.object({- locationId: z.string(),- periods: z.array(z.string()),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionPlanning(ctx.client, params.locationId, ctx.companyId, params.periods, params.args);- return toMcpResult(result);- }, "Failed: production_getProductionPlanning"),- );-- server.registerTool(- "production_getProductionProjections",- {- description: "get production projections",- inputSchema: z.object({- locationId: z.string(),- periods: z.array(z.string()),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionProjections(ctx.client, params.locationId, params.periods, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getProductionProjections"),- );-- server.registerTool(- "production_getProductionQuantity",- {- description: "get production quantity",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionQuantity(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: production_getProductionQuantity"),- );-- server.registerTool(- "production_getProductionQuantities",- {- description: "get production quantities",- inputSchema: z.object({- jobOperationIds: z.array(z.string()),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionQuantities(ctx.client, params.jobOperationIds, params.args);- return toMcpResult(result);- }, "Failed: production_getProductionQuantities"),- );-- server.registerTool(- "production_getProductionDataByOperations",- {- description: "get production data by operations",- inputSchema: z.object({- jobOperationIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProductionDataByOperations(ctx.client, params.jobOperationIds);- return toMcpResult(result);- }, "Failed: production_getProductionDataByOperations"),- );-- server.registerTool(- "production_getScrapReasonsList",- {- description: "get scrap reasons list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getScrapReasonsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getScrapReasonsList"),- );-- server.registerTool(- "production_getScrapReason",- {- description: "get scrap reason",- inputSchema: z.object({- scrapReasonId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getScrapReason(ctx.client, params.scrapReasonId);- return toMcpResult(result);- }, "Failed: production_getScrapReason"),- );-- server.registerTool(- "production_getScrapReasons",- {- description: "get scrap reasons",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getScrapReasons(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getScrapReasons"),- );-- server.registerTool(- "production_getFailureMode",- {- description: "get failure mode",- inputSchema: z.object({- failureModeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureMode(ctx.client, params.failureModeId);- return toMcpResult(result);- }, "Failed: production_getFailureMode"),- );-- server.registerTool(- "production_getFailureModes",- {- description: "get failure modes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureModes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getFailureModes"),- );-- server.registerTool(- "production_getFailureModesList",- {- description: "get failure modes list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureModesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: production_getFailureModesList"),- );-- server.registerTool(- "production_getMaintenanceDispatch",- {- description: "get maintenance dispatch",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatch(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatch"),- );-- server.registerTool(- "production_getMaintenanceDispatches",- {- description: "get maintenance dispatches",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatches(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatches"),- );-- server.registerTool(- "production_getMaintenanceDispatchComments",- {- description: "get maintenance dispatch comments",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchComments(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatchComments"),- );-- server.registerTool(- "production_getMaintenanceDispatchEvents",- {- description: "get maintenance dispatch events",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchEvents(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatchEvents"),- );-- server.registerTool(- "production_getMaintenanceDispatchItems",- {- description: "get maintenance dispatch items",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchItems(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatchItems"),- );-- server.registerTool(- "production_getMaintenanceDispatchWorkCenters",- {- description: "get maintenance dispatch work centers",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchWorkCenters(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceDispatchWorkCenters"),- );-- server.registerTool(- "production_getMaintenanceSchedule",- {- description: "get maintenance schedule",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceSchedule(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceSchedule"),- );-- server.registerTool(- "production_getMaintenanceSchedules",- {- description: "get maintenance schedules",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- active: z.boolean().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceSchedules(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: production_getMaintenanceSchedules"),- );-- server.registerTool(- "production_getMaintenanceScheduleItems",- {- description: "get maintenance schedule items",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceScheduleItems(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: production_getMaintenanceScheduleItems"),- );-- server.registerTool(- "production_getTrackedEntityByJobId",- {- description: "get tracked entity by job id",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntityByJobId(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getTrackedEntityByJobId"),- );-- server.registerTool(- "production_getTrackedEntitiesByJobId",- {- description: "get tracked entities by job id",- inputSchema: z.object({- jobId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrackedEntitiesByJobId(ctx.client, params.jobId);- return toMcpResult(result);- }, "Failed: production_getTrackedEntitiesByJobId"),- );-- server.registerTool(- "production_recalculateJobOperationDependencies",- {- description: "recalculate job operation dependencies",- inputSchema: z.object({- params: z.object({- jobId: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await recalculateJobOperationDependencies(ctx.client, { ...params.params, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_recalculateJobOperationDependencies"),- );-- server.registerTool(- "production_recalculateJobRequirements",- {- description: "recalculate job requirements",- inputSchema: z.object({- params: z.object({- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await recalculateJobRequirements(ctx.client, { ...params.params, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_recalculateJobRequirements"),- );-- server.registerTool(- "production_recalculateJobMakeMethodRequirements",- {- description: "recalculate job make method requirements",- inputSchema: z.object({- params: z.object({- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await recalculateJobMakeMethodRequirements(ctx.client, { ...params.params, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_recalculateJobMakeMethodRequirements"),- );-- server.registerTool(- "production_runMRP",- {- description: "run m r p",- inputSchema: z.object({- params: z.object({- type: z.any(),- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await runMRP(ctx.client, { ...params.params, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_runMRP"),- );-- server.registerTool(- "production_updateJobBatchNumber",- {- description: "update job batch number",- inputSchema: z.object({- trackedEntityId: z.string(),- value: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobBatchNumber(ctx.client, params.trackedEntityId, params.value);- return toMcpResult(result);- }, "Failed: production_updateJobBatchNumber"),- );-- server.registerTool(- "production_updateJobStatus",- {- description: "update job status",- inputSchema: z.object({- params: z.object({- id: z.string(),- status: z.any(),- assignee: z.string().nullable().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobStatus(ctx.client, { ...params.params, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateJobStatus"),- );-- server.registerTool(- "production_updateJobMaterialOrder",- {- description: "update job material order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobMaterialOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateJobMaterialOrder"),- );-- server.registerTool(- "production_updateJobOperationOrder",- {- description: "update job operation order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobOperationOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateJobOperationOrder"),- );-- server.registerTool(- "production_updateJobOperationStepOrder",- {- description: "update job operation step order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobOperationStepOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateJobOperationStepOrder"),- );-- server.registerTool(- "production_updateKanbanJob",- {- description: "update kanban job",- inputSchema: z.object({- params: z.object({- id: z.string(),- jobId: z.string().nullable()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateKanbanJob(ctx.client, { ...params.params, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateKanbanJob"),- );-- server.registerTool(- "production_updateQuoteOperationStepOrder",- {- description: "update quote operation step order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteOperationStepOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateQuoteOperationStepOrder"),- );-- server.registerTool(- "production_updateMethodOperationStepOrder",- {- description: "update method operation step order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMethodOperationStepOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateMethodOperationStepOrder"),- );-- server.registerTool(- "production_updateJobOperationStatus",- {- description: "update job operation status",- inputSchema: z.object({- id: z.string(),- status: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobOperationStatus(ctx.client, params.id, params.status, ctx.userId);- return toMcpResult(result);- }, "Failed: production_updateJobOperationStatus"),- );-- server.registerTool(- "production_updateJobOperationDueDate",- {- description: "update job operation due date",- inputSchema: z.object({- id: z.string(),- dueDate: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobOperationDueDate(ctx.client, params.id, params.dueDate, ctx.userId);- return toMcpResult(result);- }, "Failed: production_updateJobOperationDueDate"),- );-- server.registerTool(- "production_updateProcedureStepOrder",- {- description: "update procedure step order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateProcedureStepOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateProcedureStepOrder"),- );-- server.registerTool(- "production_upsertProductionEvent",- {- description: "upsert production event",- inputSchema: z.object({- productionEvent: productionEventValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProductionEvent(ctx.client, { ...params.productionEvent, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertProductionEvent"),- );-- server.registerTool(- "production_updateProductionQuantity",- {- description: "update production quantity",- inputSchema: z.object({- productionQuantity: productionQuantityValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateProductionQuantity(ctx.client, { ...params.productionQuantity, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_updateProductionQuantity"),- );-- server.registerTool(- "production_upsertProductionQuantity",- {- description: "upsert production quantity",- inputSchema: z.object({- productionQuantity: productionQuantityValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProductionQuantity(ctx.client, { ...params.productionQuantity, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertProductionQuantity"),- );-- server.registerTool(- "production_upsertJob",- {- description: "upsert job",- inputSchema: z.object({- job: jobValidator,- status: z.any().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJob(ctx.client, { ...params.job, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId }, params.status);- return toMcpResult(result);- }, "Failed: production_upsertJob"),- );-- server.registerTool(- "production_upsertJobMaterial",- {- description: "upsert job material",- inputSchema: z.object({- jobMaterial: jobMaterialValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobMaterial(ctx.client, { ...params.jobMaterial, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobMaterial"),- );-- server.registerTool(- "production_upsertJobOperation",- {- description: "upsert job operation",- inputSchema: z.object({- jobOperation: jobOperationValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobOperation(ctx.client, { ...params.jobOperation, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobOperation"),- );-- server.registerTool(- "production_upsertJobOperationStep",- {- description: "upsert job operation step",- inputSchema: z.object({- jobOperationStep: operationStepValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobOperationStep(ctx.client, { ...params.jobOperationStep, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobOperationStep"),- );-- server.registerTool(- "production_upsertJobOperationParameter",- {- description: "upsert job operation parameter",- inputSchema: z.object({- jobOperationParameter: operationParameterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobOperationParameter(ctx.client, { ...params.jobOperationParameter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobOperationParameter"),- );-- server.registerTool(- "production_upsertJobOperationTool",- {- description: "upsert job operation tool",- inputSchema: z.object({- jobOperationTool: operationToolValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobOperationTool(ctx.client, { ...params.jobOperationTool, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobOperationTool"),- );-- server.registerTool(- "production_upsertJobMethod",- {- description: "upsert job method",- inputSchema: z.object({- type: z.string(),- jobMethod: z.object({- sourceId: z.string(),- targetId: z.string(),- configuration: z.any().optional(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobMethod(ctx.client, params.type, { ...params.jobMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobMethod"),- );-- server.registerTool(- "production_upsertJobMaterialMakeMethod",- {- description: "upsert job material make method",- inputSchema: z.object({- jobMaterial: z.object({- sourceId: z.string(),- targetId: z.string(),- configuration: z.any().optional(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertJobMaterialMakeMethod(ctx.client, { ...params.jobMaterial, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertJobMaterialMakeMethod"),- );-- server.registerTool(- "production_upsertMakeMethodFromJob",- {- description: "upsert make method from job",- inputSchema: z.object({- jobMethod: z.object({- sourceId: z.string(),- targetId: z.string(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMakeMethodFromJob(ctx.client, { ...params.jobMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMakeMethodFromJob"),- );-- server.registerTool(- "production_upsertMakeMethodFromJobMethod",- {- description: "upsert make method from job method",- inputSchema: z.object({- jobMethod: z.object({- sourceId: z.string(),- targetId: z.string(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMakeMethodFromJobMethod(ctx.client, { ...params.jobMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMakeMethodFromJobMethod"),- );-- server.registerTool(- "production_upsertProcedure",- {- description: "upsert procedure",- inputSchema: z.object({- procedure: procedureValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProcedure(ctx.client, { ...params.procedure, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertProcedure"),- );-- server.registerTool(- "production_upsertProcedureStep",- {- description: "upsert procedure step",- inputSchema: z.object({- procedureStep: procedureStepValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProcedureStep(ctx.client, { ...params.procedureStep, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertProcedureStep"),- );-- server.registerTool(- "production_upsertProcedureParameter",- {- description: "upsert procedure parameter",- inputSchema: z.object({- procedureParameter: procedureParameterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProcedureParameter(ctx.client, { ...params.procedureParameter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertProcedureParameter"),- );-- server.registerTool(- "production_upsertScrapReason",- {- description: "upsert scrap reason",- inputSchema: z.object({- scrapReason: scrapReasonValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertScrapReason(ctx.client, { ...params.scrapReason, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertScrapReason"),- );-- server.registerTool(- "production_upsertFailureMode",- {- description: "upsert failure mode",- inputSchema: z.object({- failureMode: failureModeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertFailureMode(ctx.client, { ...params.failureMode, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertFailureMode"),- );-- server.registerTool(- "production_upsertMaintenanceDispatch",- {- description: "upsert maintenance dispatch",- inputSchema: z.object({- dispatch: maintenanceDispatchValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatch(ctx.client, { ...params.dispatch, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceDispatch"),- );-- server.registerTool(- "production_upsertMaintenanceDispatchComment",- {- description: "upsert maintenance dispatch comment",- inputSchema: z.object({- comment: maintenanceDispatchCommentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchComment(ctx.client, { ...params.comment, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceDispatchComment"),- );-- server.registerTool(- "production_upsertMaintenanceDispatchEvent",- {- description: "upsert maintenance dispatch event",- inputSchema: z.object({- event: maintenanceDispatchEventValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchEvent(ctx.client, { ...params.event, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceDispatchEvent"),- );-- server.registerTool(- "production_upsertMaintenanceDispatchItem",- {- description: "upsert maintenance dispatch item",- inputSchema: z.object({- item: maintenanceDispatchItemValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchItem(ctx.client, { ...params.item, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceDispatchItem"),- );-- server.registerTool(- "production_upsertMaintenanceDispatchWorkCenter",- {- description: "upsert maintenance dispatch work center",- inputSchema: z.object({- workCenter: maintenanceDispatchWorkCenterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchWorkCenter(ctx.client, { ...params.workCenter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceDispatchWorkCenter"),- );-- server.registerTool(- "production_upsertMaintenanceSchedule",- {- description: "upsert maintenance schedule",- inputSchema: z.object({- schedule: maintenanceScheduleValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceSchedule(ctx.client, { ...params.schedule, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceSchedule"),- );-- server.registerTool(- "production_upsertMaintenanceScheduleItem",- {- description: "upsert maintenance schedule item",- inputSchema: z.object({- item: maintenanceScheduleItemValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceScheduleItem(ctx.client, { ...params.item, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertMaintenanceScheduleItem"),- );-- server.registerTool(- "production_upsertDemandForecasts",- {- description: "upsert demand forecasts",- inputSchema: z.object({- forecasts: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertDemandForecasts(ctx.client, { ...params.forecasts, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertDemandForecasts"),- );-- server.registerTool(- "production_upsertDemandProjections",- {- description: "upsert demand projections",- inputSchema: z.object({- forecasts: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertDemandProjections(ctx.client, { ...params.forecasts, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: production_upsertDemandProjections"),- );-- server.registerTool(- "production_triggerJobSchedule",- {- description: "trigger job schedule",- inputSchema: z.object({- jobId: z.string(),- mode: z.string().optional(),- direction: z.string().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await triggerJobSchedule(ctx.client, params.jobId, ctx.companyId, ctx.userId, params.mode, params.direction);- return toMcpResult(result);- }, "Failed: production_triggerJobSchedule"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/purchasing.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/purchasing.tsdeleted file mode 100644index 557fc9a7e7..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/purchasing.ts+++ /dev/null@@ -1,1681 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- closePurchaseOrder,- convertSupplierQuoteToOrder,- deletePurchaseOrder,- deletePurchaseOrderLine,- deleteSupplier,- deleteSupplierContact,- deleteSupplierLocation,- deleteSupplierProcess,- deleteSupplierQuote,- deleteSupplierQuoteLine,- deleteSupplierType,- getPurchaseOrder,- finalizeSupplierQuote,- getPurchaseOrders,- getPurchaseOrderDelivery,- getPurchaseOrderLocations,- getPurchaseOrderPayment,- getPurchaseOrderLines,- getPurchaseOrderLine,- getPurchaseOrderSuppliers,- getPurchasingDocumentsAssignedToMe,- getPurchasingPlanning,- getPurchasingTerms,- getSupplier,- getSupplierApprovalContext,- getSupplierContact,- getSupplierContacts,- getSupplierInteraction,- getSupplierInteractionDocuments,- getSupplierInteractionLineDocuments,- getSupplierLocations,- getSupplierLocation,- getSupplierPayment,- getSupplierProcessById,- getSupplierProcessesByProcess,- getSupplierProcessesBySupplier,- getSupplierQuote,- getSupplierQuoteByInteractionId,- getSupplierQuoteByExternalLinkId,- getSupplierQuotes,- getSupplierQuoteLine,- getSupplierQuoteLines,- getSupplierQuoteLinePrices,- getSupplierQuoteLinePricesByQuoteId,- getSupplierQuotesList,- getSupplierShipping,- getSuppliers,- getSuppliersList,- getSupplierType,- getSupplierTypes,- getSupplierTypesList,- insertSupplier,- insertSupplierContact,- insertSupplierInteraction,- insertSupplierLocation,- finalizePurchaseOrder,- sendSupplierQuote,- updatePurchaseOrder,- updatePurchaseOrderExchangeRate,- updatePurchaseOrderFavorite,- updatePurchaseOrderStatus,- updateSupplierAccounting,- updateSupplierContact,- updateSupplierLocation,- updateSupplierPayment,- updateSupplierQuoteExchangeRate,- updateSupplierQuoteFavorite,- updateSupplierQuoteStatus,- updateSupplierShipping,- getSupplierTax,- updateSupplierTax,- upsertPurchaseOrder,- upsertPurchaseOrderDelivery,- upsertPurchaseOrderLine,- upsertPurchaseOrderPayment,- upsertSupplier,- upsertSupplierProcess,- upsertSupplierQuote,- upsertSupplierQuoteLine,- upsertSupplierType,- deletePurchasingRFQ,- deletePurchasingRFQLine,- getPurchasingRFQ,- getPurchasingRFQs,- getPurchasingRFQLine,- getPurchasingRFQLines,- getPurchasingRFQSuppliers,- upsertPurchasingRFQ,- upsertPurchasingRFQLine,- upsertPurchasingRFQSuppliers,- updatePurchasingRFQStatus,- getLinkedSupplierQuotes,- getLinkedPurchasingRfqs,- getLinkedPurchasingRfqsForInteraction,- getSiblingQuotesForQuote,- getLinkedPurchasingRfqsForOrder,- getSupplierQuotesForComparison,- getPurchasingRFQSuppliersWithLinks,-} from "~/modules/purchasing/purchasing.service";-import {- selectedLinesValidator,- supplierValidator,- supplierContactValidator,- supplierAccountingValidator,- supplierPaymentValidator,- supplierShippingValidator,- supplierTaxValidator,- purchaseOrderValidator,- purchaseOrderDeliveryValidator,- purchaseOrderLineValidator,- purchaseOrderPaymentValidator,- supplierProcessValidator,- supplierQuoteValidator,- supplierQuoteLineValidator,- supplierTypeValidator,-} from "~/modules/purchasing/purchasing.models";--export const registerPurchasingTools: RegisterTools = (server, ctx) => {- server.registerTool(- "purchasing_closePurchaseOrder",- {- description: "close purchase order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await closePurchaseOrder(ctx.client, params.purchaseOrderId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_closePurchaseOrder"),- );-- server.registerTool(- "purchasing_convertSupplierQuoteToOrder",- {- description: "convert supplier quote to order",- inputSchema: z.object({- payload: selectedLinesValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await convertSupplierQuoteToOrder(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_convertSupplierQuoteToOrder"),- );-- server.registerTool(- "purchasing_deletePurchaseOrder",- {- description: "delete purchase order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchaseOrder(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_deletePurchaseOrder"),- );-- server.registerTool(- "purchasing_deletePurchaseOrderLine",- {- description: "delete purchase order line",- inputSchema: z.object({- purchaseOrderLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchaseOrderLine(ctx.client, params.purchaseOrderLineId);- return toMcpResult(result);- }, "Failed: purchasing_deletePurchaseOrderLine"),- );-- server.registerTool(- "purchasing_deleteSupplier",- {- description: "delete supplier",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplier(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplier"),- );-- server.registerTool(- "purchasing_deleteSupplierContact",- {- description: "delete supplier contact",- inputSchema: z.object({- supplierId: z.string(),- supplierContactId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierContact(ctx.client, params.supplierId, params.supplierContactId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierContact"),- );-- server.registerTool(- "purchasing_deleteSupplierLocation",- {- description: "delete supplier location",- inputSchema: z.object({- supplierId: z.string(),- supplierLocationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierLocation(ctx.client, params.supplierId, params.supplierLocationId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierLocation"),- );-- server.registerTool(- "purchasing_deleteSupplierProcess",- {- description: "delete supplier process",- inputSchema: z.object({- supplierProcessId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierProcess(ctx.client, params.supplierProcessId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierProcess"),- );-- server.registerTool(- "purchasing_deleteSupplierQuote",- {- description: "delete supplier quote",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierQuote(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierQuote"),- );-- server.registerTool(- "purchasing_deleteSupplierQuoteLine",- {- description: "delete supplier quote line",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierQuoteLine(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierQuoteLine"),- );-- server.registerTool(- "purchasing_deleteSupplierType",- {- description: "delete supplier type",- inputSchema: z.object({- supplierTypeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSupplierType(ctx.client, params.supplierTypeId);- return toMcpResult(result);- }, "Failed: purchasing_deleteSupplierType"),- );-- server.registerTool(- "purchasing_getPurchaseOrder",- {- description: "get purchase order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrder(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrder"),- );-- server.registerTool(- "purchasing_finalizeSupplierQuote",- {- description: "finalize supplier quote",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await finalizeSupplierQuote(ctx.client, params.supplierQuoteId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_finalizeSupplierQuote"),- );-- server.registerTool(- "purchasing_getPurchaseOrders",- {- description: "get purchase orders",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().nullable(),- supplierId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrders(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrders"),- );-- server.registerTool(- "purchasing_getPurchaseOrderDelivery",- {- description: "get purchase order delivery",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderDelivery(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderDelivery"),- );-- server.registerTool(- "purchasing_getPurchaseOrderLocations",- {- description: "get purchase order locations",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderLocations(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderLocations"),- );-- server.registerTool(- "purchasing_getPurchaseOrderPayment",- {- description: "get purchase order payment",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderPayment(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderPayment"),- );-- server.registerTool(- "purchasing_getPurchaseOrderLines",- {- description: "get purchase order lines",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderLines(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderLines"),- );-- server.registerTool(- "purchasing_getPurchaseOrderLine",- {- description: "get purchase order line",- inputSchema: z.object({- purchaseOrderLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderLine(ctx.client, params.purchaseOrderLineId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderLine"),- );-- server.registerTool(- "purchasing_getPurchaseOrderSuppliers",- {- description: "get purchase order suppliers",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchaseOrderSuppliers(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchaseOrderSuppliers"),- );-- server.registerTool(- "purchasing_getPurchasingDocumentsAssignedToMe",- {- description: "get purchasing documents assigned to me",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingDocumentsAssignedToMe(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingDocumentsAssignedToMe"),- );-- server.registerTool(- "purchasing_getPurchasingPlanning",- {- description: "get purchasing planning",- inputSchema: z.object({- locationId: z.string(),- periods: z.array(z.string()),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingPlanning(ctx.client, params.locationId, ctx.companyId, params.periods, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingPlanning"),- );-- server.registerTool(- "purchasing_getPurchasingTerms",- {- description: "get purchasing terms",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingTerms(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingTerms"),- );-- server.registerTool(- "purchasing_getSupplier",- {- description: "get supplier",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplier(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplier"),- );-- server.registerTool(- "purchasing_getSupplierApprovalContext",- {- description: "get supplier approval context",- inputSchema: z.object({- supplierId: z.string(),- status: z.string().nullable(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierApprovalContext(ctx.client, params.supplierId, params.status, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierApprovalContext"),- );-- server.registerTool(- "purchasing_getSupplierContact",- {- description: "get supplier contact",- inputSchema: z.object({- supplierContactId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierContact(ctx.client, params.supplierContactId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierContact"),- );-- server.registerTool(- "purchasing_getSupplierContacts",- {- description: "get supplier contacts",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierContacts(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierContacts"),- );-- server.registerTool(- "purchasing_getSupplierInteraction",- {- description: "get supplier interaction",- inputSchema: z.object({- opportunityId: z.string().nullable(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierInteraction(ctx.client, params.opportunityId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierInteraction"),- );-- server.registerTool(- "purchasing_getSupplierInteractionDocuments",- {- description: "get supplier interaction documents",- inputSchema: z.object({- interactionId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierInteractionDocuments(ctx.client, ctx.companyId, params.interactionId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierInteractionDocuments"),- );-- server.registerTool(- "purchasing_getSupplierInteractionLineDocuments",- {- description: "get supplier interaction line documents",- inputSchema: z.object({- lineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierInteractionLineDocuments(ctx.client, ctx.companyId, params.lineId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierInteractionLineDocuments"),- );-- server.registerTool(- "purchasing_getSupplierLocations",- {- description: "get supplier locations",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierLocations(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierLocations"),- );-- server.registerTool(- "purchasing_getSupplierLocation",- {- description: "get supplier location",- inputSchema: z.object({- supplierContactId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierLocation(ctx.client, params.supplierContactId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierLocation"),- );-- server.registerTool(- "purchasing_getSupplierPayment",- {- description: "get supplier payment",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierPayment(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierPayment"),- );-- server.registerTool(- "purchasing_getSupplierProcessById",- {- description: "get supplier process by id",- inputSchema: z.object({- supplierProcessId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierProcessById(ctx.client, params.supplierProcessId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierProcessById"),- );-- server.registerTool(- "purchasing_getSupplierProcessesByProcess",- {- description: "get supplier processes by process",- inputSchema: z.object({- processId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierProcessesByProcess(ctx.client, params.processId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierProcessesByProcess"),- );-- server.registerTool(- "purchasing_getSupplierProcessesBySupplier",- {- description: "get supplier processes by supplier",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierProcessesBySupplier(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierProcessesBySupplier"),- );-- server.registerTool(- "purchasing_getSupplierQuote",- {- description: "get supplier quote",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuote(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuote"),- );-- server.registerTool(- "purchasing_getSupplierQuoteByInteractionId",- {- description: "get supplier quote by interaction id",- inputSchema: z.object({- interactionId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteByInteractionId(ctx.client, params.interactionId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteByInteractionId"),- );-- server.registerTool(- "purchasing_getSupplierQuoteByExternalLinkId",- {- description: "get supplier quote by external link id",- inputSchema: z.object({- externalLinkId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteByExternalLinkId(ctx.client, params.externalLinkId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteByExternalLinkId"),- );-- server.registerTool(- "purchasing_getSupplierQuotes",- {- description: "get supplier quotes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuotes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuotes"),- );-- server.registerTool(- "purchasing_getSupplierQuoteLine",- {- description: "get supplier quote line",- inputSchema: z.object({- supplierQuoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteLine(ctx.client, params.supplierQuoteLineId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteLine"),- );-- server.registerTool(- "purchasing_getSupplierQuoteLines",- {- description: "get supplier quote lines",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteLines(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteLines"),- );-- server.registerTool(- "purchasing_getSupplierQuoteLinePrices",- {- description: "get supplier quote line prices",- inputSchema: z.object({- supplierQuoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteLinePrices(ctx.client, params.supplierQuoteLineId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteLinePrices"),- );-- server.registerTool(- "purchasing_getSupplierQuoteLinePricesByQuoteId",- {- description: "get supplier quote line prices by quote id",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuoteLinePricesByQuoteId(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuoteLinePricesByQuoteId"),- );-- server.registerTool(- "purchasing_getSupplierQuotesList",- {- description: "get supplier quotes list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuotesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuotesList"),- );-- server.registerTool(- "purchasing_getSupplierShipping",- {- description: "get supplier shipping",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierShipping(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierShipping"),- );-- server.registerTool(- "purchasing_getSuppliers",- {- description: "get suppliers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- type: z.string().nullable(),- status: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSuppliers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getSuppliers"),- );-- server.registerTool(- "purchasing_getSuppliersList",- {- description: "get suppliers list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSuppliersList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getSuppliersList"),- );-- server.registerTool(- "purchasing_getSupplierType",- {- description: "get supplier type",- inputSchema: z.object({- supplierTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierType(ctx.client, params.supplierTypeId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierType"),- );-- server.registerTool(- "purchasing_getSupplierTypes",- {- description: "get supplier types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierTypes"),- );-- server.registerTool(- "purchasing_getSupplierTypesList",- {- description: "get supplier types list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierTypesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierTypesList"),- );-- server.registerTool(- "purchasing_insertSupplier",- {- description: "insert supplier",- inputSchema: z.object({- supplier: supplierValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSupplier(ctx.client, { ...params.supplier, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_insertSupplier"),- );-- server.registerTool(- "purchasing_insertSupplierContact",- {- description: "insert supplier contact",- inputSchema: z.object({- supplierContact: supplierContactValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSupplierContact(ctx.client, { ...params.supplierContact, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: purchasing_insertSupplierContact"),- );-- server.registerTool(- "purchasing_insertSupplierInteraction",- {- description: "insert supplier interaction",- inputSchema: z.object({- supplierId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSupplierInteraction(ctx.client, ctx.companyId, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_insertSupplierInteraction"),- );-- server.registerTool(- "purchasing_insertSupplierLocation",- {- description: "insert supplier location",- inputSchema: z.object({- supplierLocation: z.object({- supplierId: z.string(),- name: z.string(),- address: z.any(),- addressLine1: z.string().optional(),- addressLine2: z.string().optional(),- city: z.string().optional(),- stateProvince: z.string().optional(),- postalCode: z.string().optional(),- countryCode: z.string().optional(),- customFields: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSupplierLocation(ctx.client, { ...params.supplierLocation, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: purchasing_insertSupplierLocation"),- );-- server.registerTool(- "purchasing_finalizePurchaseOrder",- {- description: "finalize purchase order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await finalizePurchaseOrder(ctx.client, params.purchaseOrderId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_finalizePurchaseOrder"),- );-- server.registerTool(- "purchasing_sendSupplierQuote",- {- description: "send supplier quote",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await sendSupplierQuote(ctx.client, params.supplierQuoteId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_sendSupplierQuote"),- );-- server.registerTool(- "purchasing_updatePurchaseOrder",- {- description: "update purchase order",- inputSchema: z.object({- purchaseOrder: z.object({- id: z.string(),- status: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseOrder(ctx.client, { ...params.purchaseOrder, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updatePurchaseOrder"),- );-- server.registerTool(- "purchasing_updatePurchaseOrderExchangeRate",- {- description: "update purchase order exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseOrderExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: purchasing_updatePurchaseOrderExchangeRate"),- );-- server.registerTool(- "purchasing_updatePurchaseOrderFavorite",- {- description: "update purchase order favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseOrderFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updatePurchaseOrderFavorite"),- );-- server.registerTool(- "purchasing_updatePurchaseOrderStatus",- {- description: "update purchase order status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchaseOrderStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updatePurchaseOrderStatus"),- );-- server.registerTool(- "purchasing_updateSupplierAccounting",- {- description: "update supplier accounting",- inputSchema: z.object({- supplierAccounting: supplierAccountingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierAccounting(ctx.client, { ...params.supplierAccounting, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierAccounting"),- );-- server.registerTool(- "purchasing_updateSupplierContact",- {- description: "update supplier contact",- inputSchema: z.object({- supplierContact: supplierContactValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierContact(ctx.client, params.supplierContact);- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierContact"),- );-- server.registerTool(- "purchasing_updateSupplierLocation",- {- description: "update supplier location",- inputSchema: z.object({- supplierLocation: z.object({- addressId: z.string(),- name: z.string(),- address: z.any(),- addressLine1: z.string().optional(),- addressLine2: z.string().optional(),- city: z.string().optional(),- stateProvince: z.string().optional(),- countryCode: z.string().optional(),- postalCode: z.string().optional(),- customFields: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierLocation(ctx.client, params.supplierLocation);- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierLocation"),- );-- server.registerTool(- "purchasing_updateSupplierPayment",- {- description: "update supplier payment",- inputSchema: z.object({- supplierPayment: supplierPaymentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierPayment(ctx.client, { ...params.supplierPayment, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierPayment"),- );-- server.registerTool(- "purchasing_updateSupplierQuoteExchangeRate",- {- description: "update supplier quote exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierQuoteExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierQuoteExchangeRate"),- );-- server.registerTool(- "purchasing_updateSupplierQuoteFavorite",- {- description: "update supplier quote favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierQuoteFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierQuoteFavorite"),- );-- server.registerTool(- "purchasing_updateSupplierQuoteStatus",- {- description: "update supplier quote status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierQuoteStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierQuoteStatus"),- );-- server.registerTool(- "purchasing_updateSupplierShipping",- {- description: "update supplier shipping",- inputSchema: z.object({- supplierShipping: supplierShippingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierShipping(ctx.client, { ...params.supplierShipping, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierShipping"),- );-- server.registerTool(- "purchasing_getSupplierTax",- {- description: "get supplier tax",- inputSchema: {- supplierId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierTax(ctx.client, params.supplierId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierTax"),- );-- server.registerTool(- "purchasing_updateSupplierTax",- {- description: "update supplier tax",- inputSchema: {- supplierTax: supplierTaxValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierTax(ctx.client, { ...params.supplierTax, companyId: ctx.companyId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updateSupplierTax"),- );-- server.registerTool(- "purchasing_upsertPurchaseOrder",- {- description: "upsert purchase order",- inputSchema: z.object({- purchaseOrder: purchaseOrderValidator,- receiptRequestedDate: z.string().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseOrder(ctx.client, { ...params.purchaseOrder, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId }, params.receiptRequestedDate);- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchaseOrder"),- );-- server.registerTool(- "purchasing_upsertPurchaseOrderDelivery",- {- description: "upsert purchase order delivery",- inputSchema: z.object({- purchaseOrderDelivery: purchaseOrderDeliveryValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseOrderDelivery(ctx.client, { ...params.purchaseOrderDelivery, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchaseOrderDelivery"),- );-- server.registerTool(- "purchasing_upsertPurchaseOrderLine",- {- description: "upsert purchase order line",- inputSchema: z.object({- purchaseOrderLine: purchaseOrderLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseOrderLine(ctx.client, { ...params.purchaseOrderLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchaseOrderLine"),- );-- server.registerTool(- "purchasing_upsertPurchaseOrderPayment",- {- description: "upsert purchase order payment",- inputSchema: z.object({- purchaseOrderPayment: purchaseOrderPaymentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchaseOrderPayment(ctx.client, { ...params.purchaseOrderPayment, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchaseOrderPayment"),- );-- server.registerTool(- "purchasing_upsertSupplier",- {- description: "upsert supplier",- inputSchema: z.object({- supplier: supplierValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplier(ctx.client, { ...params.supplier, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertSupplier"),- );-- server.registerTool(- "purchasing_upsertSupplierProcess",- {- description: "upsert supplier process",- inputSchema: z.object({- supplierProcess: supplierProcessValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplierProcess(ctx.client, { ...params.supplierProcess, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertSupplierProcess"),- );-- server.registerTool(- "purchasing_upsertSupplierQuote",- {- description: "upsert supplier quote",- inputSchema: z.object({- supplierQuote: supplierQuoteValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplierQuote(ctx.client, { ...params.supplierQuote, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertSupplierQuote"),- );-- server.registerTool(- "purchasing_upsertSupplierQuoteLine",- {- description: "upsert supplier quote line",- inputSchema: z.object({- supplierQuoteLine: supplierQuoteLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplierQuoteLine(ctx.client, { ...params.supplierQuoteLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertSupplierQuoteLine"),- );-- server.registerTool(- "purchasing_upsertSupplierType",- {- description: "upsert supplier type",- inputSchema: z.object({- supplierType: supplierTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSupplierType(ctx.client, { ...params.supplierType, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertSupplierType"),- );-- server.registerTool(- "purchasing_deletePurchasingRFQ",- {- description: "delete purchasing r f q",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchasingRFQ(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_deletePurchasingRFQ"),- );-- server.registerTool(- "purchasing_deletePurchasingRFQLine",- {- description: "delete purchasing r f q line",- inputSchema: z.object({- purchasingRfqLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePurchasingRFQLine(ctx.client, params.purchasingRfqLineId);- return toMcpResult(result);- }, "Failed: purchasing_deletePurchasingRFQLine"),- );-- server.registerTool(- "purchasing_getPurchasingRFQ",- {- description: "get purchasing r f q",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQ(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQ"),- );-- server.registerTool(- "purchasing_getPurchasingRFQs",- {- description: "get purchasing r f qs",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQs(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQs"),- );-- server.registerTool(- "purchasing_getPurchasingRFQLine",- {- description: "get purchasing r f q line",- inputSchema: z.object({- lineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQLine(ctx.client, params.lineId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQLine"),- );-- server.registerTool(- "purchasing_getPurchasingRFQLines",- {- description: "get purchasing r f q lines",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQLines(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQLines"),- );-- server.registerTool(- "purchasing_getPurchasingRFQSuppliers",- {- description: "get purchasing r f q suppliers",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQSuppliers(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQSuppliers"),- );-- server.registerTool(- "purchasing_upsertPurchasingRFQ",- {- description: "upsert purchasing r f q",- inputSchema: z.object({- purchasingRfq: z.object({- id: z.string().optional(),- rfqId: z.string(),- rfqDate: z.string(),- expirationDate: z.string().optional(),- locationId: z.string().optional(),- employeeId: z.string().optional(),- status: z.any().optional(),- customFields: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchasingRFQ(ctx.client, { ...params.purchasingRfq, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchasingRFQ"),- );-- server.registerTool(- "purchasing_upsertPurchasingRFQLine",- {- description: "upsert purchasing r f q line",- inputSchema: z.object({- purchasingRfqLine: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchasingRFQLine(ctx.client, { ...params.purchasingRfqLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchasingRFQLine"),- );-- server.registerTool(- "purchasing_upsertPurchasingRFQSuppliers",- {- description: "upsert purchasing r f q suppliers",- inputSchema: z.object({- purchasingRfqId: z.string(),- supplierIds: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPurchasingRFQSuppliers(ctx.client, params.purchasingRfqId, params.supplierIds, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: purchasing_upsertPurchasingRFQSuppliers"),- );-- server.registerTool(- "purchasing_updatePurchasingRFQStatus",- {- description: "update purchasing r f q status",- inputSchema: z.object({- args: z.object({- id: z.string(),- status: z.any(),- assignee: z.string().nullable().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchasingRFQStatus(ctx.client, { ...params.args, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: purchasing_updatePurchasingRFQStatus"),- );-- server.registerTool(- "purchasing_getLinkedSupplierQuotes",- {- description: "get linked supplier quotes",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLinkedSupplierQuotes(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_getLinkedSupplierQuotes"),- );-- server.registerTool(- "purchasing_getLinkedPurchasingRfqs",- {- description: "get linked purchasing rfqs",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLinkedPurchasingRfqs(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_getLinkedPurchasingRfqs"),- );-- server.registerTool(- "purchasing_getLinkedPurchasingRfqsForInteraction",- {- description: "get linked purchasing rfqs for interaction",- inputSchema: z.object({- supplierInteractionId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLinkedPurchasingRfqsForInteraction(ctx.client, params.supplierInteractionId);- return toMcpResult(result);- }, "Failed: purchasing_getLinkedPurchasingRfqsForInteraction"),- );-- server.registerTool(- "purchasing_getSiblingQuotesForQuote",- {- description: "get sibling quotes for quote",- inputSchema: z.object({- supplierQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSiblingQuotesForQuote(ctx.client, params.supplierQuoteId);- return toMcpResult(result);- }, "Failed: purchasing_getSiblingQuotesForQuote"),- );-- server.registerTool(- "purchasing_getLinkedPurchasingRfqsForOrder",- {- description: "get linked purchasing rfqs for order",- inputSchema: z.object({- purchaseOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLinkedPurchasingRfqsForOrder(ctx.client, params.purchaseOrderId);- return toMcpResult(result);- }, "Failed: purchasing_getLinkedPurchasingRfqsForOrder"),- );-- server.registerTool(- "purchasing_getSupplierQuotesForComparison",- {- description: "get supplier quotes for comparison",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSupplierQuotesForComparison(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_getSupplierQuotesForComparison"),- );-- server.registerTool(- "purchasing_getPurchasingRFQSuppliersWithLinks",- {- description: "get purchasing r f q suppliers with links",- inputSchema: z.object({- purchasingRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPurchasingRFQSuppliersWithLinks(ctx.client, params.purchasingRfqId);- return toMcpResult(result);- }, "Failed: purchasing_getPurchasingRFQSuppliersWithLinks"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/quality.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/quality.tsdeleted file mode 100644index d10c7c4775..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/quality.ts+++ /dev/null@@ -1,1323 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- activateGauge,- deactivateGauge,- deleteGauge,- deleteGaugeCalibrationRecord,- deleteGaugeType,- deleteIssue,- deleteIssueAssociation,- deleteIssueType,- deleteIssueWorkflow,- deleteRequiredAction,- deleteQualityDocument,- deleteQualityDocumentStep,- deleteRisk,- getIssueFromExternalLink,- getGauge,- getGauges,- getGaugesList,- getGaugeCalibrationRecord,- getGaugeCalibrationRecords,- getGaugeCalibrationRecordsByGaugeId,- getGaugeTypesList,- getGaugeType,- getGaugeTypes,- getIssue,- getIssues,- getIssueWorkflow,- getIssueAction,- getIssueActionTasks,- getIssueApprovalTasks,- getIssueItems,- getIssueAssociations,- getIssueReviewers,- getIssueSuppliers,- getIssueTasks,- getIssueType,- getIssueTypes,- getIssueWorkflows,- getIssueWorkflowsList,- getIssueTypesList,- getQualityActions,- getQualityDocument,- getQualityDocumentSteps,- getQualityDocumentVersions,- getQualityDocuments,- getQualityDocumentsList,- getQualityFiles,- getRequiredActionsList,- getRequiredActions,- getRequiredAction,- getRisk,- getRisks,- insertIssueReviewer,- updateIssueActionProcesses,- updateIssueStatus,- updateIssueTaskStatus,- updateIssueTaskContent,- updateQualityDocumentStepOrder,- updateRiskStatus,- upsertGauge,- upsertGaugeCalibrationRecord,- upsertGaugeType,- upsertIssue,- upsertIssueWorkflow,- upsertIssueType,- upsertRequiredAction,- upsertQualityDocument,- upsertQualityDocumentStep,- upsertRisk,- getInspectionDocuments,- getInspectionDocument,- upsertInspectionDocument,- deleteInspectionDocument,- getBalloons,- getInspectionFeatures,- getInspectionPlan,- saveInspectionDocumentAtomic,-} from "~/modules/quality/quality.service";-import {- nonConformanceReviewerValidator,- gaugeValidator,- gaugeCalibrationRecordValidator,- gaugeTypeValidator,- issueValidator,- issueWorkflowValidator,- issueTypeValidator,- qualityDocumentValidator,- qualityDocumentStepValidator,- riskRegisterValidator,- inspectionDocumentValidator,-} from "~/modules/quality/quality.models";--export const registerQualityTools: RegisterTools = (server, ctx) => {- server.registerTool(- "quality_activateGauge",- {- description: "activate gauge",- inputSchema: z.object({- gaugeId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await activateGauge(ctx.client, params.gaugeId);- return toMcpResult(result);- }, "Failed: quality_activateGauge"),- );-- server.registerTool(- "quality_deactivateGauge",- {- description: "deactivate gauge",- inputSchema: z.object({- gaugeId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deactivateGauge(ctx.client, params.gaugeId);- return toMcpResult(result);- }, "Failed: quality_deactivateGauge"),- );-- server.registerTool(- "quality_deleteGauge",- {- description: "delete gauge",- inputSchema: z.object({- gaugeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteGauge(ctx.client, params.gaugeId);- return toMcpResult(result);- }, "Failed: quality_deleteGauge"),- );-- server.registerTool(- "quality_deleteGaugeCalibrationRecord",- {- description: "delete gauge calibration record",- inputSchema: z.object({- gaugeCalibrationRecordId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteGaugeCalibrationRecord(ctx.client, params.gaugeCalibrationRecordId);- return toMcpResult(result);- }, "Failed: quality_deleteGaugeCalibrationRecord"),- );-- server.registerTool(- "quality_deleteGaugeType",- {- description: "delete gauge type",- inputSchema: z.object({- gaugeTypeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteGaugeType(ctx.client, params.gaugeTypeId);- return toMcpResult(result);- }, "Failed: quality_deleteGaugeType"),- );-- server.registerTool(- "quality_deleteIssue",- {- description: "delete issue",- inputSchema: z.object({- nonConformanceId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteIssue(ctx.client, params.nonConformanceId);- return toMcpResult(result);- }, "Failed: quality_deleteIssue"),- );-- server.registerTool(- "quality_deleteIssueAssociation",- {- description: "delete issue association",- inputSchema: z.object({- type: z.string(),- associationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteIssueAssociation(ctx.client, params.type, params.associationId);- return toMcpResult(result);- }, "Failed: quality_deleteIssueAssociation"),- );-- server.registerTool(- "quality_deleteIssueType",- {- description: "delete issue type",- inputSchema: z.object({- nonConformanceTypeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteIssueType(ctx.client, params.nonConformanceTypeId);- return toMcpResult(result);- }, "Failed: quality_deleteIssueType"),- );-- server.registerTool(- "quality_deleteIssueWorkflow",- {- description: "delete issue workflow",- inputSchema: z.object({- nonConformanceWorkflowId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteIssueWorkflow(ctx.client, params.nonConformanceWorkflowId);- return toMcpResult(result);- }, "Failed: quality_deleteIssueWorkflow"),- );-- server.registerTool(- "quality_deleteRequiredAction",- {- description: "delete required action",- inputSchema: z.object({- requiredActionId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteRequiredAction(ctx.client, params.requiredActionId);- return toMcpResult(result);- }, "Failed: quality_deleteRequiredAction"),- );-- server.registerTool(- "quality_deleteQualityDocument",- {- description: "delete quality document",- inputSchema: z.object({- qualityDocumentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQualityDocument(ctx.client, params.qualityDocumentId);- return toMcpResult(result);- }, "Failed: quality_deleteQualityDocument"),- );-- server.registerTool(- "quality_deleteQualityDocumentStep",- {- description: "delete quality document step",- inputSchema: z.object({- qualityDocumentStepId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQualityDocumentStep(ctx.client, params.qualityDocumentStepId, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_deleteQualityDocumentStep"),- );-- server.registerTool(- "quality_deleteRisk",- {- description: "delete risk",- inputSchema: z.object({- riskId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteRisk(ctx.client, params.riskId);- return toMcpResult(result);- }, "Failed: quality_deleteRisk"),- );-- server.registerTool(- "quality_getIssueFromExternalLink",- {- description: "get issue from external link",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueFromExternalLink(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_getIssueFromExternalLink"),- );-- server.registerTool(- "quality_getGauge",- {- description: "get gauge",- inputSchema: z.object({- gaugeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGauge(ctx.client, params.gaugeId);- return toMcpResult(result);- }, "Failed: quality_getGauge"),- );-- server.registerTool(- "quality_getGauges",- {- description: "get gauges",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGauges(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getGauges"),- );-- server.registerTool(- "quality_getGaugesList",- {- description: "get gauges list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getGaugesList"),- );-- server.registerTool(- "quality_getGaugeCalibrationRecord",- {- description: "get gauge calibration record",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeCalibrationRecord(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_getGaugeCalibrationRecord"),- );-- server.registerTool(- "quality_getGaugeCalibrationRecords",- {- description: "get gauge calibration records",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeCalibrationRecords(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getGaugeCalibrationRecords"),- );-- server.registerTool(- "quality_getGaugeCalibrationRecordsByGaugeId",- {- description: "get gauge calibration records by gauge id",- inputSchema: z.object({- gaugeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeCalibrationRecordsByGaugeId(ctx.client, params.gaugeId);- return toMcpResult(result);- }, "Failed: quality_getGaugeCalibrationRecordsByGaugeId"),- );-- server.registerTool(- "quality_getGaugeTypesList",- {- description: "get gauge types list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeTypesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getGaugeTypesList"),- );-- server.registerTool(- "quality_getGaugeType",- {- description: "get gauge type",- inputSchema: z.object({- gaugeTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeType(ctx.client, params.gaugeTypeId);- return toMcpResult(result);- }, "Failed: quality_getGaugeType"),- );-- server.registerTool(- "quality_getGaugeTypes",- {- description: "get gauge types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGaugeTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getGaugeTypes"),- );-- server.registerTool(- "quality_getIssue",- {- description: "get issue",- inputSchema: z.object({- nonConformanceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssue(ctx.client, params.nonConformanceId);- return toMcpResult(result);- }, "Failed: quality_getIssue"),- );-- server.registerTool(- "quality_getIssues",- {- description: "get issues",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssues(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getIssues"),- );-- server.registerTool(- "quality_getIssueWorkflow",- {- description: "get issue workflow",- inputSchema: z.object({- nonConformanceWorkflowId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueWorkflow(ctx.client, params.nonConformanceWorkflowId);- return toMcpResult(result);- }, "Failed: quality_getIssueWorkflow"),- );-- server.registerTool(- "quality_getIssueAction",- {- description: "get issue action",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueAction(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_getIssueAction"),- );-- server.registerTool(- "quality_getIssueActionTasks",- {- description: "get issue action tasks",- inputSchema: z.object({- id: z.string(),- supplierId: z.string().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueActionTasks(ctx.client, params.id, ctx.companyId, params.supplierId);- return toMcpResult(result);- }, "Failed: quality_getIssueActionTasks"),- );-- server.registerTool(- "quality_getIssueApprovalTasks",- {- description: "get issue approval tasks",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueApprovalTasks(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueApprovalTasks"),- );-- server.registerTool(- "quality_getIssueItems",- {- description: "get issue items",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueItems(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueItems"),- );-- server.registerTool(- "quality_getIssueAssociations",- {- description: "get issue associations",- inputSchema: z.object({- nonConformanceId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueAssociations(ctx.client, params.nonConformanceId, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueAssociations"),- );-- server.registerTool(- "quality_getIssueReviewers",- {- description: "get issue reviewers",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueReviewers(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueReviewers"),- );-- server.registerTool(- "quality_getIssueSuppliers",- {- description: "get issue suppliers",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueSuppliers(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueSuppliers"),- );-- server.registerTool(- "quality_getIssueTasks",- {- description: "get issue tasks",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueTasks(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueTasks"),- );-- server.registerTool(- "quality_getIssueType",- {- description: "get issue type",- inputSchema: z.object({- nonConformanceTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueType(ctx.client, params.nonConformanceTypeId);- return toMcpResult(result);- }, "Failed: quality_getIssueType"),- );-- server.registerTool(- "quality_getIssueTypes",- {- description: "get issue types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getIssueTypes"),- );-- server.registerTool(- "quality_getIssueWorkflows",- {- description: "get issue workflows",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueWorkflows(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getIssueWorkflows"),- );-- server.registerTool(- "quality_getIssueWorkflowsList",- {- description: "get issue workflows list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueWorkflowsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueWorkflowsList"),- );-- server.registerTool(- "quality_getIssueTypesList",- {- description: "get issue types list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIssueTypesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getIssueTypesList"),- );-- server.registerTool(- "quality_getQualityActions",- {- description: "get quality actions",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityActions(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getQualityActions"),- );-- server.registerTool(- "quality_getQualityDocument",- {- description: "get quality document",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityDocument(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_getQualityDocument"),- );-- server.registerTool(- "quality_getQualityDocumentSteps",- {- description: "get quality document steps",- inputSchema: z.object({- qualityDocumentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityDocumentSteps(ctx.client, params.qualityDocumentId);- return toMcpResult(result);- }, "Failed: quality_getQualityDocumentSteps"),- );-- server.registerTool(- "quality_getQualityDocumentVersions",- {- description: "get quality document versions",- inputSchema: z.object({- qualityDocument: z.object({- name: z.string(),- version: z.number()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityDocumentVersions(ctx.client, params.qualityDocument, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getQualityDocumentVersions"),- );-- server.registerTool(- "quality_getQualityDocuments",- {- description: "get quality documents",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityDocuments(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getQualityDocuments"),- );-- server.registerTool(- "quality_getQualityDocumentsList",- {- description: "get quality documents list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityDocumentsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getQualityDocumentsList"),- );-- server.registerTool(- "quality_getQualityFiles",- {- description: "get quality files",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQualityFiles(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getQualityFiles"),- );-- server.registerTool(- "quality_getRequiredActionsList",- {- description: "get required actions list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRequiredActionsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: quality_getRequiredActionsList"),- );-- server.registerTool(- "quality_getRequiredActions",- {- description: "get required actions",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRequiredActions(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getRequiredActions"),- );-- server.registerTool(- "quality_getRequiredAction",- {- description: "get required action",- inputSchema: z.object({- requiredActionId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRequiredAction(ctx.client, params.requiredActionId);- return toMcpResult(result);- }, "Failed: quality_getRequiredAction"),- );-- server.registerTool(- "quality_getRisk",- {- description: "get risk",- inputSchema: z.object({- riskId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRisk(ctx.client, params.riskId);- return toMcpResult(result);- }, "Failed: quality_getRisk"),- );-- server.registerTool(- "quality_getRisks",- {- description: "get risks",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.any().optional(),- source: z.any().optional(),- assignee: z.array(z.string()).optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRisks(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getRisks"),- );-- server.registerTool(- "quality_insertIssueReviewer",- {- description: "insert issue reviewer",- inputSchema: z.object({- reviewer: nonConformanceReviewerValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertIssueReviewer(ctx.client, { ...params.reviewer, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_insertIssueReviewer"),- );-- server.registerTool(- "quality_updateIssueActionProcesses",- {- description: "update issue action processes",- inputSchema: z.object({- args: z.object({- actionTaskId: z.string(),- processIds: z.array(z.string())- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateIssueActionProcesses(ctx.client, { ...params.args, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_updateIssueActionProcesses"),- );-- server.registerTool(- "quality_updateIssueStatus",- {- description: "update issue status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any(),- closeDate: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateIssueStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_updateIssueStatus"),- );-- server.registerTool(- "quality_updateIssueTaskStatus",- {- description: "update issue task status",- inputSchema: z.object({- args: z.object({- id: z.string(),- status: z.enum(["Pending", "Completed", "Skipped", "In Progress"]),- type: z.enum(["investigation", "action", "approval", "review"]),- assignee: z.string().nullable().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateIssueTaskStatus(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_updateIssueTaskStatus"),- );-- server.registerTool(- "quality_updateIssueTaskContent",- {- description: "update issue task content",- inputSchema: z.object({- args: z.object({- id: z.string(),- type: z.enum(["action", "approval", "review"]),- content: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateIssueTaskContent(ctx.client, params.args);- return toMcpResult(result);- }, "Failed: quality_updateIssueTaskContent"),- );-- server.registerTool(- "quality_updateQualityDocumentStepOrder",- {- description: "update quality document step order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQualityDocumentStepOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_updateQualityDocumentStepOrder"),- );-- server.registerTool(- "quality_updateRiskStatus",- {- description: "update risk status",- inputSchema: z.object({- riskId: z.string(),- status: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateRiskStatus(ctx.client, params.riskId, params.status);- return toMcpResult(result);- }, "Failed: quality_updateRiskStatus"),- );-- server.registerTool(- "quality_upsertGauge",- {- description: "upsert gauge",- inputSchema: z.object({- gauge: gaugeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertGauge(ctx.client, { ...params.gauge, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertGauge"),- );-- server.registerTool(- "quality_upsertGaugeCalibrationRecord",- {- description: "upsert gauge calibration record",- inputSchema: z.object({- gaugeCalibrationRecord: gaugeCalibrationRecordValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertGaugeCalibrationRecord(ctx.client, { ...params.gaugeCalibrationRecord, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertGaugeCalibrationRecord"),- );-- server.registerTool(- "quality_upsertGaugeType",- {- description: "upsert gauge type",- inputSchema: z.object({- gaugeType: gaugeTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertGaugeType(ctx.client, { ...params.gaugeType, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertGaugeType"),- );-- server.registerTool(- "quality_upsertIssue",- {- description: "upsert issue",- inputSchema: z.object({- nonConformance: issueValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertIssue(ctx.client, { ...params.nonConformance, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertIssue"),- );-- server.registerTool(- "quality_upsertIssueWorkflow",- {- description: "upsert issue workflow",- inputSchema: z.object({- nonConformanceWorkflow: issueWorkflowValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertIssueWorkflow(ctx.client, { ...params.nonConformanceWorkflow, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertIssueWorkflow"),- );-- server.registerTool(- "quality_upsertIssueType",- {- description: "upsert issue type",- inputSchema: z.object({- nonConformanceType: issueTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertIssueType(ctx.client, { ...params.nonConformanceType, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertIssueType"),- );-- server.registerTool(- "quality_upsertRequiredAction",- {- description: "upsert required action",- inputSchema: z.object({- requiredAction: issueTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertRequiredAction(ctx.client, { ...params.requiredAction, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertRequiredAction"),- );-- server.registerTool(- "quality_upsertQualityDocument",- {- description: "upsert quality document",- inputSchema: z.object({- qualityDocument: qualityDocumentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQualityDocument(ctx.client, { ...params.qualityDocument, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertQualityDocument"),- );-- server.registerTool(- "quality_upsertQualityDocumentStep",- {- description: "upsert quality document step",- inputSchema: z.object({- qualityDocumentStep: qualityDocumentStepValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQualityDocumentStep(ctx.client, { ...params.qualityDocumentStep, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertQualityDocumentStep"),- );-- server.registerTool(- "quality_upsertRisk",- {- description: "upsert risk",- inputSchema: z.object({- risk: riskRegisterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertRisk(ctx.client, { ...params.risk, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertRisk"),- );-- server.registerTool(- "quality_getInspectionDocuments",- {- description: "get inspection documents",- inputSchema: {- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInspectionDocuments(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: quality_getInspectionDocuments"),- );-- server.registerTool(- "quality_getInspectionDocument",- {- description: "get inspection document",- inputSchema: {- id: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInspectionDocument(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_getInspectionDocument"),- );-- server.registerTool(- "quality_upsertInspectionDocument",- {- description: "upsert inspection document",- inputSchema: {- diagram: inspectionDocumentValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertInspectionDocument(ctx.client, { ...params.diagram, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: quality_upsertInspectionDocument"),- );-- server.registerTool(- "quality_deleteInspectionDocument",- {- description: "delete inspection document",- inputSchema: {- id: z.string(),- },- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteInspectionDocument(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: quality_deleteInspectionDocument"),- );-- server.registerTool(- "quality_getBalloons",- {- description: "get balloons",- inputSchema: {- inspectionDocumentId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getBalloons(ctx.client, params.inspectionDocumentId);- return toMcpResult(result);- }, "Failed: quality_getBalloons"),- );-- server.registerTool(- "quality_getInspectionFeatures",- {- description: "get inspection document features (characteristics grid)",- inputSchema: {- inspectionDocumentId: z.string()- },- annotations: READ_ONLY_ANNOTATIONS- },- withErrorHandling(async (params) => {- const result = await getInspectionFeatures(- ctx.client,- params.inspectionDocumentId- );- return toMcpResult(result);- }, "Failed: quality_getInspectionFeatures")- );-- server.registerTool(- "quality_getInspectionPlan",- {- description:- "get inspection plan; each measurement id/featureId is inspectionFeature id, balloonId set when placed on drawing",- inputSchema: {- inspectionDocumentId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInspectionPlan(ctx.client, params.inspectionDocumentId);- return toMcpResult(result);- }, "Failed: quality_getInspectionPlan"),- );-- server.registerTool(- "quality_saveInspectionDocumentAtomic",- {- description:- "save inspection document; features {create,update,delete} + balloons geometry {create,update,delete} (delete = unplace)",- inputSchema: {- args: z.object({- inspectionDocumentId: z.string(),- pdfUrl: z.string().nullable().optional(),- pageCount: z.number().optional(),- defaultPageWidth: z.number().optional(),- defaultPageHeight: z.number().optional(),- features: z.any().optional(),- balloons: z.any().optional()- }),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const { features, balloons, ...rest } = params.args;- const result = await saveInspectionDocumentAtomic(ctx.client, {- ...rest,- features: features ?? { create: [], update: [], delete: [] },- balloons: balloons ?? { create: [], update: [], delete: [] },- companyId: ctx.companyId,- userId: ctx.userId- });- return toMcpResult(result);- }, "Failed: quality_saveInspectionDocumentAtomic"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/resources.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/resources.tsdeleted file mode 100644index e89ffe86b7..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/resources.ts+++ /dev/null@@ -1,1609 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- activateWorkCenter,- deleteAbility,- deleteContractor,- deleteEmployeeAbility,- deleteFailureMode,- deleteLocation,- deleteMaintenanceDispatch,- deleteMaintenanceDispatchComment,- deleteMaintenanceDispatchEvent,- deleteMaintenanceDispatchItem,- deleteMaintenanceDispatchWorkCenter,- deleteMaintenanceSchedule,- deleteMaintenanceScheduleItem,- deletePartner,- activateProcess,- processDeactivate,- deleteProcess,- deleteShift,- deleteSuggestion,- deleteTraining,- deleteTrainingAssignment,- deleteTrainingQuestion,- deleteWorkCenter,- getAbilities,- getAbilitiesList,- getAbility,- getContractor,- getContractors,- getEmployeeAbilities,- getFailureMode,- getFailureModes,- getFailureModesList,- getLocation,- getLocations,- getLocationsList,- getMaintenanceDispatch,- getMaintenanceDispatchComments,- getMaintenanceDispatchEvents,- getMaintenanceDispatchItems,- getMaintenanceDispatchItemTrackedEntities,- getMaintenanceDispatches,- getMaintenanceDispatchesByLocation,- getMaintenanceDispatchWorkCenters,- getMaintenanceSchedule,- getMaintenanceScheduleItems,- getMaintenanceSchedules,- getMaintenanceSchedulesByLocation,- getOutstandingTrainingsForUser,- getPartner,- getPartnerBySupplierId,- getPartners,- getProcess,- getProcesses,- getProcessesList,- getSuggestion,- getSuggestions,- getTraining,- getTrainingAssignment,- getTrainingAssignmentForCompletion,- getTrainingAssignments,- getTrainingAssignmentStatus,- getTrainingAssignmentSummary,- getTrainingQuestions,- getTrainings,- getTrainingsList,- getWorkCenter,- getWorkCenters,- getWorkCentersByLocation,- getWorkCentersList,- getWorkCentersListWithBlockingStatus,- insertAbility,- insertEmployeeAbilities,- insertTrainingCompletion,- updateAbility,- updateSuggestionEmoji,- updateSuggestionTags,- updateTrainingQuestionOrder,- upsertContractor,- upsertEmployeeAbility,- upsertFailureMode,- upsertLocation,- upsertMaintenanceDispatch,- upsertMaintenanceDispatchComment,- upsertMaintenanceDispatchEvent,- upsertMaintenanceDispatchItem,- upsertMaintenanceDispatchWorkCenter,- upsertMaintenanceSchedule,- upsertMaintenanceScheduleItem,- upsertPartner,- upsertProcess,- upsertTraining,- upsertTrainingAssignment,- upsertTrainingQuestion,- upsertWorkCenter,-} from "~/modules/resources/resources.service";-import {- failureModeValidator,- locationValidator,- maintenanceDispatchValidator,- maintenanceDispatchCommentValidator,- maintenanceDispatchEventValidator,- maintenanceDispatchItemValidator,- maintenanceDispatchWorkCenterValidator,- maintenanceScheduleValidator,- maintenanceScheduleItemValidator,- partnerValidator,- processValidator,- trainingValidator,- trainingQuestionValidator,- workCenterValidator,-} from "~/modules/resources/resources.models";--export const registerResourcesTools: RegisterTools = (server, ctx) => {- server.registerTool(- "resources_activateWorkCenter",- {- description: "activate work center",- inputSchema: z.object({- id: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await activateWorkCenter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: resources_activateWorkCenter"),- );-- server.registerTool(- "resources_deleteAbility",- {- description: "delete ability",- inputSchema: z.object({- abilityId: z.string(),- hardDelete: z.boolean().optional(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteAbility(ctx.client, params.abilityId, params.hardDelete);- return toMcpResult(result);- }, "Failed: resources_deleteAbility"),- );-- server.registerTool(- "resources_deleteContractor",- {- description: "delete contractor",- inputSchema: z.object({- contractorId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteContractor(ctx.client, params.contractorId);- return toMcpResult(result);- }, "Failed: resources_deleteContractor"),- );-- server.registerTool(- "resources_deleteEmployeeAbility",- {- description: "delete employee ability",- inputSchema: z.object({- employeeAbilityId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteEmployeeAbility(ctx.client, params.employeeAbilityId);- return toMcpResult(result);- }, "Failed: resources_deleteEmployeeAbility"),- );-- server.registerTool(- "resources_deleteFailureMode",- {- description: "delete failure mode",- inputSchema: z.object({- failureModeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteFailureMode(ctx.client, params.failureModeId);- return toMcpResult(result);- }, "Failed: resources_deleteFailureMode"),- );-- server.registerTool(- "resources_deleteLocation",- {- description: "delete location",- inputSchema: z.object({- locationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteLocation(ctx.client, params.locationId);- return toMcpResult(result);- }, "Failed: resources_deleteLocation"),- );-- server.registerTool(- "resources_deleteMaintenanceDispatch",- {- description: "delete maintenance dispatch",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatch(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceDispatch"),- );-- server.registerTool(- "resources_deleteMaintenanceDispatchComment",- {- description: "delete maintenance dispatch comment",- inputSchema: z.object({- commentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchComment(ctx.client, params.commentId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceDispatchComment"),- );-- server.registerTool(- "resources_deleteMaintenanceDispatchEvent",- {- description: "delete maintenance dispatch event",- inputSchema: z.object({- eventId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchEvent(ctx.client, params.eventId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceDispatchEvent"),- );-- server.registerTool(- "resources_deleteMaintenanceDispatchItem",- {- description: "delete maintenance dispatch item",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchItem(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceDispatchItem"),- );-- server.registerTool(- "resources_deleteMaintenanceDispatchWorkCenter",- {- description: "delete maintenance dispatch work center",- inputSchema: z.object({- workCenterId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceDispatchWorkCenter(ctx.client, params.workCenterId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceDispatchWorkCenter"),- );-- server.registerTool(- "resources_deleteMaintenanceSchedule",- {- description: "delete maintenance schedule",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceSchedule(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceSchedule"),- );-- server.registerTool(- "resources_deleteMaintenanceScheduleItem",- {- description: "delete maintenance schedule item",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteMaintenanceScheduleItem(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: resources_deleteMaintenanceScheduleItem"),- );-- server.registerTool(- "resources_deletePartner",- {- description: "delete partner",- inputSchema: z.object({- partnerId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deletePartner(ctx.client, params.partnerId);- return toMcpResult(result);- }, "Failed: resources_deletePartner"),- );-- server.registerTool(- "resources_activateProcess",- {- description: "activate process",- inputSchema: z.object({- processId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await activateProcess(ctx.client, params.processId);- return toMcpResult(result);- }, "Failed: resources_activateProcess"),- );-- server.registerTool(- "resources_processDeactivate",- {- description: "process deactivate",- inputSchema: z.object({- processId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await processDeactivate(ctx.client, params.processId);- return toMcpResult(result);- }, "Failed: resources_processDeactivate"),- );-- server.registerTool(- "resources_deleteProcess",- {- description: "delete process",- inputSchema: z.object({- processId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteProcess(ctx.client, params.processId);- return toMcpResult(result);- }, "Failed: resources_deleteProcess"),- );-- server.registerTool(- "resources_deleteShift",- {- description: "delete shift",- inputSchema: z.object({- shiftId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteShift(ctx.client, params.shiftId);- return toMcpResult(result);- }, "Failed: resources_deleteShift"),- );-- server.registerTool(- "resources_deleteSuggestion",- {- description: "delete suggestion",- inputSchema: z.object({- suggestionId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSuggestion(ctx.client, params.suggestionId);- return toMcpResult(result);- }, "Failed: resources_deleteSuggestion"),- );-- server.registerTool(- "resources_deleteTraining",- {- description: "delete training",- inputSchema: z.object({- trainingId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteTraining(ctx.client, params.trainingId);- return toMcpResult(result);- }, "Failed: resources_deleteTraining"),- );-- server.registerTool(- "resources_deleteTrainingAssignment",- {- description: "delete training assignment",- inputSchema: z.object({- assignmentId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteTrainingAssignment(ctx.client, params.assignmentId);- return toMcpResult(result);- }, "Failed: resources_deleteTrainingAssignment"),- );-- server.registerTool(- "resources_deleteTrainingQuestion",- {- description: "delete training question",- inputSchema: z.object({- trainingQuestionId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteTrainingQuestion(ctx.client, params.trainingQuestionId, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_deleteTrainingQuestion"),- );-- server.registerTool(- "resources_deleteWorkCenter",- {- description: "delete work center",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteWorkCenter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: resources_deleteWorkCenter"),- );-- server.registerTool(- "resources_getAbilities",- {- description: "get abilities",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAbilities(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getAbilities"),- );-- server.registerTool(- "resources_getAbilitiesList",- {- description: "get abilities list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAbilitiesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getAbilitiesList"),- );-- server.registerTool(- "resources_getAbility",- {- description: "get ability",- inputSchema: z.object({- abilityId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAbility(ctx.client, params.abilityId);- return toMcpResult(result);- }, "Failed: resources_getAbility"),- );-- server.registerTool(- "resources_getContractor",- {- description: "get contractor",- inputSchema: z.object({- contractorId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getContractor(ctx.client, params.contractorId);- return toMcpResult(result);- }, "Failed: resources_getContractor"),- );-- server.registerTool(- "resources_getContractors",- {- description: "get contractors",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getContractors(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getContractors"),- );-- server.registerTool(- "resources_getEmployeeAbilities",- {- description: "get employee abilities",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployeeAbilities(ctx.client, params.employeeId);- return toMcpResult(result);- }, "Failed: resources_getEmployeeAbilities"),- );-- server.registerTool(- "resources_getFailureMode",- {- description: "get failure mode",- inputSchema: z.object({- failureModeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureMode(ctx.client, params.failureModeId);- return toMcpResult(result);- }, "Failed: resources_getFailureMode"),- );-- server.registerTool(- "resources_getFailureModes",- {- description: "get failure modes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureModes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getFailureModes"),- );-- server.registerTool(- "resources_getFailureModesList",- {- description: "get failure modes list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getFailureModesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getFailureModesList"),- );-- server.registerTool(- "resources_getLocation",- {- description: "get location",- inputSchema: z.object({- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLocation(ctx.client, params.locationId);- return toMcpResult(result);- }, "Failed: resources_getLocation"),- );-- server.registerTool(- "resources_getLocations",- {- description: "get locations",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLocations(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getLocations"),- );-- server.registerTool(- "resources_getLocationsList",- {- description: "get locations list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLocationsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getLocationsList"),- );-- server.registerTool(- "resources_getMaintenanceDispatch",- {- description: "get maintenance dispatch",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatch(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatch"),- );-- server.registerTool(- "resources_getMaintenanceDispatchComments",- {- description: "get maintenance dispatch comments",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchComments(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchComments"),- );-- server.registerTool(- "resources_getMaintenanceDispatchEvents",- {- description: "get maintenance dispatch events",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchEvents(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchEvents"),- );-- server.registerTool(- "resources_getMaintenanceDispatchItems",- {- description: "get maintenance dispatch items",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchItems(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchItems"),- );-- server.registerTool(- "resources_getMaintenanceDispatchItemTrackedEntities",- {- description: "get maintenance dispatch item tracked entities",- inputSchema: z.object({- maintenanceDispatchItemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchItemTrackedEntities(ctx.client, params.maintenanceDispatchItemId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchItemTrackedEntities"),- );-- server.registerTool(- "resources_getMaintenanceDispatches",- {- description: "get maintenance dispatches",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatches(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatches"),- );-- server.registerTool(- "resources_getMaintenanceDispatchesByLocation",- {- description: "get maintenance dispatches by location",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchesByLocation(ctx.client, ctx.companyId, params.locationId, params.args);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchesByLocation"),- );-- server.registerTool(- "resources_getMaintenanceDispatchWorkCenters",- {- description: "get maintenance dispatch work centers",- inputSchema: z.object({- dispatchId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceDispatchWorkCenters(ctx.client, params.dispatchId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceDispatchWorkCenters"),- );-- server.registerTool(- "resources_getMaintenanceSchedule",- {- description: "get maintenance schedule",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceSchedule(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceSchedule"),- );-- server.registerTool(- "resources_getMaintenanceScheduleItems",- {- description: "get maintenance schedule items",- inputSchema: z.object({- scheduleId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceScheduleItems(ctx.client, params.scheduleId);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceScheduleItems"),- );-- server.registerTool(- "resources_getMaintenanceSchedules",- {- description: "get maintenance schedules",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- active: z.boolean().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceSchedules(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceSchedules"),- );-- server.registerTool(- "resources_getMaintenanceSchedulesByLocation",- {- description: "get maintenance schedules by location",- inputSchema: z.object({- locationId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- active: z.boolean().optional()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getMaintenanceSchedulesByLocation(ctx.client, ctx.companyId, params.locationId, params.args);- return toMcpResult(result);- }, "Failed: resources_getMaintenanceSchedulesByLocation"),- );-- server.registerTool(- "resources_getOutstandingTrainingsForUser",- {- description: "get outstanding trainings for user",- inputSchema: z.object({- employeeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOutstandingTrainingsForUser(ctx.client, ctx.companyId, params.employeeId);- return toMcpResult(result);- }, "Failed: resources_getOutstandingTrainingsForUser"),- );-- server.registerTool(- "resources_getPartner",- {- description: "get partner",- inputSchema: z.object({- partnerId: z.string(),- abilityId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPartner(ctx.client, params.partnerId, params.abilityId);- return toMcpResult(result);- }, "Failed: resources_getPartner"),- );-- server.registerTool(- "resources_getPartnerBySupplierId",- {- description: "get partner by supplier id",- inputSchema: z.object({- partnerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPartnerBySupplierId(ctx.client, params.partnerId);- return toMcpResult(result);- }, "Failed: resources_getPartnerBySupplierId"),- );-- server.registerTool(- "resources_getPartners",- {- description: "get partners",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPartners(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getPartners"),- );-- server.registerTool(- "resources_getProcess",- {- description: "get process",- inputSchema: z.object({- processId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcess(ctx.client, params.processId);- return toMcpResult(result);- }, "Failed: resources_getProcess"),- );-- server.registerTool(- "resources_getProcesses",- {- description: "get processes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcesses(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getProcesses"),- );-- server.registerTool(- "resources_getProcessesList",- {- description: "get processes list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getProcessesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getProcessesList"),- );-- server.registerTool(- "resources_getSuggestion",- {- description: "get suggestion",- inputSchema: z.object({- suggestionId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSuggestion(ctx.client, params.suggestionId);- return toMcpResult(result);- }, "Failed: resources_getSuggestion"),- );-- server.registerTool(- "resources_getSuggestions",- {- description: "get suggestions",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSuggestions(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getSuggestions"),- );-- server.registerTool(- "resources_getTraining",- {- description: "get training",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTraining(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: resources_getTraining"),- );-- server.registerTool(- "resources_getTrainingAssignment",- {- description: "get training assignment",- inputSchema: z.object({- assignmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingAssignment(ctx.client, params.assignmentId);- return toMcpResult(result);- }, "Failed: resources_getTrainingAssignment"),- );-- server.registerTool(- "resources_getTrainingAssignmentForCompletion",- {- description: "get training assignment for completion",- inputSchema: z.object({- assignmentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingAssignmentForCompletion(ctx.client, params.assignmentId);- return toMcpResult(result);- }, "Failed: resources_getTrainingAssignmentForCompletion"),- );-- server.registerTool(- "resources_getTrainingAssignments",- {- description: "get training assignments",- inputSchema: z.object({- trainingId: z.string().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingAssignments(ctx.client, ctx.companyId, params.trainingId);- return toMcpResult(result);- }, "Failed: resources_getTrainingAssignments"),- );-- server.registerTool(- "resources_getTrainingAssignmentStatus",- {- description: "get training assignment status",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingAssignmentStatus(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getTrainingAssignmentStatus"),- );-- server.registerTool(- "resources_getTrainingAssignmentSummary",- {- description: "get training assignment summary",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingAssignmentSummary(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getTrainingAssignmentSummary"),- );-- server.registerTool(- "resources_getTrainingQuestions",- {- description: "get training questions",- inputSchema: z.object({- trainingId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingQuestions(ctx.client, params.trainingId);- return toMcpResult(result);- }, "Failed: resources_getTrainingQuestions"),- );-- server.registerTool(- "resources_getTrainings",- {- description: "get trainings",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainings(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getTrainings"),- );-- server.registerTool(- "resources_getTrainingsList",- {- description: "get trainings list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTrainingsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getTrainingsList"),- );-- server.registerTool(- "resources_getWorkCenter",- {- description: "get work center",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWorkCenter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: resources_getWorkCenter"),- );-- server.registerTool(- "resources_getWorkCenters",- {- description: "get work centers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWorkCenters(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: resources_getWorkCenters"),- );-- server.registerTool(- "resources_getWorkCentersByLocation",- {- description: "get work centers by location",- inputSchema: z.object({- locationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWorkCentersByLocation(ctx.client, params.locationId);- return toMcpResult(result);- }, "Failed: resources_getWorkCentersByLocation"),- );-- server.registerTool(- "resources_getWorkCentersList",- {- description: "get work centers list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWorkCentersList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getWorkCentersList"),- );-- server.registerTool(- "resources_getWorkCentersListWithBlockingStatus",- {- description: "get work centers list with blocking status",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWorkCentersListWithBlockingStatus(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_getWorkCentersListWithBlockingStatus"),- );-- server.registerTool(- "resources_insertAbility",- {- description: "insert ability",- inputSchema: z.object({- ability: z.object({- name: z.string(),- curve: z.any(),- data: z.any(),- week: z.number(),- value: z.number(),- shadowWeeks: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertAbility(ctx.client, { ...params.ability, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_insertAbility"),- );-- server.registerTool(- "resources_insertEmployeeAbilities",- {- description: "insert employee abilities",- inputSchema: z.object({- abilityId: z.string(),- employeeIds: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertEmployeeAbilities(ctx.client, params.abilityId, params.employeeIds, ctx.companyId);- return toMcpResult(result);- }, "Failed: resources_insertEmployeeAbilities"),- );-- server.registerTool(- "resources_insertTrainingCompletion",- {- description: "insert training completion",- inputSchema: z.object({- completion: z.object({- trainingAssignmentId: z.string(),- employeeId: z.string(),- period: z.string().nullable(),- completedBy: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertTrainingCompletion(ctx.client, { ...params.completion, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_insertTrainingCompletion"),- );-- server.registerTool(- "resources_updateAbility",- {- description: "update ability",- inputSchema: z.object({- id: z.string(),- ability: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAbility(ctx.client, params.id, params.ability);- return toMcpResult(result);- }, "Failed: resources_updateAbility"),- );-- server.registerTool(- "resources_updateSuggestionEmoji",- {- description: "update suggestion emoji",- inputSchema: z.object({- suggestionId: z.string(),- emoji: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSuggestionEmoji(ctx.client, params.suggestionId, params.emoji);- return toMcpResult(result);- }, "Failed: resources_updateSuggestionEmoji"),- );-- server.registerTool(- "resources_updateSuggestionTags",- {- description: "update suggestion tags",- inputSchema: z.object({- suggestionId: z.string(),- tags: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSuggestionTags(ctx.client, params.suggestionId, params.tags);- return toMcpResult(result);- }, "Failed: resources_updateSuggestionTags"),- );-- server.registerTool(- "resources_updateTrainingQuestionOrder",- {- description: "update training question order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateTrainingQuestionOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_updateTrainingQuestionOrder"),- );-- server.registerTool(- "resources_upsertContractor",- {- description: "upsert contractor",- inputSchema: z.object({- contractorWithAbilities: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertContractor(ctx.client, { ...params.contractorWithAbilities, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertContractor"),- );-- server.registerTool(- "resources_upsertEmployeeAbility",- {- description: "upsert employee ability",- inputSchema: z.object({- employeeAbility: z.object({- id: z.string().optional(),- abilityId: z.string(),- employeeId: z.string(),- trainingCompleted: z.boolean(),- trainingDays: z.number().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertEmployeeAbility(ctx.client, { ...params.employeeAbility, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: resources_upsertEmployeeAbility"),- );-- server.registerTool(- "resources_upsertFailureMode",- {- description: "upsert failure mode",- inputSchema: z.object({- failureMode: failureModeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertFailureMode(ctx.client, { ...params.failureMode, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertFailureMode"),- );-- server.registerTool(- "resources_upsertLocation",- {- description: "upsert location",- inputSchema: z.object({- location: locationValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertLocation(ctx.client, { ...params.location, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertLocation"),- );-- server.registerTool(- "resources_upsertMaintenanceDispatch",- {- description: "upsert maintenance dispatch",- inputSchema: z.object({- dispatch: maintenanceDispatchValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatch(ctx.client, { ...params.dispatch, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceDispatch"),- );-- server.registerTool(- "resources_upsertMaintenanceDispatchComment",- {- description: "upsert maintenance dispatch comment",- inputSchema: z.object({- comment: maintenanceDispatchCommentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchComment(ctx.client, { ...params.comment, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceDispatchComment"),- );-- server.registerTool(- "resources_upsertMaintenanceDispatchEvent",- {- description: "upsert maintenance dispatch event",- inputSchema: z.object({- event: maintenanceDispatchEventValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchEvent(ctx.client, { ...params.event, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceDispatchEvent"),- );-- server.registerTool(- "resources_upsertMaintenanceDispatchItem",- {- description: "upsert maintenance dispatch item",- inputSchema: z.object({- item: maintenanceDispatchItemValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchItem(ctx.client, { ...params.item, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceDispatchItem"),- );-- server.registerTool(- "resources_upsertMaintenanceDispatchWorkCenter",- {- description: "upsert maintenance dispatch work center",- inputSchema: z.object({- workCenter: maintenanceDispatchWorkCenterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceDispatchWorkCenter(ctx.client, { ...params.workCenter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceDispatchWorkCenter"),- );-- server.registerTool(- "resources_upsertMaintenanceSchedule",- {- description: "upsert maintenance schedule",- inputSchema: z.object({- schedule: maintenanceScheduleValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceSchedule(ctx.client, { ...params.schedule, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceSchedule"),- );-- server.registerTool(- "resources_upsertMaintenanceScheduleItem",- {- description: "upsert maintenance schedule item",- inputSchema: z.object({- item: maintenanceScheduleItemValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMaintenanceScheduleItem(ctx.client, { ...params.item, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertMaintenanceScheduleItem"),- );-- server.registerTool(- "resources_upsertPartner",- {- description: "upsert partner",- inputSchema: z.object({- partner: partnerValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertPartner(ctx.client, { ...params.partner, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertPartner"),- );-- server.registerTool(- "resources_upsertProcess",- {- description: "upsert process",- inputSchema: z.object({- process: processValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertProcess(ctx.client, { ...params.process, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertProcess"),- );-- server.registerTool(- "resources_upsertTraining",- {- description: "upsert training",- inputSchema: z.object({- training: trainingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertTraining(ctx.client, { ...params.training, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertTraining"),- );-- server.registerTool(- "resources_upsertTrainingAssignment",- {- description: "upsert training assignment",- inputSchema: z.object({- assignment: z.object({- id: z.string().optional(),- trainingId: z.string(),- groupIds: z.array(z.string())- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertTrainingAssignment(ctx.client, { ...params.assignment, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertTrainingAssignment"),- );-- server.registerTool(- "resources_upsertTrainingQuestion",- {- description: "upsert training question",- inputSchema: z.object({- trainingQuestion: trainingQuestionValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertTrainingQuestion(ctx.client, { ...params.trainingQuestion, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertTrainingQuestion"),- );-- server.registerTool(- "resources_upsertWorkCenter",- {- description: "upsert work center",- inputSchema: z.object({- workCenter: workCenterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertWorkCenter(ctx.client, { ...params.workCenter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: resources_upsertWorkCenter"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/sales.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/sales.tsdeleted file mode 100644index b93639bd86..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/sales.ts+++ /dev/null@@ -1,2615 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- closeSalesOrder,- convertSalesRfqToQuote,- convertQuoteToOrder,- copyQuoteLine,- copyQuote,- deleteCustomer,- deleteCustomerContact,- deleteCustomerLocation,- deleteCustomerStatus,- deleteCustomerType,- deleteNoQuoteReason,- deleteQuote,- deleteQuoteMakeMethod,- deleteQuoteLine,- deleteQuoteMaterial,- deleteQuoteOperation,- deleteQuoteOperationStep,- deleteQuoteOperationParameter,- deleteQuoteOperationTool,- deleteSalesOrder,- deleteSalesOrderLine,- deleteSalesRFQ,- deleteSalesRFQLine,- getConfigurationParametersByQuoteLineId,- getCustomer,- getCustomerContact,- getCustomerContacts,- getCustomerLocation,- getCustomerLocations,- getCustomerPayment,- getCustomerShipping,- getCustomers,- getCustomersList,- getCustomerStatus,- getCustomerStatuses,- getCustomerStatusesList,- getCustomerType,- getCustomerTypes,- getCustomerTypesList,- getExternalSalesOrderLines,- getModelByQuoteLineId,- getNoQuoteReasonsList,- getNoQuoteReason,- getNoQuoteReasons,- getOpportunity,- getOpportunityDocuments,- getOpportunityLineDocuments,- getQuote,- getQuoteFavorites,- getQuotes,- getQuotesList,- getQuoteAssembliesByLine,- getQuoteAssemblies,- getQuoteCustomerDetails,- getQuoteLine,- getQuoteLinesList,- getQuoteMakeMethod,- getRootQuoteMakeMethod,- getQuoteMethodTrees,- getQuoteMethodTreeArray,- getQuoteLines,- getQuoteByExternalId,- getQuoteLinePrices,- getQuoteLinePricesByQuoteId,- getQuoteLinePricesByItemId,- getQuoteLinePricesByItemIds,- getQuoteMaterials,- getQuoteMaterial,- getQuoteMaterialsByLine,- getQuoteMaterialsByMethodId,- getQuoteMaterialsByOperation,- getQuoteOperation,- getQuoteOperationsByLine,- getQuoteOperationsByMethodId,- getQuoteOperations,- getQuotePayment,- getQuoteShipment,- getRelatedPricesForQuoteLine,- getSalesDocumentsAssignedToMe,- getSalesOrder,- getSalesOrderCustomerDetails,- getSalesOrderFavorites,- getSalesOrderRelatedItems,- getSalesOrders,- getSalesOrdersList,- getSalesOrderPayment,- getSalesTerms,- getSalesOrderShipment,- getSalesOrderCustomers,- getSalesOrderLines,- getSalesOrderInvoiceLines,- getSalesOrderInvoicesByIds,- getSalesOrderLinesByItemId,- getSalesOrderLinesByItemIds,- getSalesOrderLine,- getSalesOrderLineShipments,- getSalesRFQ,- getSalesRFQFavorites,- getSalesRFQs,- getSalesRFQLine,- getSalesRFQLines,- insertCustomerContact,- insertCustomerLocation,- insertSalesOrderLines,- finalizeQuote,- releaseSalesOrder,- upsertCustomer,- updateCustomerAccounting,- updateCustomerContact,- updateCustomerLocation,- updateCustomerPayment,- updateCustomerShipping,- getCustomerTax,- updateCustomerTax,- upsertCustomerStatus,- upsertCustomerType,- upsertNoQuoteReason,- updateSalesRFQFavorite,- updateSalesRFQLineOrder,- updateQuoteExchangeRate,- updateQuoteLinePrecision,- updateSalesOrderExchangeRate,- updateQuoteFavorite,- updateSalesRFQStatus,- updateQuoteMaterialOrder,- updateQuoteOperationOrder,- updateQuoteStatus,- upsertMakeMethodFromQuoteLine,- upsertMakeMethodFromQuoteMethod,- upsertQuote,- upsertQuoteLine,- upsertQuoteLineAdditionalCharges,- upsertQuoteLinePrices,- calculatePricesForQuantities,- recalculateQuoteLinePrices,- upsertQuoteLineMethod,- upsertQuoteMaterial,- upsertQuoteMaterialMakeMethod,- upsertQuoteOperation,- upsertQuoteOperationStep,- upsertQuoteOperationParameter,- upsertQuoteOperationTool,- upsertQuotePayment,- upsertQuoteShipment,- updateSalesOrderFavorite,- updateSalesOrderStatus,- upsertSalesOrder,- upsertSalesOrderShipment,- upsertSalesOrderLine,- upsertSalesOrderPayment,- upsertSalesRFQ,- upsertSalesRFQLine,-} from "~/modules/sales/sales.service";-import {- selectedLinesValidator,- getMethodValidator,- customerContactValidator,- salesOrderLineValidator,- customerValidator,- customerAccountingValidator,- customerPaymentValidator,- customerShippingValidator,- customerTaxValidator,- customerStatusValidator,- customerTypeValidator,- noQuoteReasonValidator,- quoteValidator,- quoteLineValidator,- quoteLineAdditionalChargesValidator,- quoteMaterialValidator,- quoteOperationValidator,- quotePaymentValidator,- quoteShipmentValidator,- salesOrderValidator,- salesOrderShipmentValidator,- salesOrderPaymentValidator,- salesRfqValidator,- salesRfqLineValidator,-} from "~/modules/sales/sales.models";-import {- operationStepValidator,- operationParameterValidator,- operationToolValidator,-} from "~/modules/shared";--export const registerSalesTools: RegisterTools = (server, ctx) => {- server.registerTool(- "sales_closeSalesOrder",- {- description: "close sales order",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await closeSalesOrder(ctx.client, params.salesOrderId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_closeSalesOrder"),- );-- server.registerTool(- "sales_convertSalesRfqToQuote",- {- description: "convert sales rfq to quote",- inputSchema: z.object({- payload: z.object({- id: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await convertSalesRfqToQuote(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_convertSalesRfqToQuote"),- );-- server.registerTool(- "sales_convertQuoteToOrder",- {- description: "convert quote to order",- inputSchema: z.object({- payload: selectedLinesValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await convertQuoteToOrder(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_convertQuoteToOrder"),- );-- server.registerTool(- "sales_copyQuoteLine",- {- description: "copy quote line",- inputSchema: z.object({- payload: getMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await copyQuoteLine(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_copyQuoteLine"),- );-- server.registerTool(- "sales_copyQuote",- {- description: "copy quote",- inputSchema: z.object({- payload: getMethodValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await copyQuote(ctx.client, { ...params.payload, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_copyQuote"),- );-- server.registerTool(- "sales_deleteCustomer",- {- description: "delete customer",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomer(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_deleteCustomer"),- );-- server.registerTool(- "sales_deleteCustomerContact",- {- description: "delete customer contact",- inputSchema: z.object({- customerId: z.string(),- customerContactId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomerContact(ctx.client, params.customerId, params.customerContactId);- return toMcpResult(result);- }, "Failed: sales_deleteCustomerContact"),- );-- server.registerTool(- "sales_deleteCustomerLocation",- {- description: "delete customer location",- inputSchema: z.object({- customerId: z.string(),- customerLocationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomerLocation(ctx.client, params.customerId, params.customerLocationId);- return toMcpResult(result);- }, "Failed: sales_deleteCustomerLocation"),- );-- server.registerTool(- "sales_deleteCustomerStatus",- {- description: "delete customer status",- inputSchema: z.object({- customerStatusId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomerStatus(ctx.client, params.customerStatusId);- return toMcpResult(result);- }, "Failed: sales_deleteCustomerStatus"),- );-- server.registerTool(- "sales_deleteCustomerType",- {- description: "delete customer type",- inputSchema: z.object({- customerTypeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomerType(ctx.client, params.customerTypeId);- return toMcpResult(result);- }, "Failed: sales_deleteCustomerType"),- );-- server.registerTool(- "sales_deleteNoQuoteReason",- {- description: "delete no quote reason",- inputSchema: z.object({- noQuoteReasonId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteNoQuoteReason(ctx.client, params.noQuoteReasonId);- return toMcpResult(result);- }, "Failed: sales_deleteNoQuoteReason"),- );-- server.registerTool(- "sales_deleteQuote",- {- description: "delete quote",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuote(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_deleteQuote"),- );-- server.registerTool(- "sales_deleteQuoteMakeMethod",- {- description: "delete quote make method",- inputSchema: z.object({- quoteMakeMethodId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteMakeMethod(ctx.client, params.quoteMakeMethodId);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteMakeMethod"),- );-- server.registerTool(- "sales_deleteQuoteLine",- {- description: "delete quote line",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteLine(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteLine"),- );-- server.registerTool(- "sales_deleteQuoteMaterial",- {- description: "delete quote material",- inputSchema: z.object({- quoteMaterialId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteMaterial(ctx.client, params.quoteMaterialId);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteMaterial"),- );-- server.registerTool(- "sales_deleteQuoteOperation",- {- description: "delete quote operation",- inputSchema: z.object({- quoteOperationId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteOperation(ctx.client, params.quoteOperationId);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteOperation"),- );-- server.registerTool(- "sales_deleteQuoteOperationStep",- {- description: "delete quote operation step",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteOperationStep(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteOperationStep"),- );-- server.registerTool(- "sales_deleteQuoteOperationParameter",- {- description: "delete quote operation parameter",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteOperationParameter(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteOperationParameter"),- );-- server.registerTool(- "sales_deleteQuoteOperationTool",- {- description: "delete quote operation tool",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteQuoteOperationTool(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: sales_deleteQuoteOperationTool"),- );-- server.registerTool(- "sales_deleteSalesOrder",- {- description: "delete sales order",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesOrder(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_deleteSalesOrder"),- );-- server.registerTool(- "sales_deleteSalesOrderLine",- {- description: "delete sales order line",- inputSchema: z.object({- salesOrderLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesOrderLine(ctx.client, params.salesOrderLineId);- return toMcpResult(result);- }, "Failed: sales_deleteSalesOrderLine"),- );-- server.registerTool(- "sales_deleteSalesRFQ",- {- description: "delete sales r f q",- inputSchema: z.object({- salesRfqId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesRFQ(ctx.client, params.salesRfqId);- return toMcpResult(result);- }, "Failed: sales_deleteSalesRFQ"),- );-- server.registerTool(- "sales_deleteSalesRFQLine",- {- description: "delete sales r f q line",- inputSchema: z.object({- salesRFQLineId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSalesRFQLine(ctx.client, params.salesRFQLineId);- return toMcpResult(result);- }, "Failed: sales_deleteSalesRFQLine"),- );-- server.registerTool(- "sales_getConfigurationParametersByQuoteLineId",- {- description: "get configuration parameters by quote line id",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConfigurationParametersByQuoteLineId(ctx.client, params.quoteLineId, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getConfigurationParametersByQuoteLineId"),- );-- server.registerTool(- "sales_getCustomer",- {- description: "get customer",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomer(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomer"),- );-- server.registerTool(- "sales_getCustomerContact",- {- description: "get customer contact",- inputSchema: z.object({- customerContactId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerContact(ctx.client, params.customerContactId);- return toMcpResult(result);- }, "Failed: sales_getCustomerContact"),- );-- server.registerTool(- "sales_getCustomerContacts",- {- description: "get customer contacts",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerContacts(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomerContacts"),- );-- server.registerTool(- "sales_getCustomerLocation",- {- description: "get customer location",- inputSchema: z.object({- customerLocationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerLocation(ctx.client, params.customerLocationId);- return toMcpResult(result);- }, "Failed: sales_getCustomerLocation"),- );-- server.registerTool(- "sales_getCustomerLocations",- {- description: "get customer locations",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerLocations(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomerLocations"),- );-- server.registerTool(- "sales_getCustomerPayment",- {- description: "get customer payment",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerPayment(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomerPayment"),- );-- server.registerTool(- "sales_getCustomerShipping",- {- description: "get customer shipping",- inputSchema: z.object({- customerId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerShipping(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomerShipping"),- );-- server.registerTool(- "sales_getCustomers",- {- description: "get customers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getCustomers"),- );-- server.registerTool(- "sales_getCustomersList",- {- description: "get customers list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomersList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getCustomersList"),- );-- server.registerTool(- "sales_getCustomerStatus",- {- description: "get customer status",- inputSchema: z.object({- customerStatusId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerStatus(ctx.client, params.customerStatusId);- return toMcpResult(result);- }, "Failed: sales_getCustomerStatus"),- );-- server.registerTool(- "sales_getCustomerStatuses",- {- description: "get customer statuses",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerStatuses(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getCustomerStatuses"),- );-- server.registerTool(- "sales_getCustomerStatusesList",- {- description: "get customer statuses list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerStatusesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getCustomerStatusesList"),- );-- server.registerTool(- "sales_getCustomerType",- {- description: "get customer type",- inputSchema: z.object({- customerTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerType(ctx.client, params.customerTypeId);- return toMcpResult(result);- }, "Failed: sales_getCustomerType"),- );-- server.registerTool(- "sales_getCustomerTypes",- {- description: "get customer types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getCustomerTypes"),- );-- server.registerTool(- "sales_getCustomerTypesList",- {- description: "get customer types list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerTypesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getCustomerTypesList"),- );-- server.registerTool(- "sales_getExternalSalesOrderLines",- {- description: "get external sales order lines",- inputSchema: z.object({- customerId: z.string(),- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getExternalSalesOrderLines(ctx.client, params.customerId, params.args);- return toMcpResult(result);- }, "Failed: sales_getExternalSalesOrderLines"),- );-- server.registerTool(- "sales_getModelByQuoteLineId",- {- description: "get model by quote line id",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getModelByQuoteLineId(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getModelByQuoteLineId"),- );-- server.registerTool(- "sales_getNoQuoteReasonsList",- {- description: "get no quote reasons list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNoQuoteReasonsList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getNoQuoteReasonsList"),- );-- server.registerTool(- "sales_getNoQuoteReason",- {- description: "get no quote reason",- inputSchema: z.object({- noQuoteReasonId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNoQuoteReason(ctx.client, params.noQuoteReasonId);- return toMcpResult(result);- }, "Failed: sales_getNoQuoteReason"),- );-- server.registerTool(- "sales_getNoQuoteReasons",- {- description: "get no quote reasons",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNoQuoteReasons(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getNoQuoteReasons"),- );-- server.registerTool(- "sales_getOpportunity",- {- description: "get opportunity",- inputSchema: z.object({- opportunityId: z.string().nullable(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpportunity(ctx.client, params.opportunityId);- return toMcpResult(result);- }, "Failed: sales_getOpportunity"),- );-- server.registerTool(- "sales_getOpportunityDocuments",- {- description: "get opportunity documents",- inputSchema: z.object({- opportunityId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpportunityDocuments(ctx.client, ctx.companyId, params.opportunityId);- return toMcpResult(result);- }, "Failed: sales_getOpportunityDocuments"),- );-- server.registerTool(- "sales_getOpportunityLineDocuments",- {- description: "get opportunity line documents",- inputSchema: z.object({- lineId: z.string(),- itemId: z.string().nullable().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getOpportunityLineDocuments(ctx.client, ctx.companyId, params.lineId, params.itemId);- return toMcpResult(result);- }, "Failed: sales_getOpportunityLineDocuments"),- );-- server.registerTool(- "sales_getQuote",- {- description: "get quote",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuote(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuote"),- );-- server.registerTool(- "sales_getQuoteFavorites",- {- description: "get quote favorites",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteFavorites(ctx.client, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_getQuoteFavorites"),- );-- server.registerTool(- "sales_getQuotes",- {- description: "get quotes",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuotes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getQuotes"),- );-- server.registerTool(- "sales_getQuotesList",- {- description: "get quotes list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuotesList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getQuotesList"),- );-- server.registerTool(- "sales_getQuoteAssembliesByLine",- {- description: "get quote assemblies by line",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteAssembliesByLine(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getQuoteAssembliesByLine"),- );-- server.registerTool(- "sales_getQuoteAssemblies",- {- description: "get quote assemblies",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteAssemblies(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteAssemblies"),- );-- server.registerTool(- "sales_getQuoteCustomerDetails",- {- description: "get quote customer details",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteCustomerDetails(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteCustomerDetails"),- );-- server.registerTool(- "sales_getQuoteLine",- {- description: "get quote line",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLine(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLine"),- );-- server.registerTool(- "sales_getQuoteLinesList",- {- description: "get quote lines list",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLinesList(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLinesList"),- );-- server.registerTool(- "sales_getQuoteMakeMethod",- {- description: "get quote make method",- inputSchema: z.object({- quoteMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMakeMethod(ctx.client, params.quoteMakeMethodId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMakeMethod"),- );-- server.registerTool(- "sales_getRootQuoteMakeMethod",- {- description: "get root quote make method",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRootQuoteMakeMethod(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getRootQuoteMakeMethod"),- );-- server.registerTool(- "sales_getQuoteMethodTrees",- {- description: "get quote method trees",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMethodTrees(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMethodTrees"),- );-- server.registerTool(- "sales_getQuoteMethodTreeArray",- {- description: "get quote method tree array",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMethodTreeArray(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMethodTreeArray"),- );-- server.registerTool(- "sales_getQuoteLines",- {- description: "get quote lines",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLines(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLines"),- );-- server.registerTool(- "sales_getQuoteByExternalId",- {- description: "get quote by external id",- inputSchema: z.object({- externalId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteByExternalId(ctx.client, params.externalId);- return toMcpResult(result);- }, "Failed: sales_getQuoteByExternalId"),- );-- server.registerTool(- "sales_getQuoteLinePrices",- {- description: "get quote line prices",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLinePrices(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLinePrices"),- );-- server.registerTool(- "sales_getQuoteLinePricesByQuoteId",- {- description: "get quote line prices by quote id",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLinePricesByQuoteId(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLinePricesByQuoteId"),- );-- server.registerTool(- "sales_getQuoteLinePricesByItemId",- {- description: "get quote line prices by item id",- inputSchema: z.object({- itemId: z.string(),- currentQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLinePricesByItemId(ctx.client, params.itemId, params.currentQuoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLinePricesByItemId"),- );-- server.registerTool(- "sales_getQuoteLinePricesByItemIds",- {- description: "get quote line prices by item ids",- inputSchema: z.object({- itemIds: z.array(z.string()),- currentQuoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteLinePricesByItemIds(ctx.client, params.itemIds, params.currentQuoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteLinePricesByItemIds"),- );-- server.registerTool(- "sales_getQuoteMaterials",- {- description: "get quote materials",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMaterials(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMaterials"),- );-- server.registerTool(- "sales_getQuoteMaterial",- {- description: "get quote material",- inputSchema: z.object({- materialId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMaterial(ctx.client, params.materialId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMaterial"),- );-- server.registerTool(- "sales_getQuoteMaterialsByLine",- {- description: "get quote materials by line",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMaterialsByLine(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMaterialsByLine"),- );-- server.registerTool(- "sales_getQuoteMaterialsByMethodId",- {- description: "get quote materials by method id",- inputSchema: z.object({- quoteMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMaterialsByMethodId(ctx.client, params.quoteMakeMethodId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMaterialsByMethodId"),- );-- server.registerTool(- "sales_getQuoteMaterialsByOperation",- {- description: "get quote materials by operation",- inputSchema: z.object({- quoteOperationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteMaterialsByOperation(ctx.client, params.quoteOperationId);- return toMcpResult(result);- }, "Failed: sales_getQuoteMaterialsByOperation"),- );-- server.registerTool(- "sales_getQuoteOperation",- {- description: "get quote operation",- inputSchema: z.object({- quoteOperationId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteOperation(ctx.client, params.quoteOperationId);- return toMcpResult(result);- }, "Failed: sales_getQuoteOperation"),- );-- server.registerTool(- "sales_getQuoteOperationsByLine",- {- description: "get quote operations by line",- inputSchema: z.object({- quoteLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteOperationsByLine(ctx.client, params.quoteLineId);- return toMcpResult(result);- }, "Failed: sales_getQuoteOperationsByLine"),- );-- server.registerTool(- "sales_getQuoteOperationsByMethodId",- {- description: "get quote operations by method id",- inputSchema: z.object({- quoteMakeMethodId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteOperationsByMethodId(ctx.client, params.quoteMakeMethodId);- return toMcpResult(result);- }, "Failed: sales_getQuoteOperationsByMethodId"),- );-- server.registerTool(- "sales_getQuoteOperations",- {- description: "get quote operations",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteOperations(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteOperations"),- );-- server.registerTool(- "sales_getQuotePayment",- {- description: "get quote payment",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuotePayment(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuotePayment"),- );-- server.registerTool(- "sales_getQuoteShipment",- {- description: "get quote shipment",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getQuoteShipment(ctx.client, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getQuoteShipment"),- );-- server.registerTool(- "sales_getRelatedPricesForQuoteLine",- {- description: "get related prices for quote line",- inputSchema: z.object({- itemId: z.string(),- quoteId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getRelatedPricesForQuoteLine(ctx.client, params.itemId, params.quoteId);- return toMcpResult(result);- }, "Failed: sales_getRelatedPricesForQuoteLine"),- );-- server.registerTool(- "sales_getSalesDocumentsAssignedToMe",- {- description: "get sales documents assigned to me",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesDocumentsAssignedToMe(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getSalesDocumentsAssignedToMe"),- );-- server.registerTool(- "sales_getSalesOrder",- {- description: "get sales order",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrder(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrder"),- );-- server.registerTool(- "sales_getSalesOrderCustomerDetails",- {- description: "get sales order customer details",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderCustomerDetails(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderCustomerDetails"),- );-- server.registerTool(- "sales_getSalesOrderFavorites",- {- description: "get sales order favorites",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderFavorites(ctx.client, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderFavorites"),- );-- server.registerTool(- "sales_getSalesOrderRelatedItems",- {- description: "get sales order related items",- inputSchema: z.object({- salesOrderId: z.string(),- opportunityId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderRelatedItems(ctx.client, params.salesOrderId, params.opportunityId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderRelatedItems"),- );-- server.registerTool(- "sales_getSalesOrders",- {- description: "get sales orders",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- status: z.string().nullable(),- customerId: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrders(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getSalesOrders"),- );-- server.registerTool(- "sales_getSalesOrdersList",- {- description: "get sales orders list",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrdersList(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrdersList"),- );-- server.registerTool(- "sales_getSalesOrderPayment",- {- description: "get sales order payment",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderPayment(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderPayment"),- );-- server.registerTool(- "sales_getSalesTerms",- {- description: "get sales terms",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesTerms(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: sales_getSalesTerms"),- );-- server.registerTool(- "sales_getSalesOrderShipment",- {- description: "get sales order shipment",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderShipment(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderShipment"),- );-- server.registerTool(- "sales_getSalesOrderCustomers",- {- description: "get sales order customers",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderCustomers(ctx.client);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderCustomers"),- );-- server.registerTool(- "sales_getSalesOrderLines",- {- description: "get sales order lines",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderLines(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderLines"),- );-- server.registerTool(- "sales_getSalesOrderInvoiceLines",- {- description: "get sales order invoice lines",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderInvoiceLines(ctx.client, params.salesOrderId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderInvoiceLines"),- );-- server.registerTool(- "sales_getSalesOrderInvoicesByIds",- {- description: "get sales order invoices by ids",- inputSchema: z.object({- invoiceIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderInvoicesByIds(ctx.client, params.invoiceIds);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderInvoicesByIds"),- );-- server.registerTool(- "sales_getSalesOrderLinesByItemId",- {- description: "get sales order lines by item id",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderLinesByItemId(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderLinesByItemId"),- );-- server.registerTool(- "sales_getSalesOrderLinesByItemIds",- {- description: "get sales order lines by item ids",- inputSchema: z.object({- itemIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderLinesByItemIds(ctx.client, params.itemIds);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderLinesByItemIds"),- );-- server.registerTool(- "sales_getSalesOrderLine",- {- description: "get sales order line",- inputSchema: z.object({- salesOrderLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderLine(ctx.client, params.salesOrderLineId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderLine"),- );-- server.registerTool(- "sales_getSalesOrderLineShipments",- {- description: "get sales order line shipments",- inputSchema: z.object({- salesOrderLineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesOrderLineShipments(ctx.client, params.salesOrderLineId);- return toMcpResult(result);- }, "Failed: sales_getSalesOrderLineShipments"),- );-- server.registerTool(- "sales_getSalesRFQ",- {- description: "get sales r f q",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesRFQ(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: sales_getSalesRFQ"),- );-- server.registerTool(- "sales_getSalesRFQFavorites",- {- description: "get sales r f q favorites",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesRFQFavorites(ctx.client, ctx.companyId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_getSalesRFQFavorites"),- );-- server.registerTool(- "sales_getSalesRFQs",- {- description: "get sales r f qs",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesRFQs(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: sales_getSalesRFQs"),- );-- server.registerTool(- "sales_getSalesRFQLine",- {- description: "get sales r f q line",- inputSchema: z.object({- lineId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesRFQLine(ctx.client, params.lineId);- return toMcpResult(result);- }, "Failed: sales_getSalesRFQLine"),- );-- server.registerTool(- "sales_getSalesRFQLines",- {- description: "get sales r f q lines",- inputSchema: z.object({- salesRfqId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSalesRFQLines(ctx.client, params.salesRfqId);- return toMcpResult(result);- }, "Failed: sales_getSalesRFQLines"),- );-- server.registerTool(- "sales_insertCustomerContact",- {- description: "insert customer contact",- inputSchema: z.object({- customerContact: customerContactValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertCustomerContact(ctx.client, { ...params.customerContact, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: sales_insertCustomerContact"),- );-- server.registerTool(- "sales_insertCustomerLocation",- {- description: "insert customer location",- inputSchema: z.object({- customerLocation: z.object({- customerId: z.string(),- name: z.string(),- address: z.any(),- addressLine1: z.string().optional(),- addressLine2: z.string().optional(),- city: z.string().optional(),- stateProvince: z.string().optional(),- countryCode: z.string().optional(),- postalCode: z.string().optional(),- customFields: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertCustomerLocation(ctx.client, { ...params.customerLocation, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: sales_insertCustomerLocation"),- );-- server.registerTool(- "sales_insertSalesOrderLines",- {- description: "insert sales order lines",- inputSchema: z.object({- salesOrderLines: salesOrderLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSalesOrderLines(ctx.client, { ...params.salesOrderLines, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_insertSalesOrderLines"),- );-- server.registerTool(- "sales_finalizeQuote",- {- description: "finalize quote",- inputSchema: z.object({- quoteId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await finalizeQuote(ctx.client, params.quoteId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_finalizeQuote"),- );-- server.registerTool(- "sales_releaseSalesOrder",- {- description: "release sales order",- inputSchema: z.object({- salesOrderId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await releaseSalesOrder(ctx.client, params.salesOrderId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_releaseSalesOrder"),- );-- server.registerTool(- "sales_upsertCustomer",- {- description: "upsert customer",- inputSchema: z.object({- customer: customerValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertCustomer(ctx.client, { ...params.customer, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertCustomer"),- );-- server.registerTool(- "sales_updateCustomerAccounting",- {- description: "update customer accounting",- inputSchema: z.object({- customerAccounting: customerAccountingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerAccounting(ctx.client, { ...params.customerAccounting, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateCustomerAccounting"),- );-- server.registerTool(- "sales_updateCustomerContact",- {- description: "update customer contact",- inputSchema: z.object({- customerContact: customerContactValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerContact(ctx.client, params.customerContact);- return toMcpResult(result);- }, "Failed: sales_updateCustomerContact"),- );-- server.registerTool(- "sales_updateCustomerLocation",- {- description: "update customer location",- inputSchema: z.object({- customerLocation: z.object({- addressId: z.string(),- name: z.string(),- address: z.any(),- addressLine1: z.string().optional(),- addressLine2: z.string().optional(),- city: z.string().optional(),- stateProvince: z.string().optional(),- countryCode: z.string().optional(),- postalCode: z.string().optional(),- customFields: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerLocation(ctx.client, params.customerLocation);- return toMcpResult(result);- }, "Failed: sales_updateCustomerLocation"),- );-- server.registerTool(- "sales_updateCustomerPayment",- {- description: "update customer payment",- inputSchema: z.object({- customerPayment: customerPaymentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerPayment(ctx.client, { ...params.customerPayment, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateCustomerPayment"),- );-- server.registerTool(- "sales_updateCustomerShipping",- {- description: "update customer shipping",- inputSchema: z.object({- customerShipping: customerShippingValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerShipping(ctx.client, { ...params.customerShipping, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateCustomerShipping"),- );-- server.registerTool(- "sales_getCustomerTax",- {- description: "get customer tax",- inputSchema: {- customerId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerTax(ctx.client, params.customerId);- return toMcpResult(result);- }, "Failed: sales_getCustomerTax"),- );-- server.registerTool(- "sales_updateCustomerTax",- {- description: "update customer tax",- inputSchema: {- customerTax: customerTaxValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCustomerTax(ctx.client, { ...params.customerTax, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateCustomerTax"),- );-- server.registerTool(- "sales_upsertCustomerStatus",- {- description: "upsert customer status",- inputSchema: z.object({- customerStatus: customerStatusValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertCustomerStatus(ctx.client, { ...params.customerStatus, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertCustomerStatus"),- );-- server.registerTool(- "sales_upsertCustomerType",- {- description: "upsert customer type",- inputSchema: z.object({- customerType: customerTypeValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertCustomerType(ctx.client, { ...params.customerType, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertCustomerType"),- );-- server.registerTool(- "sales_upsertNoQuoteReason",- {- description: "upsert no quote reason",- inputSchema: z.object({- noQuoteReason: noQuoteReasonValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertNoQuoteReason(ctx.client, { ...params.noQuoteReason, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertNoQuoteReason"),- );-- server.registerTool(- "sales_updateSalesRFQFavorite",- {- description: "update sales r f q favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesRFQFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateSalesRFQFavorite"),- );-- server.registerTool(- "sales_updateSalesRFQLineOrder",- {- description: "update sales r f q line order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesRFQLineOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateSalesRFQLineOrder"),- );-- server.registerTool(- "sales_updateQuoteExchangeRate",- {- description: "update quote exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: sales_updateQuoteExchangeRate"),- );-- server.registerTool(- "sales_updateQuoteLinePrecision",- {- description: "update quote line precision",- inputSchema: z.object({- quoteLineId: z.string(),- precision: z.number(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteLinePrecision(ctx.client, params.quoteLineId, params.precision);- return toMcpResult(result);- }, "Failed: sales_updateQuoteLinePrecision"),- );-- server.registerTool(- "sales_updateSalesOrderExchangeRate",- {- description: "update sales order exchange rate",- inputSchema: z.object({- data: z.object({- id: z.string(),- exchangeRate: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesOrderExchangeRate(ctx.client, params.data);- return toMcpResult(result);- }, "Failed: sales_updateSalesOrderExchangeRate"),- );-- server.registerTool(- "sales_updateQuoteFavorite",- {- description: "update quote favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateQuoteFavorite"),- );-- server.registerTool(- "sales_updateSalesRFQStatus",- {- description: "update sales r f q status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- noQuoteReasonId: z.string().nullable(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesRFQStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateSalesRFQStatus"),- );-- server.registerTool(- "sales_updateQuoteMaterialOrder",- {- description: "update quote material order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteMaterialOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateQuoteMaterialOrder"),- );-- server.registerTool(- "sales_updateQuoteOperationOrder",- {- description: "update quote operation order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- order: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteOperationOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateQuoteOperationOrder"),- );-- server.registerTool(- "sales_updateQuoteStatus",- {- description: "update quote status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateQuoteStatus"),- );-- server.registerTool(- "sales_upsertMakeMethodFromQuoteLine",- {- description: "upsert make method from quote line",- inputSchema: z.object({- lineMethod: z.object({- itemId: z.string(),- quoteId: z.string(),- quoteLineId: z.string(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMakeMethodFromQuoteLine(ctx.client, { ...params.lineMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertMakeMethodFromQuoteLine"),- );-- server.registerTool(- "sales_upsertMakeMethodFromQuoteMethod",- {- description: "upsert make method from quote method",- inputSchema: z.object({- quoteMethod: z.object({- sourceId: z.string(),- targetId: z.string(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertMakeMethodFromQuoteMethod(ctx.client, { ...params.quoteMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertMakeMethodFromQuoteMethod"),- );-- server.registerTool(- "sales_upsertQuote",- {- description: "upsert quote",- inputSchema: z.object({- quote: quoteValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuote(ctx.client, { ...params.quote, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuote"),- );-- server.registerTool(- "sales_upsertQuoteLine",- {- description: "upsert quote line",- inputSchema: z.object({- quotationLine: quoteLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteLine(ctx.client, { ...params.quotationLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteLine"),- );-- server.registerTool(- "sales_upsertQuoteLineAdditionalCharges",- {- description: "upsert quote line additional charges",- inputSchema: z.object({- lineId: z.string(),- update: quoteLineAdditionalChargesValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteLineAdditionalCharges(ctx.client, params.lineId, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteLineAdditionalCharges"),- );-- server.registerTool(- "sales_upsertQuoteLinePrices",- {- description: "upsert quote line prices",- inputSchema: z.object({- quoteId: z.string(),- lineId: z.string(),- quoteLinePrices: z.object({- quoteLineId: z.string(),- unitPrice: z.number(),- leadTime: z.number(),- discountPercent: z.number(),- quantity: z.number(),- categoryMarkups: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteLinePrices(ctx.client, params.quoteId, params.lineId, { ...params.quoteLinePrices, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteLinePrices"),- );-- server.registerTool(- "sales_calculatePricesForQuantities",- {- description: "calculate prices for quantities",- inputSchema: z.object({- quoteId: z.string(),- quoteLineId: z.string(),- quantities: z.array(z.number()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await calculatePricesForQuantities(ctx.client, params.quoteId, params.quoteLineId, params.quantities, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_calculatePricesForQuantities"),- );-- server.registerTool(- "sales_recalculateQuoteLinePrices",- {- description: "recalculate quote line prices",- inputSchema: z.object({- quoteId: z.string(),- quoteLineId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await recalculateQuoteLinePrices(ctx.client, params.quoteId, params.quoteLineId, ctx.userId);- return toMcpResult(result);- }, "Failed: sales_recalculateQuoteLinePrices"),- );-- server.registerTool(- "sales_upsertQuoteLineMethod",- {- description: "upsert quote line method",- inputSchema: z.object({- lineMethod: z.object({- itemId: z.string(),- quoteId: z.string(),- quoteLineId: z.string(),- configuration: z.any().optional(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteLineMethod(ctx.client, { ...params.lineMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteLineMethod"),- );-- server.registerTool(- "sales_upsertQuoteMaterial",- {- description: "upsert quote material",- inputSchema: z.object({- quoteMaterial: quoteMaterialValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteMaterial(ctx.client, { ...params.quoteMaterial, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteMaterial"),- );-- server.registerTool(- "sales_upsertQuoteMaterialMakeMethod",- {- description: "upsert quote material make method",- inputSchema: z.object({- quoteMethod: z.object({- sourceId: z.string(),- targetId: z.string(),- configuration: z.any().optional(),- parts: z.any().optional(),- billOfMaterial: z.boolean(),- billOfProcess: z.boolean(),- parameters: z.boolean(),- tools: z.boolean(),- steps: z.boolean(),- workInstructions: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteMaterialMakeMethod(ctx.client, { ...params.quoteMethod, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteMaterialMakeMethod"),- );-- server.registerTool(- "sales_upsertQuoteOperation",- {- description: "upsert quote operation",- inputSchema: z.object({- operation: quoteOperationValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteOperation(ctx.client, { ...params.operation, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteOperation"),- );-- server.registerTool(- "sales_upsertQuoteOperationStep",- {- description: "upsert quote operation step",- inputSchema: z.object({- quoteOperationStep: operationStepValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteOperationStep(ctx.client, { ...params.quoteOperationStep, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteOperationStep"),- );-- server.registerTool(- "sales_upsertQuoteOperationParameter",- {- description: "upsert quote operation parameter",- inputSchema: z.object({- quoteOperationParameter: operationParameterValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteOperationParameter(ctx.client, { ...params.quoteOperationParameter, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteOperationParameter"),- );-- server.registerTool(- "sales_upsertQuoteOperationTool",- {- description: "upsert quote operation tool",- inputSchema: z.object({- quoteOperationTool: operationToolValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteOperationTool(ctx.client, { ...params.quoteOperationTool, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteOperationTool"),- );-- server.registerTool(- "sales_upsertQuotePayment",- {- description: "upsert quote payment",- inputSchema: z.object({- quotePayment: quotePaymentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuotePayment(ctx.client, { ...params.quotePayment, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuotePayment"),- );-- server.registerTool(- "sales_upsertQuoteShipment",- {- description: "upsert quote shipment",- inputSchema: z.object({- quoteShipment: quoteShipmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertQuoteShipment(ctx.client, { ...params.quoteShipment, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertQuoteShipment"),- );-- server.registerTool(- "sales_updateSalesOrderFavorite",- {- description: "update sales order favorite",- inputSchema: z.object({- args: z.object({- id: z.string(),- favorite: z.boolean()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesOrderFavorite(ctx.client, { ...params.args, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateSalesOrderFavorite"),- );-- server.registerTool(- "sales_updateSalesOrderStatus",- {- description: "update sales order status",- inputSchema: z.object({- update: z.object({- id: z.string(),- status: z.any(),- assignee: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesOrderStatus(ctx.client, { ...params.update, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_updateSalesOrderStatus"),- );-- server.registerTool(- "sales_upsertSalesOrder",- {- description: "upsert sales order",- inputSchema: z.object({- salesOrder: salesOrderValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesOrder(ctx.client, { ...params.salesOrder, companyId: ctx.companyId, companyGroupId: ctx.companyGroupId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesOrder"),- );-- server.registerTool(- "sales_upsertSalesOrderShipment",- {- description: "upsert sales order shipment",- inputSchema: z.object({- salesOrderShipment: salesOrderShipmentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesOrderShipment(ctx.client, { ...params.salesOrderShipment, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesOrderShipment"),- );-- server.registerTool(- "sales_upsertSalesOrderLine",- {- description: "upsert sales order line",- inputSchema: z.object({- salesOrderLine: salesOrderLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesOrderLine(ctx.client, { ...params.salesOrderLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesOrderLine"),- );-- server.registerTool(- "sales_upsertSalesOrderPayment",- {- description: "upsert sales order payment",- inputSchema: z.object({- salesOrderPayment: salesOrderPaymentValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesOrderPayment(ctx.client, { ...params.salesOrderPayment, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesOrderPayment"),- );-- server.registerTool(- "sales_upsertSalesRFQ",- {- description: "upsert sales r f q",- inputSchema: z.object({- rfq: salesRfqValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesRFQ(ctx.client, { ...params.rfq, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesRFQ"),- );-- server.registerTool(- "sales_upsertSalesRFQLine",- {- description: "upsert sales r f q line",- inputSchema: z.object({- salesRfqLine: salesRfqLineValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSalesRFQLine(ctx.client, { ...params.salesRfqLine, companyId: ctx.companyId, createdBy: ctx.userId, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: sales_upsertSalesRFQLine"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/settings.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/settings.tsdeleted file mode 100644index cc0a459109..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/settings.ts+++ /dev/null@@ -1,1408 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- getAccountsPayableBillingAddress,- getAccountsReceivableBillingAddress,- updateAccountsPayableBillingAddress,- updateAccountsReceivableBillingAddress,- deactivateWebhooks,- deleteApiKey,- deleteSubsidiary,- deleteWebhook,- getApiKeys,- getCompanies,- getCompany,- getCompanyIntegrations,- getCompanyPlan,- getCompanySettings,- getConfig,- getCurrentSequence,- getCustomField,- getCustomFields,- getCustomFieldsTables,- getIntegration,- getIntegrations,- getKanbanOutputSetting,- getNextSequence,- getPlanById,- getPlans,- getSequence,- getSequences,- getSequencesList,- getSubsidiaries,- getSubsidiary,- getTerms,- getWebhook,- getWebhooks,- getWebhookTables,- insertCompany,- insertSubsidiary,- updateSubsidiary,- seedCompany,- updateCompany,- updateCompanyPlan,- updateDefaultCustomerCc,- updateDefaultSupplierCc,- updateDigitalQuoteSetting,- updateIntegrationMetadata,- updateJobTravelerWorkInstructions,- updateTimeCardSetting,- updateKanbanOutputSetting,- updateLogoDark,- updateLogoDarkIcon,- updateLogoLight,- updateLogoLightIcon,- updateMaintenanceDispatchNotificationSettings,- updateMaterialGeneratedIdsSetting,- updateMetricSettings,- updateProductLabelSize,- updatePurchasePriceUpdateTimingSetting,- updateLeadTimesOnReceiptSetting,- updateSupplierApprovalSetting,- updateAccountsPayableAddressSetting,- updateAccountsReceivableAddressSetting,- updateAccountsPayableEmail,- updateAccountsReceivableEmail,- updateQuoteLineCategoryMarkups,- updatePurchasingPdfThumbnails,- updateRfqReadySetting,- updateSalesPdfThumbnails,- updateSequence,- updateSuggestionNotificationSetting,- updateSupplierQuoteNotificationSetting,- upsertApiKey,- updateConsoleSetting,- upsertWebhook,-} from "~/modules/settings/settings.service";-import {- accountsPayableBillingAddressValidator,- accountsReceivableBillingAddressValidator,- companyValidator,- subsidiaryValidator,- sequenceValidator,- apiKeyValidator,- webhookValidator,-} from "~/modules/settings/settings.models";--export const registerSettingsTools: RegisterTools = (server, ctx) => {- server.registerTool(- "settings_getAccountsPayableBillingAddress",- {- description: "get accounts payable billing address",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountsPayableBillingAddress(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getAccountsPayableBillingAddress"),- );-- server.registerTool(- "settings_getAccountsReceivableBillingAddress",- {- description: "get accounts receivable billing address",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getAccountsReceivableBillingAddress(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getAccountsReceivableBillingAddress"),- );-- server.registerTool(- "settings_updateAccountsPayableBillingAddress",- {- description: "update accounts payable billing address",- inputSchema: z.object({- data: accountsPayableBillingAddressValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsPayableBillingAddress(ctx.client, ctx.companyId, params.data, ctx.userId);- return toMcpResult(result);- }, "Failed: settings_updateAccountsPayableBillingAddress"),- );-- server.registerTool(- "settings_updateAccountsReceivableBillingAddress",- {- description: "update accounts receivable billing address",- inputSchema: z.object({- data: accountsReceivableBillingAddressValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsReceivableBillingAddress(ctx.client, ctx.companyId, params.data, ctx.userId);- return toMcpResult(result);- }, "Failed: settings_updateAccountsReceivableBillingAddress"),- );-- server.registerTool(- "settings_deactivateWebhooks",- {- description: "deactivate webhooks",- inputSchema: {},- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deactivateWebhooks(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_deactivateWebhooks"),- );-- server.registerTool(- "settings_deleteApiKey",- {- description: "delete api key",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteApiKey(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: settings_deleteApiKey"),- );-- server.registerTool(- "settings_deleteSubsidiary",- {- description: "delete subsidiary",- inputSchema: {},- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSubsidiary(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_deleteSubsidiary"),- );-- server.registerTool(- "settings_deleteWebhook",- {- description: "delete webhook",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteWebhook(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: settings_deleteWebhook"),- );-- server.registerTool(- "settings_deactivateWebhooks",- {- description: "deactivate webhooks",- inputSchema: z.object({}),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deactivateWebhooks(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_deactivateWebhooks"),- );-- server.registerTool(- "settings_getApiKeys",- {- description: "get api keys",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApiKeys(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: settings_getApiKeys"),- );-- server.registerTool(- "settings_getCompanies",- {- description: "get companies",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompanies(ctx.client, ctx.userId);- return toMcpResult(result);- }, "Failed: settings_getCompanies"),- );-- server.registerTool(- "settings_getCompany",- {- description: "get company",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompany(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCompany"),- );-- server.registerTool(- "settings_getCompanyIntegrations",- {- description: "get company integrations",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompanyIntegrations(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCompanyIntegrations"),- );-- server.registerTool(- "settings_getCompanyPlan",- {- description: "get company plan",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompanyPlan(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCompanyPlan"),- );-- server.registerTool(- "settings_getCompanySettings",- {- description: "get company settings",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompanySettings(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCompanySettings"),- );-- server.registerTool(- "settings_getCompanyIntegrations",- {- description: "get company integrations",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompanyIntegrations(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCompanyIntegrations"),- );-- server.registerTool(- "settings_getConfig",- {- description: "get config",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConfig(ctx.client);- return toMcpResult(result);- }, "Failed: settings_getConfig"),- );-- server.registerTool(- "settings_getCurrentSequence",- {- description: "get current sequence",- inputSchema: z.object({- table: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCurrentSequence(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCurrentSequence"),- );-- server.registerTool(- "settings_getCustomField",- {- description: "get custom field",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomField(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: settings_getCustomField"),- );-- server.registerTool(- "settings_getCustomFields",- {- description: "get custom fields",- inputSchema: z.object({- table: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomFields(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getCustomFields"),- );-- server.registerTool(- "settings_getCustomFieldsTables",- {- description: "get custom fields tables",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomFieldsTables(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: settings_getCustomFieldsTables"),- );-- server.registerTool(- "settings_getIntegration",- {- description: "get integration",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIntegration(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getIntegration"),- );-- server.registerTool(- "settings_getIntegrations",- {- description: "get integrations",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getIntegrations(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getIntegrations"),- );-- server.registerTool(- "settings_getKanbanOutputSetting",- {- description: "get kanban output setting",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getKanbanOutputSetting(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getKanbanOutputSetting"),- );-- server.registerTool(- "settings_getNextSequence",- {- description: "get next sequence",- inputSchema: {- table: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNextSequence(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getNextSequence"),- );-- server.registerTool(- "settings_getPlanById",- {- description: "get plan by id",- inputSchema: z.object({- planId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPlanById(ctx.client, params.planId);- return toMcpResult(result);- }, "Failed: settings_getPlanById"),- );-- server.registerTool(- "settings_getPlans",- {- description: "get plans",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPlans(ctx.client);- return toMcpResult(result);- }, "Failed: settings_getPlans"),- );-- server.registerTool(- "settings_getNextSequence",- {- description: "get next sequence",- inputSchema: z.object({- table: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNextSequence(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getNextSequence"),- );-- server.registerTool(- "settings_getSequence",- {- description: "get sequence",- inputSchema: z.object({- table: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSequence(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getSequence"),- );-- server.registerTool(- "settings_getSequences",- {- description: "get sequences",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSequences(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: settings_getSequences"),- );-- server.registerTool(- "settings_getSequencesList",- {- description: "get sequences list",- inputSchema: z.object({- table: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSequencesList(ctx.client, params.table, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getSequencesList"),- );-- server.registerTool(- "settings_getSubsidiaries",- {- description: "get subsidiaries",- inputSchema: {- companyGroupId: z.string(),- },- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSubsidiaries(ctx.client, params.companyGroupId);- return toMcpResult(result);- }, "Failed: settings_getSubsidiaries"),- );-- server.registerTool(- "settings_getSubsidiary",- {- description: "get subsidiary",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSubsidiary(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getSubsidiary"),- );-- server.registerTool(- "settings_getTerms",- {- description: "get terms",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTerms(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: settings_getTerms"),- );-- server.registerTool(- "settings_getWebhook",- {- description: "get webhook",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWebhook(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: settings_getWebhook"),- );-- server.registerTool(- "settings_getWebhookTables",- {- description: "get webhook tables",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWebhookTables(ctx.client);- return toMcpResult(result);- }, "Failed: settings_getWebhookTables"),- );-- server.registerTool(- "settings_getWebhooks",- {- description: "get webhooks",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWebhooks(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: settings_getWebhooks"),- );-- server.registerTool(- "settings_getWebhookTables",- {- description: "get webhook tables",- inputSchema: {},- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getWebhookTables(ctx.client);- return toMcpResult(result);- }, "Failed: settings_getWebhookTables"),- );-- server.registerTool(- "settings_insertCompany",- {- description: "insert company",- inputSchema: z.object({- company: companyValidator,- ownerId: z.string().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertCompany(ctx.client, params.company, params.companyGroupId);- return toMcpResult(result);- }, "Failed: settings_insertCompany"),- );-- server.registerTool(- "settings_insertSubsidiary",- {- description: "insert subsidiary",- inputSchema: {- subsidiary: subsidiaryValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertSubsidiary(ctx.client, { ...params.subsidiary, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: settings_insertSubsidiary"),- );-- server.registerTool(- "settings_updateSubsidiary",- {- description: "update subsidiary",- inputSchema: {- id: z.string(),- subsidiary: subsidiaryValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSubsidiary(ctx.client, params.id, { ...params.subsidiary, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: settings_updateSubsidiary"),- );-- server.registerTool(- "settings_seedCompany",- {- description: "seed company",- inputSchema: {- parentCompanyId: z.string().optional(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await seedCompany(ctx.client, ctx.companyId, ctx.userId, params.parentCompanyId);- return toMcpResult(result);- }, "Failed: settings_seedCompany"),- );-- server.registerTool(- "settings_updateCompany",- {- description: "update company",- inputSchema: {- company: companyValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCompany(ctx.client, ctx.companyId, { ...params.company, updatedBy: ctx.userId, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: settings_updateCompany"),- );-- server.registerTool(- "settings_updateCompanyPlan",- {- description: "update company plan",- inputSchema: z.object({- data: z.object({- stripeCustomerId: z.string(),- stripeSubscriptionId: z.string(),- stripeSubscriptionStatus: z.string(),- subscriptionStartDate: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateCompanyPlan(ctx.client, { ...params.data, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: settings_updateCompanyPlan"),- );-- server.registerTool(- "settings_updateDefaultCustomerCc",- {- description: "seed company",- inputSchema: z.object({}),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultCustomerCc(ctx.client, ctx.companyId, params.defaultCustomerCc);- return toMcpResult(result);- }, "Failed: settings_updateDefaultCustomerCc"),- );-- server.registerTool(- "settings_updateDefaultSupplierCc",- {- description: "update company",- inputSchema: z.object({- company: companyValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultSupplierCc(ctx.client, ctx.companyId, params.defaultSupplierCc);- return toMcpResult(result);- }, "Failed: settings_updateCompany"),- );-- server.registerTool(- "settings_updateKanbanOutputSetting",- {- description: "update kanban output setting",- inputSchema: z.object({- kanbanOutput: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateKanbanOutputSetting(ctx.client, ctx.companyId, params.kanbanOutput);- return toMcpResult(result);- }, "Failed: settings_updateKanbanOutputSetting"),- );-- server.registerTool(- "settings_updateMetricSettings",- {- description: "update metric settings",- inputSchema: z.object({- useMetric: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMetricSettings(ctx.client, ctx.companyId, params.useMetric);- return toMcpResult(result);- }, "Failed: settings_updateMetricSettings"),- );-- server.registerTool(- "settings_upsertApiKey",- {- description: "upsert api key",- inputSchema: z.object({- apiKey: apiKeyValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertApiKey(ctx.client, { ...params.apiKey, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: settings_upsertApiKey"),- );-- server.registerTool(- "settings_updateDigitalQuoteSetting",- {- description: "update digital quote setting",- inputSchema: z.object({- digitalQuoteEnabled: z.boolean(),- digitalQuoteNotificationGroup: z.array(z.string()),- digitalQuoteIncludesPurchaseOrders: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDigitalQuoteSetting(ctx.client, ctx.companyId, params.digitalQuoteEnabled, params.digitalQuoteNotificationGroup, params.digitalQuoteIncludesPurchaseOrders);- return toMcpResult(result);- }, "Failed: settings_updateDigitalQuoteSetting"),- );-- server.registerTool(- "settings_updateIntegrationMetadata",- {- description: "update logo dark",- inputSchema: z.object({- logoDark: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateIntegrationMetadata(ctx.client, ctx.companyId, params.integrationId, params.metadata, ctx.userId);- return toMcpResult(result);- }, "Failed: settings_updateLogoDark"),- );-- server.registerTool(- "settings_updateLogoLight",- {- description: "update logo light",- inputSchema: z.object({- logoLight: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoLight(ctx.client, ctx.companyId, params.logoLight);- return toMcpResult(result);- }, "Failed: settings_updateLogoLight"),- );-- server.registerTool(- "settings_updateLogoDarkIcon",- {- description: "update logo dark icon",- inputSchema: z.object({- logoDarkIcon: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoDarkIcon(ctx.client, ctx.companyId, params.logoDarkIcon);- return toMcpResult(result);- }, "Failed: settings_updateLogoDarkIcon"),- );-- server.registerTool(- "settings_updateLogoLightIcon",- {- description: "update logo light icon",- inputSchema: z.object({- logoLightIcon: z.string().nullable(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoLightIcon(ctx.client, ctx.companyId, params.logoLightIcon);- return toMcpResult(result);- }, "Failed: settings_updateLogoLightIcon"),- );-- server.registerTool(- "settings_updateMaterialGeneratedIdsSetting",- {- description: "update material generated ids setting",- inputSchema: z.object({- materialGeneratedIds: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMaterialGeneratedIdsSetting(ctx.client, ctx.companyId, params.materialGeneratedIds);- return toMcpResult(result);- }, "Failed: settings_updateMaterialGeneratedIdsSetting"),- );-- server.registerTool(- "settings_updateMaterialUnitsSetting",- {- description: "update material units setting",- inputSchema: z.object({- useMetric: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMaterialUnitsSetting(ctx.client, ctx.companyId, params.useMetric);- return toMcpResult(result);- }, "Failed: settings_updateMaterialUnitsSetting"),- );-- server.registerTool(- "settings_updateProductLabelSize",- {- description: "update product label size",- inputSchema: z.object({- productLabelSize: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateProductLabelSize(ctx.client, ctx.companyId, params.productLabelSize);- return toMcpResult(result);- }, "Failed: settings_updateProductLabelSize"),- );-- server.registerTool(- "settings_updatePurchasingPdfThumbnails",- {- description: "update purchasing pdf thumbnails",- inputSchema: z.object({- includeThumbnailsOnPurchasingPdfs: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchasingPdfThumbnails(ctx.client, ctx.companyId, params.includeThumbnailsOnPurchasingPdfs);- return toMcpResult(result);- }, "Failed: settings_updatePurchasingPdfThumbnails"),- );-- server.registerTool(- "settings_updateSalesPdfThumbnails",- {- description: "update sales pdf thumbnails",- inputSchema: z.object({- includeThumbnailsOnSalesPdfs: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesPdfThumbnails(ctx.client, ctx.companyId, params.includeThumbnailsOnSalesPdfs);- return toMcpResult(result);- }, "Failed: settings_updateSalesPdfThumbnails"),- );-- server.registerTool(- "settings_updateJobTravelerWorkInstructions",- {- description: "update job traveler work instructions",- inputSchema: z.object({- jobTravelerIncludeWorkInstructions: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateJobTravelerWorkInstructions(ctx.client, ctx.companyId, params.jobTravelerIncludeWorkInstructions);- return toMcpResult(result);- }, "Failed: settings_updateJobTravelerWorkInstructions"),- );-- server.registerTool(- "settings_updateTimeCardSetting",- {- description: "update time card setting",- inputSchema: z.object({- timeCardEnabled: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateTimeCardSetting(ctx.client, ctx.companyId, params.timeCardEnabled);- return toMcpResult(result);- }, "Failed: settings_updateTimeCardSetting"),- );-- server.registerTool(- "settings_updateKanbanOutputSetting",- {- description: "update console setting",- inputSchema: z.object({- consoleEnabled: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateKanbanOutputSetting(ctx.client, ctx.companyId, params.kanbanOutput);- return toMcpResult(result);- }, "Failed: settings_updateKanbanOutputSetting"),- );-- server.registerTool(- "settings_updateLogoDark",- {- description: "update rfq ready setting",- inputSchema: z.object({- rfqReadyNotificationGroup: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoDark(ctx.client, ctx.companyId, params.logoDark);- return toMcpResult(result);- }, "Failed: settings_updateLogoDark"),- );-- server.registerTool(- "settings_updateLogoDarkIcon",- {- description: "update suggestion notification setting",- inputSchema: z.object({- suggestionNotificationGroup: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoDarkIcon(ctx.client, ctx.companyId, params.logoDarkIcon);- return toMcpResult(result);- }, "Failed: settings_updateLogoDarkIcon"),- );-- server.registerTool(- "settings_updateLogoLight",- {- description: "update logo light",- inputSchema: {- logoLight: z.string().nullable(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoLight(ctx.client, ctx.companyId, params.logoLight);- return toMcpResult(result);- }, "Failed: settings_updateLogoLight"),- );-- server.registerTool(- "settings_updateLogoLightIcon",- {- description: "update logo light icon",- inputSchema: {- logoLightIcon: z.string().nullable(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLogoLightIcon(ctx.client, ctx.companyId, params.logoLightIcon);- return toMcpResult(result);- }, "Failed: settings_updateLogoLightIcon"),- );-- server.registerTool(- "settings_updateMaintenanceDispatchNotificationSettings",- {- description: "update maintenance dispatch notification settings",- inputSchema: z.object({- settings: z.object({- maintenanceDispatchNotificationGroup: z.array(z.string()).optional(),- qualityDispatchNotificationGroup: z.array(z.string()).optional(),- operationsDispatchNotificationGroup: z.array(z.string()).optional(),- otherDispatchNotificationGroup: z.array(z.string()).optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMaintenanceDispatchNotificationSettings(ctx.client, ctx.companyId, params.settings);- return toMcpResult(result);- }, "Failed: settings_updateMaintenanceDispatchNotificationSettings"),- );-- server.registerTool(- "settings_updateMaterialGeneratedIdsSetting",- {- description: "update supplier quote notification setting",- inputSchema: z.object({- supplierQuoteNotificationGroup: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMaterialGeneratedIdsSetting(ctx.client, ctx.companyId, params.materialGeneratedIds);- return toMcpResult(result);- }, "Failed: settings_updateMaterialGeneratedIdsSetting"),- );-- server.registerTool(- "settings_updateMetricSettings",- {- description: "update metric settings",- inputSchema: {- useMetric: z.boolean(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateMetricSettings(ctx.client, ctx.companyId, params.useMetric);- return toMcpResult(result);- }, "Failed: settings_updateMetricSettings"),- );-- server.registerTool(- "settings_updateProductLabelSize",- {- description: "update product label size",- inputSchema: {- productLabelSize: z.string(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateProductLabelSize(ctx.client, ctx.companyId, params.productLabelSize);- return toMcpResult(result);- }, "Failed: settings_updateProductLabelSize"),- );-- server.registerTool(- "settings_updatePurchasePriceUpdateTimingSetting",- {- description: "update purchase price update timing setting",- inputSchema: z.object({- purchasePriceUpdateTiming: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchasePriceUpdateTimingSetting(ctx.client, ctx.companyId, params.purchasePriceUpdateTiming);- return toMcpResult(result);- }, "Failed: settings_updatePurchasePriceUpdateTimingSetting"),- );-- server.registerTool(- "settings_updateLeadTimesOnReceiptSetting",- {- description: "update lead times on receipt setting",- inputSchema: z.object({- updateLeadTimesOnReceipt: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateLeadTimesOnReceiptSetting(ctx.client, ctx.companyId, params.updateLeadTimesOnReceipt);- return toMcpResult(result);- }, "Failed: settings_updateLeadTimesOnReceiptSetting"),- );-- server.registerTool(- "settings_updateAccountsPayableAddressSetting",- {- description: "update accounts payable address setting",- inputSchema: z.object({- accountsPayableAddress: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsPayableAddressSetting(ctx.client, ctx.companyId, params.accountsPayableAddress);- return toMcpResult(result);- }, "Failed: settings_updateAccountsPayableAddressSetting"),- );-- server.registerTool(- "settings_updateAccountsReceivableAddressSetting",- {- description: "update accounts receivable address setting",- inputSchema: z.object({- accountsReceivableAddress: z.boolean(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsReceivableAddressSetting(ctx.client, ctx.companyId, params.accountsReceivableAddress);- return toMcpResult(result);- }, "Failed: settings_updateAccountsReceivableAddressSetting"),- );-- server.registerTool(- "settings_updateAccountsPayableEmail",- {- description: "update accounts payable email",- inputSchema: z.object({- accountsPayableEmail: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsPayableEmail(ctx.client, ctx.companyId, params.accountsPayableEmail);- return toMcpResult(result);- }, "Failed: settings_updateAccountsPayableEmail"),- );-- server.registerTool(- "settings_updateAccountsReceivableEmail",- {- description: "update accounts receivable email",- inputSchema: z.object({- accountsReceivableEmail: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateAccountsReceivableEmail(ctx.client, ctx.companyId, params.accountsReceivableEmail);- return toMcpResult(result);- }, "Failed: settings_updateAccountsReceivableEmail"),- );-- server.registerTool(- "settings_updateDefaultSupplierCc",- {- description: "update default supplier cc",- inputSchema: z.object({- defaultSupplierCc: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultSupplierCc(ctx.client, ctx.companyId, params.defaultSupplierCc);- return toMcpResult(result);- }, "Failed: settings_updateDefaultSupplierCc"),- );-- server.registerTool(- "settings_updateDefaultCustomerCc",- {- description: "update default customer cc",- inputSchema: z.object({- defaultCustomerCc: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateDefaultCustomerCc(ctx.client, ctx.companyId, params.defaultCustomerCc);- return toMcpResult(result);- }, "Failed: settings_updateDefaultCustomerCc"),- );-- server.registerTool(- "settings_updateQuoteLineCategoryMarkups",- {- description: "update quote line category markups",- inputSchema: z.object({- quoteLineCategoryMarkups: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateQuoteLineCategoryMarkups(ctx.client, ctx.companyId, params.quoteLineCategoryMarkups);- return toMcpResult(result);- }, "Failed: settings_updateQuoteLineCategoryMarkups"),- );-- server.registerTool(- "settings_updatePurchasingPdfThumbnails",- {- description: "update purchasing pdf thumbnails",- inputSchema: {- includeThumbnailsOnPurchasingPdfs: z.boolean(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updatePurchasingPdfThumbnails(ctx.client, ctx.companyId, params.includeThumbnailsOnPurchasingPdfs);- return toMcpResult(result);- }, "Failed: settings_updatePurchasingPdfThumbnails"),- );-- server.registerTool(- "settings_updateRfqReadySetting",- {- description: "update rfq ready setting",- inputSchema: {- rfqReadyNotificationGroup: z.array(z.string()),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateRfqReadySetting(ctx.client, ctx.companyId, params.rfqReadyNotificationGroup);- return toMcpResult(result);- }, "Failed: settings_updateRfqReadySetting"),- );-- server.registerTool(- "settings_updateSalesPdfThumbnails",- {- description: "update sales pdf thumbnails",- inputSchema: {- includeThumbnailsOnSalesPdfs: z.boolean(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSalesPdfThumbnails(ctx.client, ctx.companyId, params.includeThumbnailsOnSalesPdfs);- return toMcpResult(result);- }, "Failed: settings_updateSalesPdfThumbnails"),- );-- server.registerTool(- "settings_updateSequence",- {- description: "update sequence",- inputSchema: z.object({- table: z.string(),- sequence: sequenceValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSequence(ctx.client, params.table, ctx.companyId, { ...params.sequence, updatedBy: ctx.userId, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: settings_updateSequence"),- );-- server.registerTool(- "settings_updateSuggestionNotificationSetting",- {- description: "update integration metadata",- inputSchema: z.object({- integrationId: z.string(),- metadata: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSuggestionNotificationSetting(ctx.client, ctx.companyId, params.suggestionNotificationGroup);- return toMcpResult(result);- }, "Failed: settings_updateSuggestionNotificationSetting"),- );-- server.registerTool(- "settings_updateSupplierQuoteNotificationSetting",- {- description: "update supplier quote notification setting",- inputSchema: {- supplierQuoteNotificationGroup: z.array(z.string()),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSupplierQuoteNotificationSetting(ctx.client, ctx.companyId, params.supplierQuoteNotificationGroup);- return toMcpResult(result);- }, "Failed: settings_updateSupplierQuoteNotificationSetting"),- );-- server.registerTool(- "settings_upsertApiKey",- {- description: "upsert api key",- inputSchema: {- apiKey: apiKeyValidator,- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertApiKey(ctx.client, { ...params.apiKey, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: settings_upsertApiKey"),- );-- server.registerTool(- "settings_updateConsoleSetting",- {- description: "update console setting",- inputSchema: {- consoleEnabled: z.boolean(),- },- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateConsoleSetting(ctx.client, ctx.companyId, params.consoleEnabled, ctx.userId);- return toMcpResult(result);- }, "Failed: settings_updateConsoleSetting"),- );-- server.registerTool(- "settings_upsertWebhook",- {- description: "upsert webhook",- inputSchema: z.object({- webhook: webhookValidator,- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertWebhook(ctx.client, { ...params.webhook, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: settings_upsertWebhook"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/shared.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/shared.tsdeleted file mode 100644index 19c64a8cc7..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/shared.ts+++ /dev/null@@ -1,754 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- approveRequest,- canApproveRequest,- canApproveRequestInWindow,- cancelApprovalRequest,- canViewApprovalRequest,- createApprovalRequest,- deleteApprovalRule,- deleteNote,- deleteSavedView,- generateEmbedding,- getApprovalById,- getApprovalRequestsByDocument,- getApprovalRuleByAmount,- getApproverUserIdsForRule,- getApprovalRuleById,- getApprovalRules,- getApprovalRulesForApprover,- getApprovalsForUser,- getBase64ImageFromSupabase,- getCountries,- getLatestApprovalRequestForDocument,- getModelByItemId,- getNotes,- getPendingApprovalsForApprover,- getPeriods,- getSavedViews,- getTagsList,- hasPendingApproval,- importCsv,- insertNote,- insertTag,- isApprovalRequired,- getExternalLink,- upsertExternalLink,- getCustomerPortals,- getCustomerPortal,- deleteCustomerPortal,- updateModelThumbnail,- upsertModelUpload,- updateNote,- rejectRequest,- upsertApprovalRule,- upsertSavedView,- updateSavedViewOrder,-} from "~/modules/shared/shared.service";--export const registerSharedTools: RegisterTools = (server, ctx) => {- server.registerTool(- "shared_approveRequest",- {- description: "approve request",- inputSchema: z.object({- db: z.any(),- id: z.string(),- notes: z.string().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await approveRequest(ctx.client, params.db, params.id, ctx.userId, params.notes);- return toMcpResult(result);- }, "Failed: shared_approveRequest"),- );-- server.registerTool(- "shared_canApproveRequest",- {- description: "can approve request",- inputSchema: z.object({- approvalRequest: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await canApproveRequest(ctx.client, params.approvalRequest, ctx.userId);- return toMcpResult(result);- }, "Failed: shared_canApproveRequest"),- );-- server.registerTool(- "shared_canApproveRequestInWindow",- {- description: "can approve request in window",- inputSchema: z.object({- approvalRequest: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await canApproveRequestInWindow(ctx.client, params.approvalRequest, ctx.userId);- return toMcpResult(result);- }, "Failed: shared_canApproveRequestInWindow"),- );-- server.registerTool(- "shared_cancelApprovalRequest",- {- description: "cancel approval request",- inputSchema: z.object({- id: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await cancelApprovalRequest(ctx.client, params.id, ctx.userId);- return toMcpResult(result);- }, "Failed: shared_cancelApprovalRequest"),- );-- server.registerTool(- "shared_canViewApprovalRequest",- {- description: "can view approval request",- inputSchema: z.object({- approvalRequest: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await canViewApprovalRequest(ctx.client, params.approvalRequest, ctx.userId);- return toMcpResult(result);- }, "Failed: shared_canViewApprovalRequest"),- );-- server.registerTool(- "shared_createApprovalRequest",- {- description: "create approval request",- inputSchema: z.object({- request: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await createApprovalRequest(ctx.client, params.request);- return toMcpResult(result);- }, "Failed: shared_createApprovalRequest"),- );-- server.registerTool(- "shared_deleteApprovalRule",- {- description: "delete approval rule",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteApprovalRule(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_deleteApprovalRule"),- );-- server.registerTool(- "shared_deleteNote",- {- description: "delete note",- inputSchema: z.object({- noteId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteNote(ctx.client, params.noteId);- return toMcpResult(result);- }, "Failed: shared_deleteNote"),- );-- server.registerTool(- "shared_deleteSavedView",- {- description: "delete saved view",- inputSchema: z.object({- viewId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteSavedView(ctx.client, params.viewId);- return toMcpResult(result);- }, "Failed: shared_deleteSavedView"),- );-- server.registerTool(- "shared_generateEmbedding",- {- description: "generate embedding",- inputSchema: z.object({- text: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await generateEmbedding(ctx.client, params.text);- return toMcpResult(result);- }, "Failed: shared_generateEmbedding"),- );-- server.registerTool(- "shared_getApprovalById",- {- description: "get approval by id",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalById(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: shared_getApprovalById"),- );-- server.registerTool(- "shared_getApprovalRequestsByDocument",- {- description: "get approval requests by document",- inputSchema: z.object({- documentType: z.any(),- documentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalRequestsByDocument(ctx.client, params.documentType, params.documentId);- return toMcpResult(result);- }, "Failed: shared_getApprovalRequestsByDocument"),- );-- server.registerTool(- "shared_getApprovalRuleByAmount",- {- description: "get approval rule by amount",- inputSchema: z.object({- documentType: z.any(),- amount: z.number().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalRuleByAmount(ctx.client, params.documentType, ctx.companyId, params.amount);- return toMcpResult(result);- }, "Failed: shared_getApprovalRuleByAmount"),- );-- server.registerTool(- "shared_getApproverUserIdsForRule",- {- description: "get approver user ids for rule",- inputSchema: z.object({- rule: z.any(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApproverUserIdsForRule(ctx.client, params.rule);- return toMcpResult(result);- }, "Failed: shared_getApproverUserIdsForRule"),- );-- server.registerTool(- "shared_getApprovalRuleById",- {- description: "get approval rule by id",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalRuleById(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_getApprovalRuleById"),- );-- server.registerTool(- "shared_getApprovalRules",- {- description: "get approval rules",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalRules(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_getApprovalRules"),- );-- server.registerTool(- "shared_getApprovalRulesForApprover",- {- description: "get approval rules for approver",- inputSchema: z.object({- documentType: z.any(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalRulesForApprover(ctx.client, params.documentType, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_getApprovalRulesForApprover"),- );-- server.registerTool(- "shared_getApprovalsForUser",- {- description: "get approvals for user",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0)- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getApprovalsForUser(ctx.client, ctx.userId, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: shared_getApprovalsForUser"),- );-- server.registerTool(- "shared_getBase64ImageFromSupabase",- {- description: "get base64 image from supabase",- inputSchema: z.object({- path: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getBase64ImageFromSupabase(ctx.client, params.path);- return toMcpResult(result);- }, "Failed: shared_getBase64ImageFromSupabase"),- );-- server.registerTool(- "shared_getCountries",- {- description: "get countries",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCountries(ctx.client);- return toMcpResult(result);- }, "Failed: shared_getCountries"),- );-- server.registerTool(- "shared_getLatestApprovalRequestForDocument",- {- description: "get latest approval request for document",- inputSchema: z.object({- documentType: z.any(),- documentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getLatestApprovalRequestForDocument(ctx.client, params.documentType, params.documentId);- return toMcpResult(result);- }, "Failed: shared_getLatestApprovalRequestForDocument"),- );-- server.registerTool(- "shared_getModelByItemId",- {- description: "get model by item id",- inputSchema: z.object({- itemId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getModelByItemId(ctx.client, params.itemId);- return toMcpResult(result);- }, "Failed: shared_getModelByItemId"),- );-- server.registerTool(- "shared_getNotes",- {- description: "get notes",- inputSchema: z.object({- documentId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getNotes(ctx.client, params.documentId);- return toMcpResult(result);- }, "Failed: shared_getNotes"),- );-- server.registerTool(- "shared_getPendingApprovalsForApprover",- {- description: "get pending approvals for approver",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPendingApprovalsForApprover(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_getPendingApprovalsForApprover"),- );-- server.registerTool(- "shared_getPeriods",- {- description: "get periods",- inputSchema: z.object({- arg1: z.object({- startDate: z.string(),- endDate: z.string()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPeriods(ctx.client, params.arg1);- return toMcpResult(result);- }, "Failed: shared_getPeriods"),- );-- server.registerTool(- "shared_getSavedViews",- {- description: "get saved views",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSavedViews(ctx.client, ctx.userId, ctx.companyId);- return toMcpResult(result);- }, "Failed: shared_getSavedViews"),- );-- server.registerTool(- "shared_getTagsList",- {- description: "get tags list",- inputSchema: z.object({- table: z.string().nullable().optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getTagsList(ctx.client, ctx.companyId, params.table);- return toMcpResult(result);- }, "Failed: shared_getTagsList"),- );-- server.registerTool(- "shared_hasPendingApproval",- {- description: "has pending approval",- inputSchema: z.object({- documentType: z.any(),- documentId: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await hasPendingApproval(ctx.client, params.documentType, params.documentId);- return toMcpResult(result);- }, "Failed: shared_hasPendingApproval"),- );-- server.registerTool(- "shared_importCsv",- {- description: "import csv",- inputSchema: z.object({- args: z.object({- table: z.string(),- filePath: z.string(),- columnMappings: z.any(),- enumMappings: z.any().optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await importCsv(ctx.client, { ...params.args, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: shared_importCsv"),- );-- server.registerTool(- "shared_insertNote",- {- description: "insert note",- inputSchema: z.object({- note: z.object({- note: z.string(),- documentId: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertNote(ctx.client, { ...params.note, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: shared_insertNote"),- );-- server.registerTool(- "shared_insertTag",- {- description: "insert tag",- inputSchema: z.object({- tag: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertTag(ctx.client, params.tag);- return toMcpResult(result);- }, "Failed: shared_insertTag"),- );-- server.registerTool(- "shared_isApprovalRequired",- {- description: "is approval required",- inputSchema: z.object({- documentType: z.any(),- amount: z.number().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await isApprovalRequired(ctx.client, params.documentType, ctx.companyId, params.amount);- return toMcpResult(result);- }, "Failed: shared_isApprovalRequired"),- );-- server.registerTool(- "shared_getExternalLink",- {- description: "get external link",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getExternalLink(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: shared_getExternalLink"),- );-- server.registerTool(- "shared_upsertExternalLink",- {- description: "upsert external link",- inputSchema: z.object({- externalLink: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertExternalLink(ctx.client, params.externalLink);- return toMcpResult(result);- }, "Failed: shared_upsertExternalLink"),- );-- server.registerTool(- "shared_getCustomerPortals",- {- description: "get customer portals",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerPortals(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: shared_getCustomerPortals"),- );-- server.registerTool(- "shared_getCustomerPortal",- {- description: "get customer portal",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomerPortal(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: shared_getCustomerPortal"),- );-- server.registerTool(- "shared_deleteCustomerPortal",- {- description: "delete customer portal",- inputSchema: z.object({- id: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteCustomerPortal(ctx.client, params.id);- return toMcpResult(result);- }, "Failed: shared_deleteCustomerPortal"),- );-- server.registerTool(- "shared_updateModelThumbnail",- {- description: "update model thumbnail",- inputSchema: z.object({- modelId: z.string(),- thumbnailPath: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateModelThumbnail(ctx.client, params.modelId, params.thumbnailPath);- return toMcpResult(result);- }, "Failed: shared_updateModelThumbnail"),- );-- server.registerTool(- "shared_upsertModelUpload",- {- description: "upsert model upload",- inputSchema: z.object({- upload: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertModelUpload(ctx.client, { ...params.upload, companyId: ctx.companyId, createdBy: ctx.userId });- return toMcpResult(result);- }, "Failed: shared_upsertModelUpload"),- );-- server.registerTool(- "shared_updateNote",- {- description: "update note",- inputSchema: z.object({- id: z.string(),- note: z.string(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateNote(ctx.client, params.id, params.note);- return toMcpResult(result);- }, "Failed: shared_updateNote"),- );-- server.registerTool(- "shared_rejectRequest",- {- description: "reject request",- inputSchema: z.object({- db: z.any(),- id: z.string(),- notes: z.string().optional(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await rejectRequest(ctx.client, params.db, params.id, ctx.userId, params.notes);- return toMcpResult(result);- }, "Failed: shared_rejectRequest"),- );-- server.registerTool(- "shared_upsertApprovalRule",- {- description: "upsert approval rule",- inputSchema: z.object({- rule: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertApprovalRule(ctx.client, params.rule);- return toMcpResult(result);- }, "Failed: shared_upsertApprovalRule"),- );-- server.registerTool(- "shared_upsertSavedView",- {- description: "upsert saved view",- inputSchema: z.object({- view: z.object({- id: z.string().optional(),- name: z.string(),- description: z.string().optional(),- table: z.string(),- type: z.enum(["Public", "Private"]),- filters: z.array(z.string()).optional(),- sorts: z.array(z.string()).optional(),- columnPinning: z.any().optional(),- columnVisibility: z.any().optional(),- columnOrder: z.array(z.string()).optional()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertSavedView(ctx.client, { ...params.view, companyId: ctx.companyId, userId: ctx.userId });- return toMcpResult(result);- }, "Failed: shared_upsertSavedView"),- );-- server.registerTool(- "shared_updateSavedViewOrder",- {- description: "update saved view order",- inputSchema: z.object({- updates: z.object({- id: z.string(),- sortOrder: z.number()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await updateSavedViewOrder(ctx.client, { ...params.updates, updatedBy: ctx.userId });- return toMcpResult(result);- }, "Failed: shared_updateSavedViewOrder"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/users.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/users.tsdeleted file mode 100644index d7c22d28ed..0000000000--- a/apps/erp/app/routes/api+/mcp+/lib/tools/users.ts+++ /dev/null@@ -1,444 +0,0 @@-// @ts-nocheck-// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually-import { z } from "zod";-import type { RegisterTools } from "../types";-import {- READ_ONLY_ANNOTATIONS,- WRITE_ANNOTATIONS,- DESTRUCTIVE_ANNOTATIONS,- toMcpResult,- withErrorHandling,-} from "../types";-import {- deleteEmployeeType,- deleteGroup,- getCompaniesForUser,- getCustomers,- getEmployee,- getEmployees,- getConsoleOperators,- getEmployeeType,- getEmployeeTypes,- getInvitable,- getModules,- getGroup,- getGroupMembers,- getGroups,- getGroupEmails,- getPermissionsByEmployeeType,- getSuppliers,- getUsers,- getUserEmails,- insertEmployeeType,- insertGroup,- upsertEmployeeType,- upsertEmployeeTypePermissions,- upsertGroup,- upsertGroupMembers,-} from "~/modules/users/users.service";--export const registerUsersTools: RegisterTools = (server, ctx) => {- server.registerTool(- "users_deleteEmployeeType",- {- description: "delete employee type",- inputSchema: z.object({- employeeTypeId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteEmployeeType(ctx.client, params.employeeTypeId);- return toMcpResult(result);- }, "Failed: users_deleteEmployeeType"),- );-- server.registerTool(- "users_deleteGroup",- {- description: "delete group",- inputSchema: z.object({- groupId: z.string(),- }),- annotations: DESTRUCTIVE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await deleteGroup(ctx.client, params.groupId);- return toMcpResult(result);- }, "Failed: users_deleteGroup"),- );-- server.registerTool(- "users_getCompaniesForUser",- {- description: "get companies for user",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCompaniesForUser(ctx.client, ctx.userId);- return toMcpResult(result);- }, "Failed: users_getCompaniesForUser"),- );-- server.registerTool(- "users_getCustomers",- {- description: "get customers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getCustomers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getCustomers"),- );-- server.registerTool(- "users_getEmployee",- {- description: "get employee",- inputSchema: z.object({- id: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployee(ctx.client, params.id, ctx.companyId);- return toMcpResult(result);- }, "Failed: users_getEmployee"),- );-- server.registerTool(- "users_getEmployees",- {- description: "get employees",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployees(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getEmployees"),- );-- server.registerTool(- "users_getConsoleOperators",- {- description: "get console operators",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getConsoleOperators(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getConsoleOperators"),- );-- server.registerTool(- "users_getEmployeeType",- {- description: "get employee type",- inputSchema: z.object({- employeeTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployeeType(ctx.client, params.employeeTypeId);- return toMcpResult(result);- }, "Failed: users_getEmployeeType"),- );-- server.registerTool(- "users_getEmployeeTypes",- {- description: "get employee types",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getEmployeeTypes(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getEmployeeTypes"),- );-- server.registerTool(- "users_getInvitable",- {- description: "get invitable",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getInvitable(ctx.client, ctx.companyId);- return toMcpResult(result);- }, "Failed: users_getInvitable"),- );-- server.registerTool(- "users_getModules",- {- description: "get modules",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getModules(ctx.client);- return toMcpResult(result);- }, "Failed: users_getModules"),- );-- server.registerTool(- "users_getGroup",- {- description: "get group",- inputSchema: z.object({- groupId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGroup(ctx.client, params.groupId);- return toMcpResult(result);- }, "Failed: users_getGroup"),- );-- server.registerTool(- "users_getGroupMembers",- {- description: "get group members",- inputSchema: z.object({- groupId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGroupMembers(ctx.client, params.groupId);- return toMcpResult(result);- }, "Failed: users_getGroupMembers"),- );-- server.registerTool(- "users_getGroups",- {- description: "get groups",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable(),- uid: z.string().nullable()- }).optional(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGroups(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getGroups"),- );-- server.registerTool(- "users_getGroupEmails",- {- description: "get group emails",- inputSchema: z.object({- groupIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getGroupEmails(ctx.client, params.groupIds);- return toMcpResult(result);- }, "Failed: users_getGroupEmails"),- );-- server.registerTool(- "users_getPermissionsByEmployeeType",- {- description: "get permissions by employee type",- inputSchema: z.object({- employeeTypeId: z.string(),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getPermissionsByEmployeeType(ctx.client, params.employeeTypeId);- return toMcpResult(result);- }, "Failed: users_getPermissionsByEmployeeType"),- );-- server.registerTool(- "users_getSuppliers",- {- description: "get suppliers",- inputSchema: z.object({- args: z.object({- limit: z.number().int().default(100),- offset: z.number().int().default(0),- search: z.string().nullable()- }),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getSuppliers(ctx.client, ctx.companyId, params.args);- return toMcpResult(result);- }, "Failed: users_getSuppliers"),- );-- server.registerTool(- "users_getUsers",- {- description: "get users",- inputSchema: z.object({}),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUsers(ctx.client);- return toMcpResult(result);- }, "Failed: users_getUsers"),- );-- server.registerTool(- "users_getUserEmails",- {- description: "get user emails",- inputSchema: z.object({- userIds: z.array(z.string()),- }),- annotations: READ_ONLY_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await getUserEmails(ctx.client, params.userIds);- return toMcpResult(result);- }, "Failed: users_getUserEmails"),- );-- server.registerTool(- "users_insertEmployeeType",- {- description: "insert employee type",- inputSchema: z.object({- employeeType: z.object({- name: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertEmployeeType(ctx.client, { ...params.employeeType, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: users_insertEmployeeType"),- );-- server.registerTool(- "users_insertGroup",- {- description: "insert group",- inputSchema: z.object({- group: z.object({- name: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await insertGroup(ctx.client, { ...params.group, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: users_insertGroup"),- );-- server.registerTool(- "users_upsertEmployeeType",- {- description: "upsert employee type",- inputSchema: z.object({- employeeType: z.any(),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertEmployeeType(ctx.client, { ...params.employeeType, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: users_upsertEmployeeType"),- );-- server.registerTool(- "users_upsertEmployeeTypePermissions",- {- description: "upsert employee type permissions",- inputSchema: z.object({- employeeTypeId: z.string(),- permissions: z.object({- name: z.string(),- permission: z.any()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertEmployeeTypePermissions(ctx.client, params.employeeTypeId, ctx.companyId, params.permissions);- return toMcpResult(result);- }, "Failed: users_upsertEmployeeTypePermissions"),- );-- server.registerTool(- "users_upsertGroup",- {- description: "upsert group",- inputSchema: z.object({- arg1: z.object({- id: z.string(),- name: z.string()- }),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertGroup(ctx.client, { ...params.arg1, companyId: ctx.companyId });- return toMcpResult(result);- }, "Failed: users_upsertGroup"),- );-- server.registerTool(- "users_upsertGroupMembers",- {- description: "upsert group members",- inputSchema: z.object({- groupId: z.string(),- selections: z.array(z.string()),- }),- annotations: WRITE_ANNOTATIONS,- },- withErrorHandling(async (params) => {- const result = await upsertGroupMembers(ctx.client, params.groupId, params.selections);- return toMcpResult(result);- }, "Failed: users_upsertGroupMembers"),- );-};diff --git a/apps/erp/app/routes/api+/mcp+/lib/types.ts b/apps/erp/app/routes/api+/mcp+/lib/types.tsindex 6cc80888ff..c0e3b402a6 100644--- a/apps/erp/app/routes/api+/mcp+/lib/types.ts+++ b/apps/erp/app/routes/api+/mcp+/lib/types.ts@@ -1,5 +1,4 @@import type { Database } from "@carbon/database";-import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import type { SupabaseClient } from "@supabase/supabase-js";export interface McpContext {@@ -9,9 +8,11 @@ export interface McpContext {userId: string;}-export type RegisterTools = (server: McpServer, ctx: McpContext) => void;--export type AuthField = "companyId" | "createdBy" | "updatedBy";+export type AuthField =+ | "companyId"+ | "companyGroupId"+ | "createdBy"+ | "updatedBy";export const READ_ONLY_ANNOTATIONS = {readOnlyHint: true,@@ -34,24 +35,6 @@ export const DESTRUCTIVE_ANNOTATIONS = {openWorldHint: false} as const;-export function toMcpResult(result: { data: unknown; error: unknown }) {- if (result.error) {- const message =- typeof result.error === "object" &&- result.error !== null &&- "message" in result.error- ? (result.error as { message: string }).message- : JSON.stringify(result.error);- return {- content: [{ type: "text" as const, text: message }],- isError: true- };- }- return {- content: [{ type: "text" as const, text: JSON.stringify(result.data) }]- };-}-export function withErrorHandling<T extends Record<string, unknown>>(handler: (params: T) => Promise<{content: { type: "text"; text: string }[];diff --git a/apps/erp/app/routes/oauth+/authorize.tsx b/apps/erp/app/routes/oauth+/authorize.tsxindex 6f96a6f658..2f09dfafbc 100644--- a/apps/erp/app/routes/oauth+/authorize.tsx+++ b/apps/erp/app/routes/oauth+/authorize.tsx@@ -1,6 +1,7 @@import { requirePermissions } from "@carbon/auth/auth.server";+import { getCarbonServiceRole } from "@carbon/auth/client.server";import { validator } from "@carbon/form";-import { Button } from "@carbon/react";+import { Button, Heading, VStack } from "@carbon/react";import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { data, Form, redirect, useLoaderData } from "react-router";import { z } from "zod";@@ -10,36 +11,61 @@ export async function loader({ request }: LoaderFunctionArgs) {update: "settings"});- const [companies] = await Promise.all([- client.from("userToCompany").select("companyId").eq("userId", userId)- ]);+ const userCompanies = await client+ .from("userToCompany")+ .select("companyId, company:companyId(name)")+ .eq("userId", userId);- if (!companies.data) {- throw new Error("Failed to load companies for user");- }+ const companies = (userCompanies.data ?? []).map((uc) => ({+ id: uc.companyId,+ name: (uc.company as unknown as { name: string })?.name ?? uc.companyId+ }));const url = new URL(request.url);const clientId = url.searchParams.get("client_id");const redirectUri = url.searchParams.get("redirect_uri");- const responseType = url.searchParams.get("response_type");- const state = url.searchParams.get("state");+ const scope = url.searchParams.get("scope");++ let clientName = "Unknown Application";+ let redirectDomain: string | null = null;+ if (clientId) {+ const serviceRole = getCarbonServiceRole();+ const oauthClient = await serviceRole+ .from("oauthClient")+ .select("name")+ .eq("clientId", clientId)+ .single();+ if (oauthClient.data) {+ clientName = oauthClient.data.name;+ }+ }+ if (redirectUri) {+ try {+ redirectDomain = new URL(redirectUri).hostname;+ } catch {+ // invalid URL — will be caught by the action validator+ }+ }- return { companyId, companies, clientId, redirectUri, responseType, state };+ return {+ companyId,+ companies,+ clientName,+ redirectDomain,+ scope+ };}-const authorizeValidator = z.object({- client_id: z.string(),- redirect_uri: z.string().url(),- response_type: z.literal("code"),- state: z.string().optional()+const formValidator = z.object({+ company_id: z.string()});export async function action({ request }: ActionFunctionArgs) {- const { client, companyId, userId } = await requirePermissions(request, {+ const { client, userId } = await requirePermissions(request, {update: "settings"});- const validation = await validator(authorizeValidator).validate(+ const validation = await validator(formValidator).validate(await request.formData());@@ -47,34 +73,84 @@ export async function action({ request }: ActionFunctionArgs) {return data({ error: "Invalid request" }, { status: 400 });}- const { client_id, redirect_uri, state } = validation.data;+ const { company_id } = validation.data;- // Verify client_id and redirect_uri- const [oauthClient] = await Promise.all([- client.from("oauthClient").select("*").eq("clientId", client_id).single()- ]);+ // Read OAuth params from the URL (not the form) to avoid whitespace+ // corruption from copy-paste line wrapping in hidden input values+ const url = new URL(request.url);+ const param = (key: string) =>+ url.searchParams.get(key)?.replace(/\s/g, "") ?? null;+ const response_type = url.searchParams.get("response_type");+ const client_id = param("client_id");+ const redirect_uri = url.searchParams.get("redirect_uri");+ const state = url.searchParams.get("state");+ const scope = url.searchParams.get("scope");+ const code_challenge = param("code_challenge");+ const code_challenge_method = param("code_challenge_method");++ if (response_type !== "code") {+ return data(+ { error: "Unsupported response_type. Must be 'code'." },+ { status: 400 }+ );+ }++ if (!client_id || !redirect_uri) {+ return data(+ { error: "Missing client_id or redirect_uri" },+ { status: 400 }+ );+ }++ // Verify the user belongs to the selected company+ const membership = await client+ .from("userToCompany")+ .select("companyId")+ .eq("userId", userId)+ .eq("companyId", company_id)+ .single();++ if (!membership.data) {+ return data({ error: "Invalid company" }, { status: 403 });+ }++ const serviceRole = getCarbonServiceRole();++ const oauthClientResult = await serviceRole+ .from("oauthClient")+ .select("*")+ .eq("clientId", client_id)+ .single();++ if (!oauthClientResult.data) {+ return data({ error: "Invalid client" }, { status: 400 });+ }++ const oauthClient = oauthClientResult.data;++ if (!oauthClient.redirectUris.includes(redirect_uri)) {+ return data({ error: "Invalid redirect URI" }, { status: 400 });+ }- if (- !oauthClient.data ||- !oauthClient.data.redirectUris.includes(redirect_uri)- ) {- return data({ error: "Invalid client or redirect URI" }, { status: 400 });+ if (oauthClient.tokenEndpointAuthMethod === "none" && !code_challenge) {+ return data({ error: "PKCE required for public clients" }, { status: 400 });}// Generate and store authorization codeconst code = crypto.randomUUID();- const [codeResult] = await Promise.all([- client.from("oauthCode").insert([- {- code,- clientId: client_id,- userId,- companyId,- redirectUri: redirect_uri,- createdAt: new Date().toISOString(),- expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString() // 10 minutes expiration- }- ])+ const codeResult = await serviceRole.from("oauthCode").insert([+ {+ code,+ clientId: client_id,+ userId,+ companyId: company_id,+ redirectUri: redirect_uri,+ scope: scope || null,+ codeChallenge: code_challenge || null,+ codeChallengeMethod: code_challenge_method || null,+ createdAt: new Date().toISOString(),+ expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString()+ }]);if (codeResult.error) {@@ -95,20 +171,82 @@ export async function action({ request }: ActionFunctionArgs) {}export default function AuthorizeRoute() {- const { clientId, redirectUri, responseType, state } =+ const { clientName, companyId, companies, redirectDomain, scope } =useLoaderData<typeof loader>();return (- <div className="max-w-md mx-auto mt-8">- <h2 className="text-2xl font-bold mb-4">Authorize Application</h2>- <p className="mb-4">Do you want to authorize this application?</p>- <Form method="post">- <input type="hidden" name="client_id" value={clientId || ""} />- <input type="hidden" name="redirect_uri" value={redirectUri || ""} />- <input type="hidden" name="response_type" value={responseType || ""} />- {state && <input type="hidden" name="state" value={state} />}- <Button>Authorize</Button>- </Form>+ <div className="flex min-h-dvh items-center justify-center p-4">+ <div className="flex w-[380px] flex-col items-center space-y-6">+ <div className="flex justify-center">+ <img+ src="/carbon-mark-light.svg"+ alt="Carbon Logo"+ className="w-24 dark:hidden"+ />+ <img+ src="/carbon-mark-dark.svg"+ alt="Carbon Logo"+ className="hidden w-24 dark:block"+ />+ </div>+ <div className="w-full rounded-lg p-8 md:border md:border-border md:bg-card md:shadow-lg">+ <Form method="post">+ <VStack spacing={4} className="items-center">+ <Heading size="h3" className="text-balance text-center">+ Authorize Application+ </Heading>+ <p className="text-center text-sm text-pretty text-muted-foreground">+ <strong className="text-foreground">{clientName}</strong>+ {redirectDomain && (+ <span className="text-xs"> ({redirectDomain})</span>+ )}{" "}+ is requesting access to your Carbon account.+ </p>+ <div className="flex w-full flex-col gap-1.5">+ <label+ htmlFor="company_id"+ className="text-sm font-medium text-foreground"+ >+ Company+ </label>+ {companies.length === 1 ? (+ <>+ <input+ type="hidden"+ name="company_id"+ value={companies[0].id}+ />+ <p className="text-sm text-muted-foreground">+ {companies[0].name}+ </p>+ </>+ ) : (+ <select+ id="company_id"+ name="company_id"+ defaultValue={companyId}+ className="h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground shadow-sm focus:outline-none focus:ring-1 focus:ring-ring"+ >+ {companies.map((c) => (+ <option key={c.id} value={c.id}>+ {c.name}+ </option>+ ))}+ </select>+ )}+ </div>+ {scope && (+ <div className="w-full rounded-md border border-border bg-muted/50 px-3 py-2 text-center text-sm text-muted-foreground">+ Scope: {scope}+ </div>+ )}+ <Button type="submit" size="lg" className="w-full">+ Authorize+ </Button>+ </VStack>+ </Form>+ </div>+ </div></div>);}diff --git a/apps/erp/app/routes/oauth+/register.ts b/apps/erp/app/routes/oauth+/register.tsnew file mode 100644index 0000000000..0ee8d7c0c8--- /dev/null+++ b/apps/erp/app/routes/oauth+/register.ts@@ -0,0 +1,135 @@+import { hashOAuthSecret } from "@carbon/auth/auth.server";+import { getCarbonServiceRole } from "@carbon/auth/client.server";+import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";+import { z } from "zod";++const corsHeaders = {+ "Access-Control-Allow-Origin": "*",+ "Access-Control-Allow-Methods": "POST, OPTIONS",+ "Access-Control-Allow-Headers": "Content-Type",+ "Content-Type": "application/json"+};++function jsonResponse(body: unknown, status: number = 200) {+ return new Response(JSON.stringify(body), {+ status,+ headers: corsHeaders+ });+}++const clientRegistrationSchema = z.object({+ client_name: z.string().min(1),+ redirect_uris: z.array(z.string().url()).min(1),+ grant_types: z+ .array(z.string())+ .optional()+ .default(["authorization_code", "refresh_token"]),+ response_types: z.array(z.string()).optional().default(["code"]),+ token_endpoint_auth_method: z+ .enum(["client_secret_post", "client_secret_basic", "none"])+ .optional()+ .default("none"),+ client_uri: z.string().url().optional(),+ logo_uri: z.string().url().optional(),+ scope: z.string().optional()+});++export async function loader({ request }: LoaderFunctionArgs) {+ if (request.method === "OPTIONS") {+ return new Response(null, { status: 204, headers: corsHeaders });+ }+ return jsonResponse(+ { error: "method_not_allowed", error_description: "Use POST" },+ 405+ );+}++export async function action({ request }: ActionFunctionArgs) {+ const client = getCarbonServiceRole();++ let body: unknown;+ try {+ body = await request.json();+ } catch {+ return jsonResponse(+ { error: "invalid_request", error_description: "Invalid JSON body" },+ 400+ );+ }++ const validation = clientRegistrationSchema.safeParse(body);+ if (!validation.success) {+ return jsonResponse(+ {+ error: "invalid_client_metadata",+ error_description: validation.error.issues+ .map((i) => i.message)+ .join(", ")+ },+ 400+ );+ }++ const {+ client_name,+ redirect_uris,+ grant_types,+ response_types,+ token_endpoint_auth_method,+ client_uri,+ logo_uri,+ scope+ } = validation.data;++ // Generate client credentials+ const clientId = `mcp_${crypto.randomUUID().replace(/-/g, "")}`;+ const rawClientSecret =+ token_endpoint_auth_method !== "none" ? crypto.randomUUID() : null;++ const insertResult = await client.from("oauthClient").insert([+ {+ clientId,+ clientSecret: rawClientSecret ? hashOAuthSecret(rawClientSecret) : null,+ name: client_name,+ redirectUris: redirect_uris,+ grantTypes: grant_types,+ responseTypes: response_types,+ tokenEndpointAuthMethod: token_endpoint_auth_method,+ clientUri: client_uri || null,+ logoUri: logo_uri || null,+ scope: scope || null,+ createdAt: new Date().toISOString(),+ updatedAt: new Date().toISOString()+ }+ ]);++ if (insertResult.error) {+ console.error(+ "[OAuth Register] Failed to create client:",+ insertResult.error+ );+ return jsonResponse(+ { error: "server_error", error_description: "Failed to register client" },+ 500+ );+ }++ const response: Record<string, unknown> = {+ client_id: clientId,+ client_name,+ redirect_uris,+ grant_types,+ response_types,+ token_endpoint_auth_method+ };++ if (rawClientSecret) {+ response.client_secret = rawClientSecret;+ }++ if (client_uri) response.client_uri = client_uri;+ if (logo_uri) response.logo_uri = logo_uri;+ if (scope) response.scope = scope;++ return jsonResponse(response, 201);+}diff --git a/apps/erp/app/routes/oauth+/token.tsx b/apps/erp/app/routes/oauth+/token.tsxindex db952248c0..258c453ec6 100644--- a/apps/erp/app/routes/oauth+/token.tsx+++ b/apps/erp/app/routes/oauth+/token.tsx@@ -1,18 +1,62 @@+import { hashOAuthSecret } from "@carbon/auth/auth.server";import { getCarbonServiceRole } from "@carbon/auth/client.server";import { validator } from "@carbon/form";-import type { ActionFunctionArgs } from "react-router";-import { data } from "react-router";+import { createHash } from "crypto";+import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { z } from "zod";+const corsHeaders = {+ "Access-Control-Allow-Origin": "*",+ "Access-Control-Allow-Methods": "POST, OPTIONS",+ "Access-Control-Allow-Headers": "Content-Type, Authorization",+ "Content-Type": "application/json"+};++export async function loader({ request }: LoaderFunctionArgs) {+ if (request.method === "OPTIONS") {+ return new Response(null, { status: 204, headers: corsHeaders });+ }+ return new Response(+ JSON.stringify({+ error: "method_not_allowed",+ error_description: "Use POST"+ }),+ { status: 405, headers: corsHeaders }+ );+}+const oauthTokenValidator = z.object({grant_type: z.enum(["authorization_code", "refresh_token"]),client_id: z.string(),- client_secret: z.string(),+ client_secret: z.string().optional(),code: z.string().optional(),redirect_uri: z.string().url().optional(),- refresh_token: z.string().optional()+ refresh_token: z.string().optional(),+ code_verifier: z.string().optional()});+function verifyCodeChallenge(+ codeVerifier: string,+ codeChallenge: string,+ method: string+): boolean {+ if (method !== "S256") return false;+ const hash = createHash("sha256").update(codeVerifier).digest();+ const base64url = hash+ .toString("base64")+ .replace(/\+/g, "-")+ .replace(/\//g, "_")+ .replace(/=+$/, "");+ return base64url === codeChallenge;+}++function jsonResponse(body: unknown, status: number = 200) {+ return new Response(JSON.stringify(body), {+ status,+ headers: corsHeaders+ });+}+export async function action({ request }: ActionFunctionArgs) {const client = getCarbonServiceRole();const validation = await validator(oauthTokenValidator).validate(@@ -20,7 +64,13 @@ export async function action({ request }: ActionFunctionArgs) {);if (validation.error) {- return data({ data: null, error: "Invalid request" }, { status: 400 });+ return jsonResponse(+ {+ error: "invalid_request",+ error_description: "Invalid request parameters"+ },+ 400+ );}const {@@ -29,152 +79,220 @@ export async function action({ request }: ActionFunctionArgs) {client_secret,code,redirect_uri,- refresh_token+ refresh_token,+ code_verifier} = validation.data;- const [oauthClient] = await Promise.all([- client.from("oauthClient").select("*").eq("clientId", client_id).single()- ]);+ const oauthClientResult = await client+ .from("oauthClient")+ .select("*")+ .eq("clientId", client_id)+ .single();- if (!oauthClient.data || oauthClient.data.clientSecret !== client_secret) {- return data(- {- data: null,- error: "Invalid client credentials"- },- { status: 401 }+ if (!oauthClientResult.data) {+ return jsonResponse(+ { error: "invalid_client", error_description: "Unknown client" },+ 401);}+ const oauthClient = oauthClientResult.data;++ if (oauthClient.tokenEndpointAuthMethod !== "none") {+ if (+ !client_secret ||+ oauthClient.clientSecret !== hashOAuthSecret(client_secret)+ ) {+ return jsonResponse(+ {+ error: "invalid_client",+ error_description: "Invalid client credentials"+ },+ 401+ );+ }+ }+if (grant_type === "authorization_code") {if (!code || !redirect_uri) {- return data(+ return jsonResponse({- data: null,- error: "Invalid request"+ error: "invalid_request",+ error_description: "Missing code or redirect_uri"},- { status: 400 }+ 400);}- // Verify the authorization code- const [oauthCode] = await Promise.all([- client.from("oauthCode").select("*").eq("code", code).single()- ]);+ // Atomically consume the authorization code (delete-first prevents replay)+ const oauthCode = await client+ .from("oauthCode")+ .delete()+ .eq("code", code)+ .select("*")+ .single();- if (- !oauthCode.data ||- oauthCode.data.clientId !== client_id ||- oauthCode.data.redirectUri !== redirect_uri- ) {- return data(+ if (!oauthCode.data) {+ return jsonResponse({- data: null,- error: "Invalid authorization code"+ error: "invalid_grant",+ error_description: "Invalid authorization code"},- { status: 400 }+ 400);}- // Generate access token and refresh token- const accessToken = crypto.randomUUID() as string;- const refreshToken = crypto.randomUUID() as string;+ const codeData = oauthCode.data;- const [tokenResult] = await Promise.all([- client.from("oauthToken").insert([+ if (codeData.clientId !== client_id) {+ return jsonResponse({- accessToken,- refreshToken,- clientId: client_id,- userId: oauthCode.data.userId,- companyId: oauthCode.data.companyId,- createdAt: new Date(Date.now()).toISOString(),- expiresAt: new Date(Date.now() + 3600 * 1000).toISOString() // 1 hour expiration- }- ])- ]);+ error: "invalid_grant",+ error_description: "Code was not issued to this client"+ },+ 400+ );+ }- if (tokenResult.error) {- return data(- { data: null, error: "Failed to create token" },- { status: 500 }+ if (codeData.redirectUri !== redirect_uri) {+ return jsonResponse(+ { error: "invalid_grant", error_description: "Redirect URI mismatch" },+ 400);}- // Delete the used authorization code- await client.from("oauthCode").delete().eq("code", code);+ if (new Date(codeData.expiresAt) < new Date()) {+ return jsonResponse(+ {+ error: "invalid_grant",+ error_description: "Authorization code has expired"+ },+ 400+ );+ }- return {- data: {- access_token: accessToken,- token_type: "Bearer",- expires_in: 3600,- refresh_token: refreshToken- },- error: null+ // Verify PKCE if code_challenge was stored+ if (codeData.codeChallenge) {+ if (!code_verifier) {+ return jsonResponse(+ {+ error: "invalid_grant",+ error_description: "PKCE code_verifier required"+ },+ 400+ );+ }++ const method = codeData.codeChallengeMethod || "S256";+ if (!verifyCodeChallenge(code_verifier, codeData.codeChallenge, method)) {+ return jsonResponse(+ {+ error: "invalid_grant",+ error_description: "PKCE verification failed"+ },+ 400+ );+ }+ }++ // Generate access token and refresh token+ const rawAccessToken = crypto.randomUUID();+ const rawRefreshToken = crypto.randomUUID();++ const tokenInsert = {+ accessToken: hashOAuthSecret(rawAccessToken),+ refreshToken: hashOAuthSecret(rawRefreshToken),+ clientId: client_id,+ userId: codeData.userId,+ companyId: codeData.companyId,+ createdAt: new Date().toISOString(),+ expiresAt: new Date(Date.now() + 3600 * 1000).toISOString()};++ const tokenResult = await client.from("oauthToken").insert([tokenInsert]);++ if (tokenResult.error) {+ return jsonResponse(+ { error: "server_error", error_description: "Failed to create token" },+ 500+ );+ }++ return jsonResponse({+ access_token: rawAccessToken,+ token_type: "Bearer",+ expires_in: 3600,+ refresh_token: rawRefreshToken,+ scope: codeData.scope || undefined+ });} else if (grant_type === "refresh_token") {if (!refresh_token) {- return data(+ return jsonResponse({- data: null,- error: "Invalid request"+ error: "invalid_request",+ error_description: "Missing refresh_token"},- { status: 400 }+ 400);}// Verify the refresh token- const [tokenResult] = await Promise.all([- client- .from("oauthToken")- .select("*")- .eq("refreshToken", refresh_token)- .single()- ]);-- if (!tokenResult.data || tokenResult.data.clientId !== client_id) {- return data(- { data: null, error: "Invalid refresh token" },- { status: 400 }+ const tokenResult = await client+ .from("oauthToken")+ .select("*")+ .eq("refreshToken", hashOAuthSecret(refresh_token))+ .single();++ if (!tokenResult.data) {+ return jsonResponse(+ { error: "invalid_grant", error_description: "Invalid refresh token" },+ 400+ );+ }++ const refreshTokenData = tokenResult.data;++ if (refreshTokenData.clientId !== client_id) {+ return jsonResponse(+ {+ error: "invalid_grant",+ error_description: "Refresh token was not issued to this client"+ },+ 400);}// Generate new access token- const newAccessToken = crypto.randomUUID();-- const [updateResult] = await Promise.all([- client- .from("oauthToken")- .update({- accessToken: newAccessToken,- expiresAt: new Date(Date.now() + 3600 * 1000).toISOString() // 1 hour expiration- })- .eq("refreshToken", refresh_token)- ]);+ const rawNewAccessToken = crypto.randomUUID();++ const updateResult = await client+ .from("oauthToken")+ .update({+ accessToken: hashOAuthSecret(rawNewAccessToken),+ expiresAt: new Date(Date.now() + 3600 * 1000).toISOString()+ })+ .eq("refreshToken", hashOAuthSecret(refresh_token));if (updateResult.error) {- return data(+ return jsonResponse({ error: "server_error", error_description: "Failed to refresh token" },- { status: 500 }+ 500);}- return {- data: {- access_token: newAccessToken,- token_type: "Bearer",- expires_in: 3600- },- error: null- };+ return jsonResponse({+ access_token: rawNewAccessToken,+ token_type: "Bearer",+ expires_in: 3600,+ scope: refreshTokenData.scope || undefined+ });}- return data(+ return jsonResponse({- data: null,- error: "Unsupported grant type"+ error: "unsupported_grant_type",+ error_description: "Unsupported grant type"},- { status: 400 }+ 400);}diff --git a/apps/erp/app/routes/x+/accounting+/depreciation-runs.new.tsx b/apps/erp/app/routes/x+/accounting+/depreciation-runs.new.tsxindex 5976ac402b..b7a7f48aae 100644--- a/apps/erp/app/routes/x+/accounting+/depreciation-runs.new.tsx+++ b/apps/erp/app/routes/x+/accounting+/depreciation-runs.new.tsx@@ -3,11 +3,11 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";+import { insertDepreciationRun } from "~/modules/accounting";import {buildDepreciationLines,getNextPeriodEnd} from "~/modules/accounting/accounting.utils";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";export async function action({ request }: ActionFunctionArgs) {@@ -110,69 +110,25 @@ export async function action({ request }: ActionFunctionArgs) {usageMap);- const nextSequence = await getNextSequence(- client,- "depreciationRun",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.depreciationRuns,- await flash(- request,- error(nextSequence.error, "Failed to generate run ID")- )- );- }-- const run = await client- .from("depreciationRun")- .insert({- depreciationRunId: nextSequence.data,- periodEnd,- status: "Draft",- companyId,- createdBy: userId- })- .select("id")- .single();+ const result = await insertDepreciationRun(client, {+ periodEnd,+ lines,+ companyId,+ createdBy: userId+ });- if (run.error) {+ if (result.error || !result.data) {throw redirect(path.to.depreciationRuns,await flash(request,- error(run.error, "Failed to create depreciation run")+ error(result.error, "Failed to create depreciation run")));}- if (lines.length > 0) {- const lineInserts = lines.map((line) => ({- depreciationRunId: run.data.id,- fixedAssetId: line.fixedAssetId,- amount: line.amount,- taxAmount: line.taxAmount,- companyId- }));-- const lineResult = await client- .from("depreciationRunLine")- .insert(lineInserts);-- if (lineResult.error) {- throw redirect(- path.to.depreciationRuns,- await flash(- request,- error(lineResult.error, "Failed to create run lines")- )- );- }- }-throw redirect(- path.to.depreciationRun(run.data.id),+ path.to.depreciationRun(result.data.id),await flash(request, success("Depreciation run created")));}diff --git a/apps/erp/app/routes/x+/accounting+/fixed-assets.new.tsx b/apps/erp/app/routes/x+/accounting+/fixed-assets.new.tsxindex d54c363f21..99e8b33ee6 100644--- a/apps/erp/app/routes/x+/accounting+/fixed-assets.new.tsx+++ b/apps/erp/app/routes/x+/accounting+/fixed-assets.new.tsx@@ -4,9 +4,8 @@ import { flash } from "@carbon/auth/session.server";import { validationError, validator } from "@carbon/form";import type { ActionFunctionArgs } from "react-router";import { redirect, useNavigate } from "react-router";-import { fixedAssetValidator, upsertFixedAsset } from "~/modules/accounting";+import { fixedAssetValidator, insertFixedAsset } from "~/modules/accounting";import { FixedAssetForm } from "~/modules/accounting/ui/FixedAssets";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";export async function action({ request }: ActionFunctionArgs) {@@ -24,28 +23,14 @@ export async function action({ request }: ActionFunctionArgs) {const { id: _id, ...d } = validation.data;- const nextSequence = await getNextSequence(client, "fixedAsset", companyId);- if (nextSequence.error) {- return redirect(- path.to.fixedAssets,- await flash(- request,- error(nextSequence.error, "Failed to generate asset ID")- )- );- }-- const status = "Draft";-- const result = await upsertFixedAsset(client, {+ const result = await insertFixedAsset(client, {...d,- fixedAssetId: nextSequence.data,- status,+ status: "Draft",companyId,createdBy: userId});- if (result.error) {+ if (result.error || !result.data) {return redirect(path.to.fixedAssets,await flash(request, error(result.error, "Failed to create fixed asset"))diff --git a/apps/erp/app/routes/x+/depreciation-run+/$depreciationRunId.repeat.tsx b/apps/erp/app/routes/x+/depreciation-run+/$depreciationRunId.repeat.tsxindex 804c21a5be..008fba81a7 100644--- a/apps/erp/app/routes/x+/depreciation-run+/$depreciationRunId.repeat.tsx+++ b/apps/erp/app/routes/x+/depreciation-run+/$depreciationRunId.repeat.tsx@@ -3,8 +3,8 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";+import { insertDepreciationRun } from "~/modules/accounting";import { buildDepreciationLines } from "~/modules/accounting/accounting.utils";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";export async function action({ request, params }: ActionFunctionArgs) {@@ -156,67 +156,25 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- const nextSequence = await getNextSequence(- client,- "depreciationRun",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.depreciationRuns,- await flash(- request,- error(nextSequence.error, "Failed to generate run ID")- )- );- }-- const run = await client- .from("depreciationRun")- .insert({- depreciationRunId: nextSequence.data,- periodEnd,- status: "Draft",- companyId,- createdBy: userId- })- .select("id")- .single();-- if (run.error) {- throw redirect(- path.to.depreciationRuns,- await flash(- request,- error(run.error, "Failed to create repeat depreciation run")- )- );- }-- const lineInserts = lines.map((line) => ({- depreciationRunId: run.data.id,- fixedAssetId: line.fixedAssetId,- amount: line.amount,- taxAmount: line.taxAmount,- companyId- }));-- const lineResult = await client- .from("depreciationRunLine")- .insert(lineInserts);+ const result = await insertDepreciationRun(client, {+ periodEnd,+ lines,+ companyId,+ createdBy: userId+ });- if (lineResult.error) {+ if (result.error || !result.data) {throw redirect(path.to.depreciationRuns,await flash(request,- error(lineResult.error, "Failed to create run lines")+ error(result.error, "Failed to create repeat depreciation run")));}throw redirect(- path.to.depreciationRun(run.data.id),+ path.to.depreciationRun(result.data.id),await flash(request, success("Repeat depreciation run created")));}diff --git a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.details.tsx b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.details.tsxindex 0fffbd3833..e1ec642e65 100644--- a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.details.tsx+++ b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.details.tsx@@ -7,7 +7,7 @@ import { redirect, useLoaderData, useNavigate } from "react-router";import {fixedAssetValidator,getFixedAsset,- upsertFixedAsset+ updateFixedAsset} from "~/modules/accounting";import { FixedAssetForm } from "~/modules/accounting/ui/FixedAssets";import { path } from "~/utils/path";@@ -50,9 +50,23 @@ export async function action({ request, params }: ActionFunctionArgs) {const { id, ...d } = validation.data;if (!id) throw notFound("Fixed Asset ID was not found");- const result = await upsertFixedAsset(client, {+ const result = await updateFixedAsset(client, {id,- ...d,+ fixedAssetClassId: d.fixedAssetClassId,+ name: d.name,+ description: d.description ?? null,+ serialNumber: d.serialNumber ?? null,+ depreciationMethod: d.depreciationMethod,+ usefulLifeMonths: d.usefulLifeMonths,+ residualValuePercent: d.residualValuePercent,+ assetLifetimeUsage: d.assetLifetimeUsage ?? null,+ locationId: d.locationId ?? null,+ taxDepreciationMethod: d.taxDepreciationMethod ?? null,+ taxUsefulLifeMonths: d.taxUsefulLifeMonths ?? null,+ taxResidualValuePercent: d.taxResidualValuePercent ?? null,+ macrsPropertyClass: d.macrsPropertyClass ?? null,+ macrsConvention: d.macrsConvention ?? null,+ bonusDepreciationPercent: d.bonusDepreciationPercent ?? null,updatedBy: userId});diff --git a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.purchase.tsx b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.purchase.tsxindex e0572b329c..a8aa6c91d6 100644--- a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.purchase.tsx+++ b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.purchase.tsx@@ -20,10 +20,9 @@ import { Submit, Supplier } from "~/components/Form";import { usePermissions } from "~/hooks";import { getFixedAsset } from "~/modules/accounting";import {- upsertPurchaseOrder,+ insertPurchaseOrder,upsertPurchaseOrderLine} from "~/modules/purchasing";-import { getNextSequence } from "~/modules/settings";import { getUserDefaults } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -90,23 +89,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const locationId = asset.data.locationId ?? defaults.data?.locationId ?? "";- const nextSequence = await getNextSequence(- client,- "purchaseOrder",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.fixedAsset(fixedAssetId),- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-- const newPO = await upsertPurchaseOrder(client, {- purchaseOrderId: nextSequence.data!,+ const newPO = await insertPurchaseOrder(client, {supplierId,locationId,status: "Draft",@@ -116,7 +99,7 @@ export async function action({ request, params }: ActionFunctionArgs) {createdBy: userId});- if (newPO.error || !newPO.data?.[0]) {+ if (newPO.error || !newPO.data) {throw redirect(path.to.fixedAsset(fixedAssetId),await flash(@@ -126,7 +109,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- const purchaseOrderId = newPO.data[0].id;+ const purchaseOrderId = newPO.data.id;await upsertPurchaseOrderLine(client, {purchaseOrderId,diff --git a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.sell.tsx b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.sell.tsxindex c79b9a4d22..a6165ea20a 100644--- a/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.sell.tsx+++ b/apps/erp/app/routes/x+/fixed-asset+/$fixedAssetId.sell.tsx@@ -19,8 +19,7 @@ import { z } from "zod";import { Customer, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";import { getFixedAsset } from "~/modules/accounting";-import { upsertSalesOrder } from "~/modules/sales";-import { getNextSequence } from "~/modules/settings";+import { insertSalesOrder } from "~/modules/sales";import { getUserDefaults } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -85,29 +84,10 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- const nextSequence = await getNextSequence(client, "salesOrder", companyId);- if (nextSequence.error) {- throw redirect(- path.to.fixedAsset(fixedAssetId),- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-const locationId = asset.data.locationId ?? defaults.data?.locationId ?? "";- const company = await client- .from("company")- .select("baseCurrencyCode")- .eq("id", companyId)- .single();-- const newSO = await upsertSalesOrder(client, {- salesOrderId: nextSequence.data!,+ const newSO = await insertSalesOrder(client, {customerId,- currencyCode: company.data?.baseCurrencyCode ?? "USD",locationId: locationId ?? "",status: "Draft",companyId,@@ -115,14 +95,14 @@ export async function action({ request, params }: ActionFunctionArgs) {createdBy: userId});- if (newSO.error || !newSO.data?.[0]) {+ if (newSO.error || !newSO.data) {throw redirect(path.to.fixedAsset(fixedAssetId),await flash(request, error(newSO.error, "Failed to create sales order")));}- const salesOrderId = newSO.data[0].id;+ const salesOrderId = newSO.data.id;const nbv =Number(asset.data.acquisitionCost) -diff --git a/apps/erp/app/routes/x+/issue+/$id.details.tsx b/apps/erp/app/routes/x+/issue+/$id.details.tsxindex 530be28317..3097ae05bb 100644--- a/apps/erp/app/routes/x+/issue+/$id.details.tsx+++ b/apps/erp/app/routes/x+/issue+/$id.details.tsx@@ -17,7 +17,7 @@ import {getIssueReviewers,isIssueLocked,issueValidator,- upsertIssue+ updateIssue} from "~/modules/quality";import {ActionTasksList,@@ -92,17 +92,29 @@ export async function action({ request, params }: ActionFunctionArgs) {throw new Error("Could not find issue id");}- const updateIssue = await upsertIssue(client, {- ...validation.data,- id: id,- nonConformanceId: nonConformanceId,+ const result = await updateIssue(client, {+ id,+ nonConformanceId,+ name: validation.data.name,+ priority: validation.data.priority,+ source: validation.data.source,+ locationId: validation.data.locationId,+ nonConformanceTypeId: validation.data.nonConformanceTypeId,+ nonConformanceWorkflowId: validation.data.nonConformanceWorkflowId || null,+ openDate: validation.data.openDate,+ dueDate: validation.data.dueDate || null,+ closeDate: validation.data.closeDate || null,+ description: validation.data.description || null,+ quantity: validation.data.quantity ?? null,+ requiredActionIds: validation.data.requiredActionIds,+ approvalRequirements: validation.data.approvalRequirements,customFields: setCustomFields(formData),updatedBy: userId});- if (updateIssue.error) {+ if (result.error) {throw redirect(path.to.issue(id),- await flash(request, error(updateIssue.error, "Failed to update issue"))+ await flash(request, error(result.error, "Failed to update issue")));}diff --git a/apps/erp/app/routes/x+/issue+/new.tsx b/apps/erp/app/routes/x+/issue+/new.tsxindex 12b9392002..5eff2204ed 100644--- a/apps/erp/app/routes/x+/issue+/new.tsx+++ b/apps/erp/app/routes/x+/issue+/new.tsx@@ -14,11 +14,10 @@ import {getIssueTypesList,getIssueWorkflowsList,getRequiredActionsList,- issueValidator,- upsertIssue+ insertIssue,+ issueValidator} from "~/modules/quality";import IssueForm from "~/modules/quality/ui/Issue/IssueForm";-import { getNextSequence } from "~/modules/settings";import { getCompanyIntegrations } from "~/modules/settings/settings.server";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";@@ -62,46 +61,41 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- const nextSequence = await getNextSequence(- serviceRole,- "nonConformance",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newIssue,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { id, ...nonConformance } = validation.data;-- const createIssue = await upsertIssue(serviceRole, {- ...nonConformance,- nonConformanceId: nextSequence.data,+ const d = validation.data;++ const createResult = await insertIssue(serviceRole, {+ nonConformanceId: d.nonConformanceId || undefined,+ name: d.name,+ priority: d.priority,+ source: d.source,+ locationId: d.locationId,+ nonConformanceTypeId: d.nonConformanceTypeId,+ openDate: d.openDate,+ description: d.description,+ nonConformanceWorkflowId: d.nonConformanceWorkflowId,+ dueDate: d.dueDate,+ closeDate: d.closeDate,+ quantity: d.quantity,+ requiredActionIds: d.requiredActionIds,+ approvalRequirements: d.approvalRequirements,+ items: d.items,+ jobOperationId: d.jobOperationId,+ customerId: d.customerId,+ salesOrderLineId: d.salesOrderLineId,+ operationSupplierProcessId: d.operationSupplierProcessId,companyId,createdBy: userId,customFields: setCustomFields(formData)});- if (createIssue.error || !createIssue.data) {+ if (createResult.error || !createResult.data) {throw redirect(path.to.issues,- await flash(request, error(createIssue.error, "Failed to insert issue"))+ await flash(request, error(createResult.error, "Failed to insert issue")));}- const ncrId = createIssue.data?.id;- if (!ncrId) {- throw redirect(- path.to.issues,- await flash(request, error("Failed to insert issue"))- );- }+ const ncrId = createResult.data.id;// Pre-associate tracked entities passed via query string (used by the// "Create Issue from Inspection" button on inbound inspection lots).@@ -158,7 +152,7 @@ export async function action({ request }: ActionFunctionArgs) {carbonUrl: `${ERP_URL}${path.to.issue(ncrId)}`,issue: {id: ncrId,- nonConformanceId: nextSequence.data,+ nonConformanceId: createResult.data.nonConformanceId,title: validation.data.name,description: validation.data.description ?? "",severity: validation.data.priority@@ -298,7 +292,7 @@ async function autoLinkJobOperationDisposition(}}- // Disposition row: find or create. upsertIssue may have already inserted+ // Disposition row: find or create. insertIssue may have already inserted// one for this item via the form's `items` array.const existingItem = await client.from("nonConformanceItem")diff --git a/apps/erp/app/routes/x+/job+/$jobId.details.tsx b/apps/erp/app/routes/x+/job+/$jobId.details.tsxindex b40fdc5bf0..d3addf51d6 100644--- a/apps/erp/app/routes/x+/job+/$jobId.details.tsx+++ b/apps/erp/app/routes/x+/job+/$jobId.details.tsx@@ -41,7 +41,7 @@ import {isJobLocked,jobValidator,recalculateJobRequirements,- upsertJob+ updateJob} from "~/modules/production";import {JobBillOfMaterial,@@ -167,20 +167,25 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- const { jobId, ...d } = validation.data;- if (!jobId) throw new Error("Could not find jobId in payload");-- const updateJob = await upsertJob(client, {- ...d,- id: id,- jobId,+ const result = await updateJob(client, {+ id,+ quantity: validation.data.quantity,+ scrapQuantity: validation.data.scrapQuantity,+ itemId: validation.data.itemId,+ dueDate: validation.data.dueDate || null,+ startDate: validation.data.startDate || null,+ deadlineType: validation.data.deadlineType,+ locationId: validation.data.locationId,+ unitOfMeasureCode: validation.data.unitOfMeasureCode,+ customerId: validation.data.customerId || null,+ modelUploadId: validation.data.modelUploadId || null,customFields: setCustomFields(formData),updatedBy: userId});- if (updateJob.error) {+ if (result.error) {throw redirect(path.to.job(id),- await flash(request, error(updateJob.error, "Failed to update job"))+ await flash(request, error(result.error, "Failed to update job")));}diff --git a/apps/erp/app/routes/x+/job+/$jobId.materials.session.new.tsx b/apps/erp/app/routes/x+/job+/$jobId.materials.session.new.tsxindex 3c79ed98ca..43eec57245 100644--- a/apps/erp/app/routes/x+/job+/$jobId.materials.session.new.tsx+++ b/apps/erp/app/routes/x+/job+/$jobId.materials.session.new.tsx@@ -11,13 +11,8 @@ import {import type { ActionFunctionArgs } from "react-router";import { data } from "react-router";import { z } from "zod";-import {- deleteStockTransfer,- upsertStockTransfer,- upsertStockTransferLines-} from "~/modules/inventory";+import { insertStockTransfer } from "~/modules/inventory";import { getJob } from "~/modules/production";-import { getNextSequence } from "~/modules/settings";import { getOrCreatePeriods } from "~/modules/shared/shared.server";import { path } from "~/utils/path";@@ -240,32 +235,14 @@ export async function action({ request, params }: ActionFunctionArgs) {}, []);if (linesWithExpandedSerialTracking.length > 0) {- // Now that we have valid transfer lines, create the stock transfer- // Get next sequence for stock transfer- const nextSequence = await getNextSequence(- client,- "stockTransfer",- companyId- );- if (nextSequence.error) {- return data(- { success: false, message: "Failed to get next sequence" },- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-- // Create stock transfer- const createStockTransfer = await upsertStockTransfer(client, {- stockTransferId: nextSequence.data,+ const createStockTransfer = await insertStockTransfer(client, {locationId,+ lines: linesWithExpandedSerialTracking,companyId,createdBy: userId});- if (createStockTransfer.error) {+ if (createStockTransfer.error || !createStockTransfer.data) {return data({ success: false, message: "Failed to create stock transfer" },await flash(@@ -275,28 +252,6 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- // Create stock transfer lines- const createStockTransferLines = await upsertStockTransferLines(client, {- lines: linesWithExpandedSerialTracking,- stockTransferId: createStockTransfer.data.id,- companyId,- createdBy: userId- });-- if (createStockTransferLines.error) {- await deleteStockTransfer(client, createStockTransfer.data.id);- return data(- { success: false, message: "Failed to create stock transfer lines" },- await flash(- request,- error(- createStockTransferLines.error,- "Failed to create stock transfer lines"- )- )- );- }-hasTransfer = true;}}diff --git a/apps/erp/app/routes/x+/job+/bulk.new.tsx b/apps/erp/app/routes/x+/job+/bulk.new.tsxindex 569fafbfb7..48ebf8020c 100644--- a/apps/erp/app/routes/x+/job+/bulk.new.tsx+++ b/apps/erp/app/routes/x+/job+/bulk.new.tsx@@ -4,21 +4,11 @@ import { getCarbonServiceRole } from "@carbon/auth/client.server";import { flash } from "@carbon/auth/session.server";import { validator } from "@carbon/form";import { batchTrigger } from "@carbon/jobs";-import {- parseDate,- parseDateTime,- toCalendarDateTime-} from "@internationalized/date";+import { parseDateTime, toCalendarDateTime } from "@internationalized/date";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { getDefaultStorageUnitForJob } from "~/modules/inventory";-import { getItemReplenishment } from "~/modules/items";-import {- bulkJobValidator,- upsertJob,- upsertJobMethod-} from "~/modules/production";-import { getNextSequence } from "~/modules/settings/settings.service";+import { bulkJobValidator, insertJob } from "~/modules/production";import { setCustomFields } from "~/utils/form";import { path } from "~/utils/path";@@ -45,28 +35,22 @@ export async function action({ request }: ActionFunctionArgs) {const {dueDateOfFirstJob,dueDateOfLastJob,- scrapQuantityPerJob,totalQuantity,quantityPerJob,+ configuration: configStr,...jobData} = validation.data;- const jobs = Math.ceil(totalQuantity / quantityPerJob);- const quantityOfLastJob = totalQuantity - (jobs - 1) * quantityPerJob;- let configuration = undefined;- if (jobData.configuration) {+ let configuration: Record<string, unknown> | undefined;+ if (configStr) {try {- configuration = JSON.parse(jobData.configuration);- } catch (error) {- console.error(error);+ configuration = JSON.parse(configStr);+ } catch {+ // invalid JSON — skip configuration}}-- const manufacturing = await getItemReplenishment(- serviceRole,- jobData.itemId,- companyId- );+ const jobs = Math.ceil(totalQuantity / quantityPerJob);+ const quantityOfLastJob = totalQuantity - (jobs - 1) * quantityPerJob;// Calculate due date distribution if both dates are providedlet dueDateDistribution: string[] = [];@@ -110,71 +94,33 @@ export async function action({ request }: ActionFunctionArgs) {);for await (const [i] of Array.from({ length: jobs }, (_, i) => [i])) {- const nextSequence = await getNextSequence(serviceRole, "job", companyId);- if (nextSequence.error) {- throw redirect(- path.to.newJob,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- let jobId = nextSequence.data;const dueDate = (dueDateDistribution[i] || dueDateOfFirstJob)?.split("T")[0];- const createJob = await upsertJob(serviceRole, {- jobId,- ...jobData,- quantity: i === jobs - 1 ? quantityOfLastJob : quantityPerJob,- scrapQuantity:- i === jobs - 1- ? Math.ceil(- quantityOfLastJob * (scrapQuantityPerJob / quantityPerJob)- )- : scrapQuantityPerJob,- dueDate,- startDate: dueDate- ? parseDate(dueDate)- .subtract({ days: manufacturing.data?.leadTime ?? 7 })- .toString()- : undefined,- storageUnitId: storageUnitId ?? undefined,- configuration,- companyId,- createdBy: userId,- customFields: setCustomFields(formData)- });-- if (createJob.error) {- throw redirect(- path.to.newJob,- await flash(request, error(createJob.error, "Failed to insert job"))- );- }+ const createJob = await insertJob(+ serviceRole,+ {+ ...jobData,+ quantity: i === jobs - 1 ? quantityOfLastJob : quantityPerJob,+ dueDate,+ storageUnitId: storageUnitId ?? undefined,+ configuration,+ companyId,+ createdBy: userId,+ customFields: setCustomFields(formData)+ },+ { skipRecalculate: true }+ );- const id = createJob.data?.id!;- if (createJob.error || !jobId) {+ if (createJob.error || !createJob.data) {throw redirect(- path.to.jobs,+ path.to.newJob,await flash(request, error(createJob.error, "Failed to insert job")));}- const upsertMethod = await upsertJobMethod(serviceRole, "itemToJob", {- sourceId: jobData.itemId,- targetId: id,- companyId,- userId,- configuration- });-- if (upsertMethod.error) {- console.error("Failed to upsert job method", upsertMethod.error);- }- jobIds.push(id);+ jobIds.push(createJob.data.id);}await batchTrigger(diff --git a/apps/erp/app/routes/x+/job+/new.tsx b/apps/erp/app/routes/x+/job+/new.tsxindex d6cac81e0b..f5aca971e0 100644--- a/apps/erp/app/routes/x+/job+/new.tsx+++ b/apps/erp/app/routes/x+/job+/new.tsx@@ -3,22 +3,12 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { getCarbonServiceRole } from "@carbon/auth/client.server";import { flash } from "@carbon/auth/session.server";import { validationError, validator } from "@carbon/form";-import { trigger } from "@carbon/jobs";-import { parseDate } from "@internationalized/date";import { msg } from "@lingui/core/macro";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";-import { getDefaultStorageUnitForJob } from "~/modules/inventory";-import { getItemReplenishment } from "~/modules/items";-import {- calculateJobPriority,- jobValidator,- upsertJob,- upsertJobMethod-} from "~/modules/production";+import { insertJob, jobValidator } from "~/modules/production";import { JobForm } from "~/modules/production/ui/Jobs";-import { getNextSequence } from "~/modules/settings";import type { MethodItemType } from "~/modules/shared";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";@@ -32,7 +22,7 @@ export const handle: Handle = {export async function action({ request }: ActionFunctionArgs) {assertIsPost(request);- const { client, companyId, userId } = await requirePermissions(request, {+ const { companyId, userId } = await requirePermissions(request, {create: "production",role: "employee"});@@ -44,126 +34,34 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let jobId = validation.data.jobId;- const useNextSequence = !jobId;+ const { id: _id, configuration: configStr, ...data } = validation.data;- // Fetch manufacturing data for lead time and scrap percentage- const [nextSequenceResult, manufacturing] = await Promise.all([- useNextSequence- ? getNextSequence(client, "job", companyId)- : Promise.resolve({ data: null, error: null }),- getItemReplenishment(client, validation.data.itemId, companyId)- ]);-- if (useNextSequence) {- if (nextSequenceResult.error) {- throw redirect(- path.to.newJob,- await flash(- request,- error(nextSequenceResult.error, "Failed to get next sequence")- )- );- }- // @ts-expect-error TS2322 - TODO: fix type- jobId = nextSequenceResult.data;- }-- const leadTime = manufacturing.data?.leadTime ?? 7;-- if (!jobId) throw new Error("jobId is not defined");- const { id: _id, ...d } = validation.data;-- // Calculate scrap quantity from the item's scrap percentage if not set- const scrapPercentage = manufacturing.data?.scrapPercentage ?? 0;- const calculatedScrapQuantity =- scrapPercentage > 0- ? Math.ceil(validation.data.quantity * scrapPercentage)- : 0;- // Use the form value if set, otherwise use calculated value- const scrapQuantity =- d.scrapQuantity && d.scrapQuantity > 0- ? d.scrapQuantity- : calculatedScrapQuantity;-- let configuration = undefined;- if (d.configuration) {+ let configuration: Record<string, unknown> | undefined;+ if (configStr) {try {- configuration = JSON.parse(d.configuration);- } catch (error) {- console.error(error);+ configuration = JSON.parse(configStr);+ } catch {+ // invalid JSON — skip configuration}}- const storageUnitId = await getDefaultStorageUnitForJob(- client,- validation.data.itemId,- validation.data.locationId,- companyId- );-- // Calculate priority based on due date and deadline type- const priority = await calculateJobPriority(client, {- dueDate: d.dueDate ?? null,- deadlineType: d.deadlineType,- companyId,- locationId: validation.data.locationId- });-- const createJob = await upsertJob(client, {- ...d,- jobId,+ const result = await insertJob(getCarbonServiceRole(), {+ ...data,+ jobId: data.jobId || undefined,configuration,- // @ts-expect-error TS2353 - TODO: fix type- priority,- scrapQuantity,- storageUnitId: storageUnitId ?? undefined,- startDate: d.dueDate- ? parseDate(d.dueDate).subtract({ days: leadTime }).toString()- : undefined,companyId,createdBy: userId,customFields: setCustomFields(formData)});- const id = createJob.data?.id!;- if (createJob.error || !jobId) {+ if (result.error || !result.data) {throw redirect(path.to.jobs,- await flash(request, error(createJob.error, "Failed to insert job"))+ await flash(request, error(result.error, "Failed to insert job")));}- const upsertMethod = await upsertJobMethod(- getCarbonServiceRole(),- "itemToJob",- {- sourceId: d.itemId,- targetId: id,- companyId,- userId,- configuration- }- );-- if (upsertMethod.error) {- throw redirect(- path.to.job(id),- await flash(- request,- error(upsertMethod.error, "Failed to create job method.")- )- );- }-- await trigger("recalculate", {- type: "jobRequirements",- id,- companyId,- userId- });-- throw redirect(path.to.job(id));+ throw redirect(path.to.job(result.data.id));}export default function JobNewRoute() {diff --git a/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.reverse.tsx b/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.reverse.tsxindex 39674f0e48..3394b37c29 100644--- a/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.reverse.tsx+++ b/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.reverse.tsx@@ -4,7 +4,6 @@ import { flash } from "@carbon/auth/session.server";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { reverseJournalEntry } from "~/modules/accounting";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";export async function action({ request, params }: ActionFunctionArgs) {@@ -16,20 +15,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { journalEntryId } = params;if (!journalEntryId) throw new Error("Could not find journalEntryId");- const nextSequence = await getNextSequence(client, "journalEntry", companyId);-- if (nextSequence.error) {- throw redirect(- path.to.journalEntryDetails(journalEntryId),- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-const result = await reverseJournalEntry(client, journalEntryId, {- journalEntryId: nextSequence.data,companyId,userId});diff --git a/apps/erp/app/routes/x+/maintenance+/new.tsx b/apps/erp/app/routes/x+/maintenance+/new.tsxindex 92be86be93..75e8b0293b 100644--- a/apps/erp/app/routes/x+/maintenance+/new.tsx+++ b/apps/erp/app/routes/x+/maintenance+/new.tsx@@ -7,11 +7,10 @@ import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { redirect, useLoaderData } from "react-router";import {getFailureModesList,- maintenanceDispatchValidator,- upsertMaintenanceDispatch+ insertMaintenanceDispatch,+ maintenanceDispatchValidator} from "~/modules/resources";import MaintenanceDispatchForm from "~/modules/resources/ui/Maintenance/MaintenanceDispatchForm";-import { getNextSequence } from "~/modules/settings";import { getUserDefaults } from "~/modules/users/users.server";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -53,32 +52,16 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- const nextSequence = await getNextSequence(- client,- "maintenanceDispatch",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.maintenanceDispatches,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-const content = validation.data.content? JSON.parse(validation.data.content)- : {};+ : undefined;- const insertDispatch = await upsertMaintenanceDispatch(client, {- maintenanceDispatchId: nextSequence.data,+ const result = await insertMaintenanceDispatch(client, {status: validation.data.status,priority: validation.data.priority,- severity: validation.data.severity || "Support Required",- source: validation.data.source || "Reactive",- oeeImpact: validation.data.oeeImpact || "No Impact",+ severity: validation.data.severity || undefined,+ source: validation.data.source || undefined,+ oeeImpact: validation.data.oeeImpact || undefined,workCenterId: validation.data.workCenterId || undefined,locationId: validation.data.locationId,assignee: validation.data.assignee || undefined,@@ -90,26 +73,18 @@ export async function action({ request }: ActionFunctionArgs) {createdBy: userId});- if (insertDispatch.error) {+ if (result.error || !result.data) {throw redirect(path.to.maintenanceDispatches,await flash(request,- error(insertDispatch.error, "Failed to create maintenance dispatch")+ error(result.error, "Failed to create maintenance dispatch")));}- const newId = insertDispatch.data?.id;- if (!newId) {- throw redirect(- path.to.maintenanceDispatches,- await flash(request, error(null, "Failed to get new dispatch ID"))- );- }-throw redirect(- path.to.maintenanceDispatch(newId),+ path.to.maintenanceDispatch(result.data.id),await flash(request, success("Created maintenance dispatch")));}diff --git a/apps/erp/app/routes/x+/maintenance+/update.tsx b/apps/erp/app/routes/x+/maintenance+/update.tsxindex 1a9d4d7a45..5d0cebf5f8 100644--- a/apps/erp/app/routes/x+/maintenance+/update.tsx+++ b/apps/erp/app/routes/x+/maintenance+/update.tsx@@ -2,7 +2,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";import type { ActionFunctionArgs } from "react-router";import {isMaintenanceDispatchLocked,- upsertMaintenanceDispatch+ updateMaintenanceDispatch} from "~/modules/resources";import { requireUnlockedBulk } from "~/utils/lockedGuard.server";@@ -75,13 +75,12 @@ export async function action({ request }: ActionFunctionArgs) {}}- // Update each maintenance dispatch individually since upsertMaintenanceDispatch expects single recordsconst results = await Promise.all(ids.map(async (id) => {- return await upsertMaintenanceDispatch(client, {+ return await updateMaintenanceDispatch(client, {id: id as string,...updateData- } as Parameters<typeof upsertMaintenanceDispatch>[1]);+ } as Parameters<typeof updateMaintenanceDispatch>[1]);}));diff --git a/apps/erp/app/routes/x+/production+/planning.update.tsx b/apps/erp/app/routes/x+/production+/planning.update.tsxindex fe0cd48a38..d0d25f3bb0 100644--- a/apps/erp/app/routes/x+/production+/planning.update.tsx+++ b/apps/erp/app/routes/x+/production+/planning.update.tsx@@ -2,14 +2,12 @@ import { requirePermissions } from "@carbon/auth/auth.server";import type { ActionFunctionArgs } from "react-router";import { data } from "react-router";import { z } from "zod";-import { getDefaultStorageUnitForJob } from "~/modules/inventory";import {+ insertJob,productionOrderValidator,recalculateJobRequirements,- upsertJob,upsertJobMethod} from "~/modules/production";-import { getNextSequence } from "~/modules/settings/settings.service";const itemsValidator = z.object({@@ -156,57 +154,21 @@ export async function action({ request }: ActionFunctionArgs) {for (const order of orders) {if (!order.existingId) {// Create new job- const nextSequence = await getNextSequence(- client,- "job",- companyId- );- if (nextSequence.error) {- const errorMsg = `Failed to generate job sequence for item ${item.id}: ${nextSequence.error.message}`;- console.error(errorMsg);- errors.push(errorMsg);- continue;- }-- const jobId = nextSequence.data;- if (!jobId) {- const errorMsg = `Failed to generate job ID for item ${item.id}`;- console.error(errorMsg);- errors.push(errorMsg);- continue;- }-- const storageUnitId = await getDefaultStorageUnitForJob(- client,- item.id,- locationId,- companyId- );-- // Calculate scrap quantity based on scrap percentage- const scrapPercentage = manufacturing.data?.scrapPercentage ?? 0;- const scrapQuantity =- scrapPercentage > 0- ? Math.ceil(order.quantity * scrapPercentage)- : 0;-- const createJob = await upsertJob(+ const createJob = await insertJob(client,{itemId: item.id,- jobId,quantity: order.quantity,- scrapQuantity,startDate: order.startDate ?? undefined,dueDate: order.dueDate ?? undefined,deadlineType: order.isASAP ? "ASAP" : "Soft Deadline",+ status: "Planned",locationId,- storageUnitId: storageUnitId ?? undefined,companyId,createdBy: userId,unitOfMeasureCode: "EA"},- "Planned"+ { skipMethod: true, skipRecalculate: true });if (createJob.error) {diff --git a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsxindex 3ba856cacd..6247aaf8a3 100644--- a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx+++ b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx@@ -21,7 +21,7 @@ import {isPurchaseInvoiceLocked,PurchaseInvoiceSummary,purchaseInvoiceValidator,- upsertPurchaseInvoice+ updatePurchaseInvoice} from "~/modules/invoicing";import { PurchaseInvoiceDeliveryForm } from "~/modules/invoicing/ui/PurchaseInvoice";import type { PurchaseInvoiceDeliveryFormRef } from "~/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceDeliveryForm";@@ -103,19 +103,30 @@ export async function action({ request, params }: ActionFunctionArgs) {const { invoiceId, ...d } = validation.data;if (!invoiceId) throw new Error("Could not find invoiceId");- const updatePurchaseInvoice = await upsertPurchaseInvoice(client, {+ const result = await updatePurchaseInvoice(client, {id,invoiceId,- ...d,- updatedBy: userId,- customFields: setCustomFields(formData)+ supplierId: d.supplierId,+ supplierReference: d.supplierReference || null,+ paymentTermId: d.paymentTermId || null,+ currencyCode: d.currencyCode,+ locationId: d.locationId,+ invoiceSupplierId: d.invoiceSupplierId || null,+ invoiceSupplierContactId: d.invoiceSupplierContactId || null,+ invoiceSupplierLocationId: d.invoiceSupplierLocationId || null,+ dateIssued: d.dateIssued || null,+ dateDue: d.dateDue || null,+ exchangeRate: d.exchangeRate,+ exchangeRateUpdatedAt: d.exchangeRateUpdatedAt,+ customFields: setCustomFields(formData),+ updatedBy: userId});- if (updatePurchaseInvoice.error) {+ if (result.error) {throw redirect(path.to.purchaseInvoice(id),await flash(request,- error(updatePurchaseInvoice.error, "Failed to update purchase invoice")+ error(result.error, "Failed to update purchase invoice")));}diff --git a/apps/erp/app/routes/x+/purchase-invoice+/new.tsx b/apps/erp/app/routes/x+/purchase-invoice+/new.tsxindex 652b5ee1a2..60e1701863 100644--- a/apps/erp/app/routes/x+/purchase-invoice+/new.tsx+++ b/apps/erp/app/routes/x+/purchase-invoice+/new.tsx@@ -11,11 +11,10 @@ import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";import {createPurchaseInvoiceFromPurchaseOrder,+ insertPurchaseInvoice,PurchaseInvoiceForm,- purchaseInvoiceValidator,- upsertPurchaseInvoice+ purchaseInvoiceValidator} from "~/modules/invoicing";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -81,53 +80,28 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { id, ...d } = validation.data;- let invoiceId = d.invoiceId;- const useNextSequence = !invoiceId;+ const { id: _id, ...d } = validation.data;- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "purchaseInvoice",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newPurchaseInvoice,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- invoiceId = nextSequence.data;- }-- if (!invoiceId) throw new Error("invoiceId is not defined");-- const createPurchaseInvoice = await upsertPurchaseInvoice(client, {+ const result = await insertPurchaseInvoice(client, {...d,- invoiceId,+ invoiceId: d.invoiceId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createPurchaseInvoice.error || !createPurchaseInvoice.data?.[0]) {+ if (result.error || !result.data) {throw redirect(path.to.purchaseInvoices,await flash(request,- error(createPurchaseInvoice.error, "Failed to insert purchase invoice")+ error(result.error, "Failed to insert purchase invoice")));}- const invoice = createPurchaseInvoice.data?.[0];-- throw redirect(path.to.purchaseInvoice(invoice?.id!));+ throw redirect(path.to.purchaseInvoice(result.data.id));}export default function PurchaseInvoiceNewRoute() {diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsxindex 10b96d68e7..0db95ba47f 100644--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx@@ -20,7 +20,7 @@ import {getPurchaseOrderPayment,isPurchaseOrderLocked,purchaseOrderValidator,- upsertPurchaseOrder+ updatePurchaseOrder} from "~/modules/purchasing";import {PurchaseOrderDeliveryForm,@@ -96,7 +96,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const isLocked = isPurchaseOrderLocked(purchaseOrder.data?.status);// If locked, require delete permission; otherwise require update permission- const { client, userId } = await requirePermissions(request, {+ const { client, companyGroupId, userId } = await requirePermissions(request, {...(isLocked ? { delete: "purchasing" } : { update: "purchasing" })});@@ -116,22 +116,30 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- const { purchaseOrderId, ...d } = validation.data;- if (!purchaseOrderId) throw new Error("Could not find purchaseOrderId");-- const updatePurchaseOrder = await upsertPurchaseOrder(client, {- id: orderId,- purchaseOrderId,- ...d,- updatedBy: userId,- customFields: setCustomFields(formData)- });- if (updatePurchaseOrder.error) {+ const result = await updatePurchaseOrder(+ client,+ {+ id: orderId,+ status: validation.data.status,+ supplierId: validation.data.supplierId,+ currencyCode: validation.data.currencyCode,+ orderDate: validation.data.orderDate,+ supplierContactId: validation.data.supplierContactId || null,+ supplierLocationId: validation.data.supplierLocationId || null,+ supplierReference: validation.data.supplierReference,+ purchaseOrderType: validation.data.purchaseOrderType,+ notes: validation.data.notes,+ customFields: setCustomFields(formData),+ updatedBy: userId+ },+ companyGroupId+ );+ if (result.error) {throw redirect(path.to.purchaseOrder(orderId),await flash(request,- error(updatePurchaseOrder.error, "Failed to update purchase order")+ error(result.error, "Failed to update purchase order")));}diff --git a/apps/erp/app/routes/x+/purchase-order+/new.tsx b/apps/erp/app/routes/x+/purchase-order+/new.tsxindex 54cea5019a..256c8fd54a 100644--- a/apps/erp/app/routes/x+/purchase-order+/new.tsx+++ b/apps/erp/app/routes/x+/purchase-order+/new.tsx@@ -10,11 +10,10 @@ import { z } from "zod";import { useUrlParams, useUser } from "~/hooks";import type { PurchaseOrderStatus } from "~/modules/purchasing";import {- purchaseOrderValidator,- upsertPurchaseOrder+ insertPurchaseOrder,+ purchaseOrderValidator} from "~/modules/purchasing";import { PurchaseOrderForm } from "~/modules/purchasing/ui/PurchaseOrder";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -45,51 +44,26 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let purchaseOrderId = validation.data.purchaseOrderId;- const useNextSequence = !purchaseOrderId;-- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "purchaseOrder",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newPurchaseOrder,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- purchaseOrderId = nextSequence.data;- }-- if (!purchaseOrderId) throw new Error("purchaseOrderId is not defined");-- const createPurchaseOrder = await upsertPurchaseOrder(client, {+ const result = await insertPurchaseOrder(client, {...validation.data,- purchaseOrderId,+ purchaseOrderId: validation.data.purchaseOrderId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createPurchaseOrder.error || !createPurchaseOrder.data?.[0]) {+ if (result.error || !result.data) {throw redirect(path.to.purchaseOrders,await flash(request,- error(createPurchaseOrder.error, "Failed to insert purchase order")+ error(result.error, "Failed to insert purchase order")));}- const order = createPurchaseOrder.data?.[0];-- throw redirect(path.to.purchaseOrder(order.id!));+ throw redirect(path.to.purchaseOrder(result.data.id));}export default function PurchaseOrderNewRoute() {diff --git a/apps/erp/app/routes/x+/purchasing+/planning.update.tsx b/apps/erp/app/routes/x+/purchasing+/planning.update.tsxindex faff965798..bcb05eff07 100644--- a/apps/erp/app/routes/x+/purchasing+/planning.update.tsx+++ b/apps/erp/app/routes/x+/purchasing+/planning.update.tsx@@ -2,13 +2,11 @@ import { requirePermissions } from "@carbon/auth/auth.server";import type { ActionFunctionArgs } from "react-router";import { data } from "react-router";import { z } from "zod";-import { getCurrencyByCode } from "~/modules/accounting/accounting.service";import {+ insertPurchaseOrder,plannedOrderValidator,- upsertPurchaseOrder,upsertPurchaseOrderLine} from "~/modules/purchasing";-import { getNextSequence } from "~/modules/settings/settings.service";const itemsValidator = z.object({@@ -274,54 +272,24 @@ export async function action({ request }: ActionFunctionArgs) {}if (!purchaseOrderId) {- const nextSequence = await getNextSequence(- client,- "purchaseOrder",- companyId- );- if (nextSequence.error || !nextSequence.data) {- errors.push(- `Failed to generate PO sequence for supplier ${supplierId}`- );- continue;- }-- let exchangeRate = 1;- if (supplier.currencyCode !== baseCurrencyCode) {- const currency = await getCurrencyByCode(- client,- companyGroupId,- supplier.currencyCode ?? baseCurrencyCode- );- if (!currency.error && currency.data) {- exchangeRate = currency.data.exchangeRate ?? 1;- }- }-- const createPO = await upsertPurchaseOrder(- client,- {- purchaseOrderId: nextSequence.data,- status: "Planned" as const,- supplierId,- purchaseOrderType: "Purchase",- currencyCode: supplier.currencyCode ?? baseCurrencyCode,- exchangeRate,- companyId,- companyGroupId,- createdBy: userId- },- undefined- );+ const createPO = await insertPurchaseOrder(client, {+ status: "Planned",+ supplierId,+ purchaseOrderType: "Purchase",+ currencyCode: supplier.currencyCode ?? baseCurrencyCode,+ companyId,+ companyGroupId,+ createdBy: userId+ });- if (createPO.error || !createPO.data?.[0]) {+ if (createPO.error || !createPO.data) {errors.push(`Failed to create PO for supplier ${supplierId}: ${createPO.error?.message ?? "no data returned"}`);continue;}- purchaseOrderId = createPO.data[0].id;+ purchaseOrderId = createPO.data.id;}poCache.set(key, purchaseOrderId);diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsxindex 5ba7b3a549..3ca6c4ec68 100644--- a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsx+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsx@@ -7,11 +7,10 @@ import {getPurchasingRFQ,getPurchasingRFQLines,getPurchasingRFQSuppliers,+ insertSupplierQuote,updatePurchasingRFQStatus,- upsertSupplierQuote,upsertSupplierQuoteLine} from "~/modules/purchasing";-import { getNextSequence } from "~/modules/settings";import { path } from "~/utils/path";export async function action({ request, params }: ActionFunctionArgs) {@@ -79,19 +78,9 @@ export async function action({ request, params }: ActionFunctionArgs) {for (const rfqSupplier of suppliers) {const supplierId = rfqSupplier.supplierId;- // Get next sequence number for the supplier quote- const sequence = await getNextSequence(client, "supplierQuote", companyId);- if (sequence.error || !sequence.data) {- console.error("Failed to get sequence:", sequence.error);- continue;- }-// Create the supplier quote- const quoteResult = await upsertSupplierQuote(client, {- supplierQuoteId: sequence.data,- supplierQuoteType: "Purchase",+ const quoteResult = await insertSupplierQuote(client, {supplierId,- quotedDate: new Date().toISOString().split("T")[0],companyId,companyGroupId,createdBy: userIddiff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.finalize.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.finalize.tsxindex 0b95e63340..cb5110236f 100644--- a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.finalize.tsx+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.finalize.tsx@@ -14,12 +14,12 @@ import {getSupplierContact,getSupplierInteractionDocuments,getSupplierInteractionLineDocuments,+ insertSupplierQuote,purchasingRfqFinalizeValidator,updatePurchasingRFQStatus,- upsertSupplierQuote,upsertSupplierQuoteLine} from "~/modules/purchasing";-import { getCompany, getNextSequence } from "~/modules/settings";+import { getCompany } from "~/modules/settings";import { upsertExternalLink } from "~/modules/shared";import { getUser } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -110,6 +110,7 @@ export async function action({ request, params }: ActionFunctionArgs) {contactEmail: string;contactFirstName: string;supplierQuoteId: string;+ supplierQuoteReadableId: string;externalLinkId: string;}> = [];@@ -119,19 +120,9 @@ export async function action({ request, params }: ActionFunctionArgs) {(sc) => sc.supplierId === supplierId);- // Get next sequence number for the supplier quote- const sequence = await getNextSequence(client, "supplierQuote", companyId);- if (sequence.error || !sequence.data) {- console.error("Failed to get sequence:", sequence.error);- continue;- }-// Create the supplier quote- const quoteResult = await upsertSupplierQuote(client, {- supplierQuoteId: sequence.data,- supplierQuoteType: "Purchase",+ const quoteResult = await insertSupplierQuote(client, {supplierId,- quotedDate: new Date().toISOString().split("T")[0],companyId,companyGroupId,createdBy: userId@@ -143,6 +134,7 @@ export async function action({ request, params }: ActionFunctionArgs) {}const supplierQuoteId = quoteResult.data.id;+ const supplierQuoteReadableId = quoteResult.data.supplierQuoteId;createdQuotes.push(supplierQuoteId);// Create quote lines for each RFQ line that has an itemId@@ -211,7 +203,8 @@ export async function action({ request, params }: ActionFunctionArgs) {emailsToSend.push({contactEmail: supplierContact.data.contact.email,contactFirstName: supplierContact.data.contact.firstName ?? "there",- supplierQuoteId: sequence.data,+ supplierQuoteId,+ supplierQuoteReadableId,externalLinkId: externalLinkResult.data.id});}@@ -280,7 +273,7 @@ export async function action({ request, params }: ActionFunctionArgs) {for (const email of emailsToSend) {try {const externalQuoteUrl = `${baseUrl}${path.to.externalSupplierQuote(email.externalLinkId)}`;- const emailSubject = `Supplier Quote ${email.supplierQuoteId} from ${company.data.name}`;+ const emailSubject = `Supplier Quote ${email.supplierQuoteReadableId} from ${company.data.name}`;const emailBody = `Hey ${email.contactFirstName},\n\nPlease provide pricing and lead time(s) for the linked quote:`;const emailSignature = `Thanks,\n${user.data.firstName} ${user.data.lastName}\n${company.data.name}`;diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/new.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/new.tsxindex 7e83cf8054..aa92be6ddf 100644--- a/apps/erp/app/routes/x+/purchasing-rfq+/new.tsx+++ b/apps/erp/app/routes/x+/purchasing-rfq+/new.tsx@@ -9,12 +9,11 @@ import { redirect } from "react-router";import { useUser } from "~/hooks";import type { PurchasingRFQStatusType } from "~/modules/purchasing";import {+ insertPurchasingRFQ,purchasingRfqValidator,- upsertPurchasingRFQ,upsertPurchasingRFQSuppliers} from "~/modules/purchasing";import { PurchasingRFQForm } from "~/modules/purchasing/ui/PurchasingRfq";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -37,51 +36,24 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let rfqId = validation.data.rfqId;- const useNextSequence = !rfqId;-- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "purchasingRfq",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newPurchasingRFQ,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- rfqId = nextSequence.data;- }-- if (!rfqId) throw new Error("rfqId is not defined");-- // Extract supplier IDsconst { supplierIds, ...rfqData } = validation.data;- const createPurchasingRFQ = await upsertPurchasingRFQ(client, {+ const result = await insertPurchasingRFQ(client, {...rfqData,- rfqId,+ rfqId: rfqData.rfqId || undefined,companyId,createdBy: userId,customFields: setCustomFields(formData)});- if (createPurchasingRFQ.error || !createPurchasingRFQ.data) {+ if (result.error || !result.data) {throw redirect(path.to.purchasingRfqs,- await flash(- request,- error(createPurchasingRFQ.error, "Failed to insert RFQ")- )+ await flash(request, error(result.error, "Failed to insert RFQ")));}- const rfq = createPurchasingRFQ.data;+ const rfq = result.data;// Create supplier associationsif (supplierIds && supplierIds.length > 0) {diff --git a/apps/erp/app/routes/x+/quality+/gauges.$id.tsx b/apps/erp/app/routes/x+/quality+/gauges.$id.tsxindex c9d615674d..ea2a74f0bd 100644--- a/apps/erp/app/routes/x+/quality+/gauges.$id.tsx+++ b/apps/erp/app/routes/x+/quality+/gauges.$id.tsx@@ -13,7 +13,7 @@ import {gaugeValidator,getGauge,getGaugeCalibrationRecordsByGaugeId,- upsertGauge+ updateGauge} from "~/modules/quality";import GaugeForm from "~/modules/quality/ui/Gauge/GaugeForm";import { getCustomFields, setCustomFields } from "~/utils/form";@@ -80,11 +80,22 @@ export async function action({ request, params }: ActionFunctionArgs) {: "Pending": "Pending";- const update = await upsertGauge(client, {+ const update = await updateGauge(client, {id,gaugeId,gaugeCalibrationStatus,- ...d,+ gaugeTypeId: d.gaugeTypeId,+ gaugeRole: d.gaugeRole,+ supplierId: d.supplierId || null,+ modelNumber: d.modelNumber || null,+ serialNumber: d.serialNumber || null,+ description: d.description || null,+ dateAcquired: d.dateAcquired || null,+ lastCalibrationDate: d.lastCalibrationDate || null,+ nextCalibrationDate: d.nextCalibrationDate || null,+ locationId: d.locationId || null,+ storageUnitId: d.storageUnitId || null,+ calibrationIntervalInMonths: d.calibrationIntervalInMonths,customFields: setCustomFields(formData),updatedBy: userId});diff --git a/apps/erp/app/routes/x+/quality+/gauges.new.tsx b/apps/erp/app/routes/x+/quality+/gauges.new.tsxindex 0a284aa5fb..b1d8507af8 100644--- a/apps/erp/app/routes/x+/quality+/gauges.new.tsx+++ b/apps/erp/app/routes/x+/quality+/gauges.new.tsx@@ -1,6 +1,5 @@import { assertIsPost, error, success } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";-import { getCarbonServiceRole } from "@carbon/auth/client.server";import { flash } from "@carbon/auth/session.server";import { validationError, validator } from "@carbon/form";import { getLocalTimeZone, parseDate, today } from "@internationalized/date";@@ -8,10 +7,8 @@ import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { redirect, useNavigate } from "react-router";import { useRouteData, useUser } from "~/hooks";import type { GaugeType } from "~/modules/quality";-import { gaugeValidator, upsertGauge } from "~/modules/quality";+import { gaugeValidator, insertGauge } from "~/modules/quality";import GaugeForm from "~/modules/quality/ui/Gauge/GaugeForm";--import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import { getParams, path } from "~/utils/path";@@ -36,27 +33,6 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let gaugeId = validation.data.gaugeId;- const useNextSequence = !gaugeId;- if (useNextSequence) {- const nextSequence = await getNextSequence(- getCarbonServiceRole(),- "gauge",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newGauge,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- gaugeId = nextSequence.data;- }-- if (!gaugeId) throw new Error("gaugeId is not defined");const { id: _id, ...d } = validation.data;const gaugeCalibrationStatus = d.nextCalibrationDate@@ -67,33 +43,25 @@ export async function action({ request }: ActionFunctionArgs) {: "Pending": "Pending";- const createGauge = await upsertGauge(client, {+ const result = await insertGauge(client, {...d,- gaugeId,+ gaugeId: d.gaugeId || undefined,gaugeCalibrationStatus,companyId,createdBy: userId,customFields: setCustomFields(formData)});- if (createGauge.error || !createGauge.data) {- throw redirect(- path.to.gauges,- await flash(request, error(createGauge.error, "Failed to insert gauge"))- );- }-- const readableId = createGauge.data?.gaugeId;- if (!readableId) {+ if (result.error || !result.data) {throw redirect(path.to.gauges,- await flash(request, error("Failed to insert gauge"))+ await flash(request, error(result.error, "Failed to insert gauge")));}throw redirect(`${path.to.gauges}?${getParams(request)}`,- await flash(request, success(`Gauge ${readableId} created`))+ await flash(request, success(`Gauge ${result.data.gaugeId} created`)));}diff --git a/apps/erp/app/routes/x+/quality+/inbound-inspections.$id.reject.tsx b/apps/erp/app/routes/x+/quality+/inbound-inspections.$id.reject.tsxindex 0182388b72..eb0e2d48be 100644--- a/apps/erp/app/routes/x+/quality+/inbound-inspections.$id.reject.tsx+++ b/apps/erp/app/routes/x+/quality+/inbound-inspections.$id.reject.tsx@@ -12,10 +12,9 @@ import {deleteIssue,getInboundInspection,getIssueTypesList,- upsertIssue+ insertIssue} from "~/modules/quality";import { dispositionInboundInspection } from "~/modules/quality/quality.server";-import { getNextSequence } from "~/modules/settings";import { getCompanyIntegrations } from "~/modules/settings/settings.server";import { getUserDefaults } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -90,21 +89,6 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- const nextSequence = await getNextSequence(- serviceRole,- "nonConformance",- companyId- );- if (nextSequence.error || !nextSequence.data) {- throw redirect(- path.to.inboundInspection(id),- await flash(- request,- error(nextSequence.error, "Lot rejected, but failed to open NCR")- )- );- }-const supplierName = insp.supplier?.name ?? "supplier";const receiptReadableId = insp.receipt?.receiptId ?? "";const itemReadableId =@@ -120,37 +104,33 @@ export async function action({ request, params }: ActionFunctionArgs) {.filter(Boolean).join(" ");- const createIssue = await upsertIssue(serviceRole, {- nonConformanceId: nextSequence.data,+ const createResult = await insertIssue(serviceRole, {name: issueTitle,description: `Auto-created from inbound inspection ${inspectionReadableId}. Lot size ${insp.lotSize}, sample ${insp.sampleSize}, Ac ${insp.acceptanceNumber} / Re ${insp.rejectionNumber}. Supplier: ${supplierName}.`,priority: "Medium",source: "Internal",locationId,nonConformanceTypeId: issueType.id,- nonConformanceWorkflowId: undefined,openDate: today(getLocalTimeZone()).toString(),quantity: Number(insp.lotSize ?? 0),items: insp.itemId ? [insp.itemId] : [],- requiredActionIds: [],- approvalRequirements: [],companyId,createdBy: userId});- if (createIssue.error || !createIssue.data?.id) {+ if (createResult.error || !createResult.data) {throw redirect(path.to.inboundInspection(id),await flash(request,- error(createIssue.error, "Lot rejected, but failed to create NCR")+ error(createResult.error, "Lot rejected, but failed to create NCR")));}- const ncrId = createIssue.data.id;+ const ncrId = createResult.data.id;- // upsertIssue inserted nonConformanceItem rows with default qty 0 and+ // insertIssue inserted nonConformanceItem rows with default qty 0 and// disposition 'Pending'. Now that we know the lot context, overwrite with// the actual lot quantity and default the MRB's starting disposition to// 'Scrap' (the most conservative outcome — they can downgrade to Rework /@@ -278,7 +258,7 @@ export async function action({ request, params }: ActionFunctionArgs) {carbonUrl: `${ERP_URL}${path.to.issue(ncrId)}`,issue: {id: ncrId,- nonConformanceId: nextSequence.data,+ nonConformanceId: createResult.data.nonConformanceId,title: issueTitle,description: `Auto-created from inbound inspection ${inspectionReadableId || id}`,severity: "Medium"diff --git a/apps/erp/app/routes/x+/quote+/$quoteId.details.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.details.tsxindex c57bfa569d..4e5f994102 100644--- a/apps/erp/app/routes/x+/quote+/$quoteId.details.tsx+++ b/apps/erp/app/routes/x+/quote+/$quoteId.details.tsx@@ -20,7 +20,7 @@ import {getQuote,isQuoteLocked,quoteValidator,- upsertQuote+ updateQuote} from "~/modules/sales";import {OpportunityDocuments,@@ -86,21 +86,37 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- const { quoteId, ...d } = validation.data;- if (!quoteId) throw new Error("Could not find quoteId");-- const update = await upsertQuote(client, {- id,- quoteId,- ...d,- companyGroupId,- customFields: setCustomFields(formData),- updatedBy: userId- });- if (update.error) {+ const result = await updateQuote(+ client,+ {+ id,+ name: validation.data.name || null,+ status: validation.data.status,+ currencyCode: validation.data.currencyCode,+ expirationDate: validation.data.expirationDate || null,+ customerId: validation.data.customerId,+ customerContactId: validation.data.customerContactId || null,+ customerLocationId: validation.data.customerLocationId || null,+ customerEngineeringContactId:+ validation.data.customerEngineeringContactId || null,+ customerReference: validation.data.customerReference || null,+ salesPersonId: validation.data.salesPersonId || null,+ estimatorId: validation.data.estimatorId || null,+ locationId: validation.data.locationId,+ dueDate: validation.data.dueDate || null,+ digitalQuoteAcceptedBy: validation.data.digitalQuoteAcceptedBy || null,+ digitalQuoteAcceptedByEmail:+ validation.data.digitalQuoteAcceptedByEmail || null,+ notes: validation.data.notes,+ customFields: setCustomFields(formData),+ updatedBy: userId+ },+ companyGroupId+ );+ if (result.error) {throw redirect(path.to.quote(id),- await flash(request, error(update.error, "Failed to update quote"))+ await flash(request, error(result.error, "Failed to update quote")));}diff --git a/apps/erp/app/routes/x+/quote+/new.tsx b/apps/erp/app/routes/x+/quote+/new.tsxindex a9e15b455b..3331bac206 100644--- a/apps/erp/app/routes/x+/quote+/new.tsx+++ b/apps/erp/app/routes/x+/quote+/new.tsx@@ -8,9 +8,8 @@ import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";import type { QuotationStatusType } from "~/modules/sales";-import { quoteValidator, upsertQuote } from "~/modules/sales";+import { insertQuote, quoteValidator } from "~/modules/sales";import { QuoteForm } from "~/modules/sales/ui/Quotes";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -36,44 +35,25 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let quoteId = validation.data.quoteId;- const useNextSequence = !quoteId;+ const { id: _id, ...data } = validation.data;- if (useNextSequence) {- const nextSequence = await getNextSequence(client, "quote", companyId);- if (nextSequence.error) {- throw redirect(- path.to.newQuote,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- quoteId = nextSequence.data;- }-- if (!quoteId) throw new Error("quoteId is not defined");-- const createQuote = await upsertQuote(client, {- ...validation.data,- quoteId,+ const result = await insertQuote(client, {+ ...data,+ quoteId: data.quoteId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createQuote.error || !createQuote.data?.[0]) {+ if (result.error || !result.data) {throw redirect(path.to.quotes,- await flash(request, error(createQuote.error, "Failed to insert quote"))+ await flash(request, error(result.error, "Failed to insert quote")));}- const order = createQuote.data?.[0];-- throw redirect(path.to.quote(order.id!));+ throw redirect(path.to.quote(result.data.id));}export default function QuoteNewRoute() {diff --git a/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.details.tsx b/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.details.tsxindex 4f038231e1..7954e98ebd 100644--- a/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.details.tsx+++ b/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.details.tsx@@ -20,7 +20,7 @@ import {getSalesInvoice,isSalesInvoiceLocked,salesInvoiceValidator,- upsertSalesInvoice+ updateSalesInvoice} from "~/modules/invoicing";import type { SalesInvoiceShipmentFormRef } from "~/modules/invoicing/ui/SalesInvoice/SalesInvoiceShipmentForm";import SalesInvoiceShipmentForm from "~/modules/invoicing/ui/SalesInvoice/SalesInvoiceShipmentForm";@@ -95,19 +95,30 @@ export async function action({ request, params }: ActionFunctionArgs) {const { invoiceId, ...d } = validation.data;if (!invoiceId) throw new Error("Could not find invoiceId");- const updateSalesInvoice = await upsertSalesInvoice(client, {+ const result = await updateSalesInvoice(client, {id,invoiceId,- ...d,- updatedBy: userId,- customFields: setCustomFields(formData)+ customerId: d.customerId,+ customerReference: d.customerReference || null,+ paymentTermId: d.paymentTermId || null,+ currencyCode: d.currencyCode,+ locationId: d.locationId,+ invoiceCustomerId: d.invoiceCustomerId || null,+ invoiceCustomerContactId: d.invoiceCustomerContactId || null,+ invoiceCustomerLocationId: d.invoiceCustomerLocationId || null,+ dateIssued: d.dateIssued || null,+ dateDue: d.dateDue || null,+ exchangeRate: d.exchangeRate,+ exchangeRateUpdatedAt: d.exchangeRateUpdatedAt,+ customFields: setCustomFields(formData),+ updatedBy: userId});- if (updateSalesInvoice.error) {+ if (result.error) {throw redirect(path.to.salesInvoice(id),await flash(request,- error(updateSalesInvoice.error, "Failed to update sales invoice")+ error(result.error, "Failed to update sales invoice")));}diff --git a/apps/erp/app/routes/x+/sales-invoice+/new.tsx b/apps/erp/app/routes/x+/sales-invoice+/new.tsxindex 8cf62f86a0..5234835dd5 100644--- a/apps/erp/app/routes/x+/sales-invoice+/new.tsx+++ b/apps/erp/app/routes/x+/sales-invoice+/new.tsx@@ -12,11 +12,10 @@ import { useUrlParams, useUser } from "~/hooks";import {createSalesInvoiceFromSalesOrder,createSalesInvoiceFromShipment,- salesInvoiceValidator,- upsertSalesInvoice+ insertSalesInvoice,+ salesInvoiceValidator} from "~/modules/invoicing";import SalesInvoiceForm from "~/modules/invoicing/ui/SalesInvoice/SalesInvoiceForm";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -102,54 +101,28 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { id, ...d } = validation.data;- let invoiceId = d.invoiceId;- const useNextSequence = !invoiceId;+ const { id: _id, ...d } = validation.data;- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "salesInvoice",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newSalesInvoice,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- invoiceId = nextSequence.data;- }-- if (!invoiceId) throw new Error("invoiceId is not defined");-- const createSalesInvoice = await upsertSalesInvoice(client, {+ const result = await insertSalesInvoice(client, {...d,- invoiceId,+ invoiceId: d.invoiceId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createSalesInvoice.error || !createSalesInvoice.data?.[0]) {- console.error(createSalesInvoice.error);+ if (result.error || !result.data) {throw redirect(path.to.salesInvoices,await flash(request,- error(createSalesInvoice.error, "Failed to insert sales invoice")+ error(result.error, "Failed to insert sales invoice")));}- const invoice = createSalesInvoice.data?.[0];-- throw redirect(path.to.salesInvoice(invoice?.id!));+ throw redirect(path.to.salesInvoice(result.data.id));}export default function SalesInvoiceNewRoute() {diff --git a/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx b/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.job.tsxindex 39b5c1a4cd..5389f22d81 100644--- a/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx+++ b/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.job.tsx@@ -3,18 +3,9 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { getCarbonServiceRole } from "@carbon/auth/client.server";import { flash } from "@carbon/auth/session.server";import { validationError, validator } from "@carbon/form";-import { trigger } from "@carbon/jobs";-import { parseDate } from "@internationalized/date";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";-import { getDefaultStorageUnitForJob } from "~/modules/inventory";-import { getItemReplenishment } from "~/modules/items";-import {- salesOrderToJobValidator,- upsertJob,- upsertJobMethod-} from "~/modules/production";-import { getNextSequence } from "~/modules/settings";+import { insertJob, salesOrderToJobValidator } from "~/modules/production";import { setCustomFields } from "~/utils/form";import { path } from "~/utils/path";@@ -40,58 +31,23 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- let jobId = validation.data.jobId;- const useNextSequence = !jobId;- let leadTime = 7;- if (useNextSequence) {- const [nextSequence, manufacturing] = await Promise.all([- getNextSequence(serviceRole, "job", companyId),- getItemReplenishment(serviceRole, validation.data.itemId, companyId)- ]);- if (nextSequence.error) {- throw redirect(- path.to.newJob,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- jobId = nextSequence.data;- leadTime = manufacturing.data?.leadTime ?? 7;- } else {- const manufacturing = await getItemReplenishment(- serviceRole,- validation.data.itemId,- companyId- );- leadTime = manufacturing.data?.leadTime ?? 7;- }-- if (!jobId) throw new Error("jobId is not defined");const { id: _id, ...d } = validation.data;- const storageUnitId = await getDefaultStorageUnitForJob(+ const methodSource = d.quoteId && d.quoteLineId ? "quoteLine" : "item";++ const createJob = await insertJob(serviceRole,- validation.data.itemId,- validation.data.locationId,- companyId+ {+ ...d,+ jobId: d.jobId || undefined,+ companyId,+ createdBy: userId,+ customFields: setCustomFields(formData)+ },+ { methodSource });- const createJob = await upsertJob(serviceRole, {- ...d,- jobId,- storageUnitId: storageUnitId ?? undefined,- startDate: d.dueDate- ? parseDate(d.dueDate).subtract({ days: leadTime }).toString()- : undefined,- companyId,- createdBy: userId,- customFields: setCustomFields(formData)- });-- const id = createJob.data?.id!;- if (createJob.error || !jobId) {+ if (createJob.error || !createJob.data) {console.error(createJob.error);throw redirect(path.to.salesOrderLine(orderId, lineId),@@ -99,49 +55,7 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- if (validation.data.quoteId && validation.data.quoteLineId) {- const upsertMethod = await upsertJobMethod(serviceRole, "quoteLineToJob", {- sourceId: `${d.quoteId}:${d.quoteLineId}`,- targetId: id,- companyId,- userId- });-- if (upsertMethod.error) {- console.error(upsertMethod.error);- throw redirect(- path.to.salesOrderLine(orderId, lineId),- await flash(- request,- error(upsertMethod.error, "Failed to create job method.")- )- );- }- } else {- const upsertMethod = await upsertJobMethod(serviceRole, "itemToJob", {- sourceId: d.itemId,- targetId: id,- companyId,- userId- });-- if (upsertMethod.error) {- throw redirect(- path.to.salesOrderLine(orderId, lineId),- await flash(- request,- error(upsertMethod.error, "Failed to create job method.")- )- );- }- }-- await trigger("recalculate", {- type: "jobRequirements",- id,- companyId,- userId- });+ const id = createJob.data.id;throw redirect(path.to.jobDetails(id));}diff --git a/apps/erp/app/routes/x+/sales-order+/$orderId.details.tsx b/apps/erp/app/routes/x+/sales-order+/$orderId.details.tsxindex 306682df2e..57c4a78138 100644--- a/apps/erp/app/routes/x+/sales-order+/$orderId.details.tsx+++ b/apps/erp/app/routes/x+/sales-order+/$orderId.details.tsx@@ -17,7 +17,7 @@ import {getSalesOrderShipment,isSalesOrderLocked,salesOrderValidator,- upsertSalesOrder+ updateSalesOrder} from "~/modules/sales";import {OpportunityDocuments,@@ -118,21 +118,26 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- const { salesOrderId, ...d } = validation.data;- if (!salesOrderId) throw new Error("Could not find salesOrderId");-- const update = await upsertSalesOrder(client, {- id,- salesOrderId,- ...d,- companyGroupId,- customFields: setCustomFields(formData),- updatedBy: userId- });- if (update.error) {+ const result = await updateSalesOrder(+ client,+ {+ id,+ status: validation.data.status,+ currencyCode: validation.data.currencyCode,+ orderDate: validation.data.orderDate,+ customerId: validation.data.customerId,+ customerContactId: validation.data.customerContactId || null,+ customerLocationId: validation.data.customerLocationId || null,+ notes: validation.data.notes,+ customFields: setCustomFields(formData),+ updatedBy: userId+ },+ companyGroupId+ );+ if (result.error) {throw redirect(path.to.salesOrder(id),- await flash(request, error(update.error, "Failed to update order"))+ await flash(request, error(result.error, "Failed to update order")));}diff --git a/apps/erp/app/routes/x+/sales-order+/new.tsx b/apps/erp/app/routes/x+/sales-order+/new.tsxindex e0d0d32246..e51b474e03 100644--- a/apps/erp/app/routes/x+/sales-order+/new.tsx+++ b/apps/erp/app/routes/x+/sales-order+/new.tsx@@ -6,9 +6,8 @@ import { msg } from "@lingui/core/macro";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";-import { salesOrderValidator, upsertSalesOrder } from "~/modules/sales";+import { insertSalesOrder, salesOrderValidator } from "~/modules/sales";import { SalesOrderForm } from "~/modules/sales/ui/SalesOrder";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -33,49 +32,25 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { id, ...d } = validation.data;- let salesOrderId = d.salesOrderId;- const useNextSequence = !salesOrderId;+ const { id: _id, ...data } = validation.data;- if (useNextSequence) {- const nextSequence = await getNextSequence(client, "salesOrder", companyId);- if (nextSequence.error) {- throw redirect(- path.to.newSalesOrder,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- salesOrderId = nextSequence.data;- }-- if (!salesOrderId) throw new Error("salesOrderId is not defined");-- const createSalesOrder = await upsertSalesOrder(client, {- ...d,- salesOrderId,+ const result = await insertSalesOrder(client, {+ ...data,+ salesOrderId: data.salesOrderId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createSalesOrder.error || !createSalesOrder.data?.[0]) {+ if (result.error || !result.data) {throw redirect(path.to.salesOrders,- await flash(- request,- error(createSalesOrder.error, "Failed to insert sales order")- )+ await flash(request, error(result.error, "Failed to insert sales order")));}- const order = createSalesOrder.data?.[0];-- throw redirect(path.to.salesOrder(order.id!));+ throw redirect(path.to.salesOrder(result.data.id));}export default function SalesOrderNewRoute() {diff --git a/apps/erp/app/routes/x+/sales-rfq+/new.tsx b/apps/erp/app/routes/x+/sales-rfq+/new.tsxindex 8e1f9a76fc..b23b68f49d 100644--- a/apps/erp/app/routes/x+/sales-rfq+/new.tsx+++ b/apps/erp/app/routes/x+/sales-rfq+/new.tsx@@ -8,9 +8,8 @@ import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";import type { SalesRFQStatusType } from "~/modules/sales";-import { salesRfqValidator, upsertSalesRFQ } from "~/modules/sales";+import { insertSalesRFQ, salesRfqValidator } from "~/modules/sales";import { SalesRFQForm } from "~/modules/sales/ui/SalesRFQ";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -33,43 +32,22 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let rfqId = validation.data.rfqId;- const useNextSequence = !rfqId;-- if (useNextSequence) {- const nextSequence = await getNextSequence(client, "salesRfq", companyId);- if (nextSequence.error) {- throw redirect(- path.to.newSalesRFQ,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- rfqId = nextSequence.data;- }-- if (!rfqId) throw new Error("rfqId is not defined");-- const createSalesRFQ = await upsertSalesRFQ(client, {+ const result = await insertSalesRFQ(client, {...validation.data,- rfqId,+ rfqId: validation.data.rfqId || undefined,companyId,createdBy: userId,customFields: setCustomFields(formData)});- if (createSalesRFQ.error || !createSalesRFQ.data?.[0]) {+ if (result.error || !result.data) {throw redirect(path.to.salesRfqs,- await flash(request, error(createSalesRFQ.error, "Failed to insert RFQ"))+ await flash(request, error(result.error, "Failed to insert RFQ")));}- const order = createSalesRFQ.data?.[0];-- throw redirect(path.to.salesRfq(order.id!));+ throw redirect(path.to.salesRfq(result.data.id));}export default function SalesRFQNewRoute() {diff --git a/apps/erp/app/routes/x+/stock-transfer+/new.tsx b/apps/erp/app/routes/x+/stock-transfer+/new.tsxindex f862e8189f..6e5fc4fd47 100644--- a/apps/erp/app/routes/x+/stock-transfer+/new.tsx+++ b/apps/erp/app/routes/x+/stock-transfer+/new.tsx@@ -11,12 +11,9 @@ import { msg } from "@lingui/core/macro";import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import {- deleteStockTransfer,- stockTransferValidator,- upsertStockTransfer,- upsertStockTransferLines+ insertStockTransfer,+ stockTransferValidator} from "~/modules/inventory";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -38,21 +35,6 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- const nextSequence = await getNextSequence(- client,- "stockTransfer",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.stockTransfers,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }-const { locationId, lines } = validation.data;const acknowledged = formData.get("acknowledged") === "true";@@ -87,39 +69,15 @@ export async function action({ request }: ActionFunctionArgs) {};}- const linesWithExpandedSerialTracking = lines.reduce<typeof lines>(- (acc, line) => {- // If quantity contains a decimal, ignore the line (as per requirements)- if (line.quantity && !Number.isInteger(line.quantity)) {- return acc;- }-- // If item requires serial tracking and quantity is a whole number > 1- if (line.requiresSerialTracking && line.quantity && line.quantity > 1) {- // Break out into multiple lines with quantity 1- acc.push(- ...Array.from({ length: line.quantity }, () => ({- ...line,- quantity: 1- }))- );- } else {- acc.push(line);- }- return acc;- },- []- );-- const createStockTransfer = await upsertStockTransfer(client, {- stockTransferId: nextSequence.data,+ const createStockTransfer = await insertStockTransfer(client, {locationId,+ lines,companyId,createdBy: userId,customFields: setCustomFields(formData)});- if (createStockTransfer.error) {+ if (createStockTransfer.error || !createStockTransfer.data) {throw redirect(path.to.stockTransfers,await flash(@@ -129,26 +87,5 @@ export async function action({ request }: ActionFunctionArgs) {);}- const createStockTransferLines = await upsertStockTransferLines(client, {- lines: linesWithExpandedSerialTracking,- stockTransferId: createStockTransfer.data.id,- companyId,- createdBy: userId- });-- if (createStockTransferLines.error) {- await deleteStockTransfer(client, createStockTransfer.data.id);- throw redirect(- path.to.stockTransfers,- await flash(- request,- error(- createStockTransferLines.error,- "Failed to create stock transfer lines"- )- )- );- }-throw redirect(path.to.stockTransfer(createStockTransfer.data.id));}diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsxindex 09b0ff88f7..6e97391815 100644--- a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx@@ -12,7 +12,7 @@ import {getSupplierQuote,isSupplierQuoteLocked,supplierQuoteValidator,- upsertSupplierQuote+ updateSupplierQuote} from "~/modules/purchasing";import type {SupplierInteraction,@@ -77,21 +77,25 @@ export async function action({ request, params }: ActionFunctionArgs) {return validationError(validation.error);}- const { supplierQuoteId, ...d } = validation.data;- if (!supplierQuoteId) throw new Error("Could not find supplierQuoteId");-- const update = await upsertSupplierQuote(client, {- id,- supplierQuoteId,- ...d,- companyGroupId,- customFields: setCustomFields(formData),- updatedBy: userId- });- if (update.error) {+ const result = await updateSupplierQuote(+ client,+ {+ id,+ status: validation.data.status,+ currencyCode: validation.data.currencyCode,+ expirationDate: validation.data.expirationDate || null,+ supplierContactId: validation.data.supplierContactId || null,+ supplierLocationId: validation.data.supplierLocationId || null,+ notes: validation.data.notes,+ customFields: setCustomFields(formData),+ updatedBy: userId+ },+ companyGroupId+ );+ if (result.error) {throw redirect(path.to.supplierQuote(id),- await flash(request, error(update.error, "Failed to update quote"))+ await flash(request, error(result.error, "Failed to update quote")));}diff --git a/apps/erp/app/routes/x+/supplier-quote+/new.tsx b/apps/erp/app/routes/x+/supplier-quote+/new.tsxindex 1acfd85b98..d63959d6ac 100644--- a/apps/erp/app/routes/x+/supplier-quote+/new.tsx+++ b/apps/erp/app/routes/x+/supplier-quote+/new.tsx@@ -8,11 +8,10 @@ import type { ActionFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUrlParams, useUser } from "~/hooks";import {- supplierQuoteValidator,- upsertSupplierQuote+ insertSupplierQuote,+ supplierQuoteValidator} from "~/modules/purchasing";import { SupplierQuoteForm } from "~/modules/purchasing/ui/SupplierQuote";-import { getNextSequence } from "~/modules/settings/settings.service";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -38,49 +37,28 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let supplierQuoteId = validation.data.supplierQuoteId;- const useNextSequence = !supplierQuoteId;+ const { id: _id, ...data } = validation.data;- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "supplierQuote",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newSupplierQuote,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- supplierQuoteId = nextSequence.data;- }-- if (!supplierQuoteId) throw new Error("supplierQuoteId is not defined");-- const createSupplierQuote = await upsertSupplierQuote(client, {- ...validation.data,- supplierQuoteId,+ const result = await insertSupplierQuote(client, {+ ...data,+ supplierQuoteId: data.supplierQuoteId || undefined,companyId,companyGroupId,createdBy: userId,customFields: setCustomFields(formData)});- if (createSupplierQuote.error || !createSupplierQuote.data?.id) {+ if (result.error || !result.data) {throw redirect(path.to.supplierQuotes,await flash(request,- error(createSupplierQuote.error, "Failed to insert supplier quote")+ error(result.error, "Failed to insert supplier quote")));}- throw redirect(path.to.supplierQuote(createSupplierQuote.data.id));+ throw redirect(path.to.supplierQuote(result.data.id));}export default function SupplierQuoteNewRoute() {diff --git a/apps/erp/app/routes/x+/warehouse-transfer+/$transferId.details.tsx b/apps/erp/app/routes/x+/warehouse-transfer+/$transferId.details.tsxindex 6fc4de436b..3b719b95a4 100644--- a/apps/erp/app/routes/x+/warehouse-transfer+/$transferId.details.tsx+++ b/apps/erp/app/routes/x+/warehouse-transfer+/$transferId.details.tsx@@ -12,7 +12,7 @@ import type {import {getWarehouseTransfer,isWarehouseTransferLocked,- upsertWarehouseTransfer,+ updateWarehouseTransfer,warehouseTransferValidator} from "~/modules/inventory";import {@@ -54,11 +54,10 @@ export async function action({ request, params }: ActionFunctionArgs) {const { id, transferId: validatedTransferId, ...d } = validation.data;if (!id) throw new Error("id not found");- if (!validatedTransferId) throw new Error("transferId not found");- const updateTransfer = await upsertWarehouseTransfer(client, {+ const updateTransfer = await updateWarehouseTransfer(client, {id,- transferId: validatedTransferId,+ transferId: validatedTransferId || undefined,...d,updatedBy: userId,customFields: setCustomFields(formData)diff --git a/apps/erp/app/routes/x+/warehouse-transfer+/new.tsx b/apps/erp/app/routes/x+/warehouse-transfer+/new.tsxindex e810f25b8a..51613410ab 100644--- a/apps/erp/app/routes/x+/warehouse-transfer+/new.tsx+++ b/apps/erp/app/routes/x+/warehouse-transfer+/new.tsx@@ -7,11 +7,10 @@ import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { redirect } from "react-router";import { useUser } from "~/hooks";import {- upsertWarehouseTransfer,+ insertWarehouseTransfer,warehouseTransferValidator} from "~/modules/inventory";import { WarehouseTransferForm } from "~/modules/inventory/ui/WarehouseTransfers";-import { getNextSequence } from "~/modules/settings";import { setCustomFields } from "~/utils/form";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -44,34 +43,12 @@ export async function action({ request }: ActionFunctionArgs) {return validationError(validation.error);}- let transferId = validation.data.transferId;- const useNextSequence = !transferId;-- if (useNextSequence) {- const nextSequence = await getNextSequence(- client,- "warehouseTransfer",- companyId- );- if (nextSequence.error) {- throw redirect(- path.to.newWarehouseTransfer,- await flash(- request,- error(nextSequence.error, "Failed to get next sequence")- )- );- }- transferId = nextSequence.data;- }-- if (!transferId) throw new Error("transferId is not defined");// biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration- const { id, ...d } = validation.data;+ const { id, transferId: providedTransferId, ...d } = validation.data;- const createTransfer = await upsertWarehouseTransfer(client, {+ const createTransfer = await insertWarehouseTransfer(client, {...d,- transferId,+ transferId: providedTransferId || undefined,companyId,createdBy: userId,customFields: setCustomFields(formData)diff --git a/llm/cache/authentication-system.md b/llm/cache/authentication-system.mdindex a5204b7010..7e5e4fe069 100644--- a/llm/cache/authentication-system.md+++ b/llm/cache/authentication-system.md@@ -377,3 +377,118 @@ Environment variables in `packages/auth/src/config/env.ts`:2. **Existing Company Update**:- Updates company and location details if they already exist++## OAuth 2.0 for MCP Remote Servers (Claude Connector)++Carbon's MCP server supports OAuth 2.0 authentication to enable use as a remote Claude connector.++### OAuth Endpoints++- `/.well-known/oauth-authorization-server` - OAuth metadata discovery+- `/oauth/authorize` - Authorization endpoint (user consent)+- `/oauth/token` - Token endpoint (code exchange, refresh)+- `/oauth/register` - Dynamic client registration++### Key Files++- `apps/erp/app/routes/[.]well-known.oauth-authorization-server.ts` - Metadata endpoint+- `apps/erp/app/routes/oauth+/authorize.tsx` - Authorization with PKCE support+- `apps/erp/app/routes/oauth+/token.tsx` - Token exchange with PKCE verification+- `apps/erp/app/routes/oauth+/register.ts` - Dynamic client registration++### Database Tables++**oauthClient** (static clients):+```typescript+{+ clientId: string+ clientSecret: string // SHA-256 hash, not plaintext+ name: string+ redirectUris: string[]+ companyId: string+}+```++**oauthDynamicClient** (dynamically registered clients):+```typescript+{+ clientId: string+ clientSecret: string | null // SHA-256 hash, not plaintext+ clientName: string+ redirectUris: string[]+ grantTypes: string[]+ responseTypes: string[]+ tokenEndpointAuthMethod: "client_secret_post" | "client_secret_basic" | "none"+ clientUri: string | null+ logoUri: string | null+ scope: string | null+}+```++**oauthCode** (authorization codes):+```typescript+{+ code: string+ clientId: string+ userId: string+ companyId: string+ redirectUri: string+ scope: string | null+ codeChallenge: string | null // PKCE+ codeChallengeMethod: "S256" | "plain" | null+ expiresAt: string+}+```++**oauthToken** (access/refresh tokens):+```typescript+{+ accessToken: string // SHA-256 hash, not plaintext+ refreshToken: string // SHA-256 hash, not plaintext+ clientId: string+ userId: string+ companyId: string+ scope: string | null+ expiresAt: string+}+```++### PKCE Support++OAuth flow supports PKCE (Proof Key for Code Exchange) which is required for public clients:+- `code_challenge` and `code_challenge_method` parameters on authorize+- `code_verifier` parameter on token exchange+- Supports both S256 (recommended) and plain methods++### MCP OAuth Authentication++The MCP endpoint (`/api/mcp`) accepts OAuth Bearer tokens:+1. Checks if Bearer token hash exists in `oauthToken` table (tokens are stored as SHA-256 hashes and looked up by hash)+2. Validates token hasn't expired+3. Uses userId/companyId from token for authorization+4. Falls back to carbon-key API key auth if not an OAuth token+5. `companyId` and `userId` always come from the authenticated token context and cannot be overridden by caller arguments++**Token Hashing**: Access tokens and refresh tokens are stored as SHA-256 hashes in the database. The `hashOAuthSecret` function in `@carbon/auth/auth.server` is the canonical hashing function used for all OAuth secret storage (access tokens, refresh tokens, and client secrets).++### Dynamic Client Registration++Clients like Claude can register themselves via POST to `/oauth/register`:+```json+{+ "client_name": "My MCP Client",+ "redirect_uris": ["https://example.com/callback"],+ "token_endpoint_auth_method": "none",+ "grant_types": ["authorization_code", "refresh_token"]+}+```++Returns:+```json+{+ "client_id": "mcp_abc123...",+ "client_name": "My MCP Client",+ "redirect_uris": ["https://example.com/callback"],+ "token_endpoint_auth_method": "none"+}+```diff --git a/llm/test-playbooks/create-bulk-jobs.md b/llm/test-playbooks/create-bulk-jobs.mdnew file mode 100644index 0000000000..0b34716bf4--- /dev/null+++ b/llm/test-playbooks/create-bulk-jobs.md@@ -0,0 +1,42 @@+# Create Bulk Jobs++Last tested: 2026-06-06+Route: /x/job/new (then click "Many Jobs" tab)++## Prerequisites+- At least one manufactured item must exist (e.g., "M000000001 Manufactured")++## Steps++### 1. Navigate+- URL: /x/job/new+- Click the "Many Jobs" tab (second tab, next to "Single Job")+- Expected: "Bulk Jobs" form with Item, Total Quantity, Quantity Per Job, Scrap Quantity Per Job, dates, location, deadline type++### 2. Fill form+- Field "Item" (combobox): Click to open, select "M000000001 Manufactured"+- Field "Total Quantity" (textbox): Defaults to 1+- Field "Quantity Per Job" (textbox): Defaults to 1+- Field "Scrap Quantity Per Job" (textbox): Defaults to 0+- Due Date of First Job: Optional+- Due Date of Last Job: Optional+- Location: Defaults to HEADQUARTERS+- Deadline Type: Defaults to "Low Priority No Deadline"++### 3. Submit+- Button: "Save"++### 4. Verify+- Expected redirect: /x/job (jobs list page)+- Success indicator: Jobs list shows the newly created job(s) with status "DRAFT"+- A toast notification appears confirming creation++## Selector Notes+- Must click "Many Jobs" tab first; the default is "Single Job"+- The "Many Jobs" tab URL does not have a separate route; it's a tab within /x/job/new+- Item combobox shows both manufactured and purchased items (unlike Single Job which filters)+- Total Quantity / Quantity Per Job determines how many jobs are created (Total / PerJob = number of jobs)++## Common Failures+- If no items exist, only "Create Item" option appears+- The form redirects to the jobs LIST page, not a single job detail pagediff --git a/llm/test-playbooks/create-depreciation-run.md b/llm/test-playbooks/create-depreciation-run.mdnew file mode 100644index 0000000000..2422d42b33--- /dev/null+++ b/llm/test-playbooks/create-depreciation-run.md@@ -0,0 +1,38 @@+# Create Depreciation Run++Last tested: 2026-06-07+Route: /x/accounting/depreciation-runs++## Prerequisites+- At least one fixed asset should exist (though the run can be created even with no active assets)+- Navigation: The depreciation runs page is not in the accounting sidebar by default; navigate directly via URL++## Steps++### 1. Navigate+- URL: /x/accounting/depreciation-runs+- Expected: "Depreciation" heading with "Run Next Period" button and a list of existing runs++### 2. Open confirmation dialog+- Click "Run Next Period" button+- Expected: Modal dialog with heading "Run Next Period" and text explaining the period end date (e.g., "This will create a draft depreciation run for the period ending Jun 30, 2026. All active assets will be calculated automatically.")++### 3. Submit+- Button: "Create Run" in the dialog+- Wait 3 seconds for redirect++### 4. Verify+- Expected redirect: /x/depreciation-run/<new-id> (detail page)+- Success indicator: Page shows heading with run ID (e.g., "DR000002"), status badge "DRAFT", "Period End" date, and a table of assets+- If no active assets exist, table shows "No assets to depreciate for this period."+- "Post Run" button is available to finalize++## Selector Notes+- "Run Next Period" button appears at top of the list and also in the empty state+- The confirmation dialog has "Cancel" and "Create Run" buttons+- The dialog auto-calculates the next period end date based on fiscal year settings++## Common Failures+- If all periods have already been run, the behavior may differ+- Fixed assets in DRAFT status are not included; they need to be registered/active first+- The depreciation runs page is at /x/accounting/depreciation-runs, not /x/accounting/depreciationdiff --git a/llm/test-playbooks/create-fixed-asset.md b/llm/test-playbooks/create-fixed-asset.mdnew file mode 100644index 0000000000..e208684922--- /dev/null+++ b/llm/test-playbooks/create-fixed-asset.md@@ -0,0 +1,47 @@+# Create Fixed Asset++Last tested: 2026-06-07+Route: /x/accounting/fixed-assets (via "Add Fixed Asset" button)++## Prerequisites+- At least one asset class must exist (seeded by default: BUILDINGS, MACHINERY & EQUIPMENT, VEHICLES)++## Steps++### 1. Navigate+- URL: /x/accounting/fixed-assets+- Expected: Fixed Assets list page with "Add Fixed Asset" button++### 2. Open form+- Click "Add Fixed Asset" button+- Expected: Modal dialog with heading "New Fixed Asset"++### 3. Fill form+- Field "Name" (textbox): Required. Enter asset name (e.g., "Test CNC Machine")+- Field "Asset Class" (combobox, labeled "Select"): Click to open, select from list (e.g., "MACHINERY & EQUIPMENT"). This auto-fills depreciation method and useful life from the asset class defaults.+- Field "Description" (textbox): Optional+- Field "Serial Number" (textbox): Optional+- Field "Depreciation Method" (combobox): Auto-filled from asset class (e.g., "Straight Line")+- Field "Useful Life (Months)" (textbox with spinbutton): Auto-filled from asset class (e.g., 120 for MACHINERY & EQUIPMENT)+- Field "Salvage Value" (textbox with spinbutton): Defaults to 0+- Field "Cost Center" (combobox, labeled "Select"): Optional++### 4. Submit+- Button: "Save" in modal footer+- Wait 3 seconds for redirect++### 5. Verify+- Expected redirect: /x/fixed-asset/<new-id> (detail page)+- Success indicator: Page shows heading with asset ID (e.g., "FA000002"), status badge "DRAFT", summary showing Acquisition Cost, Accum. Depreciation, and Net Book Value (all $0.00 initially)+- Toast notification: "Fixed asset created"+- Detail fields show Name, Asset Class, Depreciation Method, Useful Life, Residual Value++## Selector Notes+- Name is the first textbox in the modal+- Asset Class is the first combobox (labeled "Select")+- Selecting an asset class auto-updates the Depreciation Method and Useful Life fields+- The modal has Save and Cancel buttons at the bottom++## Common Failures+- Name and Asset Class are both required; form won't submit without them+- If no asset classes exist, you need to create one first via /x/accounting/asset-classesdiff --git a/llm/test-playbooks/create-gauge.md b/llm/test-playbooks/create-gauge.mdnew file mode 100644index 0000000000..d2964a97a4--- /dev/null+++ b/llm/test-playbooks/create-gauge.md@@ -0,0 +1,50 @@+# Create Gauge++Last tested: 2026-06-07+Route: /x/quality/gauges (via "Add Gauge" button)++## Prerequisites+- At least one gauge type must exist (seeded by default: BORE GAUGE, CALIPER - DEPTH, etc.)++## Steps++### 1. Navigate+- URL: /x/quality/gauges+- Expected: Gauges list page with "Add Gauge" button in top right and empty state area++### 2. Open form+- Click "Add Gauge" button+- Expected: Modal dialog with heading "New Gauge" and fields for Gauge ID, Description, Gauge Type, Manufacturer, etc.++### 3. Fill form+- Field "Gauge ID" (textbox, labeled "Next Sequence"): Leave as-is for auto-generated ID+- Field "Description" (textbox): Optional+- Field "Gauge Type" (combobox): Click to open, select from list (e.g., "CALIPER - DEPTH")+- Field "Manufacturer" (combobox, labeled "Select"): Optional+- Field "Model Number" (textbox): Optional+- Field "Serial Number" (textbox): Optional+- Field "Role" (combobox): Defaults to "STANDARD"+- Field "Date Acquired" (date): Defaults to today+- Field "Last Calibration Date" (date): Optional+- Field "Next Calibration Date" (date): Optional+- Field "Location" (combobox): Defaults to "HEADQUARTERS"+- Field "Storage Unit" (combobox): Optional+- Number field at bottom (calibration interval in months): Defaults to 6++### 4. Submit+- Button: "Save" in the modal footer+- Wait 3 seconds for redirect++### 5. Verify+- Expected: Returns to gauges list page+- Success indicator: New gauge row appears in the table with generated ID (e.g., "G00001"), type, role, status "ACTIVE", calibration status "PENDING", and location+- Toast notification appears++## Selector Notes+- Gauge Type is the first combobox after the Gauge ID field+- The modal has Save and Cancel buttons at the bottom+- The form is a modal/drawer overlay on the gauges list++## Common Failures+- If Gauge Type is not selected, form may not submit (it's the only required field beyond defaults)+- The "Toggle" button next to Gauge ID toggles visibility of the sequence numberdiff --git a/llm/test-playbooks/create-job.md b/llm/test-playbooks/create-job.mdnew file mode 100644index 0000000000..13cca6030e--- /dev/null+++ b/llm/test-playbooks/create-job.md@@ -0,0 +1,39 @@+# Create Job++Last tested: 2026-06-06+Route: /x/job/new++## Prerequisites+- At least one manufactured item must exist (e.g., "M000000001 Manufactured")++## Steps++### 1. Navigate+- URL: /x/job/new+- Expected: "New Job" form with tabs "Single Job" (selected) and "Many Jobs". Form has Item combobox, Change Type button, quantity, scrap quantity, location, date, and deadline type.++### 2. Fill form+- Field "Item" (combobox, labeled "Select"): Click to open, then select "M000000001 Manufactured"+- Field "Quantity" (textbox): Defaults to 1, leave as-is or change+- Field "Scrap Quantity" (textbox): Defaults to 0+- Location defaults to HEADQUARTERS+- Deadline Type defaults to "Low Priority No Deadline"++### 3. Submit+- Button: "Save"+- Note: Save button becomes disabled while submitting. Wait 3-5 seconds for redirect.++### 4. Verify+- Expected redirect: /x/job/<new-id> (e.g., /x/job/J000002)+- Success indicator: Page shows heading with Job ID, buttons like "Release", "Complete", "Cancel", and a tree view of the item's bill of process++## Selector Notes+- Item combobox is the first combobox after the Job ID field+- The form shows "Change Type" button next to the item (for switching between Manufactured/Purchased)+- Quantity and Scrap Quantity are textbox fields with Increase/Decrease buttons+- Location is a combobox defaulting to HEADQUARTERS+- Deadline Type is a combobox++## Common Failures+- If no manufactured items exist, only "Create Item" appears in the combobox+- Save button briefly disables during submission; don't click againdiff --git a/llm/test-playbooks/create-maintenance-dispatch.md b/llm/test-playbooks/create-maintenance-dispatch.mdnew file mode 100644index 0000000000..3e12efc8bb--- /dev/null+++ b/llm/test-playbooks/create-maintenance-dispatch.md@@ -0,0 +1,47 @@+# Create Maintenance Dispatch++Last tested: 2026-06-07+Route: /x/resources/maintenance (via "Add Dispatch" button)++## Prerequisites+- None required; all fields except Location have sensible defaults++## Steps++### 1. Navigate+- URL: /x/resources/maintenance or click "Dispatches" in the Resources sidebar+- Expected: "Maintenance Dispatches" list page with "Add Dispatch" button and location filter combobox++### 2. Open form+- Click "Add Dispatch" button+- Expected: Full-page form with heading "New Maintenance Dispatch" showing Description editor, Priority, Source, Severity, Work Center, Location, OEE Impact, and date fields++### 3. Fill form+- Field "Description" (rich text editor, "Press '/' for commands"): Optional+- Field "Priority" (combobox): Defaults to "Medium"+- Field "Source" (combobox): Defaults to "REACTIVE" with clear button. Optional+- Field "Severity" (combobox): Defaults to "SUPPORT REQUIRED" with clear button. Optional+- Field "Work Center" (combobox, labeled "Select"): Optional+- Field "Location" (combobox): Defaults to "HEADQUARTERS"+- Field "OEE Impact" (combobox): Defaults to "NO IMPACT" with clear button. Optional+- Fields "Planned Start Time" and "Planned End Time" (date pickers): Optional++### 4. Submit+- Button: "Save"+- Note: The standard agent-browser click on Save may not trigger Remix form submission. Use eval to click the submit button: `agent-browser eval "(function(){ document.querySelector('button[type=submit]').click(); return 'ok'; })()"`+- Wait 3 seconds for redirect++### 5. Verify+- Expected redirect: /x/maintenance/<new-id> (detail page, e.g., /x/maintenance/main_xxx)+- Success indicator: Page shows heading with dispatch ID (e.g., "MAIN000001"), status badge "OPEN", "Start" and "Complete" action buttons+- Right sidebar shows PROPERTIES with ID, Status (OPEN), Assignee (Unassigned), Location, Work Center, Priority, Severity, Source+- Left sidebar shows "Items" and "Timecards" sections++## Selector Notes+- The form renders as a full-page route, not a modal+- All combobox fields with "Clear" buttons are optional+- The rich text Description editor accepts plain text or slash commands++## Common Failures+- The Save button may not respond to standard agent-browser click; use eval-based click as noted above+- All form fields except Location have defaults, so the form can be submitted with minimal inputdiff --git a/llm/test-playbooks/create-purchase-invoice.md b/llm/test-playbooks/create-purchase-invoice.mdnew file mode 100644index 0000000000..26ea089e0e--- /dev/null+++ b/llm/test-playbooks/create-purchase-invoice.md@@ -0,0 +1,51 @@+# Create Purchase Invoice++Last tested: 2026-06-07+Route: /x/purchasing/invoices (via "Add Purchase Invoice" button)++## Prerequisites+- At least one supplier must exist (e.g., "Test Supplier Inc")++## Steps++### 1. Navigate+- URL: /x/purchasing/invoices or click "Invoices" in the Purchasing sidebar+- Expected: "Purchase Invoices" list page with "Add Purchase Invoice" button++### 2. Open form+- Click "Add Purchase Invoice" button+- Expected: Full-page form with heading "New Purchase Invoice" showing Invoice ID, Supplier, Supplier Invoice Number, Invoice Supplier, locations, contacts, dates, payment terms, currency, and delivery location++### 3. Fill form+- Field "Invoice ID" (textbox, labeled "Next Sequence"): Leave as-is for auto-generated ID+- Field "Supplier" (combobox, labeled "Select"): Required. Click to open, select supplier (e.g., "Test Supplier Inc"). This auto-fills Invoice Supplier and Currency.+- Field "Supplier Invoice Number" (textbox): Optional+- Field "Invoice Supplier" (combobox): Auto-filled from Supplier selection+- Field "Invoice Supplier Location" (combobox, labeled "Select"): Optional+- Field "Invoice Supplier Contact" (combobox, labeled "Select Contact"): Optional+- Field "Due Date" (date picker): Optional+- Field "Date Issued" (date picker): Defaults to today+- Field "Payment Terms" (combobox, labeled "Select"): Optional+- Field "Currency" (combobox): Auto-filled (e.g., "US Dollar")+- Field "Delivery Location" (combobox): Defaults to "HEADQUARTERS"++### 4. Submit+- Button: "Save"+- Note: Use eval-based click for reliable submission: `agent-browser eval "(function(){ document.querySelector('button[type=submit]').click(); return 'ok'; })()"`+- Wait 3 seconds for redirect++### 5. Verify+- Expected redirect: /x/purchase-invoice/<new-id>/details (detail page)+- Success indicator: Page shows heading with invoice ID (e.g., "AP000001"), status badge "DRAFT", supplier name, subtotal/tax/total summary+- Right sidebar shows PROPERTIES with ID, Assignee, Supplier, Invoice Supplier, dates+- Left panel shows "Add Line Item" button and empty line items area++## Selector Notes+- Supplier is the first combobox after the Invoice ID field+- Selecting a supplier auto-populates Invoice Supplier and Currency fields+- The form is a full-page route, not a modal++## Common Failures+- Supplier is required; form won't submit without it+- If no suppliers exist, use "Create Supplier" option in the combobox dropdown+- The Save button may require eval-based click for Remix formsdiff --git a/llm/test-playbooks/create-purchase-order.md b/llm/test-playbooks/create-purchase-order.mdnew file mode 100644index 0000000000..509d95a711--- /dev/null+++ b/llm/test-playbooks/create-purchase-order.md@@ -0,0 +1,47 @@+# Create Purchase Order++Last tested: 2026-06-06+Route: /x/purchase-order/new++## Prerequisites+- At least one supplier must exist. If none exist, the supplier combobox only shows "Create Supplier" — you can create one inline.++## Steps++### 1. Navigate+- URL: `/x/purchase-order/new`+- Expected: drawer form with heading "New Purchase Order"++### 2. Fill form+- Field "Supplier" (first combobox, labeled "Select"): search and select a supplier+ - If no suppliers exist, click "Create Supplier" option, fill name, click Save, then search for the new supplier+- Field "Location" (combobox, labeled "HEADQUARTERS"): auto-populated with default location+- Field "Currency" (combobox, labeled "US Dollar"): auto-populated from supplier++### 3. Submit+- Button: "Save" (at the bottom of the drawer form, before the "Close" button)++### 4. Verify+- Expected redirect: `/x/purchase-order/<id>` (detail page opens in drawer)+- Success indicator: heading shows "PO000001" (or next sequence), page shows "Add Line Item" buttons and detail sections (Shipping, Payment, Notes, Files)+- URL stays on the purchase orders list with the detail drawer open++## Selector Notes+- The supplier combobox is the first combobox in the form, initially showing "Select"+- When you click the supplier combobox, a search input appears — type to filter suppliers+- The location combobox auto-populates (e.g., "HEADQUARTERS") — no need to change it+- The currency combobox auto-populates when a supplier is selected (e.g., "US Dollar")+- The "Purchase Order Type" combobox defaults to "Purchase" — no need to change it+- The Save button is at the bottom of the drawer, before the Close button+- After save, the PO detail view opens with the PO ID as a heading++## Creating a Supplier Inline+- When the supplier combobox is open and no match is found, a "Create <search text>" option appears+- Clicking it opens a "New Supplier" drawer+- Only the name field is required — fill it and click Save+- After save, you return to the PO form with the supplier combobox open+- Search for the supplier you just created and select it++## Common Failures+- No suppliers in database — use the inline "Create Supplier" option+- Supplier combobox shows "Create a" — this means no suppliers match; type a name and use the create optiondiff --git a/llm/test-playbooks/create-quote.md b/llm/test-playbooks/create-quote.mdnew file mode 100644index 0000000000..ae1e2b56ee--- /dev/null+++ b/llm/test-playbooks/create-quote.md@@ -0,0 +1,35 @@+# Create Quote++Last tested: 2026-06-06+Route: /x/quote/new++## Prerequisites+- At least one customer must exist (e.g., "Acme Corp")++## Steps++### 1. Navigate+- URL: /x/quote/new+- Expected: "New Quote" form with fields for Customer, Name, contacts, sales person, estimator, location, dates, currency++### 2. Fill form+- Field "Customer" (first combobox after Quote ID): Select "Acme Corp"+- All other fields are optional+- Expiration Date defaults to 30 days from today++### 3. Submit+- Button: "Save" (at the bottom of the form)+- Note: Use `document.querySelector('button[type="submit"]')?.click()` if agent-browser click doesn't work++### 4. Verify+- Expected redirect: /x/quote/<new-id> (e.g., /x/quote/Q000002)+- Success indicator: Page shows heading with the Quote ID and buttons like "Finalize", "Won", "Lost", "Cancel"++## Selector Notes+- Customer combobox is the first combobox in the form+- Form has optional fields: Name (textbox), Purchasing Contact, Engineering Contact, Customer Location, Sales Person (defaults to logged-in user), Estimator, Location (defaults to HEADQUARTERS), Requested Date, Expiration Date (defaults to 30 days out), Currency+- Save button is a submit button at the bottom++## Common Failures+- Save button may need JS click to work reliably+- Customer is the only required fielddiff --git a/llm/test-playbooks/create-sales-invoice.md b/llm/test-playbooks/create-sales-invoice.mdnew file mode 100644index 0000000000..f1c0e1aafd--- /dev/null+++ b/llm/test-playbooks/create-sales-invoice.md@@ -0,0 +1,54 @@+# Create Sales Invoice++Last tested: 2026-06-07+Route: /x/sales/invoices (via "Add Sales Invoice" button)++## Prerequisites+- At least one customer must exist (e.g., "Acme Corp")++## Steps++### 1. Navigate+- URL: /x/sales/invoices or click "Invoices" in the Sales sidebar under MANAGE+- Expected: "Sales Invoices" list page with "Add Sales Invoice" button++### 2. Open form+- Click "Add Sales Invoice" button+- Expected: Drawer/overlay form with heading "New Sales Invoice" showing Invoice ID, Customer, Customer Invoice Number, Invoice Customer, locations, contacts, dates, payment terms, currency, and delivery location++### 3. Fill form+- Field "Invoice ID" (textbox, labeled "Next Sequence"): Leave as-is for auto-generated ID+- Field "Customer" (combobox, labeled "Select"): Required. Click to open, select customer (e.g., "Acme Corp"). This auto-fills Invoice Customer and Currency.+- Field "Customer Invoice Number" (textbox): Optional+- Field "Invoice Customer" (combobox): Auto-filled from Customer selection+- Field "Invoice Customer Location" (combobox, labeled "Select"): Optional+- Field "Invoice Customer Contact" (combobox, labeled "Select Contact"): Optional+- Field "Due Date" (date picker): Optional+- Field "Date Issued" (date picker): Defaults to today+- Field "Payment Terms" (combobox, labeled "Select"): Optional+- Field "Currency" (combobox): Auto-filled (e.g., "US Dollar")+- Field "Delivery Location" (combobox): Defaults to "HEADQUARTERS"++### 4. Submit+- Button: "Save"+- Note: Use eval-based click for reliable submission: `agent-browser eval "(function(){ document.querySelector('button[type=submit]').click(); return 'ok'; })()"`+- Wait 3 seconds for redirect++### 5. Verify+- Expected redirect: /x/sales-invoice/<new-id>/details (detail page)+- Success indicator: Page shows heading with invoice ID (e.g., "AR000001"), status badge "DRAFT", customer name, subtotal/tax/total summary+- Right sidebar shows PROPERTIES with ID, Assignee, Customer, Invoice Customer, dates+- Left panel shows "Add Line Item" button and empty line items area+- Internal/External notes tabs available+- Preview button available for PDF generation++## Selector Notes+- Customer is the first combobox after the Invoice ID field+- Selecting a customer auto-populates Invoice Customer and Currency fields+- The form is a drawer overlay on the invoices list, with a Close button++## Common Failures+- Customer is required; form won't submit without it+- If no customers exist, use "Create Customer" option in the combobox dropdown+- The Save button may require eval-based click for Remix forms+- A "Sales Invoices in Carbon" academy help panel may appear; dismiss with "Dismiss" button if it covers the formdiff --git a/llm/test-playbooks/create-sales-order.md b/llm/test-playbooks/create-sales-order.mdnew file mode 100644index 0000000000..67f85dad5f--- /dev/null+++ b/llm/test-playbooks/create-sales-order.md@@ -0,0 +1,34 @@+# Create Sales Order++Last tested: 2026-06-06+Route: /x/sales-order/new++## Prerequisites+- At least one customer must exist (e.g., "Acme Corp")++## Steps++### 1. Navigate+- URL: /x/sales-order/new+- Expected: "New Sales Order" form with fields for Customer, PO Number, contacts, dates, location, sales person, currency++### 2. Fill form+- Field "Customer" (first combobox after Sales Order ID): Select "Acme Corp"+- All other fields are optional++### 3. Submit+- Button: "Save" (at the bottom of the form - may need to scroll down or use JS click)+- Note: The Save button ref may not be visible without scrolling. Use `document.querySelector('button[type="submit"]')?.click()` if needed.++### 4. Verify+- Expected redirect: /x/sales-order/<new-id> (e.g., /x/sales-order/SO000006)+- Success indicator: Page shows heading with the SO ID (e.g., "SO000006") and buttons like "Confirm", "Cancel", "Ship", "Invoice"++## Selector Notes+- Customer combobox is the first combobox in the form, after the "Sales Order ID" field+- The form has optional fields: Customer PO Number (textbox), Purchasing Contact, Engineering Contact, Customer Location, Requested Date, Promised Date, Shipping Location (defaults to HEADQUARTERS), Sales Person (defaults to logged-in user), Currency (defaults to US Dollar)+- Save button is a submit button at the bottom of the form++## Common Failures+- Save button may not respond to agent-browser click if not scrolled into view; use JS click via eval+- Form requires at least a customer to be selecteddiff --git a/llm/test-playbooks/create-supplier-quote.md b/llm/test-playbooks/create-supplier-quote.mdnew file mode 100644index 0000000000..aaf4cbda7c--- /dev/null+++ b/llm/test-playbooks/create-supplier-quote.md@@ -0,0 +1,36 @@+# Create Supplier Quote++Last tested: 2026-06-06+Route: /x/supplier-quote/new++## Prerequisites+- At least one supplier must exist (e.g., "Test Supplier Inc")++## Steps++### 1. Navigate+- URL: /x/supplier-quote/new+- Expected: "New Supplier Quote" form with fields for Supplier, Reference, Supplier Location, Supplier Contact, dates, currency, and Quote Type++### 2. Fill form+- Field "Supplier" (first combobox after Supplier Quote ID): Select "Test Supplier Inc"+- All other fields are optional+- Date Created defaults to today's date+- Currency defaults to "US Dollar"+- Quote Type defaults to "Purchase"++### 3. Submit+- Button: "Save"+- Note: Use `document.querySelector('button[type="submit"]')?.click()` if agent-browser click doesn't work++### 4. Verify+- Expected redirect: /x/supplier-quote/<new-id> (e.g., /x/supplier-quote/SQ000002)+- Success indicator: Page shows heading with Supplier Quote ID and buttons like "Finalize", "Cancel"++## Selector Notes+- Supplier combobox is the first combobox in the form+- Other fields: Reference (textbox), Supplier Location (combobox), Supplier Contact (combobox), Date Created (date picker), Expiration Date (date picker), Currency (combobox with clear button), Quote Type (combobox defaulting to "Purchase")++## Common Failures+- Save button may need JS click+- Supplier is the only required fielddiff --git a/llm/test-playbooks/create-warehouse-transfer.md b/llm/test-playbooks/create-warehouse-transfer.mdnew file mode 100644index 0000000000..5b5bdfbe01--- /dev/null+++ b/llm/test-playbooks/create-warehouse-transfer.md@@ -0,0 +1,38 @@+# Create Warehouse Transfer++Last tested: 2026-06-06+Route: /x/warehouse-transfer/new++## Prerequisites+- At least two different locations must exist (e.g., "HEADQUARTERS" and "SECONDARY")+- If only one location exists, create a second one via Resources > Locations > Add Location before testing++## Steps++### 1. Navigate+- URL: /x/warehouse-transfer/new+- Expected: "New Warehouse Transfer" form with Transfer ID, Reference, From Location, To Location, and Notes++### 2. Fill form+- Field "From Location" (first location combobox): Defaults to "HEADQUARTERS"+- Field "To Location" (second location combobox): Click and select a DIFFERENT location (e.g., "SECONDARY")+- Notes is optional++### 3. Submit+- Button: "Save"+- Note: Use `document.querySelector('button[type="submit"]')?.click()` if agent-browser click doesn't work++### 4. Verify+- Expected redirect: /x/warehouse-transfer/<new-id> (e.g., /x/warehouse-transfer/WT000001)+- Success indicator: Page shows heading with Transfer ID and buttons like "Confirm", "Cancel", "Ship", "Receive"++## Selector Notes+- From Location combobox defaults to HEADQUARTERS+- To Location combobox needs to be different from From Location+- "Create To Location" option in the To Location combobox opens a drawer to create a new location inline+- The inline location create requires: Location Name, Address (with autocomplete), City, Postal Code, Country++## Common Failures+- From and To locations must be different (validation error: "From and To locations must be different")+- If only one location exists, inline create via "Create To Location" may not reliably auto-select the new location after creation. Better to create the location separately via /x/resources/locations/new first, then reload the transfer form.+- The address autocomplete (combobox labeled "Address Line 1") requires selecting a suggestion to auto-fill City, State, Postal Code, and Countrydiff --git a/llm/workflows/database-migration.md b/llm/workflows/database-migration.mdindex f883f4dc0b..bab7cac0bc 100644--- a/llm/workflows/database-migration.md+++ b/llm/workflows/database-migration.md@@ -21,6 +21,8 @@ npm run db:migrate <name-of-migration>This will create a new migration file in `packages/database/supabase/migrations/` with the timestamp prefix.+> **WARNING:** Never use `000000` as the HHMMSS portion of a migration filename (e.g. `20260512000000_foo.sql`). The timestamp is the primary key for migrations and other branches may pick the same date. Always use randomized digits for the HHMMSS portion (e.g. `20260512041739_foo.sql`) to avoid cross-branch collisions.+### 2. Analyze the Migration Requirements- Identify what database changes are needed (new tables, columns, indexes, etc.)@@ -104,54 +106,47 @@ ALTER TABLE "entityName" ADD CONSTRAINT "entityName_name_companyId_key"#### Row Level Security (RLS)-**IMPORTANT**: Use the new standardized RLS pattern (2025+):+**IMPORTANT**: Use the standardized RLS pattern from the rls-refactor migrations. Always qualify table names with `"public"."tableName"` and cast the helper function result with `::text[]`.```sql-- Enable RLS-ALTER TABLE "entityName" ENABLE ROW LEVEL SECURITY;+ALTER TABLE "public"."entityName" ENABLE ROW LEVEL SECURITY;-- Standardized policy names: SELECT, INSERT, UPDATE, DELETE-CREATE POLICY "SELECT" ON "entityName"- FOR SELECT- TO authenticated- USING (- "companyId" IN (- SELECT "companyId"- FROM get_companies_with_employee_permission('module_view')- )- );--CREATE POLICY "INSERT" ON "entityName"- FOR INSERT- TO authenticated- WITH CHECK (- "companyId" IN (- SELECT "companyId"- FROM get_companies_with_employee_permission('module_create')- )- );--CREATE POLICY "UPDATE" ON "entityName"- FOR UPDATE- TO authenticated- USING (- "companyId" IN (- SELECT "companyId"- FROM get_companies_with_employee_permission('module_update')- )- );--CREATE POLICY "DELETE" ON "entityName"- FOR DELETE- TO authenticated- USING (- "companyId" IN (- SELECT "companyId"- FROM get_companies_with_employee_permission('module_delete')- )- );+-- For SELECT: use get_companies_with_employee_role() (any employee can view)+-- For INSERT/UPDATE/DELETE: use get_companies_with_employee_permission('module_action')++CREATE POLICY "SELECT" ON "public"."entityName"+FOR SELECT USING (+ "companyId" = ANY (+ (SELECT get_companies_with_employee_role())::text[]+ )+);++CREATE POLICY "INSERT" ON "public"."entityName"+FOR INSERT WITH CHECK (+ "companyId" = ANY (+ (SELECT get_companies_with_employee_permission('module_create'))::text[]+ )+);++CREATE POLICY "UPDATE" ON "public"."entityName"+FOR UPDATE USING (+ "companyId" = ANY (+ (SELECT get_companies_with_employee_permission('module_update'))::text[]+ )+);++CREATE POLICY "DELETE" ON "public"."entityName"+FOR DELETE USING (+ "companyId" = ANY (+ (SELECT get_companies_with_employee_permission('module_delete'))::text[]+ )+);```+> **Reference migrations:** `20260228000000_rls-refactor-3.sql` (company-scoped) and `20260228024512_dimensions.sql` (group-scoped).+#### Common Column Types- **IDs**: `TEXT NOT NULL DEFAULT id()`diff --git a/packages/auth/package.json b/packages/auth/package.jsonindex 4e0c5e4ce7..c332877480 100644--- a/packages/auth/package.json+++ b/packages/auth/package.json@@ -56,6 +56,7 @@"@simplewebauthn/server": "^13.1.0","cookie": "catalog:","dompurify": "catalog:",+ "jose": "catalog:","nanoid": "catalog:","zustand": "catalog:"}diff --git a/packages/auth/src/lib/supabase/client.server.ts b/packages/auth/src/lib/supabase/client.server.tsindex b42538f4aa..f68fb62c36 100644--- a/packages/auth/src/lib/supabase/client.server.ts+++ b/packages/auth/src/lib/supabase/client.server.ts@@ -1,8 +1,33 @@import type { Database } from "@carbon/database";import type { SupabaseClient } from "@supabase/supabase-js";-import { SUPABASE_SERVICE_ROLE_KEY } from "../../config/env";-import { getCarbonClient } from "./client";+import { SignJWT } from "jose";+import {+ SUPABASE_JWT_SECRET,+ SUPABASE_SERVICE_ROLE_KEY+} from "../../config/env";+import { getCarbon, getCarbonClient } from "./client";export const getCarbonServiceRole = (): SupabaseClient<Database> => {return getCarbonClient(SUPABASE_SERVICE_ROLE_KEY!);};++export async function getUserScopedClient(+ userId: string+): Promise<SupabaseClient<Database>> {+ if (!SUPABASE_JWT_SECRET) {+ throw new Error("SUPABASE_JWT_SECRET is required for user-scoped clients");+ }++ const secret = new TextEncoder().encode(SUPABASE_JWT_SECRET);+ const jwt = await new SignJWT({+ sub: userId,+ aud: "authenticated",+ role: "authenticated"+ })+ .setProtectedHeader({ alg: "HS256", typ: "JWT" })+ .setIssuedAt()+ .setExpirationTime("5m")+ .sign(secret);++ return getCarbon(jwt);+}diff --git a/packages/auth/src/services/auth.server.ts b/packages/auth/src/services/auth.server.tsindex 92b4dba066..b19f326a37 100644--- a/packages/auth/src/services/auth.server.ts+++ b/packages/auth/src/services/auth.server.ts@@ -74,6 +74,11 @@ export function hashApiKey(rawKey: string): string {return createHash("sha256").update(rawKey).digest("hex");}+/** Hash an OAuth token or secret using SHA-256 for secure storage/lookup */+export function hashOAuthSecret(raw: string): string {+ return createHash("sha256").update(raw).digest("hex");+}+type ApiKeyRecord = {id: string;companyId: string;@@ -292,9 +297,8 @@ export async function requirePermissions(}}- const { accessToken, companyId, companyGroupId, email, userId } =- await requireAuthSession(request);const authSession = await requireAuthSession(request);+ const { accessToken, companyId, companyGroupId, email, userId } = authSession;const consoleMode = authSession.console === companyId;const myClaims = await getUserClaims(userId, companyId);diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 268104fc57..1197a7e66f 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -25525,32 +25525,50 @@ export type Database = {oauthClient: {Row: {clientId: string- clientSecret: string- companyId: string+ clientSecret: string | null+ clientUri: string | null+ companyId: string | nullcreatedAt: string | null+ grantTypes: string[]id: string+ logoUri: string | nullname: stringredirectUris: string[]+ responseTypes: string[]+ scope: string | null+ tokenEndpointAuthMethod: stringupdatedAt: string | null}Insert: {clientId: string- clientSecret: string- companyId: string+ clientSecret?: string | null+ clientUri?: string | null+ companyId?: string | nullcreatedAt?: string | null+ grantTypes?: string[]id?: string+ logoUri?: string | nullname: stringredirectUris?: string[]+ responseTypes?: string[]+ scope?: string | null+ tokenEndpointAuthMethod?: stringupdatedAt?: string | null}Update: {clientId?: string- clientSecret?: string- companyId?: string+ clientSecret?: string | null+ clientUri?: string | null+ companyId?: string | nullcreatedAt?: string | null+ grantTypes?: string[]id?: string+ logoUri?: string | nullname?: stringredirectUris?: string[]+ responseTypes?: string[]+ scope?: string | null+ tokenEndpointAuthMethod?: stringupdatedAt?: string | null}Relationships: []@@ -25559,31 +25577,40 @@ export type Database = {Row: {clientId: stringcode: string+ codeChallenge: string | null+ codeChallengeMethod: string | nullcompanyId: stringcreatedAt: string | nullexpiresAt: stringid: stringredirectUri: string+ scope: string | nulluserId: string}Insert: {clientId: stringcode: string+ codeChallenge?: string | null+ codeChallengeMethod?: string | nullcompanyId: stringcreatedAt?: string | nullexpiresAt: stringid?: stringredirectUri: string+ scope?: string | nulluserId: string}Update: {clientId?: stringcode?: string+ codeChallenge?: string | null+ codeChallengeMethod?: string | nullcompanyId?: stringcreatedAt?: string | nullexpiresAt?: stringid?: stringredirectUri?: string+ scope?: string | nulluserId?: string}Relationships: [@@ -25668,6 +25695,7 @@ export type Database = {expiresAt: stringid: stringrefreshToken: string+ scope: string | nulluserId: string}Insert: {@@ -25678,6 +25706,7 @@ export type Database = {expiresAt: stringid?: stringrefreshToken: string+ scope?: string | nulluserId: string}Update: {@@ -25688,6 +25717,7 @@ export type Database = {expiresAt?: stringid?: stringrefreshToken?: string+ scope?: string | nulluserId?: string}Relationships: [@@ -38187,7 +38217,49 @@ export type Database = {},]}- searchIndex_MvZGQSEAkgLUthUCevNd2m: {+ searchIndex_d8i6c9cjm0h04743p2ng: {+ Row: {+ createdAt: string+ description: string | null+ entityId: string+ entityType: string+ id: number+ link: string+ metadata: Json | null+ searchVector: unknown+ tags: string[] | null+ title: string+ updatedAt: string | null+ }+ Insert: {+ createdAt?: string+ description?: string | null+ entityId: string+ entityType: string+ id?: number+ link: string+ metadata?: Json | null+ searchVector?: unknown+ tags?: string[] | null+ title: string+ updatedAt?: string | null+ }+ Update: {+ createdAt?: string+ description?: string | null+ entityId?: string+ entityType?: string+ id?: number+ link?: string+ metadata?: Json | null+ searchVector?: unknown+ tags?: string[] | null+ title?: string+ updatedAt?: string | null+ }+ Relationships: []+ }+ searchIndex_Vah7cNqpjARtZDhq8CcaPu: {Row: {createdAt: stringdescription: string | null@@ -40437,98 +40509,98 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -40560,112 +40632,112 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "consumables"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "item"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "materials"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "parts"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "services"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "tools"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_ruleId_fkey"+ foreignKeyName: "storageRuleItemAssignment_ruleId_fkey"columns: ["ruleId"]isOneToOne: falsereferencedRelation: "storageRule"@@ -40697,98 +40769,98 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_ruleId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_ruleId_fkey"columns: ["ruleId"]isOneToOne: falsereferencedRelation: "storageRule"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "riskRegisters"referencedColumns: ["workCenterId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCenter"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCenters"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCentersWithBlockingStatus"@@ -50123,6 +50195,7 @@ export type Database = {locationId: string | nulllocationName: string | nullname: string | null+ status: string | null}Relationships: [{@@ -59213,21 +59286,21 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["shipmentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["invoiceCountryCode"]+ columns: ["shipmentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["invoiceCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]diff --git a/packages/database/supabase/functions/close-job/index.ts b/packages/database/supabase/functions/close-job/index.tsindex fc4791a005..5f6d162d70 100644--- a/packages/database/supabase/functions/close-job/index.ts+++ b/packages/database/supabase/functions/close-job/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { credit, debit, journalReference } from "../lib/utils.ts";import { getCurrentAccountingPeriod } from "../shared/get-accounting-period.ts";import { getNextSequence } from "../shared/get-next-sequence.ts";@@ -30,11 +30,7 @@ serve(async (req: Request) => {try {const { jobId, userId, companyId } = payloadValidator.parse(payload);- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettings, companyRecord] = await Promise.all([clientdiff --git a/packages/database/supabase/functions/convert/index.ts b/packages/database/supabase/functions/convert/index.tsindex 676a93fd1e..73d8534514 100644--- a/packages/database/supabase/functions/convert/index.ts+++ b/packages/database/supabase/functions/convert/index.ts@@ -10,7 +10,7 @@ import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { format } from "https://deno.land/[email protected]/datetime/format.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";import { getNextSequence } from "../shared/get-next-sequence.ts";@@ -122,10 +122,23 @@ serve(async (req: Request) => {userId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId+ const permissionsByType: Record<string, { view?: string | string[]; create?: string | string[]; update?: string | string[]; delete?: string | string[] }> = {+ methodVersionToActive: { update: "resources" },+ purchaseOrderToPurchaseInvoice: { update: "invoicing" },+ quoteToSalesOrder: { update: "sales" },+ salesOrderToSalesInvoice: { update: "invoicing" },+ salesRfqToQuote: { update: "sales" },+ shipmentToSalesInvoice: { update: "invoicing" },+ supplierQuoteToPurchaseOrder: { update: "purchasing" },+ warehouseTransferToShipment: { update: "inventory" },+ warehouseTransferToReceipt: { update: "inventory" },+ };++ const client = await requirePermissions(+ req,+ companyId,+ userId,+ permissionsByType[type] ?? { update: "settings" });switch (type) {diff --git a/packages/database/supabase/functions/create/index.ts b/packages/database/supabase/functions/create/index.tsindex 9ce8901092..cfefd21a59 100644--- a/packages/database/supabase/functions/create/index.ts+++ b/packages/database/supabase/functions/create/index.ts@@ -4,7 +4,7 @@ import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import z from "npm:zod@^3.24.1";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";import { getNextSequence } from "../shared/get-next-sequence.ts";@@ -120,6 +120,31 @@ serve(async (req: Request) => {const payload = await req.json();const { type, companyId, userId } = payloadValidator.parse(payload);++ const permissionsByType: Record<string, { view?: string | string[]; create?: string | string[]; update?: string | string[]; delete?: string | string[] }> = {+ nonConformanceTasks: { update: "quality" },+ purchaseOrderFromJob: { create: ["purchasing", "production"] },+ receiptDefault: { create: "inventory" },+ receiptFromPurchaseOrder: { create: "inventory" },+ receiptFromInboundTransfer: { create: "inventory" },+ receiptFromWarehouseTransfer: { create: "inventory" },+ receiptLineSplit: { create: "inventory" },+ shipmentDefault: { create: "inventory" },+ shipmentFromPurchaseOrder: { create: "inventory" },+ shipmentFromWarehouseTransfer: { create: "inventory" },+ shipmentFromSalesOrder: { create: "inventory" },+ shipmentFromSalesOrderLine: { create: "inventory" },+ shipmentLineSplit: { create: "inventory" },+ journalEntry: { create: "accounting" },+ };++ const client = await requirePermissions(+ req,+ companyId,+ userId,+ permissionsByType[type] ?? { update: "settings" }+ );+switch (type) {case "nonConformanceTasks": {const { id } = payload;@@ -131,11 +156,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [nonConformance,@@ -387,11 +407,6 @@ serve(async (req: Request) => {userId,});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [job, jobOperations] = await Promise.all([client.from("job").select("*").eq("id", jobId).single(),@@ -772,11 +787,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [purchaseOrder, purchaseOrderLines, fixedAssetPoLines, receipt] = await Promise.all([client@@ -1049,11 +1059,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [warehouseTransfer, warehouseTransferLines, receipt] =await Promise.all([@@ -1228,11 +1233,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [warehouseTransfer, warehouseTransferLines, receipt] =await Promise.all([@@ -1414,11 +1414,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [receiptLine, trackedEntities] = await Promise.all([client@@ -1599,11 +1594,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [warehouseTransfer, warehouseTransferLines, shipment] =await Promise.all([@@ -1781,11 +1771,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [purchaseOrder,@@ -1992,11 +1977,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [salesOrder,@@ -2357,11 +2337,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const salesOrderLine = await client.from("salesOrderLine")@@ -2628,11 +2603,6 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );const [shipmentLine] = await Promise.all([clientdiff --git a/packages/database/supabase/functions/download/index.ts b/packages/database/supabase/functions/download/index.tsindex 930a4c9c61..382decf686 100644--- a/packages/database/supabase/functions/download/index.ts+++ b/packages/database/supabase/functions/download/index.ts@@ -2,12 +2,13 @@ import { serve } from "https://deno.land/[email protected]/http/server.ts";import { z } from "npm:zod@^3.24.1";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";const downloadValidator = z.object({bucket: z.string(),path: z.string(),companyId: z.string(),+ userId: z.string(),});serve(async (req: Request) => {@@ -18,21 +19,18 @@ serve(async (req: Request) => {try {const validatedPayload = downloadValidator.parse(payload);- const { bucket, path, companyId } = validatedPayload;+ const { bucket, path, companyId, userId } = validatedPayload;console.log({function: "download",bucket,path,companyId,+ userId,});// verify that the request is authorized by an API key or service role- const serviceRole = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const serviceRole = await requirePermissions(req, companyId, userId, { view: "documents" });const signedUrl = await serviceRole.storage.from(bucket)diff --git a/packages/database/supabase/functions/get-method/index.ts b/packages/database/supabase/functions/get-method/index.tsindex a324309847..d8251e053a 100644--- a/packages/database/supabase/functions/get-method/index.ts+++ b/packages/database/supabase/functions/get-method/index.ts@@ -8,7 +8,7 @@ import type {} from "@supabase/supabase-js";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import type { Database } from "../lib/types.ts";import { Transaction } from "kysely";@@ -96,11 +96,7 @@ serve(async (req: Request) => {configuration,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });switch (type) {case "itemToItem": {diff --git a/packages/database/supabase/functions/import-csv/index.ts b/packages/database/supabase/functions/import-csv/index.tsindex 3b665970a3..6cd2e2eead 100644--- a/packages/database/supabase/functions/import-csv/index.ts+++ b/packages/database/supabase/functions/import-csv/index.ts@@ -5,7 +5,7 @@ import { sql } from "npm:[email protected]";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";import { getReadableIdWithRevision } from "../lib/utils.ts";@@ -806,11 +806,7 @@ serve(async (req: Request) => {userId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { create: "resources" });const csvFile = await client.storage.from("private").download(filePath);if (!csvFile.data) {diff --git a/packages/database/supabase/functions/issue/index.ts b/packages/database/supabase/functions/issue/index.tsindex ccd9ac0609..beb1bfa395 100644--- a/packages/database/supabase/functions/issue/index.ts+++ b/packages/database/supabase/functions/issue/index.ts@@ -11,7 +11,7 @@ import {getStorageUnitWithHighestQuantity,updatePickMethodDefaultStorageUnitIfNeeded,} from "../lib/storage-units.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";import { TrackedEntityAttributes, credit, debit, journalReference } from "../lib/utils.ts";@@ -875,11 +875,7 @@ serve(async (req: Request) => {case "jobOperation": {const { id, companyId, quantity, userId } = validatedPayload;- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettings, companyRecord] = await Promise.all([client@@ -933,11 +929,7 @@ serve(async (req: Request) => {}case "jobOperationBatchComplete": {const { trackedEntityId, companyId, userId, ...row } = validatedPayload;- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [jobOperation, productionQuantities] = await Promise.all([client@@ -1083,11 +1075,7 @@ serve(async (req: Request) => {}case "jobOperationSerialComplete": {const { trackedEntityId, companyId, userId, ...row } = validatedPayload;- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const jobOperation = await client.from("jobOperation")@@ -1275,11 +1263,7 @@ serve(async (req: Request) => {adjustmentType,} = validatedPayload;- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettings, companyRecord] = await Promise.all([client@@ -1550,11 +1534,7 @@ serve(async (req: Request) => {companyId,userId,} = validatedPayload;- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [trackedEntity, jobMaterial] = await Promise.all([client@@ -1770,11 +1750,7 @@ serve(async (req: Request) => {);}- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettingsTracked, companyRecordTracked] = await Promise.all([client@@ -2380,11 +2356,7 @@ serve(async (req: Request) => {throw new Error("Children are required");}- const clientUnconsume = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const clientUnconsume = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettingsUnconsume, companyRecordUnconsume] = await Promise.all([clientUnconsumediff --git a/packages/database/supabase/functions/lib/supabase.ts b/packages/database/supabase/functions/lib/supabase.tsindex 45425133f1..669fb784e7 100644--- a/packages/database/supabase/functions/lib/supabase.ts+++ b/packages/database/supabase/functions/lib/supabase.ts@@ -26,7 +26,7 @@ function postgrestServiceKey(authorizationHeader: string | null): string {return envKey;}-function isTrustedServiceBearer(authorizationHeader: string | null): boolean {+function isTrustedBearer(authorizationHeader: string | null): boolean {const envKey = (Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ?? "").trim();const token =authorizationHeader?.replace(/^Bearer\s+/i, "").trim() ?? "";@@ -35,8 +35,8 @@ function isTrustedServiceBearer(authorizationHeader: string | null): boolean {const parts = token.split(".");if (parts.length !== 3) return false;try {- return (JSON.parse(atob(parts[1]!)) as { role?: string }).role ===- "service_role";+ const role = (JSON.parse(atob(parts[1]!)) as { role?: string }).role;+ return role === "service_role";} catch {return false;}@@ -183,8 +183,8 @@ export const getSupabaseServiceRole = async (}if (authorizationHeader) {- if (!isTrustedServiceBearer(authorizationHeader)) {- throw new Error("Service role is required");+ if (!isTrustedBearer(authorizationHeader)) {+ throw new Error("Valid authorization is required");}return serviceRole;@@ -192,3 +192,177 @@ export const getSupabaseServiceRole = async (throw new Error("Authorization header or API key header is required");};++type RequiredPermissions = {+ view?: string | string[];+ create?: string | string[];+ update?: string | string[];+ delete?: string | string[];+};++type Permission = {+ view: string[];+ create: string[];+ update: string[];+ delete: string[];+};++function parseClaimsPermissions(+ claims: Record<string, unknown>+): { permissions: Record<string, Permission>; role: string | null } {+ const permissions: Record<string, Permission> = {};+ let role: string | null = null;++ for (const [key, value] of Object.entries(claims)) {+ if (key === "role") {+ role = value as string;+ continue;+ }+ const parts = key.split("_");+ if (parts.length !== 2) continue;+ const [mod, action] = parts;+ if (+ !["view", "create", "update", "delete"].includes(action!) ||+ !Array.isArray(value)+ )+ continue;++ if (!(mod! in permissions)) {+ permissions[mod!] = { view: [], create: [], update: [], delete: [] };+ }+ permissions[mod!][action as keyof Permission] = value as string[];+ }++ return { permissions, role };+}++function checkPermissions(+ claims: Record<string, Permission>,+ companyId: string,+ required: RequiredPermissions+): boolean {+ for (const [action, modules] of Object.entries(required)) {+ const moduleList =+ typeof modules === "string" ? [modules] : (modules as string[]);+ for (const mod of moduleList) {+ const perm = claims[mod]?.[action as keyof Permission];+ if (!perm || !perm.includes(companyId)) {+ return false;+ }+ }+ }+ return true;+}++export async function requirePermissions(+ req: Request,+ companyId: string,+ userId: string,+ permissions: RequiredPermissions+): Promise<ReturnType<typeof createClient<Database>>> {+ const authorizationHeader = req.headers.get("Authorization");+ const apiKeyHeader = req.headers.get("carbon-key");++ const serviceRole = createClient<Database>(+ Deno.env.get("SUPABASE_URL") ?? "",+ postgrestServiceKey(authorizationHeader),+ {+ auth: {+ autoRefreshToken: false,+ persistSession: false,+ },+ }+ );++ // API key path+ if (apiKeyHeader && companyId) {+ const keyHash = hashApiKey(apiKeyHeader);+ const { data, error } = await serviceRole+ .from("apiKey")+ .select("id, companyId, scopes, rateLimit, rateLimitWindow, expiresAt")+ .eq("keyHash" as any, keyHash)+ .eq("companyId", companyId)+ .single();++ if (error || !data) {+ throw new Error("API key not found");+ }++ const row = data as any;++ if (row.expiresAt && new Date(row.expiresAt) < new Date()) {+ throw new Error("API key has expired");+ }++ const rl = await checkApiKeyRateLimit(+ serviceRole,+ row.id,+ row.rateLimit ?? 60,+ row.rateLimitWindow ?? "1m"+ );+ if (!rl.success) {+ throw new Error("Rate limit exceeded");+ }++ // Check API key scopes against required permissions+ const scopes: Record<string, string[]> = row.scopes ?? {};+ for (const [action, modules] of Object.entries(permissions)) {+ const moduleList =+ typeof modules === "string" ? [modules] : (modules as string[]);+ for (const mod of moduleList) {+ const scopeKey = `${mod}_${action}`;+ if (!(scopeKey in scopes) || !scopes[scopeKey]?.includes(companyId)) {+ throw new Error("API key lacks required permissions");+ }+ }+ }++ return serviceRole;+ }++ // JWT path+ if (!authorizationHeader) {+ throw new Error("Authorization header or API key header is required");+ }++ const token =+ authorizationHeader.replace(/^Bearer\s+/i, "").trim();+ const parts = token.split(".");+ if (parts.length !== 3) {+ throw new Error("Invalid authorization token");+ }++ let role: string | undefined;+ try {+ role = (JSON.parse(atob(parts[1]!)) as { role?: string }).role;+ } catch {+ throw new Error("Invalid authorization token");+ }++ if (role === "service_role") {+ return serviceRole;+ }++ if (role === "authenticated") {+ const claimsResult = await serviceRole.rpc("get_claims", {+ uid: userId,+ company: companyId,+ });++ if (claimsResult.error || !claimsResult.data) {+ throw new Error("Failed to get user permissions");+ }++ const parsed = parseClaimsPermissions(+ claimsResult.data as unknown as Record<string, unknown>+ );++ if (!checkPermissions(parsed.permissions, companyId, permissions)) {+ throw new Error("Insufficient permissions");+ }++ return serviceRole;+ }++ throw new Error("Valid authorization is required");+}diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 268104fc57..1197a7e66f 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -25525,32 +25525,50 @@ export type Database = {oauthClient: {Row: {clientId: string- clientSecret: string- companyId: string+ clientSecret: string | null+ clientUri: string | null+ companyId: string | nullcreatedAt: string | null+ grantTypes: string[]id: string+ logoUri: string | nullname: stringredirectUris: string[]+ responseTypes: string[]+ scope: string | null+ tokenEndpointAuthMethod: stringupdatedAt: string | null}Insert: {clientId: string- clientSecret: string- companyId: string+ clientSecret?: string | null+ clientUri?: string | null+ companyId?: string | nullcreatedAt?: string | null+ grantTypes?: string[]id?: string+ logoUri?: string | nullname: stringredirectUris?: string[]+ responseTypes?: string[]+ scope?: string | null+ tokenEndpointAuthMethod?: stringupdatedAt?: string | null}Update: {clientId?: string- clientSecret?: string- companyId?: string+ clientSecret?: string | null+ clientUri?: string | null+ companyId?: string | nullcreatedAt?: string | null+ grantTypes?: string[]id?: string+ logoUri?: string | nullname?: stringredirectUris?: string[]+ responseTypes?: string[]+ scope?: string | null+ tokenEndpointAuthMethod?: stringupdatedAt?: string | null}Relationships: []@@ -25559,31 +25577,40 @@ export type Database = {Row: {clientId: stringcode: string+ codeChallenge: string | null+ codeChallengeMethod: string | nullcompanyId: stringcreatedAt: string | nullexpiresAt: stringid: stringredirectUri: string+ scope: string | nulluserId: string}Insert: {clientId: stringcode: string+ codeChallenge?: string | null+ codeChallengeMethod?: string | nullcompanyId: stringcreatedAt?: string | nullexpiresAt: stringid?: stringredirectUri: string+ scope?: string | nulluserId: string}Update: {clientId?: stringcode?: string+ codeChallenge?: string | null+ codeChallengeMethod?: string | nullcompanyId?: stringcreatedAt?: string | nullexpiresAt?: stringid?: stringredirectUri?: string+ scope?: string | nulluserId?: string}Relationships: [@@ -25668,6 +25695,7 @@ export type Database = {expiresAt: stringid: stringrefreshToken: string+ scope: string | nulluserId: string}Insert: {@@ -25678,6 +25706,7 @@ export type Database = {expiresAt: stringid?: stringrefreshToken: string+ scope?: string | nulluserId: string}Update: {@@ -25688,6 +25717,7 @@ export type Database = {expiresAt?: stringid?: stringrefreshToken?: string+ scope?: string | nulluserId?: string}Relationships: [@@ -38187,7 +38217,49 @@ export type Database = {},]}- searchIndex_MvZGQSEAkgLUthUCevNd2m: {+ searchIndex_d8i6c9cjm0h04743p2ng: {+ Row: {+ createdAt: string+ description: string | null+ entityId: string+ entityType: string+ id: number+ link: string+ metadata: Json | null+ searchVector: unknown+ tags: string[] | null+ title: string+ updatedAt: string | null+ }+ Insert: {+ createdAt?: string+ description?: string | null+ entityId: string+ entityType: string+ id?: number+ link: string+ metadata?: Json | null+ searchVector?: unknown+ tags?: string[] | null+ title: string+ updatedAt?: string | null+ }+ Update: {+ createdAt?: string+ description?: string | null+ entityId?: string+ entityType?: string+ id?: number+ link?: string+ metadata?: Json | null+ searchVector?: unknown+ tags?: string[] | null+ title?: string+ updatedAt?: string | null+ }+ Relationships: []+ }+ searchIndex_Vah7cNqpjARtZDhq8CcaPu: {Row: {createdAt: stringdescription: string | null@@ -40437,98 +40509,98 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRule_companyId_fkey"+ foreignKeyName: "storageRule_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRule_createdBy_fkey"+ foreignKeyName: "storageRule_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRule_updatedBy_fkey"+ foreignKeyName: "storageRule_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -40560,112 +40632,112 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleItemAssignment_companyId_fkey"+ foreignKeyName: "storageRuleItemAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleItemAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "consumables"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "item"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "materials"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "parts"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "services"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_itemId_fkey"+ foreignKeyName: "storageRuleItemAssignment_itemId_fkey"columns: ["itemId"]isOneToOne: falsereferencedRelation: "tools"referencedColumns: ["id"]},{- foreignKeyName: "customRuleItemAssignment_ruleId_fkey"+ foreignKeyName: "storageRuleItemAssignment_ruleId_fkey"columns: ["ruleId"]isOneToOne: falsereferencedRelation: "storageRule"@@ -40697,98 +40769,98 @@ export type Database = {}Relationships: [{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "companies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "company"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "customFieldTables"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_companyId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_companyId_fkey"columns: ["companyId"]isOneToOne: falsereferencedRelation: "integrations"referencedColumns: ["companyId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_createdBy_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_ruleId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_ruleId_fkey"columns: ["ruleId"]isOneToOne: falsereferencedRelation: "storageRule"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "riskRegisters"referencedColumns: ["workCenterId"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCenter"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCenters"referencedColumns: ["id"]},{- foreignKeyName: "customRuleWorkCenterAssignment_workCenterId_fkey"+ foreignKeyName: "storageRuleWorkCenterAssignment_workCenterId_fkey"columns: ["workCenterId"]isOneToOne: falsereferencedRelation: "workCentersWithBlockingStatus"@@ -50123,6 +50195,7 @@ export type Database = {locationId: string | nulllocationName: string | nullname: string | null+ status: string | null}Relationships: [{@@ -59213,21 +59286,21 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["shipmentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["invoiceCountryCode"]+ columns: ["shipmentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["invoiceCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]diff --git a/packages/database/supabase/functions/mrp/index.ts b/packages/database/supabase/functions/mrp/index.tsindex 3b3ef41584..1c7e604ef3 100644--- a/packages/database/supabase/functions/mrp/index.ts+++ b/packages/database/supabase/functions/mrp/index.ts@@ -19,7 +19,7 @@ import {import { Kysely, sql } from "npm:kysely";import z from "npm:zod@^3.24.1";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";const pool = getConnectionPool(1);@@ -85,11 +85,7 @@ serve(async (req: Request) => {const ranges = getStartAndEndDates(today, "Week");const periods = await getOrCreateDemandPeriods(db, ranges, "Week");- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const locations = await client.from("location")diff --git a/packages/database/supabase/functions/pick/index.ts b/packages/database/supabase/functions/pick/index.tsindex 939f24fd51..e5f6c4a6ed 100644--- a/packages/database/supabase/functions/pick/index.ts+++ b/packages/database/supabase/functions/pick/index.ts@@ -2,7 +2,7 @@ import { serve } from "https://deno.land/[email protected]/http/server.ts";import { z } from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { corsHeaders } from "../lib/headers.ts";@@ -54,11 +54,7 @@ serve(async (req: Request) => {userId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "inventory" });switch (type) {case "stageJob":diff --git a/packages/database/supabase/functions/post-production-event/index.ts b/packages/database/supabase/functions/post-production-event/index.tsindex 7abcb6dfd6..deda022946 100644--- a/packages/database/supabase/functions/post-production-event/index.ts+++ b/packages/database/supabase/functions/post-production-event/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { credit, debit, journalReference } from "../lib/utils.ts";import { getCurrentAccountingPeriod } from "../shared/get-accounting-period.ts";@@ -32,11 +32,7 @@ serve(async (req: Request) => {const { productionEventId, userId, companyId } =payloadValidator.parse(payload);- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const [accountingSettings, companyRecord] = await Promise.all([clientdiff --git a/packages/database/supabase/functions/post-purchase-invoice/index.ts b/packages/database/supabase/functions/post-purchase-invoice/index.tsindex 64fb1f3d93..258aa3d274 100644--- a/packages/database/supabase/functions/post-purchase-invoice/index.ts+++ b/packages/database/supabase/functions/post-purchase-invoice/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import type { Database } from "../lib/types.ts";import { credit, debit, journalReference } from "../lib/utils.ts";import { getCurrentAccountingPeriod } from "../shared/get-accounting-period.ts";@@ -41,11 +41,7 @@ serve(async (req: Request) => {userId,skipReceiptPost,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "invoicing" });const accountingEnabled = await client.from("companySettings")@@ -1651,11 +1647,7 @@ serve(async (req: Request) => {} catch (err) {console.error(err);if (payload.type !== "void" && "invoiceId" in payload) {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- payload.companyId- );+ const client = await requirePermissions(req, payload.companyId, payload.userId, { update: "invoicing" });await client.from("purchaseInvoice").update({ status: "Draft" })diff --git a/packages/database/supabase/functions/post-receipt/index.ts b/packages/database/supabase/functions/post-receipt/index.tsindex 083b45eece..ca31b3da13 100644--- a/packages/database/supabase/functions/post-receipt/index.ts+++ b/packages/database/supabase/functions/post-receipt/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import { z } from "https://deno.land/x/[email protected]/mod.ts";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import type { Database } from "../lib/types.ts";import {credit,@@ -50,11 +50,7 @@ serve(async (req: Request) => {companyId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "inventory" });const [companyRecord, accountingSettings] = await Promise.all([client@@ -1896,11 +1892,7 @@ serve(async (req: Request) => {} catch (err) {console.error(err);if (payload.type !== "void" && "receiptId" in payload) {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- payload.companyId- );+ const client = await requirePermissions(req, payload.companyId, payload.userId, { update: "inventory" });await client.from("receipt").update({ status: "Draft" })diff --git a/packages/database/supabase/functions/post-sales-invoice/index.ts b/packages/database/supabase/functions/post-sales-invoice/index.tsindex 4a0dce1cc7..c4409ce198 100644--- a/packages/database/supabase/functions/post-sales-invoice/index.ts+++ b/packages/database/supabase/functions/post-sales-invoice/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import type { Database } from "../lib/types.ts";import { credit, debit, journalReference } from "../lib/utils.ts";@@ -43,11 +43,7 @@ serve(async (req: Request) => {companyId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "invoicing" });const [companyRecord, accountingSettings] = await Promise.all([client@@ -1449,11 +1445,7 @@ serve(async (req: Request) => {} catch (err) {console.error(err);if ("invoiceId" in payload) {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- payload.companyId- );+ const client = await requirePermissions(req, payload.companyId, payload.userId, { update: "invoicing" });await client.from("salesInvoice").update({ status: "Draft" })diff --git a/packages/database/supabase/functions/post-shipment/index.ts b/packages/database/supabase/functions/post-shipment/index.tsindex 7177c67ca5..87d6eef60a 100644--- a/packages/database/supabase/functions/post-shipment/index.ts+++ b/packages/database/supabase/functions/post-shipment/index.ts@@ -4,7 +4,7 @@ import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";import { z } from "https://deno.land/x/[email protected]/mod.ts";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import type { Database, Json } from "../lib/types.ts";import { TrackedEntityAttributes, credit, debit, journalReference } from "../lib/utils.ts";import { calculateCOGS } from "../shared/calculate-cogs.ts";@@ -42,11 +42,7 @@ serve(async (req: Request) => {companyId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "inventory" });const [shipment, shipmentLines, shipmentLineTracking] = await Promise.all([client.from("shipment").select("*").eq("id", shipmentId).single(),@@ -2846,11 +2842,7 @@ serve(async (req: Request) => {} catch (err) {console.error(err);if ("shipmentId" in payload) {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- payload.companyId- );+ const client = await requirePermissions(req, payload.companyId, payload.userId, { update: "inventory" });await client.from("shipment").update({ status: "Draft" })diff --git a/packages/database/supabase/functions/recalculate/index.ts b/packages/database/supabase/functions/recalculate/index.tsindex 310113a9b5..29b8808a25 100644--- a/packages/database/supabase/functions/recalculate/index.ts+++ b/packages/database/supabase/functions/recalculate/index.ts@@ -6,7 +6,7 @@ import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { Transaction } from "kysely";import { corsHeaders } from "../lib/headers.ts";import { getJobMethodTree, JobMethodTreeItem } from "../lib/methods.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";const pool = getConnectionPool(1);const db = getDatabaseClient<DB>(pool);@@ -35,11 +35,7 @@ serve(async (req: Request) => {userId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });switch (type) {case "jobMakeMethodRequirements": {diff --git a/packages/database/supabase/functions/schedule/index.ts b/packages/database/supabase/functions/schedule/index.tsindex 026f4f0c30..433f7f40a3 100644--- a/packages/database/supabase/functions/schedule/index.ts+++ b/packages/database/supabase/functions/schedule/index.ts@@ -8,7 +8,7 @@ import type {SchedulingDirection,SchedulingMode,} from "../lib/scheduling/types.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";const pool = getConnectionPool(1);const db = getDatabaseClient<DB>(pool);@@ -34,11 +34,7 @@ serve(async (req: Request) => {console.info(`🔰 Starting ${mode} scheduling for job ${jobId}`);console.info(`📋 Direction: ${direction}`);- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? "",- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "production" });const engine = new SchedulingEngine({client,diff --git a/packages/database/supabase/functions/sync/index.ts b/packages/database/supabase/functions/sync/index.tsindex ca21bac728..33a5979c61 100644--- a/packages/database/supabase/functions/sync/index.ts+++ b/packages/database/supabase/functions/sync/index.ts@@ -4,7 +4,7 @@ import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import z from "npm:zod@^3.24.1";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { getReadableIdWithRevision } from "../lib/utils.ts";const pool = getConnectionPool(1);@@ -185,10 +185,7 @@ serve(async (req: Request) => {userId,});- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key") ?? ""- );+ const client = await requirePermissions(req, companyId, userId, { update: "resources" });// Check if top-level make method is Active and find or create a Draftconst topLevelMakeMethod = await clientdiff --git a/packages/database/supabase/functions/update-purchased-prices/index.ts b/packages/database/supabase/functions/update-purchased-prices/index.tsindex 7eb6e70740..323ee62713 100644--- a/packages/database/supabase/functions/update-purchased-prices/index.ts+++ b/packages/database/supabase/functions/update-purchased-prices/index.ts@@ -4,7 +4,7 @@ import { format } from "https://deno.land/[email protected]/datetime/mod.ts";import z from "npm:zod@^3.24.1";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";-import { getSupabaseServiceRole } from "../lib/supabase.ts";+import { requirePermissions } from "../lib/supabase.ts";import { Database } from "../lib/types.ts";const pool = getConnectionPool(1);@@ -15,6 +15,7 @@ const payloadValidator = z.discriminatedUnion("source", [source: z.literal("purchaseOrder"),purchaseOrderId: z.string(),companyId: z.string(),+ userId: z.string(),updatePrices: z.boolean().optional(),updateLeadTimes: z.boolean().optional(),}),@@ -22,6 +23,7 @@ const payloadValidator = z.discriminatedUnion("source", [source: z.literal("purchaseInvoice"),invoiceId: z.string(),companyId: z.string(),+ userId: z.string(),updatePrices: z.boolean().optional(),updateLeadTimes: z.boolean().optional(),}),@@ -57,7 +59,7 @@ serve(async (req: Request) => {const payload = await req.json();const parsedPayload = payloadValidator.parse(payload);- const { source, companyId } = parsedPayload;+ const { source, companyId, userId } = parsedPayload;const shouldUpdatePrices = parsedPayload.updatePrices ?? true;const shouldUpdateLeadTimes = parsedPayload.updateLeadTimes ?? false;@@ -70,11 +72,7 @@ serve(async (req: Request) => {});try {- const client = await getSupabaseServiceRole(- req.headers.get("Authorization"),- req.headers.get("carbon-key"),- companyId- );+ const client = await requirePermissions(req, companyId, userId, { update: "purchasing" });let supplierId: string;let lines: PurchaseLineData[];diff --git a/packages/database/supabase/migrations/20260429031443_oauth-pkce-support.sql b/packages/database/supabase/migrations/20260429031443_oauth-pkce-support.sqlnew file mode 100644index 0000000000..28df613d4f--- /dev/null+++ b/packages/database/supabase/migrations/20260429031443_oauth-pkce-support.sql@@ -0,0 +1,17 @@+-- Add PKCE support to OAuth authorization codes+ALTER TABLE "oauthCode" ADD COLUMN "codeChallenge" TEXT;+ALTER TABLE "oauthCode" ADD COLUMN "codeChallengeMethod" TEXT CHECK ("codeChallengeMethod" IN ('S256', 'plain'));+ALTER TABLE "oauthCode" ADD COLUMN "scope" TEXT;++-- Add scope column for OAuth tokens+ALTER TABLE "oauthToken" ADD COLUMN "scope" TEXT;++-- Extend oauthClient to support dynamic registration and public clients+ALTER TABLE "oauthClient" ALTER COLUMN "clientSecret" DROP NOT NULL;+ALTER TABLE "oauthClient" ALTER COLUMN "companyId" DROP NOT NULL;+ALTER TABLE "oauthClient" ADD COLUMN "grantTypes" TEXT[] NOT NULL DEFAULT ARRAY['authorization_code', 'refresh_token'];+ALTER TABLE "oauthClient" ADD COLUMN "responseTypes" TEXT[] NOT NULL DEFAULT ARRAY['code'];+ALTER TABLE "oauthClient" ADD COLUMN "tokenEndpointAuthMethod" TEXT NOT NULL DEFAULT 'client_secret_post';+ALTER TABLE "oauthClient" ADD COLUMN "clientUri" TEXT;+ALTER TABLE "oauthClient" ADD COLUMN "logoUri" TEXT;+ALTER TABLE "oauthClient" ADD COLUMN "scope" TEXT;diff --git a/packages/dev/src/commands/up.ts b/packages/dev/src/commands/up.tsindex 6236acd82f..916765fe49 100644--- a/packages/dev/src/commands/up.ts+++ b/packages/dev/src/commands/up.ts@@ -28,6 +28,7 @@ import {import {applyBootstrapSql,applyMigrations,+ ensureSmokeTestUser,waitForPostgres,waitForStorageReady,waitForTcp@@ -151,6 +152,7 @@ export async function up(opts: UpOpts = {}) {await waitForServices(ctx);}await runDatabaseMigrations(ctx, { shouldMigrate, shouldRegen });+ await seedSmokeTestUser(ctx);if (portless) {await setupPortless(ctx, selectedApps);await ensureHostsFile();@@ -395,6 +397,22 @@ async function runDatabaseMigrations(]);}+async function seedSmokeTestUser(ctx: Ctx) {+ await tasks([+ {+ title: "Seed smoke-test user ([email protected])",+ task: async () => {+ const r = await ensureSmokeTestUser(+ ctx.root,+ ctx.ports.PORT_DB,+ ctx.ports.PORT_API+ );+ return r.seeded ? "user created" : "already exists";+ }+ }+ ]);+}+async function setupPortless(ctx: Ctx, _selectedApps: AppId[]) {await tasks([{diff --git a/packages/dev/src/env.ts b/packages/dev/src/env.tsindex 182936c5b5..2497bd4f96 100644--- a/packages/dev/src/env.ts+++ b/packages/dev/src/env.ts@@ -89,6 +89,9 @@ export function renderEnv(opts: {// `erp.main.dev` host the SDK URL points at).lines.push(`INNGEST_TLS_HOST=${portless ? host("erp") : "localhost"}`);lines.push("");+ lines.push("# Dev auth bypass");+ lines.push("[email protected]");+ lines.push("");return lines.join("\n");}diff --git a/packages/dev/src/services/migrations.ts b/packages/dev/src/services/migrations.tsindex 425ceee7f1..7f62a6227c 100644--- a/packages/dev/src/services/migrations.ts+++ b/packages/dev/src/services/migrations.ts@@ -217,6 +217,55 @@ async function repairStaleMigrations(return stale.length;}+// ---------------------------------------------------------------------------+// Smoke-test user+// ---------------------------------------------------------------------------++const SMOKE_TEST_EMAIL = "[email protected]";++export async function ensureSmokeTestUser(+ root: string,+ dbPort: number,+ apiPort: number+): Promise<{ seeded: boolean }> {+ const exists = await withClient(dbPort, async (c) => {+ const r = await c.query<{ count: string }>(+ `SELECT count(*)::text FROM "user" WHERE email = $1`,+ [SMOKE_TEST_EMAIL]+ );+ return Number(r.rows[0]?.count) > 0;+ });++ if (exists) return { seeded: false };++ const dbUrl = `postgresql://postgres:postgres@localhost:${dbPort}/postgres`;+ const supabaseUrl = `http://localhost:${apiPort}`;+ await execa(+ "pnpm",+ [+ "--filter",+ "@carbon/database",+ "run",+ "db:seed:dev",+ "--",+ "--email",+ SMOKE_TEST_EMAIL+ ],+ {+ cwd: root,+ env: {+ ...process.env,+ SUPABASE_DB_URL: dbUrl,+ SUPABASE_URL: supabaseUrl,+ NODE_TLS_REJECT_UNAUTHORIZED: "0"+ },+ stdio: "pipe"+ }+ );++ return { seeded: true };+}+// ---------------------------------------------------------------------------// Private helpers// ---------------------------------------------------------------------------diff --git a/packages/env/src/index.ts b/packages/env/src/index.tsindex 244fb23ac1..3c76856ec2 100644--- a/packages/env/src/index.ts+++ b/packages/env/src/index.ts@@ -243,6 +243,10 @@ export const SLACK_STATE_SECRET = getEnv("SLACK_STATE_SECRET", {});export const SUPABASE_SERVICE_ROLE_KEY = getEnv("SUPABASE_SERVICE_ROLE_KEY");+export const SUPABASE_JWT_SECRET = getEnv("SUPABASE_JWT_SECRET", {+ isSecret: true,+ isRequired: false+});export const SUPABASE_DB_URL = getEnv("SUPABASE_DB_URL", {isRequired: true,isSecret: truediff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 12217db576..62cc39a705 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -279,9 +279,6 @@ msgstr "Fügen Sie Notizen zu Ihrer Entscheidung hinzu..."msgid "Add Approval Requirement"msgstr "Genehmigungsanforderung hinzufügen"-msgid "Add attachments"-msgstr "Anhänge hinzufügen"-msgid "Add Calibration Record"msgstr "Kalibrierungsdatensatz hinzufügen"@@ -919,10 +916,6 @@ msgstr "Als Unternehmenseigentümer können Sie das Eigentum an einen anderen Mimsgid "Ascending"msgstr "Aufsteigend"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Frag mich alles"-msgid "Assembly:"msgstr "Baugruppe:"@@ -1037,9 +1030,6 @@ msgstr "Durchschn. Tage bis Abschluss"msgid "Back"msgstr "Zurück"-msgid "Back to home"-msgstr "Zurück zur Startseite"-msgid "Back to traceability"msgstr "Zurück zur Rückverfolgbarkeit"@@ -1634,9 +1624,6 @@ msgstr "In Angebot umwandeln"msgid "Copied link to clipboard"msgstr "Link in die Zwischenablage kopiert"-msgid "Copied!"-msgstr "Kopiert!"-msgid "Copy"msgstr "Kopieren"@@ -1742,9 +1729,6 @@ msgstr "Angebot kopieren"msgid "Copy Quote number"msgstr "Angebotsnummer kopieren"-msgid "Copy response"-msgstr "Antwort kopieren"-msgid "Copy this item's pricing to another scope."msgstr "Kopieren Sie die Preisgestaltung dieses Artikels in einen anderen Bereich."@@ -2270,9 +2254,6 @@ msgstr "Attribut löschen"msgid "Delete Category"msgstr "Kategorie löschen"-msgid "Delete chat"-msgstr "Chat löschen"-msgid "Delete Consumable"msgstr "Verbrauchsmaterial löschen"@@ -4415,9 +4396,6 @@ msgstr "Live-Neuladen"msgid "Load Templates"msgstr "Vorlagen laden"-msgid "Loader"-msgstr "Ladevorgang"-msgid "Loading item details..."msgstr "Artikeldetails werden geladen..."@@ -4888,9 +4866,6 @@ msgstr "Benötigen Sie die richtigen Spalten?"msgid "Negative Adjustment"msgstr "Negative Anpassung"-msgid "Negative feedback"-msgstr "Negatives Feedback"-msgid "Never"msgstr "Nie"@@ -4915,9 +4890,6 @@ msgstr "Neues Attribut"msgid "New Attribute Category"msgstr "Neue Attributkategorie"-msgid "New chat"-msgstr "Neuer Chat"-msgid "New Consumable"msgstr "Neuer Verbrauchsstoff"@@ -5193,12 +5165,6 @@ msgstr "Keine Kalibrierungsdatensätze gefunden"msgid "No changes recorded"msgstr "Keine Änderungen aufgezeichnet"-msgid "No chat history"-msgstr "Keine Chat-Verlauf"--msgid "No chats found"-msgstr "Keine Chats gefunden"-msgid "No comments yet. Be the first to add a comment."msgstr "Noch keine Kommentare. Seien Sie der Erste, der einen Kommentar hinzufügt."@@ -5463,9 +5429,6 @@ msgstr "Offene Maßnahmen"msgid "Open Audit Log"msgstr "Audit-Protokoll öffnen"-msgid "Open chat history"-msgstr "Chat-Verlauf öffnen"-msgid "Open Date"msgstr "Öffnungsdatum"@@ -5862,9 +5825,6 @@ msgstr "Portale"msgid "Positive Adjustment"msgstr "Positive Anpassung"-msgid "Positive feedback"-msgstr "Positives Feedback"-msgid "Post"msgstr "Buchen"@@ -6382,9 +6342,6 @@ msgstr "Entfernen"msgid "Remove {0}"msgstr "Entfernen {0}"-msgid "Remove attachment"-msgstr "Anhang entfernen"-msgid "Remove condition"msgstr "Bedingung entfernen"@@ -6403,9 +6360,6 @@ msgstr "Aus Preisliste entfernen"msgid "Remove item"msgstr "Element entfernen"-msgid "Remove negative feedback"-msgstr "Negative Feedback entfernen"-msgid "Remove order"msgstr "Bestellung entfernen"@@ -6415,9 +6369,6 @@ msgstr "Bestellung entfernen"msgid "Remove pair"msgstr "Paar entfernen"-msgid "Remove positive feedback"-msgstr "Positive Bewertung entfernen"-msgid "Remove sort by column"msgstr "Sortierung nach Spalte entfernen"@@ -6567,9 +6518,6 @@ msgstr "Ergebnisse pro Seite"msgid "Retry"msgstr "Erneut versuchen"-msgid "Retry response"-msgstr "Antwort erneut versuchen"-msgid "Return Home"msgstr "Zur Startseite zurück"@@ -6856,9 +6804,6 @@ msgstr "Felder durchsuchen..."msgid "Search for existing or create a new one"msgstr "Suchen Sie nach einem vorhandenen oder erstellen Sie einen neuen"-msgid "Search history"-msgstr "Suchverlauf durchsuchen"-msgid "Search Job"msgstr "Job durchsuchen"@@ -6874,10 +6819,6 @@ msgstr "Nach verwandten Elementen suchen..."msgid "Search suppliers..."msgstr "Lieferanten durchsuchen..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Im Web suchen"-msgid "Search..."msgstr "Suchen..."@@ -7337,9 +7278,6 @@ msgstr "Quellmethode"msgid "Source Version"msgstr "Quellversion"-msgid "Sources"-msgstr "Quellen"-msgid "Sourcing Type"msgstr "Beschaffungstyp"@@ -7502,9 +7440,6 @@ msgstr "Unterbereiche"msgid "Subassembly"msgstr "Baugruppe"-msgid "Submit"-msgstr "Absenden"-msgid "Submit anonymously"msgstr "Anonym einreichen"@@ -7544,9 +7479,6 @@ msgstr "Neue Revision erfolgreich erstellt"msgid "Suffix"msgstr "Suffix"-msgid "Suggested Actions"-msgstr "Vorgeschlagene Aktionen"-msgid "Suggestion"msgstr "Vorschlag"@@ -8535,9 +8467,6 @@ msgstr "Sichtbarkeit"msgid "Visible on a user's public profile"msgstr "Sichtbar im öffentlichen Profil eines Benutzers"-msgid "Voice"-msgstr "Sprache"-msgid "Void"msgstr "Stornieren"@@ -8604,9 +8533,6 @@ msgstr "Wir haben einen Verifizierungscode an {signupEmail} gesendet"msgid "We've sent you a magic link to sign in to your account."msgstr "Wir haben dir einen Magic Link zum Anmelden bei deinem Konto gesendet."-msgid "Web Search"-msgstr "Websuche"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 568c39588e..7b13cd1468 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -279,9 +279,6 @@ msgstr "Add any notes about your decision..."msgid "Add Approval Requirement"msgstr "Add Approval Requirement"-msgid "Add attachments"-msgstr "Add attachments"-msgid "Add Calibration Record"msgstr "Add Calibration Record"@@ -919,10 +916,6 @@ msgstr "As the company owner, you can transfer ownership to another employee. Thmsgid "Ascending"msgstr "Ascending"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Ask anything"-msgid "Assembly:"msgstr "Assembly:"@@ -1037,9 +1030,6 @@ msgstr "Avg Days to Close"msgid "Back"msgstr "Back"-msgid "Back to home"-msgstr "Back to home"-msgid "Back to traceability"msgstr "Back to traceability"@@ -1634,9 +1624,6 @@ msgstr "Convert to Quote"msgid "Copied link to clipboard"msgstr "Copied link to clipboard"-msgid "Copied!"-msgstr "Copied!"-msgid "Copy"msgstr "Copy"@@ -1742,9 +1729,6 @@ msgstr "Copy Quote"msgid "Copy Quote number"msgstr "Copy Quote number"-msgid "Copy response"-msgstr "Copy response"-msgid "Copy this item's pricing to another scope."msgstr "Copy this item's pricing to another scope."@@ -2270,9 +2254,6 @@ msgstr "Delete Attribute"msgid "Delete Category"msgstr "Delete Category"-msgid "Delete chat"-msgstr "Delete chat"-msgid "Delete Consumable"msgstr "Delete Consumable"@@ -4415,9 +4396,6 @@ msgstr "Live reloading"msgid "Load Templates"msgstr "Load Templates"-msgid "Loader"-msgstr "Loader"-msgid "Loading item details..."msgstr "Loading item details..."@@ -4888,9 +4866,6 @@ msgstr "Need the right columns?"msgid "Negative Adjustment"msgstr "Negative Adjustment"-msgid "Negative feedback"-msgstr "Negative feedback"-msgid "Never"msgstr "Never"@@ -4915,9 +4890,6 @@ msgstr "New Attribute"msgid "New Attribute Category"msgstr "New Attribute Category"-msgid "New chat"-msgstr "New chat"-msgid "New Consumable"msgstr "New Consumable"@@ -5193,12 +5165,6 @@ msgstr "No calibration records found"msgid "No changes recorded"msgstr "No changes recorded"-msgid "No chat history"-msgstr "No chat history"--msgid "No chats found"-msgstr "No chats found"-msgid "No comments yet. Be the first to add a comment."msgstr "No comments yet. Be the first to add a comment."@@ -5463,9 +5429,6 @@ msgstr "Open Actions"msgid "Open Audit Log"msgstr "Open Audit Log"-msgid "Open chat history"-msgstr "Open chat history"-msgid "Open Date"msgstr "Open Date"@@ -5862,9 +5825,6 @@ msgstr "Portals"msgid "Positive Adjustment"msgstr "Positive Adjustment"-msgid "Positive feedback"-msgstr "Positive feedback"-msgid "Post"msgstr "Post"@@ -6382,9 +6342,6 @@ msgstr "Remove"msgid "Remove {0}"msgstr "Remove {0}"-msgid "Remove attachment"-msgstr "Remove attachment"-msgid "Remove condition"msgstr "Remove condition"@@ -6403,9 +6360,6 @@ msgstr "Remove from Price List"msgid "Remove item"msgstr "Remove item"-msgid "Remove negative feedback"-msgstr "Remove negative feedback"-msgid "Remove order"msgstr "Remove order"@@ -6415,9 +6369,6 @@ msgstr "Remove Order"msgid "Remove pair"msgstr "Remove pair"-msgid "Remove positive feedback"-msgstr "Remove positive feedback"-msgid "Remove sort by column"msgstr "Remove sort by column"@@ -6567,9 +6518,6 @@ msgstr "Results per page"msgid "Retry"msgstr "Retry"-msgid "Retry response"-msgstr "Retry response"-msgid "Return Home"msgstr "Return Home"@@ -6856,9 +6804,6 @@ msgstr "Search fields..."msgid "Search for existing or create a new one"msgstr "Search for existing or create a new one"-msgid "Search history"-msgstr "Search history"-msgid "Search Job"msgstr "Search Job"@@ -6874,10 +6819,6 @@ msgstr "Search related items..."msgid "Search suppliers..."msgstr "Search suppliers..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Search the web"-msgid "Search..."msgstr "Search..."@@ -7337,9 +7278,6 @@ msgstr "Source Method"msgid "Source Version"msgstr "Source Version"-msgid "Sources"-msgstr "Sources"-msgid "Sourcing Type"msgstr "Sourcing Type"@@ -7502,9 +7440,6 @@ msgstr "Sub-Departments"msgid "Subassembly"msgstr "Subassembly"-msgid "Submit"-msgstr "Submit"-msgid "Submit anonymously"msgstr "Submit anonymously"@@ -7544,9 +7479,6 @@ msgstr "Successfully created a new revision"msgid "Suffix"msgstr "Suffix"-msgid "Suggested Actions"-msgstr "Suggested Actions"-msgid "Suggestion"msgstr "Suggestion"@@ -8535,9 +8467,6 @@ msgstr "Visibility"msgid "Visible on a user's public profile"msgstr "Visible on a user's public profile"-msgid "Voice"-msgstr "Voice"-msgid "Void"msgstr "Void"@@ -8604,9 +8533,6 @@ msgstr "We've sent a verification code to {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "We've sent you a magic link to sign in to your account."-msgid "Web Search"-msgstr "Web Search"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex 45745e87e5..9f062f1574 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -279,9 +279,6 @@ msgstr "Añade cualquier nota sobre tu decisión..."msgid "Add Approval Requirement"msgstr "Agregar Requisito de Aprobación"-msgid "Add attachments"-msgstr "Agregar archivos adjuntos"-msgid "Add Calibration Record"msgstr "Agregar Registro de Calibración"@@ -919,10 +916,6 @@ msgstr "Como propietario de la empresa, puedes transferir la propiedad a otro emmsgid "Ascending"msgstr "Ascendente"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Pregunta cualquier cosa"-msgid "Assembly:"msgstr "Ensamblaje:"@@ -1037,9 +1030,6 @@ msgstr "Días promedio para cerrar"msgid "Back"msgstr "Atrás"-msgid "Back to home"-msgstr "Volver al inicio"-msgid "Back to traceability"msgstr "Volver a trazabilidad"@@ -1634,9 +1624,6 @@ msgstr "Convertir a Cotización"msgid "Copied link to clipboard"msgstr "Enlace copiado al portapapeles"-msgid "Copied!"-msgstr "¡Copiado!"-msgid "Copy"msgstr "Copiar"@@ -1742,9 +1729,6 @@ msgstr "Copiar Presupuesto"msgid "Copy Quote number"msgstr "Copiar número de cotización"-msgid "Copy response"-msgstr "Copiar respuesta"-msgid "Copy this item's pricing to another scope."msgstr "Copiar el precio de este artículo a otro ámbito."@@ -2270,9 +2254,6 @@ msgstr "Eliminar Atributo"msgid "Delete Category"msgstr "Eliminar Categoría"-msgid "Delete chat"-msgstr "Eliminar chat"-msgid "Delete Consumable"msgstr "Eliminar Consumible"@@ -4415,9 +4396,6 @@ msgstr "Recarga en vivo"msgid "Load Templates"msgstr "Cargar Plantillas"-msgid "Loader"-msgstr "Cargador"-msgid "Loading item details..."msgstr "Cargando detalles del artículo..."@@ -4888,9 +4866,6 @@ msgstr "¿Necesitas las columnas correctas?"msgid "Negative Adjustment"msgstr "Ajuste Negativo"-msgid "Negative feedback"-msgstr "Comentarios negativos"-msgid "Never"msgstr "Nunca"@@ -4915,9 +4890,6 @@ msgstr "Nuevo Atributo"msgid "New Attribute Category"msgstr "Nueva Categoría de Atributo"-msgid "New chat"-msgstr "Nuevo chat"-msgid "New Consumable"msgstr "Nuevo Consumible"@@ -5193,12 +5165,6 @@ msgstr "No se encontraron registros de calibración"msgid "No changes recorded"msgstr "Sin cambios registrados"-msgid "No chat history"-msgstr "Sin historial de chat"--msgid "No chats found"-msgstr "No se encontraron chats"-msgid "No comments yet. Be the first to add a comment."msgstr "No hay comentarios aún. Sé el primero en agregar un comentario."@@ -5463,9 +5429,6 @@ msgstr "Acciones Abiertas"msgid "Open Audit Log"msgstr "Abrir Registro de Auditoría"-msgid "Open chat history"-msgstr "Abrir historial de chat"-msgid "Open Date"msgstr "Fecha de Apertura"@@ -5862,9 +5825,6 @@ msgstr "Portales"msgid "Positive Adjustment"msgstr "Ajuste Positivo"-msgid "Positive feedback"-msgstr "Comentarios positivos"-msgid "Post"msgstr "Registrar"@@ -6382,9 +6342,6 @@ msgstr "Eliminar"msgid "Remove {0}"msgstr "Eliminar {0}"-msgid "Remove attachment"-msgstr "Eliminar adjunto"-msgid "Remove condition"msgstr "Eliminar condición"@@ -6403,9 +6360,6 @@ msgstr "Eliminar de la Lista de Precios"msgid "Remove item"msgstr "Eliminar artículo"-msgid "Remove negative feedback"-msgstr "Eliminar comentarios negativos"-msgid "Remove order"msgstr "Eliminar orden"@@ -6415,9 +6369,6 @@ msgstr "Eliminar Pedido"msgid "Remove pair"msgstr "Eliminar par"-msgid "Remove positive feedback"-msgstr "Eliminar comentarios positivos"-msgid "Remove sort by column"msgstr "Eliminar ordenamiento por columna"@@ -6567,9 +6518,6 @@ msgstr "Resultados por página"msgid "Retry"msgstr "Reintentar"-msgid "Retry response"-msgstr "Reintentar respuesta"-msgid "Return Home"msgstr "Volver al Inicio"@@ -6856,9 +6804,6 @@ msgstr "Buscar campos..."msgid "Search for existing or create a new one"msgstr "Buscar uno existente o crear uno nuevo"-msgid "Search history"-msgstr "Buscar historial"-msgid "Search Job"msgstr "Buscar trabajo"@@ -6874,10 +6819,6 @@ msgstr "Buscar elementos relacionados..."msgid "Search suppliers..."msgstr "Buscar proveedores..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Buscar en la web"-msgid "Search..."msgstr "Buscar..."@@ -7337,9 +7278,6 @@ msgstr "Método de Origen"msgid "Source Version"msgstr "Versión de Origen"-msgid "Sources"-msgstr "Fuentes"-msgid "Sourcing Type"msgstr "Tipo de Abastecimiento"@@ -7502,9 +7440,6 @@ msgstr "Sub-Departamentos"msgid "Subassembly"msgstr "Subconjunto"-msgid "Submit"-msgstr "Enviar"-msgid "Submit anonymously"msgstr "Enviar anónimamente"@@ -7544,9 +7479,6 @@ msgstr "Se creó exitosamente una nueva revisión"msgid "Suffix"msgstr "Sufijo"-msgid "Suggested Actions"-msgstr "Acciones sugeridas"-msgid "Suggestion"msgstr "Sugerencia"@@ -8535,9 +8467,6 @@ msgstr "Visibilidad"msgid "Visible on a user's public profile"msgstr "Visible en el perfil público de un usuario"-msgid "Voice"-msgstr "Voz"-msgid "Void"msgstr "Anular"@@ -8604,9 +8533,6 @@ msgstr "Hemos enviado un código de verificación a {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "Te hemos enviado un enlace mágico para iniciar sesión en tu cuenta."-msgid "Web Search"-msgstr "Búsqueda web"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex d141f7cd8f..c6de1cbd17 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -279,9 +279,6 @@ msgstr "Ajoutez des notes sur votre décision..."msgid "Add Approval Requirement"msgstr "Ajouter une exigence d'approbation"-msgid "Add attachments"-msgstr "Ajouter des pièces jointes"-msgid "Add Calibration Record"msgstr "Ajouter un enregistrement d'étalonnage"@@ -919,10 +916,6 @@ msgstr "En tant que propriétaire de l'entreprise, vous pouvez transférer la prmsgid "Ascending"msgstr "Croissant"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Demandez n'importe quoi"-msgid "Assembly:"msgstr "Assemblage :"@@ -1037,9 +1030,6 @@ msgstr "Jours moy. pour fermer"msgid "Back"msgstr "Retour"-msgid "Back to home"-msgstr "Retour à l'accueil"-msgid "Back to traceability"msgstr "Retour à la traçabilité"@@ -1634,9 +1624,6 @@ msgstr "Convertir en devis"msgid "Copied link to clipboard"msgstr "Lien copié dans le presse-papiers"-msgid "Copied!"-msgstr "Copié !"-msgid "Copy"msgstr "Copier"@@ -1742,9 +1729,6 @@ msgstr "Copier le devis"msgid "Copy Quote number"msgstr "Copier le numéro de devis"-msgid "Copy response"-msgstr "Copier la réponse"-msgid "Copy this item's pricing to another scope."msgstr "Copiez la tarification de cet article vers une autre portée."@@ -2270,9 +2254,6 @@ msgstr "Supprimer l'attribut"msgid "Delete Category"msgstr "Supprimer la catégorie"-msgid "Delete chat"-msgstr "Supprimer le chat"-msgid "Delete Consumable"msgstr "Supprimer la consommable"@@ -4415,9 +4396,6 @@ msgstr "Rechargement en direct"msgid "Load Templates"msgstr "Charger les modèles"-msgid "Loader"-msgstr "Chargement"-msgid "Loading item details..."msgstr "Chargement des détails de l'article..."@@ -4888,9 +4866,6 @@ msgstr "Besoin des bonnes colonnes ?"msgid "Negative Adjustment"msgstr "Ajustement Négatif"-msgid "Negative feedback"-msgstr "Retour négatif"-msgid "Never"msgstr "Jamais"@@ -4915,9 +4890,6 @@ msgstr "Nouvel Attribut"msgid "New Attribute Category"msgstr "Nouvelle Catégorie d'Attribut"-msgid "New chat"-msgstr "Nouveau chat"-msgid "New Consumable"msgstr "Nouveau consommable"@@ -5193,12 +5165,6 @@ msgstr "Aucun enregistrement d'étalonnage trouvé"msgid "No changes recorded"msgstr "Aucune modification enregistrée"-msgid "No chat history"-msgstr "Aucun historique de chat"--msgid "No chats found"-msgstr "Aucun chat trouvé"-msgid "No comments yet. Be the first to add a comment."msgstr "Aucun commentaire pour le moment. Soyez le premier à ajouter un commentaire."@@ -5463,9 +5429,6 @@ msgstr "Actions ouvertes"msgid "Open Audit Log"msgstr "Ouvrir le journal d'audit"-msgid "Open chat history"-msgstr "Ouvrir l'historique des conversations"-msgid "Open Date"msgstr "Date d'ouverture"@@ -5862,9 +5825,6 @@ msgstr "Portails"msgid "Positive Adjustment"msgstr "Ajustement positif"-msgid "Positive feedback"-msgstr "Retour positif"-msgid "Post"msgstr "Publier"@@ -6382,9 +6342,6 @@ msgstr "Supprimer"msgid "Remove {0}"msgstr "Supprimer {0}"-msgid "Remove attachment"-msgstr "Supprimer la pièce jointe"-msgid "Remove condition"msgstr "Supprimer la condition"@@ -6403,9 +6360,6 @@ msgstr "Supprimer de la liste de prix"msgid "Remove item"msgstr "Supprimer l'article"-msgid "Remove negative feedback"-msgstr "Supprimer les commentaires négatifs"-msgid "Remove order"msgstr "Supprimer la commande"@@ -6415,9 +6369,6 @@ msgstr "Supprimer la commande"msgid "Remove pair"msgstr "Supprimer la paire"-msgid "Remove positive feedback"-msgstr "Supprimer les commentaires positifs"-msgid "Remove sort by column"msgstr "Supprimer le tri par colonne"@@ -6567,9 +6518,6 @@ msgstr "Résultats par page"msgid "Retry"msgstr "Réessayer"-msgid "Retry response"-msgstr "Réessayer la réponse"-msgid "Return Home"msgstr "Retour à l'accueil"@@ -6856,9 +6804,6 @@ msgstr "Rechercher des champs..."msgid "Search for existing or create a new one"msgstr "Rechercher un existant ou en créer un nouveau"-msgid "Search history"-msgstr "Historique de recherche"-msgid "Search Job"msgstr "Rechercher un travail"@@ -6874,10 +6819,6 @@ msgstr "Rechercher les articles associés..."msgid "Search suppliers..."msgstr "Rechercher des fournisseurs..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Rechercher sur le web"-msgid "Search..."msgstr "Rechercher..."@@ -7337,9 +7278,6 @@ msgstr "Méthode source"msgid "Source Version"msgstr "Version source"-msgid "Sources"-msgstr "Sources"-msgid "Sourcing Type"msgstr "Type d'approvisionnement"@@ -7502,9 +7440,6 @@ msgstr "Sous-départements"msgid "Subassembly"msgstr "Sous-assemblage"-msgid "Submit"-msgstr "Soumettre"-msgid "Submit anonymously"msgstr "Soumettre anonymement"@@ -7544,9 +7479,6 @@ msgstr "Révision créée avec succès"msgid "Suffix"msgstr "Suffixe"-msgid "Suggested Actions"-msgstr "Actions suggérées"-msgid "Suggestion"msgstr "Suggestion"@@ -8535,9 +8467,6 @@ msgstr "Visibilité"msgid "Visible on a user's public profile"msgstr "Visible sur le profil public d'un utilisateur"-msgid "Voice"-msgstr "Voix"-msgid "Void"msgstr "Annuler"@@ -8604,9 +8533,6 @@ msgstr "Nous avons envoyé un code de vérification à {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "Nous vous avons envoyé un lien magique pour vous connecter à votre compte."-msgid "Web Search"-msgstr "Recherche Web"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex 3ec22494c7..8d597171ee 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -279,9 +279,6 @@ msgstr "अपने निर्णय के बारे में कोईmsgid "Add Approval Requirement"msgstr "अनुमोदन आवश्यकता जोड़ें"-msgid "Add attachments"-msgstr "संलग्नताएं जोड़ें"-msgid "Add Calibration Record"msgstr "कैलिब्रेशन रिकॉर्ड जोड़ें"@@ -919,10 +916,6 @@ msgstr "कंपनी के मालिक के रूप में, आmsgid "Ascending"msgstr "आरोही"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "कुछ भी पूछें"-msgid "Assembly:"msgstr "असेंबली:"@@ -1037,9 +1030,6 @@ msgstr "बंद करने के लिए औसत दिन"msgid "Back"msgstr "वापस"-msgid "Back to home"-msgstr "घर वापस जाएं"-msgid "Back to traceability"msgstr "ट्रेसेबिलिटी पर वापस जाएं"@@ -1634,9 +1624,6 @@ msgstr "उद्धरण में परिवर्तित करें"msgid "Copied link to clipboard"msgstr "क्लिपबोर्ड में लिंक कॉपी किया गया"-msgid "Copied!"-msgstr "कॉपी किया गया!"-msgid "Copy"msgstr "कॉपी करें"@@ -1742,9 +1729,6 @@ msgstr "उद्धरण की प्रतिलिपि बनाएँ"msgid "Copy Quote number"msgstr "उद्धरण संख्या कॉपी करें"-msgid "Copy response"-msgstr "प्रतिक्रिया कॉपी करें"-msgid "Copy this item's pricing to another scope."msgstr "इस आइटम की मूल्य निर्धारण को दूसरे स्कोप में कॉपी करें।"@@ -2270,9 +2254,6 @@ msgstr "विशेषता हटाएं"msgid "Delete Category"msgstr "श्रेणी हटाएं"-msgid "Delete chat"-msgstr "चैट हटाएं"-msgid "Delete Consumable"msgstr "उपभोग्य हटाएं"@@ -4415,9 +4396,6 @@ msgstr "लाइव रीलोडिंग"msgid "Load Templates"msgstr "टेम्पलेट लोड करें"-msgid "Loader"-msgstr "लोडर"-msgid "Loading item details..."msgstr "आइटम विवरण लोड हो रहे हैं..."@@ -4888,9 +4866,6 @@ msgstr "क्या आपको सही कॉलम चाहिए?"msgid "Negative Adjustment"msgstr "नकारात्मक समायोजन"-msgid "Negative feedback"-msgstr "नकारात्मक प्रतिक्रिया"-msgid "Never"msgstr "कभी नहीं"@@ -4915,9 +4890,6 @@ msgstr "नई विशेषता"msgid "New Attribute Category"msgstr "नई विशेषता श्रेणी"-msgid "New chat"-msgstr "नई चैट"-msgid "New Consumable"msgstr "नया उपभोग्य"@@ -5193,12 +5165,6 @@ msgstr "कोई अंशांकन रिकॉर्ड नहीं मmsgid "No changes recorded"msgstr "कोई परिवर्तन दर्ज नहीं किया गया"-msgid "No chat history"-msgstr "कोई चैट इतिहास नहीं"--msgid "No chats found"-msgstr "कोई चैट नहीं मिला"-msgid "No comments yet. Be the first to add a comment."msgstr "अभी तक कोई टिप्पणी नहीं है। टिप्पणी जोड़ने वाले पहले व्यक्ति बनें।"@@ -5463,9 +5429,6 @@ msgstr "खुली कार्रवाइयाँ"msgid "Open Audit Log"msgstr "ऑडिट लॉग खोलें"-msgid "Open chat history"-msgstr "चैट इतिहास खोलें"-msgid "Open Date"msgstr "खुली तारीख"@@ -5862,9 +5825,6 @@ msgstr "पोर्टल"msgid "Positive Adjustment"msgstr "सकारात्मक समायोजन"-msgid "Positive feedback"-msgstr "सकारात्मक प्रतिक्रिया"-msgid "Post"msgstr "पोस्ट करें"@@ -6382,9 +6342,6 @@ msgstr "हटाएं"msgid "Remove {0}"msgstr "{0} को हटाएं"-msgid "Remove attachment"-msgstr "संलग्नक हटाएं"-msgid "Remove condition"msgstr "शर्त हटाएं"@@ -6403,9 +6360,6 @@ msgstr "मूल्य सूची से हटाएं"msgid "Remove item"msgstr "आइटम हटाएं"-msgid "Remove negative feedback"-msgstr "नकारात्मक प्रतिक्रिया हटाएं"-msgid "Remove order"msgstr "ऑर्डर हटाएं"@@ -6415,9 +6369,6 @@ msgstr "ऑर्डर हटाएं"msgid "Remove pair"msgstr "जोड़ी हटाएं"-msgid "Remove positive feedback"-msgstr "सकारात्मक प्रतिक्रिया हटाएं"-msgid "Remove sort by column"msgstr "कॉलम द्वारा सॉर्ट हटाएं"@@ -6567,9 +6518,6 @@ msgstr "प्रति पृष्ठ परिणाम"msgid "Retry"msgstr "पुनः प्रयास करें"-msgid "Retry response"-msgstr "प्रतिक्रिया पुनः प्रयास करें"-msgid "Return Home"msgstr "घर लौटें"@@ -6856,9 +6804,6 @@ msgstr "फ़ील्ड खोजें..."msgid "Search for existing or create a new one"msgstr "मौजूदा को खोजें या नया बनाएं"-msgid "Search history"-msgstr "इतिहास खोजें"-msgid "Search Job"msgstr "Job खोजें"@@ -6874,10 +6819,6 @@ msgstr "संबंधित आइटम खोजें..."msgid "Search suppliers..."msgstr "आपूर्तिकर्ताओं को खोजें..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "वेब खोजें"-msgid "Search..."msgstr "खोजें..."@@ -7337,9 +7278,6 @@ msgstr "स्रोत विधि"msgid "Source Version"msgstr "स्रोत संस्करण"-msgid "Sources"-msgstr "स्रोत"-msgid "Sourcing Type"msgstr "सोर्सिंग प्रकार"@@ -7502,9 +7440,6 @@ msgstr "उप-विभाग"msgid "Subassembly"msgstr "उप-विधानसभा"-msgid "Submit"-msgstr "जमा करें"-msgid "Submit anonymously"msgstr "गुमनाम रूप से सबमिट करें"@@ -7544,9 +7479,6 @@ msgstr "सफलतापूर्वक एक नया संशोधनmsgid "Suffix"msgstr "प्रत्यय"-msgid "Suggested Actions"-msgstr "सुझाए गए कार्य"-msgid "Suggestion"msgstr "सुझाव"@@ -8535,9 +8467,6 @@ msgstr "दृश्यता"msgid "Visible on a user's public profile"msgstr "उपयोगकर्ता की सार्वजनिक प्रोफ़ाइल पर दृश्यमान"-msgid "Voice"-msgstr "आवाज़"-msgid "Void"msgstr "रद्द करें"@@ -8604,9 +8533,6 @@ msgstr "हमने {signupEmail} को एक सत्यापन कोडmsgid "We've sent you a magic link to sign in to your account."msgstr "हमने आपके खाते में साइन इन करने के लिए आपको एक जादुई लिंक भेजा है।"-msgid "Web Search"-msgstr "वेब सर्च"-msgid "Webhook"msgstr "वेबहुक"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex f53037e58c..431857bc5b 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -279,9 +279,6 @@ msgstr "Aggiungi eventuali note sulla tua decisione..."msgid "Add Approval Requirement"msgstr "Aggiungi Requisito di Approvazione"-msgid "Add attachments"-msgstr "Aggiungi allegati"-msgid "Add Calibration Record"msgstr "Aggiungi Record di Calibrazione"@@ -919,10 +916,6 @@ msgstr "Come proprietario dell'azienda, puoi trasferire la proprietà a un altromsgid "Ascending"msgstr "Ascendente"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Chiedi qualsiasi cosa"-msgid "Assembly:"msgstr "Assieme:"@@ -1037,9 +1030,6 @@ msgstr "Giorni medi per chiudere"msgid "Back"msgstr "Indietro"-msgid "Back to home"-msgstr "Torna alla home"-msgid "Back to traceability"msgstr "Torna alla tracciabilità"@@ -1634,9 +1624,6 @@ msgstr "Converti in Preventivo"msgid "Copied link to clipboard"msgstr "Collegamento copiato negli appunti"-msgid "Copied!"-msgstr "Copiato!"-msgid "Copy"msgstr "Copia"@@ -1742,9 +1729,6 @@ msgstr "Copia Preventivo"msgid "Copy Quote number"msgstr "Copia numero preventivo"-msgid "Copy response"-msgstr "Copia risposta"-msgid "Copy this item's pricing to another scope."msgstr "Copia il prezzo di questo articolo in un altro ambito."@@ -2270,9 +2254,6 @@ msgstr "Elimina Attributo"msgid "Delete Category"msgstr "Elimina Categoria"-msgid "Delete chat"-msgstr "Elimina chat"-msgid "Delete Consumable"msgstr "Elimina Consumabile"@@ -4415,9 +4396,6 @@ msgstr "Ricaricamento in tempo reale"msgid "Load Templates"msgstr "Carica Modelli"-msgid "Loader"-msgstr "Caricamento"-msgid "Loading item details..."msgstr "Caricamento dettagli articolo..."@@ -4888,9 +4866,6 @@ msgstr "Hai bisogno delle colonne giuste?"msgid "Negative Adjustment"msgstr "Rettifica Negativa"-msgid "Negative feedback"-msgstr "Feedback negativo"-msgid "Never"msgstr "Mai"@@ -4915,9 +4890,6 @@ msgstr "Nuovo Attributo"msgid "New Attribute Category"msgstr "Nuova Categoria Attributo"-msgid "New chat"-msgstr "Nuova chat"-msgid "New Consumable"msgstr "Nuovo Consumabile"@@ -5193,12 +5165,6 @@ msgstr "Nessun record di calibrazione trovato"msgid "No changes recorded"msgstr "Nessuna modifica registrata"-msgid "No chat history"-msgstr "Nessuna cronologia chat"--msgid "No chats found"-msgstr "Nessuna chat trovata"-msgid "No comments yet. Be the first to add a comment."msgstr "Nessun commento ancora. Sii il primo ad aggiungere un commento."@@ -5463,9 +5429,6 @@ msgstr "Azioni Aperte"msgid "Open Audit Log"msgstr "Apri Registro di Audit"-msgid "Open chat history"-msgstr "Apri cronologia chat"-msgid "Open Date"msgstr "Data di apertura"@@ -5862,9 +5825,6 @@ msgstr "Portali"msgid "Positive Adjustment"msgstr "Rettifica Positiva"-msgid "Positive feedback"-msgstr "Feedback positivo"-msgid "Post"msgstr "Registra"@@ -6382,9 +6342,6 @@ msgstr "Rimuovi"msgid "Remove {0}"msgstr "Rimuovi {0}"-msgid "Remove attachment"-msgstr "Rimuovi allegato"-msgid "Remove condition"msgstr "Rimuovi condizione"@@ -6403,9 +6360,6 @@ msgstr "Rimuovi da Listino Prezzi"msgid "Remove item"msgstr "Rimuovi elemento"-msgid "Remove negative feedback"-msgstr "Rimuovi feedback negativo"-msgid "Remove order"msgstr "Rimuovi ordine"@@ -6415,9 +6369,6 @@ msgstr "Rimuovi Ordine"msgid "Remove pair"msgstr "Rimuovi coppia"-msgid "Remove positive feedback"-msgstr "Rimuovi feedback positivo"-msgid "Remove sort by column"msgstr "Rimuovi ordinamento per colonna"@@ -6567,9 +6518,6 @@ msgstr "Risultati per pagina"msgid "Retry"msgstr "Riprova"-msgid "Retry response"-msgstr "Riprova risposta"-msgid "Return Home"msgstr "Torna alla Home"@@ -6856,9 +6804,6 @@ msgstr "Cerca campi..."msgid "Search for existing or create a new one"msgstr "Cerca uno esistente o creane uno nuovo"-msgid "Search history"-msgstr "Cerca nella cronologia"-msgid "Search Job"msgstr "Cerca Job"@@ -6874,10 +6819,6 @@ msgstr "Cerca elementi correlati..."msgid "Search suppliers..."msgstr "Cerca fornitori..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Cerca nel web"-msgid "Search..."msgstr "Cerca..."@@ -7337,9 +7278,6 @@ msgstr "Metodo Sorgente"msgid "Source Version"msgstr "Versione Sorgente"-msgid "Sources"-msgstr "Fonti"-msgid "Sourcing Type"msgstr "Tipo di approvvigionamento"@@ -7502,9 +7440,6 @@ msgstr "Sotto-Dipartimenti"msgid "Subassembly"msgstr "Sottoassembly"-msgid "Submit"-msgstr "Invia"-msgid "Submit anonymously"msgstr "Invia in modo anonimo"@@ -7544,9 +7479,6 @@ msgstr "Revisione creata con successo"msgid "Suffix"msgstr "Suffisso"-msgid "Suggested Actions"-msgstr "Azioni suggerite"-msgid "Suggestion"msgstr "Suggerimento"@@ -8535,9 +8467,6 @@ msgstr "Visibilità"msgid "Visible on a user's public profile"msgstr "Visibile sul profilo pubblico di un utente"-msgid "Voice"-msgstr "Voce"-msgid "Void"msgstr "Annulla"@@ -8604,9 +8533,6 @@ msgstr "Abbiamo inviato un codice di verifica a {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "Ti abbiamo inviato un link magico per accedere al tuo account."-msgid "Web Search"-msgstr "Ricerca Web"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex 9041594dd2..b175607c21 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -279,9 +279,6 @@ msgstr "あなたの決定についてのメモを追加してください..."msgid "Add Approval Requirement"msgstr "承認要件を追加"-msgid "Add attachments"-msgstr "添付ファイルを追加"-msgid "Add Calibration Record"msgstr "キャリブレーション記録を追加"@@ -919,10 +916,6 @@ msgstr "会社のオーナーとして、別の従業員に所有権を譲渡でmsgid "Ascending"msgstr "昇順"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "何でも聞いてください"-msgid "Assembly:"msgstr "アセンブリ:"@@ -1037,9 +1030,6 @@ msgstr "平均クローズ日数"msgid "Back"msgstr "戻る"-msgid "Back to home"-msgstr "ホームに戻る"-msgid "Back to traceability"msgstr "トレーサビリティに戻る"@@ -1634,9 +1624,6 @@ msgstr "見積に変換"msgid "Copied link to clipboard"msgstr "クリップボードにリンクをコピーしました"-msgid "Copied!"-msgstr "コピーしました!"-msgid "Copy"msgstr "コピー"@@ -1742,9 +1729,6 @@ msgstr "見積書をコピー"msgid "Copy Quote number"msgstr "見積番号をコピー"-msgid "Copy response"-msgstr "レスポンスをコピー"-msgid "Copy this item's pricing to another scope."msgstr "このアイテムの価格設定を別のスコープにコピーします。"@@ -2270,9 +2254,6 @@ msgstr "属性を削除"msgid "Delete Category"msgstr "カテゴリを削除"-msgid "Delete chat"-msgstr "チャットを削除"-msgid "Delete Consumable"msgstr "消耗品を削除"@@ -4415,9 +4396,6 @@ msgstr "ライブリロード中"msgid "Load Templates"msgstr "テンプレートを読み込む"-msgid "Loader"-msgstr "ローダー"-msgid "Loading item details..."msgstr "アイテムの詳細を読み込み中..."@@ -4888,9 +4866,6 @@ msgstr "正しい列が必要ですか?"msgid "Negative Adjustment"msgstr "負の調整"-msgid "Negative feedback"-msgstr "ネガティブフィードバック"-msgid "Never"msgstr "なし"@@ -4915,9 +4890,6 @@ msgstr "新しい属性"msgid "New Attribute Category"msgstr "新しい属性カテゴリ"-msgid "New chat"-msgstr "新しいチャット"-msgid "New Consumable"msgstr "新しい消耗品"@@ -5193,12 +5165,6 @@ msgstr "キャリブレーション記録が見つかりません"msgid "No changes recorded"msgstr "変更が記録されていません"-msgid "No chat history"-msgstr "チャット履歴がありません"--msgid "No chats found"-msgstr "チャットが見つかりません"-msgid "No comments yet. Be the first to add a comment."msgstr "まだコメントがありません。最初のコメントを追加してください。"@@ -5463,9 +5429,6 @@ msgstr "オープンアクション"msgid "Open Audit Log"msgstr "監査ログを開く"-msgid "Open chat history"-msgstr "チャット履歴を開く"-msgid "Open Date"msgstr "開始日"@@ -5862,9 +5825,6 @@ msgstr "ポータル"msgid "Positive Adjustment"msgstr "正の調整"-msgid "Positive feedback"-msgstr "ポジティブなフィードバック"-msgid "Post"msgstr "転記"@@ -6382,9 +6342,6 @@ msgstr "削除"msgid "Remove {0}"msgstr "{0}を削除"-msgid "Remove attachment"-msgstr "添付ファイルを削除"-msgid "Remove condition"msgstr "条件を削除"@@ -6403,9 +6360,6 @@ msgstr "価格リストから削除"msgid "Remove item"msgstr "アイテムを削除"-msgid "Remove negative feedback"-msgstr "ネガティブフィードバックを削除"-msgid "Remove order"msgstr "注文を削除"@@ -6415,9 +6369,6 @@ msgstr "注文を削除"msgid "Remove pair"msgstr "ペアを削除"-msgid "Remove positive feedback"-msgstr "ポジティブフィードバックを削除"-msgid "Remove sort by column"msgstr "列でソートを削除"@@ -6567,9 +6518,6 @@ msgstr "ページあたりの結果数"msgid "Retry"msgstr "再試行"-msgid "Retry response"-msgstr "再度応答を試みる"-msgid "Return Home"msgstr "ホームに戻る"@@ -6856,9 +6804,6 @@ msgstr "フィールドを検索..."msgid "Search for existing or create a new one"msgstr "既存のものを検索するか、新しいものを作成してください"-msgid "Search history"-msgstr "履歴を検索"-msgid "Search Job"msgstr "ジョブを検索"@@ -6874,10 +6819,6 @@ msgstr "関連アイテムを検索..."msgid "Search suppliers..."msgstr "サプライヤーを検索..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "ウェブを検索"-msgid "Search..."msgstr "検索..."@@ -7337,9 +7278,6 @@ msgstr "ソース方法"msgid "Source Version"msgstr "ソースバージョン"-msgid "Sources"-msgstr "ソース"-msgid "Sourcing Type"msgstr "調達タイプ"@@ -7502,9 +7440,6 @@ msgstr "サブ部門"msgid "Subassembly"msgstr "サブアセンブリ"-msgid "Submit"-msgstr "送信"-msgid "Submit anonymously"msgstr "匿名で送信"@@ -7544,9 +7479,6 @@ msgstr "新しいリビジョンが正常に作成されました"msgid "Suffix"msgstr "サフィックス"-msgid "Suggested Actions"-msgstr "提案されたアクション"-msgid "Suggestion"msgstr "提案"@@ -8535,9 +8467,6 @@ msgstr "可視性"msgid "Visible on a user's public profile"msgstr "ユーザーの公開プロフィールに表示されます"-msgid "Voice"-msgstr "音声"-msgid "Void"msgstr "無効化"@@ -8604,9 +8533,6 @@ msgstr "検証コードを {signupEmail} に送信しました"msgid "We've sent you a magic link to sign in to your account."msgstr "あなたのアカウントにサインインするためのマジックリンクを送信しました。"-msgid "Web Search"-msgstr "ウェブ検索"-msgid "Webhook"msgstr "ウェブフック"diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex beff3a0c34..27693b8264 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -279,9 +279,6 @@ msgstr "Dodaj dowolne notatki dotyczące Twojej decyzji..."msgid "Add Approval Requirement"msgstr "Dodaj wymóg zatwierdzenia"-msgid "Add attachments"-msgstr "Dodaj załączniki"-msgid "Add Calibration Record"msgstr "Dodaj Rekord Kalibracji"@@ -919,10 +916,6 @@ msgstr "Jako właściciel firmy możesz przenieść własność na innego pracowmsgid "Ascending"msgstr "Rosnąco"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Zapytaj o cokolwiek"-msgid "Assembly:"msgstr "Zespół:"@@ -1037,9 +1030,6 @@ msgstr "Średnia liczba dni do zamknięcia"msgid "Back"msgstr "Wstecz"-msgid "Back to home"-msgstr "Powrót do strony głównej"-msgid "Back to traceability"msgstr "Wróć do śledzenia"@@ -1634,9 +1624,6 @@ msgstr "Konwertuj na Ofertę"msgid "Copied link to clipboard"msgstr "Skopiowano link do schowka"-msgid "Copied!"-msgstr "Skopiowano!"-msgid "Copy"msgstr "Kopiuj"@@ -1742,9 +1729,6 @@ msgstr "Skopiuj Ofertę"msgid "Copy Quote number"msgstr "Skopiuj numer oferty"-msgid "Copy response"-msgstr "Skopiuj odpowiedź"-msgid "Copy this item's pricing to another scope."msgstr "Skopiuj ceny tego artykułu do innego zakresu."@@ -2270,9 +2254,6 @@ msgstr "Usuń atrybut"msgid "Delete Category"msgstr "Usuń kategorię"-msgid "Delete chat"-msgstr "Usuń czat"-msgid "Delete Consumable"msgstr "Usuń materiał eksploatacyjny"@@ -4415,9 +4396,6 @@ msgstr "Odświeżanie na żywo"msgid "Load Templates"msgstr "Załaduj szablony"-msgid "Loader"-msgstr "Ładowarka"-msgid "Loading item details..."msgstr "Ładowanie szczegółów przedmiotu..."@@ -4888,9 +4866,6 @@ msgstr "Potrzebujesz odpowiednich kolumn?"msgid "Negative Adjustment"msgstr "Ujemna Korekta"-msgid "Negative feedback"-msgstr "Negatywna opinia"-msgid "Never"msgstr "Nigdy"@@ -4915,9 +4890,6 @@ msgstr "Nowy atrybut"msgid "New Attribute Category"msgstr "Nowa Kategoria Atrybutu"-msgid "New chat"-msgstr "Nowy czat"-msgid "New Consumable"msgstr "Nowy materiał zużywalny"@@ -5193,12 +5165,6 @@ msgstr "Nie znaleziono rekordów kalibracji"msgid "No changes recorded"msgstr "Brak zarejestrowanych zmian"-msgid "No chat history"-msgstr "Brak historii czatów"--msgid "No chats found"-msgstr "Nie znaleziono czatów"-msgid "No comments yet. Be the first to add a comment."msgstr "Brak komentarzy. Bądź pierwszy i dodaj komentarz."@@ -5463,9 +5429,6 @@ msgstr "Otwarte Działania"msgid "Open Audit Log"msgstr "Otwórz dziennik audytu"-msgid "Open chat history"-msgstr "Otwórz historię czatu"-msgid "Open Date"msgstr "Data otwarcia"@@ -5862,9 +5825,6 @@ msgstr "Portale"msgid "Positive Adjustment"msgstr "Dodatnia Korekta"-msgid "Positive feedback"-msgstr "Pozytywna opinia"-msgid "Post"msgstr "Opublikuj"@@ -6382,9 +6342,6 @@ msgstr "Usuń"msgid "Remove {0}"msgstr "Usuń {0}"-msgid "Remove attachment"-msgstr "Usuń załącznik"-msgid "Remove condition"msgstr "Usuń warunek"@@ -6403,9 +6360,6 @@ msgstr "Usuń z listy cen"msgid "Remove item"msgstr "Usuń element"-msgid "Remove negative feedback"-msgstr "Usuń negatywną opinię"-msgid "Remove order"msgstr "Usuń zamówienie"@@ -6415,9 +6369,6 @@ msgstr "Usuń zamówienie"msgid "Remove pair"msgstr "Usuń parę"-msgid "Remove positive feedback"-msgstr "Usuń pozytywną opinię"-msgid "Remove sort by column"msgstr "Usuń sortowanie według kolumny"@@ -6567,9 +6518,6 @@ msgstr "Wyniki na stronę"msgid "Retry"msgstr "Ponów"-msgid "Retry response"-msgstr "Ponów odpowiedź"-msgid "Return Home"msgstr "Wróć do domu"@@ -6856,9 +6804,6 @@ msgstr "Wyszukaj pola..."msgid "Search for existing or create a new one"msgstr "Wyszukaj istniejący lub utwórz nowy"-msgid "Search history"-msgstr "Przeszukaj historię"-msgid "Search Job"msgstr "Szukaj zadania"@@ -6874,10 +6819,6 @@ msgstr "Szukaj powiązanych elementów..."msgid "Search suppliers..."msgstr "Szukaj dostawców..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Przeszukaj internet"-msgid "Search..."msgstr "Szukaj..."@@ -7337,9 +7278,6 @@ msgstr "Metoda źródłowa"msgid "Source Version"msgstr "Wersja źródłowa"-msgid "Sources"-msgstr "Źródła"-msgid "Sourcing Type"msgstr "Typ pozyskiwania"@@ -7502,9 +7440,6 @@ msgstr "Poddziały"msgid "Subassembly"msgstr "Podzespół"-msgid "Submit"-msgstr "Wyślij"-msgid "Submit anonymously"msgstr "Wyslij anonimowo"@@ -7544,9 +7479,6 @@ msgstr "Pomyślnie utworzono nową wersję"msgid "Suffix"msgstr "Sufiks"-msgid "Suggested Actions"-msgstr "Sugerowane akcje"-msgid "Suggestion"msgstr "Sugestia"@@ -8535,9 +8467,6 @@ msgstr "Widoczność"msgid "Visible on a user's public profile"msgstr "Widoczne w publicznym profilu użytkownika"-msgid "Voice"-msgstr "Głos"-msgid "Void"msgstr "Anuluj"@@ -8604,9 +8533,6 @@ msgstr "Wysłaliśmy kod weryfikacyjny na {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "Wysłaliśmy Ci magiczny link, aby zalogować się na Twoje konto."-msgid "Web Search"-msgstr "Wyszukiwanie internetowe"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex e5f0076a51..5fd9adf946 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -279,9 +279,6 @@ msgstr "Adicione qualquer nota sobre sua decisão..."msgid "Add Approval Requirement"msgstr "Adicionar Requisito de Aprovação"-msgid "Add attachments"-msgstr "Adicionar anexos"-msgid "Add Calibration Record"msgstr "Adicionar Registro de Calibração"@@ -919,10 +916,6 @@ msgstr "Como proprietário da empresa, você pode transferir a propriedade paramsgid "Ascending"msgstr "Ascendente"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Pergunte qualquer coisa"-msgid "Assembly:"msgstr "Montagem:"@@ -1037,9 +1030,6 @@ msgstr "Dias Médios para Fechar"msgid "Back"msgstr "Voltar"-msgid "Back to home"-msgstr "Voltar para casa"-msgid "Back to traceability"msgstr "Voltar para rastreabilidade"@@ -1634,9 +1624,6 @@ msgstr "Converter para Cotação"msgid "Copied link to clipboard"msgstr "Link copiado para a área de transferência"-msgid "Copied!"-msgstr "Copiado!"-msgid "Copy"msgstr "Copiar"@@ -1742,9 +1729,6 @@ msgstr "Copiar Cotação"msgid "Copy Quote number"msgstr "Copiar número da Cotação"-msgid "Copy response"-msgstr "Copiar resposta"-msgid "Copy this item's pricing to another scope."msgstr "Copie o preço deste item para outro escopo."@@ -2270,9 +2254,6 @@ msgstr "Eliminar Atributo"msgid "Delete Category"msgstr "Eliminar Categoria"-msgid "Delete chat"-msgstr "Eliminar conversa"-msgid "Delete Consumable"msgstr "Eliminar Consumível"@@ -4415,9 +4396,6 @@ msgstr "Recarregamento ao vivo"msgid "Load Templates"msgstr "Carregar Modelos"-msgid "Loader"-msgstr "Carregador"-msgid "Loading item details..."msgstr "Carregando detalhes do item..."@@ -4888,9 +4866,6 @@ msgstr "Precisa das colunas certas?"msgid "Negative Adjustment"msgstr "Ajuste Negativo"-msgid "Negative feedback"-msgstr "Feedback negativo"-msgid "Never"msgstr "Nunca"@@ -4915,9 +4890,6 @@ msgstr "Novo Atributo"msgid "New Attribute Category"msgstr "Nova Categoria de Atributo"-msgid "New chat"-msgstr "Novo chat"-msgid "New Consumable"msgstr "Novo Consumível"@@ -5193,12 +5165,6 @@ msgstr "Nenhum registro de calibração encontrado"msgid "No changes recorded"msgstr "Nenhuma alteração registrada"-msgid "No chat history"-msgstr "Sem histórico de chat"--msgid "No chats found"-msgstr "Nenhum chat encontrado"-msgid "No comments yet. Be the first to add a comment."msgstr "Sem comentários ainda. Seja o primeiro a adicionar um comentário."@@ -5463,9 +5429,6 @@ msgstr "Ações Abertas"msgid "Open Audit Log"msgstr "Abrir Registro de Auditoria"-msgid "Open chat history"-msgstr "Abrir histórico de chat"-msgid "Open Date"msgstr "Data de Abertura"@@ -5862,9 +5825,6 @@ msgstr "Portais"msgid "Positive Adjustment"msgstr "Ajuste Positivo"-msgid "Positive feedback"-msgstr "Feedback positivo"-msgid "Post"msgstr "Publicar"@@ -6382,9 +6342,6 @@ msgstr "Remover"msgid "Remove {0}"msgstr "Remover {0}"-msgid "Remove attachment"-msgstr "Remover anexo"-msgid "Remove condition"msgstr "Remover condição"@@ -6403,9 +6360,6 @@ msgstr "Remover da Lista de Preços"msgid "Remove item"msgstr "Remover item"-msgid "Remove negative feedback"-msgstr "Remover feedback negativo"-msgid "Remove order"msgstr "Remover pedido"@@ -6415,9 +6369,6 @@ msgstr "Remover Pedido"msgid "Remove pair"msgstr "Remover par"-msgid "Remove positive feedback"-msgstr "Remover feedback positivo"-msgid "Remove sort by column"msgstr "Remover ordenação por coluna"@@ -6567,9 +6518,6 @@ msgstr "Resultados por página"msgid "Retry"msgstr "Tentar novamente"-msgid "Retry response"-msgstr "Tentar novamente"-msgid "Return Home"msgstr "Voltar para Início"@@ -6856,9 +6804,6 @@ msgstr "Pesquisar campos..."msgid "Search for existing or create a new one"msgstr "Procure por um existente ou crie um novo"-msgid "Search history"-msgstr "Pesquisar histórico"-msgid "Search Job"msgstr "Pesquisar Trabalho"@@ -6874,10 +6819,6 @@ msgstr "Pesquisar itens relacionados..."msgid "Search suppliers..."msgstr "Pesquisar fornecedores..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Pesquisar na web"-msgid "Search..."msgstr "Pesquisar..."@@ -7337,9 +7278,6 @@ msgstr "Método de Origem"msgid "Source Version"msgstr "Versão de Origem"-msgid "Sources"-msgstr "Fontes"-msgid "Sourcing Type"msgstr "Tipo de Fornecimento"@@ -7502,9 +7440,6 @@ msgstr "Sub-Departamentos"msgid "Subassembly"msgstr "Subconjunto"-msgid "Submit"-msgstr "Enviar"-msgid "Submit anonymously"msgstr "Enviar anonimamente"@@ -7544,9 +7479,6 @@ msgstr "Revisão criada com sucesso"msgid "Suffix"msgstr "Sufixo"-msgid "Suggested Actions"-msgstr "Ações Sugeridas"-msgid "Suggestion"msgstr "Sugestão"@@ -8535,9 +8467,6 @@ msgstr "Visibilidade"msgid "Visible on a user's public profile"msgstr "Visível no perfil público de um utilizador"-msgid "Voice"-msgstr "Voz"-msgid "Void"msgstr "Anular"@@ -8604,9 +8533,6 @@ msgstr "Enviámos um código de verificação para {signupEmail}"msgid "We've sent you a magic link to sign in to your account."msgstr "Enviámos-lhe um link mágico para iniciar sessão na sua conta."-msgid "Web Search"-msgstr "Pesquisa Web"-msgid "Webhook"msgstr "Webhook"diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex c84254823f..0ffbf4ea7e 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -279,9 +279,6 @@ msgstr "Добавьте любые заметки о вашем решении.msgid "Add Approval Requirement"msgstr "Добавить требование утверждения"-msgid "Add attachments"-msgstr "Добавить вложения"-msgid "Add Calibration Record"msgstr "Добавить запись калибровки"@@ -919,10 +916,6 @@ msgstr "Как владелец компании, вы можете передаmsgid "Ascending"msgstr "По возрастанию"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "Спросите что угодно"-msgid "Assembly:"msgstr "Сборка:"@@ -1037,9 +1030,6 @@ msgstr "Среднее количество дней до закрытия"msgid "Back"msgstr "Назад"-msgid "Back to home"-msgstr "Вернуться на главную"-msgid "Back to traceability"msgstr "Вернуться к отслеживанию"@@ -1634,9 +1624,6 @@ msgstr "Преобразовать в предложение"msgid "Copied link to clipboard"msgstr "Ссылка скопирована в буфер обмена"-msgid "Copied!"-msgstr "Скопировано!"-msgid "Copy"msgstr "Копировать"@@ -1742,9 +1729,6 @@ msgstr "Копировать предложение"msgid "Copy Quote number"msgstr "Копировать номер предложения"-msgid "Copy response"-msgstr "Копировать ответ"-msgid "Copy this item's pricing to another scope."msgstr "Скопируйте цены этого товара в другую область."@@ -2270,9 +2254,6 @@ msgstr "Удалить атрибут"msgid "Delete Category"msgstr "Удалить категорию"-msgid "Delete chat"-msgstr "Удалить чат"-msgid "Delete Consumable"msgstr "Удалить расходный материал"@@ -4415,9 +4396,6 @@ msgstr "Живая перезагрузка"msgid "Load Templates"msgstr "Загрузить шаблоны"-msgid "Loader"-msgstr "Загрузчик"-msgid "Loading item details..."msgstr "Загрузка деталей товара..."@@ -4888,9 +4866,6 @@ msgstr "Нужны правильные столбцы?"msgid "Negative Adjustment"msgstr "Отрицательная корректировка"-msgid "Negative feedback"-msgstr "Отрицательный отзыв"-msgid "Never"msgstr "Никогда"@@ -4915,9 +4890,6 @@ msgstr "Новый атрибут"msgid "New Attribute Category"msgstr "Новая категория атрибутов"-msgid "New chat"-msgstr "Новый чат"-msgid "New Consumable"msgstr "Новый расходный материал"@@ -5193,12 +5165,6 @@ msgstr "Записи о калибровке не найдены"msgid "No changes recorded"msgstr "Изменений не записано"-msgid "No chat history"-msgstr "Нет истории чатов"--msgid "No chats found"-msgstr "Чаты не найдены"-msgid "No comments yet. Be the first to add a comment."msgstr "Нет комментариев. Будьте первым, кто добавит комментарий."@@ -5463,9 +5429,6 @@ msgstr "Открытые действия"msgid "Open Audit Log"msgstr "Открыть журнал аудита"-msgid "Open chat history"-msgstr "Открыть историю чатов"-msgid "Open Date"msgstr "Дата открытия"@@ -5862,9 +5825,6 @@ msgstr "Порталы"msgid "Positive Adjustment"msgstr "Положительная корректировка"-msgid "Positive feedback"-msgstr "Положительный отзыв"-msgid "Post"msgstr "Опубликовать"@@ -6382,9 +6342,6 @@ msgstr "Удалить"msgid "Remove {0}"msgstr "Удалить {0}"-msgid "Remove attachment"-msgstr "Удалить вложение"-msgid "Remove condition"msgstr "Удалить условие"@@ -6403,9 +6360,6 @@ msgstr "Удалить из прайс-листа"msgid "Remove item"msgstr "Удалить товар"-msgid "Remove negative feedback"-msgstr "Удалить отрицательный отзыв"-msgid "Remove order"msgstr "Удалить заказ"@@ -6415,9 +6369,6 @@ msgstr "Удалить заказ"msgid "Remove pair"msgstr "Удалить пару"-msgid "Remove positive feedback"-msgstr "Удалить положительный отзыв"-msgid "Remove sort by column"msgstr "Удалить сортировку по столбцу"@@ -6567,9 +6518,6 @@ msgstr "Результатов на странице"msgid "Retry"msgstr "Повторить"-msgid "Retry response"-msgstr "Повторить ответ"-msgid "Return Home"msgstr "Вернуться на главную"@@ -6856,9 +6804,6 @@ msgstr "Поиск полей..."msgid "Search for existing or create a new one"msgstr "Поиск существующей или создание новой"-msgid "Search history"-msgstr "Поиск в истории"-msgid "Search Job"msgstr "Поиск задания"@@ -6874,10 +6819,6 @@ msgstr "Поиск связанных элементов..."msgid "Search suppliers..."msgstr "Поиск поставщиков..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "Поиск в интернете"-msgid "Search..."msgstr "Поиск..."@@ -7337,9 +7278,6 @@ msgstr "Исходный метод"msgid "Source Version"msgstr "Исходная версия"-msgid "Sources"-msgstr "Источники"-msgid "Sourcing Type"msgstr "Тип источника"@@ -7502,9 +7440,6 @@ msgstr "Подразделения"msgid "Subassembly"msgstr "Узел в сборке"-msgid "Submit"-msgstr "Отправить"-msgid "Submit anonymously"msgstr "Отправить анонимно"@@ -7544,9 +7479,6 @@ msgstr "Успешно создана новая редакция"msgid "Suffix"msgstr "Суффикс"-msgid "Suggested Actions"-msgstr "Предлагаемые действия"-msgid "Suggestion"msgstr "Предложение"@@ -8535,9 +8467,6 @@ msgstr "Видимость"msgid "Visible on a user's public profile"msgstr "Видно в общедоступном профиле пользователя"-msgid "Voice"-msgstr "Голос"-msgid "Void"msgstr "Аннулировать"@@ -8604,9 +8533,6 @@ msgstr "Мы отправили код подтверждения на {signupEmmsgid "We've sent you a magic link to sign in to your account."msgstr "Мы отправили вам волшебную ссылку для входа в ваш аккаунт."-msgid "Web Search"-msgstr "Веб-поиск"-msgid "Webhook"msgstr "Вебхук"diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex e3832d42cd..a5d43c4f82 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -279,9 +279,6 @@ msgstr "添加关于您的决定的任何备注..."msgid "Add Approval Requirement"msgstr "添加批准要求"-msgid "Add attachments"-msgstr "添加附件"-msgid "Add Calibration Record"msgstr "添加校准记录"@@ -919,10 +916,6 @@ msgstr "作为公司所有者,您可以将所有权转移给另一名员工。msgid "Ascending"msgstr "升序"-#. js-lingui-explicit-id-msgid "Ask anything"-msgstr "随便问"-msgid "Assembly:"msgstr "装配体:"@@ -1037,9 +1030,6 @@ msgstr "平均关闭天数"msgid "Back"msgstr "返回"-msgid "Back to home"-msgstr "返回主页"-msgid "Back to traceability"msgstr "返回可追溯性"@@ -1634,9 +1624,6 @@ msgstr "转换为报价"msgid "Copied link to clipboard"msgstr "已复制链接到剪贴板"-msgid "Copied!"-msgstr "已复制!"-msgid "Copy"msgstr "复制"@@ -1742,9 +1729,6 @@ msgstr "复制报价"msgid "Copy Quote number"msgstr "复制报价单号"-msgid "Copy response"-msgstr "复制回复"-msgid "Copy this item's pricing to another scope."msgstr "将此项目的定价复制到另一个范围。"@@ -2270,9 +2254,6 @@ msgstr "删除属性"msgid "Delete Category"msgstr "删除分类"-msgid "Delete chat"-msgstr "删除聊天"-msgid "Delete Consumable"msgstr "删除耗材"@@ -4415,9 +4396,6 @@ msgstr "实时重新加载"msgid "Load Templates"msgstr "加载模板"-msgid "Loader"-msgstr "加载器"-msgid "Loading item details..."msgstr "正在加载项目详情..."@@ -4888,9 +4866,6 @@ msgstr "需要正确的列吗?"msgid "Negative Adjustment"msgstr "负调整"-msgid "Negative feedback"-msgstr "负面反馈"-msgid "Never"msgstr "永不"@@ -4915,9 +4890,6 @@ msgstr "新属性"msgid "New Attribute Category"msgstr "新属性类别"-msgid "New chat"-msgstr "新聊天"-msgid "New Consumable"msgstr "新消耗品"@@ -5193,12 +5165,6 @@ msgstr "未找到校准记录"msgid "No changes recorded"msgstr "未记录任何更改"-msgid "No chat history"-msgstr "没有聊天历史"--msgid "No chats found"-msgstr "未找到聊天"-msgid "No comments yet. Be the first to add a comment."msgstr "还没有评论。成为第一个添加评论的人。"@@ -5463,9 +5429,6 @@ msgstr "开放操作"msgid "Open Audit Log"msgstr "打开审计日志"-msgid "Open chat history"-msgstr "打开聊天历史"-msgid "Open Date"msgstr "开放日期"@@ -5862,9 +5825,6 @@ msgstr "门户"msgid "Positive Adjustment"msgstr "正向调整"-msgid "Positive feedback"-msgstr "正面反馈"-msgid "Post"msgstr "过账"@@ -6382,9 +6342,6 @@ msgstr "移除"msgid "Remove {0}"msgstr "删除 {0}"-msgid "Remove attachment"-msgstr "移除附件"-msgid "Remove condition"msgstr "移除条件"@@ -6403,9 +6360,6 @@ msgstr "从价格列表中移除"msgid "Remove item"msgstr "删除项目"-msgid "Remove negative feedback"-msgstr "移除负面反馈"-msgid "Remove order"msgstr "删除订单"@@ -6415,9 +6369,6 @@ msgstr "删除订单"msgid "Remove pair"msgstr "移除配对"-msgid "Remove positive feedback"-msgstr "移除正面反馈"-msgid "Remove sort by column"msgstr "删除按列排序"@@ -6567,9 +6518,6 @@ msgstr "每页结果数"msgid "Retry"msgstr "重试"-msgid "Retry response"-msgstr "重试响应"-msgid "Return Home"msgstr "返回首页"@@ -6856,9 +6804,6 @@ msgstr "搜索字段..."msgid "Search for existing or create a new one"msgstr "搜索现有问题或创建新问题"-msgid "Search history"-msgstr "搜索历史"-msgid "Search Job"msgstr "搜索任务"@@ -6874,10 +6819,6 @@ msgstr "搜索相关项目..."msgid "Search suppliers..."msgstr "搜索供应商..."-#. js-lingui-explicit-id-msgid "Search the web"-msgstr "搜索网络"-msgid "Search..."msgstr "搜索..."@@ -7337,9 +7278,6 @@ msgstr "源方法"msgid "Source Version"msgstr "源版本"-msgid "Sources"-msgstr "来源"-msgid "Sourcing Type"msgstr "采购类型"@@ -7502,9 +7440,6 @@ msgstr "子部门"msgid "Subassembly"msgstr "小组件"-msgid "Submit"-msgstr "提交"-msgid "Submit anonymously"msgstr "匿名提交"@@ -7544,9 +7479,6 @@ msgstr "成功创建新版本"msgid "Suffix"msgstr "后缀"-msgid "Suggested Actions"-msgstr "建议操作"-msgid "Suggestion"msgstr "建议"@@ -8535,9 +8467,6 @@ msgstr "可见性"msgid "Visible on a user's public profile"msgstr "在用户的公开资料中可见"-msgid "Voice"-msgstr "语音"-msgid "Void"msgstr "作废"@@ -8604,9 +8533,6 @@ msgstr "我们已向 {signupEmail} 发送了验证码"msgid "We've sent you a magic link to sign in to your account."msgstr "我们已向您发送了一个魔法链接以登录您的账户。"-msgid "Web Search"-msgstr "网络搜索"-msgid "Webhook"msgstr "Webhook"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex bf06c854a7..1444a1c066 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -168,6 +168,9 @@ catalogs:isbot:specifier: '5'version: 5.1.37+ jose:+ specifier: 6.0.11+ version: 6.0.11kysely:specifier: 0.28.15version: 0.28.15@@ -1639,6 +1642,9 @@ importers:dompurify:specifier: 'catalog:'version: 3.4.0+ jose:+ specifier: 'catalog:'+ version: 6.0.11nanoid:specifier: 'catalog:'version: 5.1.7@@ -10292,6 +10298,9 @@ packages:resolution: {integrity: sha512-KUXdbctm1uHVL8BYhnyHkgp3zDX5KW8ZhAKVFEfUbU2P8Alpzjb+48hHvjOdQIyPshoblhzsuqOwEEAbtHVirA==}+ resolution: {integrity: sha512-QxG7EaliDARm1O1S8BGakqncGT9s25bKL1WSf6/oa17Tkqwi8D2ZNglqCF+DsYF88/rV66Q/Q2mFAy697E1DUg==}+resolution: {integrity: sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==}@@ -21886,6 +21895,8 @@ snapshots:+ [email protected]: {}+[email protected](@babel/[email protected])(@babel/[email protected])(@types/[email protected])([email protected]):diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex b349fe81b5..2054f23c12 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -64,6 +64,7 @@ catalog:framer-motion: 11.18.2intl-parse-accept-language: 1.0.0isbot: '5'+ jose: 6.0.11kysely: 0.28.15nanoid: 5.1.7nanostores: 0.9.5diff --git a/scripts/generate-mcp.ts b/scripts/generate-mcp.tsindex 52c64eace6..a7e3ffed98 100644--- a/scripts/generate-mcp.ts+++ b/scripts/generate-mcp.ts@@ -1,10 +1,10 @@/**- * Generate MCP tool metadata for JIT loading- * This runs as part of generate-mcp.ts to create a metadata file- * that can be imported without loading all tool implementations.+ * MCP Tool Metadata Generator*- * Tools listed in apps/erp/.../mcp-blocked-tools.ts are omitted from metadata- * (and blocked at runtime) so they never appear in search_tools / describe_tool.+ * Parses all *.service.ts files and generates tool-metadata.json+ * with descriptions and JSON Schema for each tool's parameters.+ *+ * Usage: npx tsx scripts/generate-mcp.ts*/import * as fs from "fs";@@ -14,10 +14,83 @@ import { MCP_BLOCKED_TOOL_NAMES } from "../apps/erp/app/routes/api+/mcp+/lib/mcpimport type { AuthField } from "../apps/erp/app/routes/api+/mcp+/lib/types";const ROOT = path.resolve(__dirname, "..");-const MCP_LIB_DIR = path.join(ROOT, "apps/erp/app/routes/api+/mcp+/lib");-const TOOLS_DIR = path.join(MCP_LIB_DIR, "tools");const MODULES_DIR = path.join(ROOT, "apps/erp/app/modules");-const METADATA_FILE = path.join(MCP_LIB_DIR, "tool-metadata.json");+const METADATA_FILE = path.join(+ ROOT,+ "apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json"+);++const MODULE_LIST = [+ "account",+ "accounting",+ "documents",+ "inventory",+ "invoicing",+ "items",+ "people",+ "production",+ "purchasing",+ "quality",+ "resources",+ "sales",+ "settings",+ "shared",+ "users",+];++const CONTEXT_PARAMS = new Set([+ "client",+ "db",+ "companyId",+ "userId",+ "createdBy",+ "updatedBy",+ "companyGroupId",+]);++const DESCRIPTION_OVERRIDES: Record<string, string> = {+ purchasing_insertPurchaseOrder:+ "Create a new purchase order with all business logic - generates sequence, creates supplier interaction, resolves payment/shipping defaults from supplier. LLM can create a PO with just supplierId.",+ purchasing_updatePurchaseOrder:+ "Update an existing purchase order - handles exchange rate updates when currency changes",+ purchasing_insertSupplierQuote:+ "Create a new supplier quote with all business logic - generates sequence, creates supplier interaction, sets up external link. LLM can create a quote with just supplierId.",+ purchasing_updateSupplierQuote:+ "Update an existing supplier quote - handles exchange rate updates when currency changes",+ sales_insertQuote:+ "Create a new quote with all business logic - generates sequence, creates opportunity, resolves payment/shipping defaults from customer. LLM can create a quote with just customerId.",+ sales_updateQuote:+ "Update an existing quote - handles exchange rate updates when currency changes, syncs customer to opportunity",+ sales_insertSalesOrder:+ "Create a new sales order with all business logic - generates sequence, creates opportunity, resolves payment/shipping defaults from customer. LLM can create a sales order with just customerId.",+ sales_updateSalesOrder:+ "Update an existing sales order - handles exchange rate updates when currency changes, syncs customer to opportunity",+ production_insertJob:+ "Create a new job with all business logic - generates sequence, resolves location, copies method from item, recalculates requirements. LLM can create a job with just itemId and quantity.",+ production_updateJob:+ "Update an existing job - handles priority recalculation when deadline changes",+ inventory_insertStockTransfer:+ "Create a stock transfer with lines. Generates sequence ID automatically.",+ inventory_updateStockTransfer: "Update an existing stock transfer",+ inventory_insertWarehouseTransfer:+ "Create a warehouse transfer between locations. Generates sequence ID automatically.",+ inventory_updateWarehouseTransfer: "Update an existing warehouse transfer",+};++// ---------------------------------------------------------------------------+// Types+// ---------------------------------------------------------------------------++interface ParsedParam {+ name: string;+ typeStr: string;+ optional: boolean;+}++interface ParsedFunction {+ name: string;+ params: ParsedParam[];+}interface ToolMetadata {name: string;@@ -27,200 +100,513 @@ interface ToolMetadata {paramCount: number;serviceParams: string[];injectAuth: AuthField[];+ schema: Record<string, unknown>;}-function computeInjectAuth(- funcName: string,- classification: ToolMetadata["classification"]-): AuthField[] {- const lower = funcName.toLowerCase();+// ---------------------------------------------------------------------------+// Parsing helpers+// ---------------------------------------------------------------------------- if (classification === "READ" || classification === "DESTRUCTIVE") {- return ["companyId"];+function findMatchingBrace(content: string, openPos: number): number {+ const open = content[openPos];+ const close = open === "(" ? ")" : open === "{" ? "}" : open === "[" ? "]" : ">";+ let depth = 1;+ let i = openPos + 1;+ while (i < content.length && depth > 0) {+ if (content[i] === open) depth++;+ else if (content[i] === close) depth--;+ i++;}- // upsertX uses `"createdBy" in payload` to pick INSERT vs UPDATE.- if (/^(upsert|create|insert|add|new|copy|duplicate|generate)/.test(lower)) {- return ["companyId", "createdBy", "updatedBy"];+ return i - 1;+}++function splitAtTopLevel(str: string, delimiter: string): string[] {+ const parts: string[] = [];+ let depth = 0;+ let current = "";+ for (let i = 0; i < str.length; i++) {+ const ch = str[i];+ if ("({[<".includes(ch)) depth++;+ else if (")}]>".includes(ch)) depth--;+ if (ch === delimiter && depth === 0) {+ parts.push(current.trim());+ current = "";+ } else {+ current += ch;+ }}- // Don't stamp createdBy on updates — it'd overwrite the audit column.- if (/^(update|modify|set|change|edit|approve|reject|finalize|toggle|move|reorder|recalculate|sync|favorite|unfavorite)/.test(lower)) {- return ["companyId", "updatedBy"];+ if (current.trim()) parts.push(current.trim());+ return parts;+}++function findTopLevelColon(str: string): number {+ let depth = 0;+ for (let i = 0; i < str.length; i++) {+ const ch = str[i];+ if ("({[<".includes(ch)) depth++;+ else if (")}]>".includes(ch)) depth--;+ if (ch === ":" && depth === 0) return i;}- return ["companyId"];+ return -1;}-function extractParamNames(paramsStr: string): string[] {- const params: string[] = [];+function parseExportedFunctions(content: string): ParsedFunction[] {+ const results: ParsedFunction[] = [];+ const regex = /export\s+(?:async\s+)?function\s+(\w+)\s*\(/g;+ let match;++ while ((match = regex.exec(content)) !== null) {+ const name = match[1];+ const openParen = match.index + match[0].length - 1;+ const closeParen = findMatchingBrace(content, openParen);+ const rawParams = content.substring(openParen + 1, closeParen).trim();++ if (!rawParams) {+ results.push({ name, params: [] });+ continue;+ }++ const paramStrings = splitAtTopLevel(rawParams, ",");+ const params: ParsedParam[] = [];++ for (const p of paramStrings) {+ if (!p) continue;+ const colonIdx = findTopLevelColon(p);+ if (colonIdx === -1) {+ params.push({ name: p.trim(), typeStr: "unknown", optional: false });+ continue;+ }+ const before = p.substring(0, colonIdx).trim();+ const optional = before.endsWith("?");+ const paramName = before.replace(/\?$/, "").trim();+ const typeStr = p.substring(colonIdx + 1).trim();+ params.push({ name: paramName, typeStr, optional });+ }++ results.push({ name, params });+ }++ return results;+}++// ---------------------------------------------------------------------------+// Type → JSON Schema conversion+// ---------------------------------------------------------------------------++function typeToJsonSchema(typeStr: string): Record<string, unknown> {+ const t = typeStr.trim();++ // Nullable: "Type | null"+ const nullableMatch = t.match(/^(.+?)\s*\|\s*null$/);+ if (nullableMatch) {+ const inner = typeToJsonSchema(nullableMatch[1].trim());+ if (inner.type) {+ return { ...inner, type: [inner.type, "null"] };+ }+ return inner;+ }++ // String literal union: "A" | "B" | "C"+ const literalParts = splitAtTopLevel(t, "|").map((s) => s.trim());+ if (literalParts.length > 1 && literalParts.every((p) => /^"[^"]*"$/.test(p))) {+ return {+ type: "string",+ enum: literalParts.map((p) => p.slice(1, -1)),+ };+ }++ // Primitives+ if (t === "string") return { type: "string" };+ if (t === "number") return { type: "number" };+ if (t === "boolean") return { type: "boolean" };++ // Arrays+ if (t === "string[]") return { type: "array", items: { type: "string" } };+ if (t === "number[]") return { type: "array", items: { type: "number" } };+ if (t.endsWith("[]")) {+ const inner = typeToJsonSchema(t.slice(0, -2).trim());+ return { type: "array", items: inner };+ }++ // Json type+ if (t === "Json" || t === "Json | null") return {};++ // (typeof X)[number] — enum array reference+ if (t.match(/\(typeof\s+\w+\)\s*\[number\]/)) return { type: "string" };++ // Inline object: { field: Type; ... }+ if (t.startsWith("{")) {+ return parseInlineObjectType(t);+ }++ // GenericQueryFilters & { ... }+ if (t.includes("GenericQueryFilters")) {+ const base: Record<string, unknown> = {+ type: "object",+ properties: {+ limit: { type: "integer", default: 100 },+ offset: { type: "integer", default: 0 },+ },+ };+ const intersectMatch = t.match(/&\s*(\{.+\})\s*$/s);+ if (intersectMatch) {+ const extra = parseInlineObjectType(intersectMatch[1]);+ if (extra.properties) {+ base.properties = {+ ...(base.properties as Record<string, unknown>),+ ...(extra.properties as Record<string, unknown>),+ };+ }+ }+ return base;+ }++ // Fallback+ return {};+}++function parseInlineObjectType(typeStr: string): Record<string, unknown> {+ let inner = typeStr.trim();+ if (inner.startsWith("{")) inner = inner.slice(1);+ if (inner.endsWith("}")) inner = inner.slice(0, -1);+ inner = inner.trim();++ if (!inner) return { type: "object", properties: {} };++ const properties: Record<string, unknown> = {};+ const required: string[] = [];++ const fields = splitObjectFields(inner);++ for (const field of fields) {+ const f = field.trim();+ if (!f) continue;++ const optional = f.includes("?:");+ const colonIdx = f.indexOf("?:") !== -1 ? f.indexOf("?:") : f.indexOf(":");+ if (colonIdx === -1) continue;++ const fieldName = f.substring(0, colonIdx).replace("?", "").trim();+ if (CONTEXT_PARAMS.has(fieldName)) continue;++ const fieldType = f+ .substring(colonIdx + (optional ? 2 : 1))+ .trim()+ .replace(/;$/, "")+ .trim();++ properties[fieldName] = typeToJsonSchema(fieldType);+ if (!optional) required.push(fieldName);+ }++ const schema: Record<string, unknown> = { type: "object", properties };+ if (required.length > 0) schema.required = required;+ return schema;+}++function splitObjectFields(inner: string): string[] {+ const fields: string[] = [];let depth = 0;let current = "";- for (let i = 0; i < paramsStr.length; i++) {- const ch = paramsStr[i];- const prev = i > 0 ? paramsStr[i - 1] : "";+ for (let i = 0; i < inner.length; i++) {+ const ch = inner[i];+ if ("({[<".includes(ch)) depth++;+ else if (")}]>".includes(ch)) depth--;- if ("({[".includes(ch)) {- depth++;- current += ch;- } else if (")}]".includes(ch)) {- depth--;- current += ch;- } else if (ch === "<") {- depth++;- current += ch;- } else if (ch === ">" && prev === "=") {- current += ch;- } else if (ch === ">") {- depth--;- current += ch;- } else if (ch === "," && depth === 0) {- const name = current.trim().split(/[?:\s]/)[0].trim();- if (name) params.push(name);+ if (ch === ";" && depth === 0) {+ fields.push(current.trim());current = "";} else {current += ch;}}+ if (current.trim()) fields.push(current.trim());+ return fields;+}- const lastName = current.trim().split(/[?:\s]/)[0].trim();- if (lastName) params.push(lastName);+// ---------------------------------------------------------------------------+// Validator resolution+// ---------------------------------------------------------------------------- return params;-}+function parseValidatorFields(+ validatorName: string,+ modelsContent: string+): Record<string, unknown> | null {+ const regex = new RegExp(+ `export\\s+const\\s+${validatorName}\\s*=\\s*z\\.object\\(\\{`+ );+ const match = regex.exec(modelsContent);+ if (!match) return null;++ const braceStart = match.index + match[0].length - 1;+ const braceEnd = findMatchingBrace(modelsContent, braceStart);+ const inner = modelsContent.substring(braceStart + 1, braceEnd).trim();++ const properties: Record<string, unknown> = {};+ const required: string[] = [];++ // Validator fields are comma-separated, not semicolon-separated+ const fields = splitAtTopLevel(inner, ",");++ for (const field of fields) {+ const f = field.trim();+ if (!f || f.startsWith("//")) continue;-function extractServiceParamNames(moduleName: string): Map<string, string[]> {- const serviceFile = path.join(MODULES_DIR, moduleName, `${moduleName}.service.ts`);+ const colonMatch = f.match(/^(\w+)\s*:/);+ if (!colonMatch) continue;+ const fieldName = colonMatch[1];- if (!fs.existsSync(serviceFile)) {- console.warn(` ⚠ Service file not found: ${serviceFile}`);- return new Map();+ if (CONTEXT_PARAMS.has(fieldName)) continue;++ const zodExpr = f.substring(colonMatch[0].length).trim();+ const schema = zodExprToJsonSchema(zodExpr);+ const isOptional =+ zodExpr.includes(".optional()") ||+ zodExpr.includes(".nullable()") ||+ zodExpr.startsWith("zfd.text(") ||+ zodExpr.startsWith("zfd.numeric(") ||+ zodExpr.includes(".default(");++ properties[fieldName] = schema;+ if (!isOptional) required.push(fieldName);}- const content = fs.readFileSync(serviceFile, "utf-8");- const result = new Map<string, string[]>();+ const result: Record<string, unknown> = { type: "object", properties };+ if (required.length > 0) result.required = required;+ return result;+}- const funcStartRegex = /export\s+(?:async\s+)?function\s+(\w+)\s*\(/g;- let match;+function zodExprToJsonSchema(expr: string): Record<string, unknown> {+ const e = expr.trim();- while ((match = funcStartRegex.exec(content)) !== null) {- const funcName = match[1];- const openParenPos = match.index + match[0].length - 1;-- let depth = 1;- let pos = openParenPos + 1;- while (pos < content.length && depth > 0) {- const ch = content[pos];- if ("({[".includes(ch)) depth++;- else if (")}]".includes(ch)) depth--;- pos++;+ if (e.includes("z.enum(")) {+ const enumMatch = e.match(/z\.enum\(\[([^\]]+)\]\)/);+ if (enumMatch) {+ const values = enumMatch[1]+ .split(",")+ .map((s) => s.trim().replace(/^["']|["']$/g, ""))+ .filter(Boolean);+ return { type: "string", enum: values };}+ }- const paramsStr = content.substring(openParenPos + 1, pos - 1);- result.set(funcName, extractParamNames(paramsStr));+ if (e.startsWith("z.array(")) return { type: "array" };+ if (e.includes("z.number()")) return { type: "number" };+ if (e.includes("z.boolean()")) return { type: "boolean" };+ if (e.includes("z.string()") || e.startsWith("zfd.text("))+ return { type: "string" };+ if (e.includes("z.any()")) return {};+ if (e.startsWith("zfd.numeric(")) return { type: "number" };+ if (e.startsWith("z.preprocess(")) {+ if (e.includes("z.enum(")) return zodExprToJsonSchema(e);+ if (e.includes("z.number()")) return { type: "number" };+ return { type: "string" };}- return result;+ return { type: "string" };}-// Parse a tool file to extract metadata-function extractToolsFromFile(filePath: string, moduleName: string): ToolMetadata[] {- const content = fs.readFileSync(filePath, 'utf-8');- const tools: ToolMetadata[] = [];-- // Regular expression to match tool registrations (matches until annotations)- const toolRegex = /server\.registerTool\(\s*"([^"]+)",\s*\{([\s\S]*?)annotations:\s*(\w+_ANNOTATIONS)/g;- let match;-- while ((match = toolRegex.exec(content)) !== null) {- const toolName = match[1];- const configBlock = match[2];- const annotationType = match[3];-- // Extract description- const descMatch = configBlock.match(/description:\s*"([^"]+)"/);- const description = descMatch ? descMatch[1] : toolName;-- // Determine classification from annotations- let classification: "READ" | "WRITE" | "DESTRUCTIVE" = "WRITE";- if (annotationType === "DESTRUCTIVE_ANNOTATIONS") {- classification = "DESTRUCTIVE";- } else if (annotationType === "READ_ONLY_ANNOTATIONS") {- classification = "READ";+// ---------------------------------------------------------------------------+// Classification & auth+// ---------------------------------------------------------------------------++function classifyFunction(+ name: string+): "READ" | "WRITE" | "DESTRUCTIVE" {+ if (/^delete/.test(name)) return "DESTRUCTIVE";+ if (/^(get|list|fetch|search|find|count|check|is|has)/.test(name))+ return "READ";+ return "WRITE";+}++function computeInjectAuth(+ funcName: string,+ classification: "READ" | "WRITE" | "DESTRUCTIVE"+): AuthField[] {+ const lower = funcName.toLowerCase();+ if (classification === "READ" || classification === "DESTRUCTIVE") {+ return ["companyId"];+ }+ if (+ /^(upsert|create|insert|add|new|copy|duplicate|generate)/.test(lower)+ ) {+ return ["companyId", "createdBy", "updatedBy"];+ }+ if (+ /^(update|modify|set|change|edit|approve|reject|finalize|toggle|move|reorder|recalculate|sync|favorite|unfavorite|send|release|close|convert|run)/.test(+ lower+ )+ ) {+ return ["companyId", "updatedBy"];+ }+ return ["companyId"];+}++function generateDescription(funcName: string): string {+ return funcName+ .replace(/([A-Z])/g, " $1")+ .trim()+ .toLowerCase();+}++// ---------------------------------------------------------------------------+// Schema building for a function+// ---------------------------------------------------------------------------++function buildToolSchema(+ func: ParsedFunction,+ modelsContent: string | null+): { schema: Record<string, unknown>; paramCount: number } {+ const userParams = func.params.filter((p) => !CONTEXT_PARAMS.has(p.name));++ if (userParams.length === 0) {+ return { schema: { type: "object", properties: {} }, paramCount: 0 };+ }++ // Single object param — flatten its fields into the schema+ if (userParams.length === 1) {+ const param = userParams[0];++ // Check for validator reference: z.infer<typeof validatorName>+ const validatorMatch = param.typeStr.match(+ /z\.infer<typeof\s+(\w+)>/+ );+ if (validatorMatch && modelsContent) {+ const validatorName = validatorMatch[1];+ const resolved = parseValidatorFields(validatorName, modelsContent);+ if (resolved) {+ const propCount = Object.keys(+ (resolved.properties as Record<string, unknown>) || {}+ ).length;+ return { schema: resolved, paramCount: propCount };+ }}-- // Count parameters (simplified - counts properties in inputSchema)- const inputSchemaMatch = configBlock.match(/inputSchema:\s*z\.object\(\{([^}]*)\}\)/);- let paramCount = 0;- if (inputSchemaMatch) {- const schemaContent = inputSchemaMatch[1];- // Count occurrences of property definitions (simplified)- const propMatches = schemaContent.match(/\w+:\s*z\./g);- paramCount = propMatches ? propMatches.length : 0;++ // Inline object type+ if (param.typeStr.trim().startsWith("{")) {+ const schema = parseInlineObjectType(param.typeStr);+ const propCount = Object.keys(+ (schema.properties as Record<string, unknown>) || {}+ ).length;+ return { schema, paramCount: propCount };+ }++ // GenericQueryFilters+ if (param.typeStr.includes("GenericQueryFilters")) {+ const innerSchema = typeToJsonSchema(param.typeStr);+ const schema: Record<string, unknown> = {+ type: "object",+ properties: { [param.name]: innerSchema },+ };+ const propCount = Object.keys(+ (innerSchema.properties as Record<string, unknown>) || {}+ ).length;+ return { schema, paramCount: propCount };+ }++ // Simple primitive param+ const propSchema = typeToJsonSchema(param.typeStr);+ const schema: Record<string, unknown> = {+ type: "object",+ properties: { [param.name]: propSchema },+ required: param.optional ? undefined : [param.name],+ };+ return { schema, paramCount: 1 };+ }++ // Multiple params — each becomes a property (or flattened if inline object)+ const properties: Record<string, unknown> = {};+ const required: string[] = [];+ for (const param of userParams) {+ if (param.typeStr.trim().startsWith("{")) {+ // Inline object — wrap under param name+ properties[param.name] = parseInlineObjectType(param.typeStr);+ } else {+ properties[param.name] = typeToJsonSchema(param.typeStr);}-- const funcName = toolName.startsWith(`${moduleName}_`)- ? toolName.slice(moduleName.length + 1)- : toolName;+ if (!param.optional) required.push(param.name);+ }++ const schema: Record<string, unknown> = { type: "object", properties };+ if (required.length > 0) schema.required = required;+ return { schema, paramCount: Object.keys(properties).length };+}++// ---------------------------------------------------------------------------+// Main+// ---------------------------------------------------------------------------- tools.push({- name: toolName,- module: moduleName,- classification,- description,- paramCount,- serviceParams: [],- injectAuth: computeInjectAuth(funcName, classification)- });+function loadModelsContent(mod: string): string | null {+ const modelsPath = path.join(MODULES_DIR, mod, `${mod}.models.ts`);+ if (fs.existsSync(modelsPath)) {+ return fs.readFileSync(modelsPath, "utf-8");}-- return tools;+ // Try shared models for cross-module validators+ const sharedPath = path.join(MODULES_DIR, "shared", "index.ts");+ if (fs.existsSync(sharedPath)) {+ return fs.readFileSync(sharedPath, "utf-8");+ }+ return null;}export function generateToolMetadata(): void {- console.log("Generating tool metadata for JIT loading...");-+ console.log("Generating tool metadata from service files...");+const allTools: ToolMetadata[] = [];-- // Get all tool files- const toolFiles = fs.readdirSync(TOOLS_DIR)- .filter(f => f.endsWith('.ts') && f !== 'index.ts')- .map(f => ({- path: path.join(TOOLS_DIR, f),- module: f.replace('.ts', '')- }));-- for (const file of toolFiles) {- try {- const tools = extractToolsFromFile(file.path, file.module).filter(- (t) => !MCP_BLOCKED_TOOL_NAMES.includes(t.name),- );-- const serviceParamMap = extractServiceParamNames(file.module);- for (const tool of tools) {- const funcName = tool.name.slice(file.module.length + 1);- tool.serviceParams = serviceParamMap.get(funcName) || [];- }- allTools.push(...tools);- console.log(` ✓ ${file.module}: ${tools.length} tools`);- } catch (error) {- console.error(` ✗ Failed to process ${file.module}:`, error);+ for (const mod of MODULE_LIST) {+ const serviceFile = path.join(MODULES_DIR, mod, `${mod}.service.ts`);+ if (!fs.existsSync(serviceFile)) {+ console.warn(` ⚠ Service file not found: ${serviceFile}`);+ continue;+ }++ const content = fs.readFileSync(serviceFile, "utf-8");+ const modelsContent = loadModelsContent(mod);+ const functions = parseExportedFunctions(content);++ let toolCount = 0;++ for (const func of functions) {+ const toolName = `${mod}_${func.name}`;+ if (MCP_BLOCKED_TOOL_NAMES.includes(toolName)) continue;++ const classification = classifyFunction(func.name);+ const injectAuth = computeInjectAuth(func.name, classification);+ const description =+ DESCRIPTION_OVERRIDES[toolName] || generateDescription(func.name);+ const serviceParams = func.params.map((p) => p.name);+ const { schema, paramCount } = buildToolSchema(func, modelsContent);++ allTools.push({+ name: toolName,+ module: mod,+ classification,+ description,+ paramCount,+ serviceParams,+ injectAuth,+ schema,+ });+ toolCount++;}++ console.log(` ✓ ${mod}: ${toolCount} tools`);}-- // Write metadata file+const metadata = {generated: new Date().toISOString(),totalTools: allTools.length,- modules: [...new Set(allTools.map(t => t.module))].length,- tools: allTools+ modules: [...new Set(allTools.map((t) => t.module))].length,+ tools: allTools,};-+fs.writeFileSync(METADATA_FILE, JSON.stringify(metadata, null, 2));console.log(`\n✓ Generated metadata for ${allTools.length} tools`);console.log(` Output: ${path.relative(ROOT, METADATA_FILE)}`);}-// Run if called directlyif (require.main === module) {generateToolMetadata();-}\ No newline at end of file+}