-
Notifications
You must be signed in to change notification settings - Fork 9
feat(sdk): add support for endpoints #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7933bf2
feat(sdk): add support for endpoints
dominikkadera 2d7ea7d
build(deps): package bump
dominikkadera eff803e
Merge branch 'main' into dka/sdk-endpoints
dominikkadera 7ad4e6e
docs: fix categories
dominikkadera 8ba73e3
test: improve test case
dominikkadera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,330 @@ | ||
| import type { Make } from '../../make.js'; | ||
| import type { MakeTool } from '../../tools.js'; | ||
| import type { SDKEndpointAnnotations, SDKEndpointSectionType } from './endpoints.js'; | ||
|
|
||
| const SECTION_ENUM = ['api', 'scope', 'inputParameters', 'outputParameters']; | ||
|
|
||
| export const tools: MakeTool[] = [ | ||
| { | ||
| name: 'sdk-endpoints_list', | ||
| title: 'List SDK Endpoints', | ||
| description: 'List all Endpoints for the app.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:read', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| }, | ||
| required: ['appName', 'appVersion'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1 }], | ||
| execute: async (make: Make, args: { appName: string; appVersion: number }) => { | ||
| return await make.sdk.endpoints.list(args.appName, args.appVersion); | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_get', | ||
| title: 'Get SDK Endpoint', | ||
| description: 'Get a single Endpoint by name.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:read', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity' }], | ||
| execute: async (make: Make, args: { appName: string; appVersion: number; endpointName: string }) => { | ||
| return await make.sdk.endpoints.get(args.appName, args.appVersion, args.endpointName); | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_create', | ||
| title: 'Create SDK Endpoint', | ||
| description: 'Create a new Endpoint.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| idempotentHint: true, | ||
| destructiveHint: false, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| name: { type: 'string', description: 'The name of the Endpoint' }, | ||
| label: { type: 'string', description: 'The label of the Endpoint' }, | ||
| description: { type: 'string', description: 'The description of the Endpoint' }, | ||
| attachedAccounts: { | ||
| type: 'array', | ||
| items: { type: 'string' }, | ||
| description: 'Connection names to attach to the Endpoint', | ||
| }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'name', 'label'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, name: 'getEntity', label: 'Get Entity' }], | ||
| execute: async ( | ||
| make: Make, | ||
| args: { | ||
| appName: string; | ||
| appVersion: number; | ||
| name: string; | ||
| label: string; | ||
| description?: string; | ||
| attachedAccounts?: string[]; | ||
| }, | ||
| ) => { | ||
| const { appName, appVersion, ...body } = args; | ||
| return await make.sdk.endpoints.create(appName, appVersion, body); | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_update', | ||
| title: 'Update SDK Endpoint', | ||
| description: "Update an existing Endpoint's metadata.", | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| idempotentHint: true, | ||
| destructiveHint: false, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| label: { type: 'string', description: 'The label of the Endpoint' }, | ||
| description: { type: 'string', description: 'The description of the Endpoint' }, | ||
| context: { type: 'string', description: 'Context for how to use the Endpoint' }, | ||
| annotations: { | ||
| type: 'object', | ||
| description: 'MCP-inspired behavior hints', | ||
| properties: { | ||
| readOnlyHint: { | ||
| type: 'boolean', | ||
| description: 'If true, the Endpoint does not modify its environment.', | ||
| }, | ||
| destructiveHint: { | ||
| type: 'boolean', | ||
| description: 'If true, the Endpoint may perform destructive updates.', | ||
| }, | ||
| idempotentHint: { | ||
| type: 'boolean', | ||
| description: 'If true, repeated calls with the same arguments have no additional effect.', | ||
| }, | ||
| openWorldHint: { | ||
| type: 'boolean', | ||
| description: | ||
| 'If true, the Endpoint may interact with an "open world" of external entities.', | ||
| }, | ||
| }, | ||
| }, | ||
| attachedAccounts: { | ||
| type: 'array', | ||
| items: { type: 'string' }, | ||
| description: 'Connection names attached to the Endpoint (replaces the existing list)', | ||
| }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity', label: 'Get Entity (Updated)' }], | ||
| execute: async ( | ||
| make: Make, | ||
| args: { | ||
| appName: string; | ||
| appVersion: number; | ||
| endpointName: string; | ||
| label?: string; | ||
| description?: string; | ||
| context?: string; | ||
| annotations?: SDKEndpointAnnotations; | ||
| attachedAccounts?: string[]; | ||
| }, | ||
| ) => { | ||
| const { appName, appVersion, endpointName, ...body } = args; | ||
| return await make.sdk.endpoints.update(appName, appVersion, endpointName, body); | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_delete', | ||
| title: 'Delete SDK Endpoint', | ||
| description: 'Delete an Endpoint.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| destructiveHint: true, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity' }], | ||
| execute: async (make: Make, args: { appName: string; appVersion: number; endpointName: string }) => { | ||
| await make.sdk.endpoints.delete(args.appName, args.appVersion, args.endpointName); | ||
| return `Endpoint has been deleted.`; | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_set-public', | ||
| title: 'Set SDK Endpoint public', | ||
| description: 'Mark an SDK app Endpoint as public.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { idempotentHint: true, destructiveHint: false }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity' }], | ||
| execute: async (make: Make, args: { appName: string; appVersion: number; endpointName: string }) => { | ||
| await make.sdk.endpoints.makePublic(args.appName, args.appVersion, args.endpointName); | ||
| return `Endpoint has been made public.`; | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_set-private', | ||
| title: 'Set SDK Endpoint private', | ||
| description: 'Mark an SDK app Endpoint as private.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { idempotentHint: true, destructiveHint: false }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity' }], | ||
| execute: async (make: Make, args: { appName: string; appVersion: number; endpointName: string }) => { | ||
| await make.sdk.endpoints.makePrivate(args.appName, args.appVersion, args.endpointName); | ||
| return `Endpoint has been made private.`; | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_get-section', | ||
| title: 'Get SDK Endpoint section', | ||
| description: 'Get Endpoint section data.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:read', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| section: { | ||
| type: 'string', | ||
| enum: SECTION_ENUM, | ||
| description: 'The section to get', | ||
| }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName', 'section'], | ||
| }, | ||
| examples: [{ appName: 'my-app', appVersion: 1, endpointName: 'getEntity', section: 'api' }], | ||
| execute: async ( | ||
| make: Make, | ||
| args: { | ||
| appName: string; | ||
| appVersion: number; | ||
| endpointName: string; | ||
| section: SDKEndpointSectionType; | ||
| }, | ||
| ) => { | ||
| return await make.sdk.endpoints.getSection(args.appName, args.appVersion, args.endpointName, args.section); | ||
| }, | ||
| }, | ||
| { | ||
| name: 'sdk-endpoints_set-section', | ||
| title: 'Set SDK Endpoint section', | ||
| description: 'Set Endpoint section data.', | ||
| category: 'sdk-endpoints', | ||
| scope: 'sdk-apps:write', | ||
| scopeId: undefined, | ||
| annotations: { | ||
| idempotentHint: true, | ||
| destructiveHint: false, | ||
| }, | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| appName: { type: 'string', description: 'The name of the app' }, | ||
| appVersion: { type: 'number', description: 'The version of the app' }, | ||
| endpointName: { type: 'string', description: 'The name of the Endpoint' }, | ||
| section: { | ||
| type: 'string', | ||
| enum: SECTION_ENUM, | ||
| description: 'The section to set', | ||
| }, | ||
| body: { type: 'string', description: 'The section data to set in JSONC format' }, | ||
| }, | ||
| required: ['appName', 'appVersion', 'endpointName', 'section', 'body'], | ||
| }, | ||
| examples: [ | ||
| { | ||
| appName: 'my-app', | ||
| appVersion: 1, | ||
| endpointName: 'getEntity', | ||
| section: 'api', | ||
| body: '{"url": "/entities/{{parameters.id}}", "method": "GET"}', | ||
| }, | ||
| ], | ||
| execute: async ( | ||
| make: Make, | ||
| args: { | ||
| appName: string; | ||
| appVersion: number; | ||
| endpointName: string; | ||
| section: SDKEndpointSectionType; | ||
| body: string; | ||
| }, | ||
| ) => { | ||
| await make.sdk.endpoints.setSection( | ||
| args.appName, | ||
| args.appVersion, | ||
| args.endpointName, | ||
| args.section, | ||
| args.body, | ||
| ); | ||
| return `Section '${args.section}' has been set.`; | ||
| }, | ||
| }, | ||
| ]; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.