d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
174 lines
5.8 KiB
TypeScript
174 lines
5.8 KiB
TypeScript
import type { SapProxyResponse, UpdateSupplierParams } from '@/tools/sap_s4hana/types'
|
|
import {
|
|
baseProxyBody,
|
|
parseJsonInput,
|
|
quoteOdataKey,
|
|
SAP_PROXY_URL,
|
|
transformSapProxyResponse,
|
|
} from '@/tools/sap_s4hana/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const updateSupplierTool: ToolConfig<UpdateSupplierParams, SapProxyResponse> = {
|
|
id: 'sap_s4hana_update_supplier',
|
|
name: 'SAP S/4HANA Update Supplier',
|
|
description:
|
|
'Update fields on an A_Supplier entity in SAP S/4HANA Cloud (API_BUSINESS_PARTNER). Uses HTTP MERGE (OData v2 partial update) — only the fields you provide are written; existing values are preserved. A_Supplier is limited to modifiable fields such as PostingIsBlocked, PurchasingIsBlocked, PaymentIsBlockedForSupplier, DeletionIndicator, and SupplierAccountGroup; company-code/purchasing-org segments must be updated via the `to_SupplierCompany` / `to_SupplierPurchasingOrg` deep-update endpoints. If-Match defaults to a wildcard - for safe concurrent updates pass the ETag from a prior GET to avoid lost updates.',
|
|
version: '1.0.0',
|
|
params: {
|
|
subdomain: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description:
|
|
'SAP BTP subaccount subdomain (technical name of your subaccount, not the S/4HANA host)',
|
|
},
|
|
region: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'BTP region (e.g. eu10, us10)',
|
|
},
|
|
clientId: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'OAuth client ID from the S/4HANA Communication Arrangement',
|
|
},
|
|
clientSecret: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'OAuth client secret from the S/4HANA Communication Arrangement',
|
|
},
|
|
deploymentType: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Deployment type: cloud_public (default), cloud_private, or on_premise',
|
|
},
|
|
authType: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Authentication type: oauth_client_credentials (default) or basic',
|
|
},
|
|
baseUrl: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Base URL of the S/4HANA host (Cloud Private / On-Premise)',
|
|
},
|
|
tokenUrl: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'OAuth token URL (Cloud Private / On-Premise + OAuth)',
|
|
},
|
|
username: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Username for HTTP Basic auth',
|
|
},
|
|
password: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Password for HTTP Basic auth',
|
|
},
|
|
supplier: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Supplier key to update (string, up to 10 characters)',
|
|
},
|
|
body: {
|
|
type: 'json',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'JSON object with A_Supplier fields to update (e.g., {"PaymentIsBlockedForSupplier":true,"PostingIsBlocked":true})',
|
|
},
|
|
ifMatch: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'If-Match ETag for optimistic concurrency. Defaults to "*" (unconditional).',
|
|
},
|
|
},
|
|
request: {
|
|
url: SAP_PROXY_URL,
|
|
method: 'POST',
|
|
headers: () => ({ 'Content-Type': 'application/json' }),
|
|
body: (params) => {
|
|
const payload = parseJsonInput<Record<string, unknown>>(params.body, 'body')
|
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
throw new Error('body must be a JSON object with the fields to update')
|
|
}
|
|
return {
|
|
...baseProxyBody(params),
|
|
service: 'API_BUSINESS_PARTNER',
|
|
path: `/A_Supplier(${quoteOdataKey(params.supplier)})`,
|
|
method: 'MERGE',
|
|
query: { $format: 'json' },
|
|
body: payload,
|
|
ifMatch: params.ifMatch || '*',
|
|
}
|
|
},
|
|
},
|
|
transformResponse: transformSapProxyResponse,
|
|
outputs: {
|
|
status: { type: 'number', description: 'HTTP status code returned by SAP (204 on success)' },
|
|
data: {
|
|
type: 'json',
|
|
description:
|
|
'Null on 204 success, or OData v2 envelope with updated entity at output.data.d when SAP returns a representation',
|
|
properties: {
|
|
d: {
|
|
type: 'json',
|
|
description: 'A_Supplier entity (when SAP returns a representation)',
|
|
optional: true,
|
|
properties: {
|
|
Supplier: {
|
|
type: 'string',
|
|
description: 'Supplier key (up to 10 characters)',
|
|
optional: true,
|
|
},
|
|
SupplierName: { type: 'string', description: 'Supplier name', optional: true },
|
|
SupplierAccountGroup: {
|
|
type: 'string',
|
|
description: 'Supplier account group',
|
|
optional: true,
|
|
},
|
|
BusinessPartner: {
|
|
type: 'string',
|
|
description: 'Linked BusinessPartner key',
|
|
optional: true,
|
|
},
|
|
PaymentIsBlockedForSupplier: {
|
|
type: 'boolean',
|
|
description: 'Payment block flag',
|
|
optional: true,
|
|
},
|
|
PostingIsBlocked: {
|
|
type: 'boolean',
|
|
description: 'Posting block flag',
|
|
optional: true,
|
|
},
|
|
PurchasingIsBlocked: {
|
|
type: 'boolean',
|
|
description: 'Purchasing block flag',
|
|
optional: true,
|
|
},
|
|
DeletionIndicator: {
|
|
type: 'boolean',
|
|
description: 'Central deletion flag',
|
|
optional: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|