Files
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
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
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

175 lines
6.2 KiB
TypeScript

import type { ListCustomersParams, SapProxyResponse } from '@/tools/sap_s4hana/types'
import {
baseProxyBody,
buildOdataQuery,
SAP_PROXY_URL,
transformSapProxyResponse,
} from '@/tools/sap_s4hana/utils'
import type { ToolConfig } from '@/tools/types'
export const listCustomersTool: ToolConfig<ListCustomersParams, SapProxyResponse> = {
id: 'sap_s4hana_list_customers',
name: 'SAP S/4HANA List Customers',
description:
'List customers from SAP S/4HANA Cloud (API_BUSINESS_PARTNER, A_Customer) with optional OData $filter, $top, $skip, $orderby, $select, $expand.',
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',
},
filter: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'OData $filter expression (e.g., "CustomerAccountGroup eq \'Z001\'")',
},
top: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum results to return ($top)',
},
skip: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to skip ($skip)',
},
orderBy: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'OData $orderby expression',
},
select: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated fields to return ($select)',
},
expand: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated navigation properties to expand (e.g., "to_CustomerCompany,to_CustomerSalesArea")',
},
},
request: {
url: SAP_PROXY_URL,
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
...baseProxyBody(params),
service: 'API_BUSINESS_PARTNER',
path: '/A_Customer',
method: 'GET',
query: buildOdataQuery(params),
}),
},
transformResponse: transformSapProxyResponse,
outputs: {
status: { type: 'number', description: 'HTTP status code returned by SAP' },
data: {
type: 'json',
description:
'Array of A_Customer entities, or `{ results, __count?, __next? }` when pagination metadata is present (proxy unwraps the OData v2 `d` envelope). Properties below describe each customer item.',
items: {
type: 'object',
properties: {
Customer: { type: 'string', description: 'Customer key (up to 10 characters)' },
CustomerName: { type: 'string', description: 'Name of customer' },
CustomerFullName: { type: 'string', description: 'Full name of the customer' },
CustomerAccountGroup: { type: 'string', description: 'Customer account group' },
CustomerClassification: { type: 'string', description: 'Customer classification code' },
CustomerCorporateGroup: { type: 'string', description: 'Corporate group code' },
AuthorizationGroup: { type: 'string', description: 'Authorization group' },
Supplier: { type: 'string', description: 'Linked supplier account number' },
FiscalAddress: { type: 'string', description: 'Fiscal address ID' },
Industry: { type: 'string', description: 'Industry key' },
NielsenRegion: { type: 'string', description: 'Nielsen ID' },
ResponsibleType: { type: 'string', description: 'Responsible type' },
NFPartnerIsNaturalPerson: { type: 'string', description: 'Natural person indicator' },
InternationalLocationNumber1: {
type: 'string',
description: 'International location number 1',
},
TaxNumberType: { type: 'string', description: 'Tax number type' },
VATRegistration: { type: 'string', description: 'VAT registration number' },
DeletionIndicator: { type: 'boolean', description: 'Central deletion flag' },
OrderIsBlockedForCustomer: {
type: 'string',
description: 'Central order block reason code',
},
PostingIsBlocked: { type: 'boolean', description: 'Central posting block flag' },
DeliveryIsBlocked: { type: 'string', description: 'Central delivery block reason code' },
BillingIsBlockedForCustomer: {
type: 'string',
description: 'Central billing block reason code',
},
CreationDate: { type: 'string', description: 'Creation date (OData v2 epoch)' },
CreatedByUser: { type: 'string', description: 'User who created the customer' },
},
},
},
},
}