Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copy to .env and fill in real values:
# cp .env.example .env

# API token with organizations:read, agents:read, and agents:write scopes
MAKE_API_KEY="REPLACE_WITH_YOUR_API_TOKEN"

# Zone hostname only (no https://), e.g. eu2.make.com or us2.make.com
MAKE_ZONE="eu2.make.com"

# Numeric organization ID (required for on-prem agent / connected-system tests)
MAKE_ORGANIZATION="12345"

# Connected-system *create* integration (keys must match getAppConfig for each app)
MAKE_CONNECTED_SYSTEM_HTTP_INPUTS='{"url":"https://example.com"}'
MAKE_CONNECTED_SYSTEM_SAP_AGENT_INPUTS='{"ashost":"00","sysnr":"00","client":"00"}'
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ MAKE_TEAM="<team-id>"
MAKE_ORGANIZATION="<organization-id>"
```

Required for connected-system **create** integration (field names from `getAppConfig`):

```
MAKE_CONNECTED_SYSTEM_HTTP_INPUTS='{"url":"https://example.com"}'
MAKE_CONNECTED_SYSTEM_SAP_AGENT_INPUTS='{"ashost":"00","sysnr":"00","client":"00"}'
```

Each create suite registers a **new** on-prem agent, then creates the connected system on that agent (no agent ID in `.env`). Use the same input field names and values you would enter in the Make UI. For `sap-agent`, the form uses `ashost`, `sysnr`, and `client` (not `language`); confirm names via `getAppConfig` if your zone differs.

Read tests always cover **http** and **sap-agent**. Create suites run when the matching `MAKE_CONNECTED_SYSTEM_*_INPUTS` is set.

Copy `.env.example` to `.env` and fill in values. The organization must have `license.onPremAgent` enabled; the API token needs `organizations:read`, `agents:read`, and `agents:write` scopes.

Please provide zone without `https://` prefix (e.g. `eu2.make.com`).

## Building
Expand Down
15 changes: 11 additions & 4 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"name": "@make/sdk",
"version": "0.0.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change this.

"version": "1.5.0",
"exports": "./src/index.ts",
"license": "MIT",
"publish": {
"include": ["LICENSE", "README.md", "src/**/*.ts"],
"exclude": ["test/*", "scripts/*"]
"include": [
"LICENSE",
"README.md",
"src/**/*.ts"
],
"exclude": [
"test/*",
"scripts/*"
]
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makehq/sdk",
"version": "1.4.0",
"version": "1.5.0",
"description": "Make TypeScript SDK",
"license": "MIT",
"author": "Make",
Expand Down
206 changes: 206 additions & 0 deletions src/endpoints/agents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import type { FetchFunction } from '../types.js';

/**
* Status of an on-prem bridge agent.
*/
export type AgentStatus = 'ACTIVE' | 'STOPPED' | 'NOT_RESPONDING' | 'REGISTERED';

/**
* Represents a Make on-prem bridge agent (not Make AI `/v1/agents`).
*/
export type Agent = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please name this OnPremAgent? All other classes and exports should be renamed as well. Feels like a leftover given the tools are already exported with prefix.

/** Unique identifier of the agent */
id: string;
/** Tenant identifier in the agency service */
tenantId: string;
/** User-defined name of the agent */
name: string;
/** Client secret for agent authentication (sensitive; may only be shown at creation) */
clientSecret?: string;
/** Current operational status */
status: AgentStatus;
/** Whether the agent has been alerted */
alerted: boolean;
/** Whether the agent is currently connected */
connected: boolean;
/** Installed agent version */
version?: string;
/** When the agent was created */
createdDate?: string;
/** Last successful connection timestamp */
lastConnectionDate?: string;
/** Number of connected systems using this agent */
systemConnectionsCount?: number;
};

/**
* Parameters for registering a new on-prem agent.
*/
export type CreateAgentBody = {
/** Display name for the new agent */
name: string;
};

/**
* Parameters for updating an on-prem agent.
*/
export type UpdateAgentBody = {
/** New name for the agent */
name?: string;
};

/**
* Field definition returned for connected-system configuration on an agent app.
*/
export type AgentAppConfigField = {
/** Field identifier used in `inputs` when creating a connected system */
name: string;
/** Human-readable label */
label: string;
/** Help text, if any */
help?: string | null;
/** Whether the field is required */
required?: boolean;
};

/**
* Forman-style input descriptor for an agent app's connected-system form.
*/
export type AgentAppConfigInput = {
/** Top-level field name (typically `inputs` for a collection) */
name: string;
/** Human-readable label */
label: string;
/** Field type (e.g. `collection`) */
type: string;
/** Nested field definitions when `type` is `collection` */
spec?: AgentAppConfigField[];
};

type ListAgentsResponse = {
agents: Agent[];
};

type GetAgentResponse = {
agent: Agent;
};

type CreateAgentResponse = {
agent: Agent;
};

type UpdateAgentResponse = {
agent: Agent;
};

type DeleteAgentResponse = {
agent: string;
};

type GetAgentAppConfigResponse = {
inputs: AgentAppConfigInput[];
};

/**
* Class providing methods for Make on-prem bridge agents.
* These agents run on customer infrastructure and connect to Make via the agency service.
*/
export class Agents {
readonly #fetch: FetchFunction;

constructor(fetch: FetchFunction) {
this.#fetch = fetch;
}

/**
* List on-prem agents for an organization.
* @param organizationId The organization ID
*/
async list(organizationId: number): Promise<Agent[]> {
return (
await this.#fetch<ListAgentsResponse>('/agents', {
query: { organizationId },
})
).agents;
}

/**
* Get details of a specific on-prem agent.
* @param organizationId The organization ID
* @param agentId The agent UUID
*/
async get(organizationId: number, agentId: string): Promise<Agent> {
return (
await this.#fetch<GetAgentResponse>(`/agents/${agentId}`, {
query: { organizationId },
})
).agent;
}

/**
* Register a new on-prem agent. The server assigns `id` and `clientSecret`.
* @param organizationId The organization ID
* @param body Agent registration parameters (`name` only)
*/
async create(organizationId: number, body: CreateAgentBody): Promise<Agent> {
return (
await this.#fetch<CreateAgentResponse>('/agent/register', {
method: 'POST',
query: { organizationId },
body,
})
).agent;
}

/**
* Update an on-prem agent (currently supports renaming via `name`).
* @param organizationId The organization ID
* @param agentId The agent UUID
* @param body Fields to update
*/
async update(organizationId: number, agentId: string, body: UpdateAgentBody): Promise<Agent> {
return (
await this.#fetch<UpdateAgentResponse>(`/agents/${agentId}`, {
method: 'PATCH',
query: { organizationId },
body,
})
).agent;
}

/**
* Delete an on-prem agent.
* @param organizationId The organization ID
* @param agentId The agent UUID
* @returns The deleted agent ID
*/
async delete(organizationId: number, agentId: string): Promise<string> {
return (
await this.#fetch<DeleteAgentResponse>(`/agents/${agentId}`, {
method: 'DELETE',
query: { organizationId },
})
).agent;
}

/**
* Get dynamic input field definitions for creating a connected system on an agent app.
* @param organizationId The organization ID
* @param agentId The agent UUID
* @param appName Connected-system app slug (e.g. `http`, `sap-agent`)
*/
async getAppConfig(
organizationId: number,
agentId: string,
appName: string,
): Promise<AgentAppConfigInput[]> {
return (
await this.#fetch<GetAgentAppConfigResponse>(
`/agents/${agentId}/apps/${appName}/config`,
{
query: { organizationId },
},
)
).inputs;
}
}
Loading