diff --git a/packages/sdk/package.json b/packages/sdk/package.json index b99bb35ff4657..07683a7782da2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,7 +1,7 @@ { "name": "@pipedream/sdk", "type": "module", - "version": "1.6.3", + "version": "1.6.4", "description": "Pipedream SDK", "main": "./dist/server.js", "module": "./dist/server.js", diff --git a/packages/sdk/src/shared/index.ts b/packages/sdk/src/shared/index.ts index eb4955a88d658..3c21bb327a277 100644 --- a/packages/sdk/src/shared/index.ts +++ b/packages/sdk/src/shared/index.ts @@ -250,6 +250,27 @@ export type GetAppsOpts = RelationOpts & { * Filter by whether apps have triggers in the component registry. */ hasTriggers?: boolean; + /** + * Search for apps that have private connect components published. + */ + privateConnect?: boolean; +}; + +/** + * Parameters for the retrieval of a component from the Connect API + */ +export type GetComponentOpts2 = RelationOpts & { + /** + * The key that uniquely identifies the component. + * + * @example "gitlab-list-commits" + * @example "slack-send-message" + */ + key: string; + /** + * Tells Pipedream API to retrieve a private connect enabled component. + */ + privateConnect?: boolean; }; /** @@ -424,6 +445,11 @@ export type ConfigureComponentOpts = ExternalUserId & { * See {@link ConfigureComponentResponse.context}. */ prevContext?: ConfigureComponentContext; + + /** + * Specifies that the component being configured is a private connect enabled component. + */ + privateConnect?: boolean; }; /** @@ -449,6 +475,11 @@ export type GetComponentsOpts = RelationOpts & { * The type of component to filter (either "trigger" or "action"). */ componentType?: ComponentType; + + /** + * Search for components that are within your private connect component registry. + */ + privateConnect?: boolean; }; /** @@ -567,6 +598,11 @@ export type RunActionOpts = ExternalUserId & { * The ID of the last prop reconfiguration (if any). */ dynamicPropsId?: string; + + /** + * Tells Pipedream API to run a private connect enabled component. + */ + privateConnect?: boolean; }; /** @@ -1155,6 +1191,11 @@ export abstract class BaseClient { ? "1" : "0"; } + if (opts?.privateConnect != null) { + params.private_connect = opts.privateConnect + ? "1" + : "0"; + } this.addRelationOpts(params, opts); return this.makeAuthorizedRequest( @@ -1227,6 +1268,11 @@ export abstract class BaseClient { } else if (opts?.componentType === "action") { path = "/actions"; } + if (opts?.privateConnect != null) { + params.private_connect = opts.privateConnect + ? "1" + : "0"; + } // XXX Is V1Component the correct type for triggers and actions? return this.makeConnectRequest(path, { method: "GET", @@ -1254,10 +1300,33 @@ export abstract class BaseClient { * ``` */ public getComponent(id: ComponentId) { - const { key } = id; + return this.getComponentWithOpts({ key: id.key }) + } + + /** + * Retrieves the metadata for a specific component. + * + * @param id - The identifier of the component. + * @returns A promise resolving to the component metadata. + * + * @example + * ```typescript + * const component = await client.getComponent("slack-send-message"); + * console.log(component); + * ``` + */ + public getComponentWithOpts(opts: GetComponentOpts2) { + const { key, privateConnect } = opts; + const params: Record = {}; + if (privateConnect != null) { + params.private_connect = privateConnect + ? "1" + : "0"; + } const path = `/components/${key}`; return this.makeConnectRequest(path, { method: "GET", + params, }); } @@ -1298,8 +1367,16 @@ export abstract class BaseClient { userId, externalUserId = userId, componentId, + privateConnect, } = opts; + const params: Record = {}; + if (privateConnect != null) { + params.private_connect = privateConnect + ? "1" + : "0"; + } + const id = typeof componentId === "object" ? componentId.key : componentId; @@ -1316,6 +1393,7 @@ export abstract class BaseClient { }; return this.makeConnectRequest("/components/configure", { method: "POST", + params, body, }); } @@ -1413,6 +1491,12 @@ export abstract class BaseClient { * ``` */ public runAction(opts: RunActionOpts) { + const params: Record = {}; + if (opts?.privateConnect != null) { + params.private_connect = opts.privateConnect + ? "1" + : "0"; + } const { userId, externalUserId = userId, @@ -1431,6 +1515,7 @@ export abstract class BaseClient { }; return this.makeConnectRequest("/actions/run", { method: "POST", + params, body, }); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc20dd09ec1b9..18cbdc35b57f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5445,8 +5445,7 @@ importers: specifier: ^8.3.2 version: 8.3.2 - components/google_cloud_document_ai: - specifiers: {} + components/google_cloud_document_ai: {} components/google_cloud_translate: {} @@ -13230,11 +13229,9 @@ importers: components/test_apps_for_checking_something_006: {} - components/test_apps_for_checking_something_009: - specifiers: {} + components/test_apps_for_checking_something_009: {} - components/test_apps_for_checking_something_010: - specifiers: {} + components/test_apps_for_checking_something_010: {} components/test_apps_for_switching_appslug_009: {} @@ -15493,14 +15490,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk': @@ -15584,8 +15573,8 @@ importers: specifier: file:../.. version: file:packages/connect-react(@types/react@18.3.12)(react-dom@19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106))(react@19.0.0-rc-66855b96-20241106) '@pipedream/sdk': - specifier: ^1.3.3 - version: 1.3.3 + specifier: file:../../../sdk + version: link:../../../sdk next: specifier: 15.0.3 version: 15.0.3(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106))(react@19.0.0-rc-66855b96-20241106) @@ -18622,10 +18611,6 @@ packages: '@pipedream/ramp@0.1.2': resolution: {integrity: sha512-vYC5OPJo+kxhYYav5y0Mb7WihbLqNdoUO/CnOH1rHfKKNI4E23LLLLICn3VAl0gRc7xbWLHf4Nmcyjw7qf5k7Q==} - '@pipedream/sdk@1.3.3': - resolution: {integrity: sha512-sh0dZWdQlh7IprVs1Ka04+jMmpwTKf5SlyvaAJFmSbcvJ7So1fj/YLuU3BMXU91ehA1R6DGb66Yr+QzBsANcSA==} - engines: {node: '>=18.0.0'} - '@pipedream/sdk@1.5.3': resolution: {integrity: sha512-shXEDK91RzaTAbFQCVLHCV+PuKjQaes9V1C8r1abV6hRCyAQcYnr5j6alJuKiozBnIh5BGA/OYh0JEYBWau7yA==} engines: {node: '>=18.0.0'} @@ -35476,16 +35461,6 @@ snapshots: transitivePeerDependencies: - debug - '@pipedream/sdk@1.3.3': - dependencies: - '@rails/actioncable': 8.0.0 - commander: 12.1.0 - oauth4webapi: 3.1.4 - ws: 8.18.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - '@pipedream/sdk@1.5.3': dependencies: '@rails/actioncable': 8.0.0