@composio/client 2.0.0-rc.11 → 2.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +336 -4
- package/dist/{api-key-revocation-Dh-KSokR.mjs → api-key-revocation-Cepb5MPW.mjs} +2 -2
- package/dist/{auth-configs-yM05-r6r.mjs → auth-configs-DuClvjog.mjs} +1 -1
- package/dist/{auth-Drov-jN8.mjs → auth-g5G0n9oV.mjs} +2 -2
- package/dist/{clanker-BYmc69WC.mjs → clanker-D1NQWaPc.mjs} +2 -2
- package/dist/{cli-Ce8RT7yp.mjs → cli-CGKT5K03.mjs} +3 -3
- package/dist/{connected-accounts-D__sOoNZ.mjs → connected-accounts-C8CZoYC9.mjs} +3 -3
- package/dist/{consumer-DTh50Hih.mjs → consumer-C9YlbuuF.mjs} +3 -3
- package/dist/{custom-nlGufiDz.mjs → custom-C__H3Kph.mjs} +1 -1
- package/dist/{custom-CdC-6Y_i.mjs → custom-Dh-9BeLk.mjs} +1 -1
- package/dist/effect/schemas/api-key-revocation/create.d.mts +8 -0
- package/dist/effect/schemas/api-key-revocation/create.mjs +8 -0
- package/dist/effect/schemas/auth/session/retrieve-info.d.mts +56 -0
- package/dist/effect/schemas/auth/session/retrieve-info.mjs +174 -0
- package/dist/effect/schemas/auth-configs/create.d.mts +16 -0
- package/dist/effect/schemas/auth-configs/create.mjs +22 -0
- package/dist/effect/schemas/auth-configs/delete.d.mts +10 -0
- package/dist/effect/schemas/auth-configs/delete.mjs +15 -0
- package/dist/effect/schemas/auth-configs/list.d.mts +54 -0
- package/dist/effect/schemas/auth-configs/list.mjs +66 -0
- package/dist/effect/schemas/auth-configs/retrieve.d.mts +48 -0
- package/dist/effect/schemas/auth-configs/retrieve.mjs +60 -0
- package/dist/effect/schemas/auth-configs/update-status.d.mts +9 -0
- package/dist/effect/schemas/auth-configs/update-status.mjs +11 -0
- package/dist/effect/schemas/auth-configs/update.d.mts +9 -0
- package/dist/effect/schemas/auth-configs/update.mjs +11 -0
- package/dist/effect/schemas/cli/create-codact-failure.d.mts +9 -0
- package/dist/effect/schemas/cli/create-codact-failure.mjs +17 -0
- package/dist/effect/schemas/cli/create-session.d.mts +12 -0
- package/dist/effect/schemas/cli/create-session.mjs +26 -0
- package/dist/effect/schemas/cli/get-session.d.mts +18 -0
- package/dist/effect/schemas/cli/get-session.mjs +48 -0
- package/dist/effect/schemas/cli/realtime/auth.d.mts +9 -0
- package/dist/effect/schemas/cli/realtime/auth.mjs +11 -0
- package/dist/effect/schemas/cli/realtime/credentials.d.mts +10 -0
- package/dist/effect/schemas/cli/realtime/credentials.mjs +12 -0
- package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.d.mts +17 -0
- package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.mjs +22 -0
- package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.d.mts +9 -0
- package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.mjs +20 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.d.mts +31 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.mjs +33 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.d.mts +33 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.mjs +35 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.d.mts +32 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.mjs +34 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.d.mts +179 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.mjs +113 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.d.mts +168 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.mjs +104 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.d.mts +140 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.mjs +76 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.d.mts +162 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.mjs +12 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.d.mts +202 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.mjs +130 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.d.mts +193 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.mjs +211 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.d.mts +176 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.mjs +86 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.d.mts +33 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.mjs +35 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.d.mts +35 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.mjs +37 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.d.mts +34 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.mjs +36 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.d.mts +231 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.mjs +160 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.d.mts +31 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.mjs +33 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.d.mts +31 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.mjs +33 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.d.mts +171 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.mjs +108 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.d.mts +139 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.mjs +74 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.d.mts +136 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.mjs +72 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.d.mts +139 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.mjs +98 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.d.mts +159 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.mjs +69 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.d.mts +162 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.mjs +12 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.d.mts +162 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.mjs +12 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.d.mts +167 -0
- package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.mjs +101 -0
- package/dist/effect/schemas/components/connected-account-retrieve-response-state.d.mts +2443 -0
- package/dist/effect/schemas/components/connected-account-retrieve-response-state.mjs +42 -0
- package/dist/effect/schemas/components/deprecated-toolkit-info.d.mts +8 -0
- package/dist/effect/schemas/components/deprecated-toolkit-info.mjs +12 -0
- package/dist/effect/schemas/components/execute-completed.d.mts +16 -0
- package/dist/effect/schemas/components/execute-completed.mjs +27 -0
- package/dist/effect/schemas/components/execute-failed.d.mts +16 -0
- package/dist/effect/schemas/components/execute-failed.mjs +27 -0
- package/dist/effect/schemas/components/execute-requires-user-input.d.mts +15 -0
- package/dist/effect/schemas/components/execute-requires-user-input.mjs +16 -0
- package/dist/effect/schemas/components/instant-account.d.mts +12 -0
- package/dist/effect/schemas/components/instant-account.mjs +15 -0
- package/dist/effect/schemas/components/mcp-create-response-commands.d.mts +10 -0
- package/dist/effect/schemas/components/mcp-create-response-commands.mjs +24 -0
- package/dist/effect/schemas/components/mcp-list-response-items.d.mts +23 -0
- package/dist/effect/schemas/components/mcp-list-response-items.mjs +96 -0
- package/dist/effect/schemas/components/project-list-response-data.d.mts +21 -0
- package/dist/effect/schemas/components/project-list-response-data.mjs +74 -0
- package/dist/effect/schemas/components/proxy-execute-completed.d.mts +17 -0
- package/dist/effect/schemas/components/proxy-execute-completed.mjs +36 -0
- package/dist/effect/schemas/components/session-create-response-config.d.mts +83 -0
- package/dist/effect/schemas/components/session-create-response-config.mjs +130 -0
- package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.d.mts +20 -0
- package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.mjs +25 -0
- package/dist/effect/schemas/components/session-create-response-warnings.d.mts +9 -0
- package/dist/effect/schemas/components/session-create-response-warnings.mjs +25 -0
- package/dist/effect/schemas/components/session-link-response-experimental.d.mts +13 -0
- package/dist/effect/schemas/components/session-link-response-experimental.mjs +18 -0
- package/dist/effect/schemas/components/session-retrieve-response-experimental.d.mts +37 -0
- package/dist/effect/schemas/components/session-retrieve-response-experimental.mjs +27 -0
- package/dist/effect/schemas/components/tool-details.d.mts +51 -0
- package/dist/effect/schemas/components/tool-details.mjs +144 -0
- package/dist/effect/schemas/components/tool-pricing.d.mts +9 -0
- package/dist/effect/schemas/components/tool-pricing.mjs +14 -0
- package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.d.mts +94 -0
- package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.mjs +141 -0
- package/dist/effect/schemas/components/tool-router-toolkits-list-response.d.mts +34 -0
- package/dist/effect/schemas/components/tool-router-toolkits-list-response.mjs +45 -0
- package/dist/effect/schemas/components/tool.d.mts +51 -0
- package/dist/effect/schemas/components/tool.mjs +144 -0
- package/dist/effect/schemas/components/toolkit-list-response-items.d.mts +36 -0
- package/dist/effect/schemas/components/toolkit-list-response-items.mjs +101 -0
- package/dist/effect/schemas/components/tools-paginated.d.mts +57 -0
- package/dist/effect/schemas/components/tools-paginated.mjs +15 -0
- package/dist/effect/schemas/components/trigger-retrieve-response-log.d.mts +31 -0
- package/dist/effect/schemas/components/trigger-retrieve-response-log.mjs +39 -0
- package/dist/effect/schemas/components/user-input-request.d.mts +11 -0
- package/dist/effect/schemas/components/user-input-request.mjs +19 -0
- package/dist/effect/schemas/connected-accounts/complete-auth.d.mts +9 -0
- package/dist/effect/schemas/connected-accounts/complete-auth.mjs +11 -0
- package/dist/effect/schemas/connected-accounts/create.d.mts +2457 -0
- package/dist/effect/schemas/connected-accounts/create.mjs +58 -0
- package/dist/effect/schemas/connected-accounts/delete.d.mts +9 -0
- package/dist/effect/schemas/connected-accounts/delete.mjs +17 -0
- package/dist/effect/schemas/connected-accounts/list.d.mts +2480 -0
- package/dist/effect/schemas/connected-accounts/list.mjs +84 -0
- package/dist/effect/schemas/connected-accounts/patch.d.mts +10 -0
- package/dist/effect/schemas/connected-accounts/patch.mjs +19 -0
- package/dist/effect/schemas/connected-accounts/refresh.d.mts +10 -0
- package/dist/effect/schemas/connected-accounts/refresh.mjs +27 -0
- package/dist/effect/schemas/connected-accounts/retrieve.d.mts +2477 -0
- package/dist/effect/schemas/connected-accounts/retrieve.mjs +81 -0
- package/dist/effect/schemas/connected-accounts/revoke.d.mts +12 -0
- package/dist/effect/schemas/connected-accounts/revoke.mjs +35 -0
- package/dist/effect/schemas/connected-accounts/update-status.d.mts +8 -0
- package/dist/effect/schemas/connected-accounts/update-status.mjs +11 -0
- package/dist/effect/schemas/custom/delete-toolkit.d.mts +12 -0
- package/dist/effect/schemas/custom/delete-toolkit.mjs +17 -0
- package/dist/effect/schemas/custom/sync.d.mts +10 -0
- package/dist/effect/schemas/custom/sync.mjs +21 -0
- package/dist/effect/schemas/custom/upsert.d.mts +8 -0
- package/dist/effect/schemas/custom/upsert.mjs +11 -0
- package/dist/effect/schemas/files/create-presigned-url.d.mts +15 -0
- package/dist/effect/schemas/files/create-presigned-url.mjs +15 -0
- package/dist/effect/schemas/files/list.d.mts +18 -0
- package/dist/effect/schemas/files/list.mjs +20 -0
- package/dist/effect/schemas/keyring/list-transfer-keys.d.mts +17 -0
- package/dist/effect/schemas/keyring/list-transfer-keys.mjs +19 -0
- package/dist/effect/schemas/link/create.d.mts +19 -0
- package/dist/effect/schemas/link/create.mjs +18 -0
- package/dist/effect/schemas/logs/create-tool-execution.d.mts +25 -0
- package/dist/effect/schemas/logs/create-tool-execution.mjs +39 -0
- package/dist/effect/schemas/logs/retrieve-tool-execution.d.mts +37 -0
- package/dist/effect/schemas/logs/retrieve-tool-execution.mjs +51 -0
- package/dist/effect/schemas/logs/tools/list-fields.d.mts +13 -0
- package/dist/effect/schemas/logs/tools/list-fields.mjs +13 -0
- package/dist/effect/schemas/logs/tools/list.d.mts +28 -0
- package/dist/effect/schemas/logs/tools/list.mjs +33 -0
- package/dist/effect/schemas/logs/tools/retrieve.d.mts +60 -0
- package/dist/effect/schemas/logs/tools/retrieve.mjs +74 -0
- package/dist/effect/schemas/logs/triggers/list.d.mts +34 -0
- package/dist/effect/schemas/logs/triggers/list.mjs +12 -0
- package/dist/effect/schemas/logs/triggers/retrieve.d.mts +33 -0
- package/dist/effect/schemas/logs/triggers/retrieve.mjs +9 -0
- package/dist/effect/schemas/mcp/create-instance.d.mts +12 -0
- package/dist/effect/schemas/mcp/create-instance.mjs +29 -0
- package/dist/effect/schemas/mcp/create.d.mts +23 -0
- package/dist/effect/schemas/mcp/create.mjs +67 -0
- package/dist/effect/schemas/mcp/custom/create.d.mts +17 -0
- package/dist/effect/schemas/mcp/custom/create.mjs +48 -0
- package/dist/effect/schemas/mcp/delete-instance.d.mts +9 -0
- package/dist/effect/schemas/mcp/delete-instance.mjs +11 -0
- package/dist/effect/schemas/mcp/delete.d.mts +9 -0
- package/dist/effect/schemas/mcp/delete.mjs +17 -0
- package/dist/effect/schemas/mcp/generate/url.d.mts +10 -0
- package/dist/effect/schemas/mcp/generate/url.mjs +21 -0
- package/dist/effect/schemas/mcp/list-instances.d.mts +18 -0
- package/dist/effect/schemas/mcp/list-instances.mjs +56 -0
- package/dist/effect/schemas/mcp/list.d.mts +27 -0
- package/dist/effect/schemas/mcp/list.mjs +19 -0
- package/dist/effect/schemas/mcp/retrieve-app.d.mts +27 -0
- package/dist/effect/schemas/mcp/retrieve-app.mjs +19 -0
- package/dist/effect/schemas/mcp/retrieve.d.mts +24 -0
- package/dist/effect/schemas/mcp/retrieve.mjs +68 -0
- package/dist/effect/schemas/mcp/update.d.mts +24 -0
- package/dist/effect/schemas/mcp/update.mjs +68 -0
- package/dist/effect/schemas/org/clanker/create-claim.d.mts +9 -0
- package/dist/effect/schemas/org/clanker/create-claim.mjs +14 -0
- package/dist/effect/schemas/org/consumer/list-connected-toolkits.d.mts +8 -0
- package/dist/effect/schemas/org/consumer/list-connected-toolkits.mjs +8 -0
- package/dist/effect/schemas/org/consumer/project/resolve.d.mts +19 -0
- package/dist/effect/schemas/org/consumer/project/resolve.mjs +30 -0
- package/dist/effect/schemas/org/list.d.mts +17 -0
- package/dist/effect/schemas/org/list.mjs +22 -0
- package/dist/effect/schemas/org/owner/project/create.d.mts +10 -0
- package/dist/effect/schemas/org/owner/project/create.mjs +22 -0
- package/dist/effect/schemas/org/owner/project/delete.d.mts +9 -0
- package/dist/effect/schemas/org/owner/project/delete.mjs +17 -0
- package/dist/effect/schemas/org/owner/project/list.d.mts +27 -0
- package/dist/effect/schemas/org/owner/project/list.mjs +15 -0
- package/dist/effect/schemas/org/owner/project/regenerate-api-key.d.mts +14 -0
- package/dist/effect/schemas/org/owner/project/regenerate-api-key.mjs +31 -0
- package/dist/effect/schemas/org/owner/project/retrieve.d.mts +27 -0
- package/dist/effect/schemas/org/owner/project/retrieve.mjs +93 -0
- package/dist/effect/schemas/org/project/list.d.mts +27 -0
- package/dist/effect/schemas/org/project/list.mjs +15 -0
- package/dist/effect/schemas/org/usage/retrieve-summary.d.mts +13 -0
- package/dist/effect/schemas/org/usage/retrieve-summary.mjs +15 -0
- package/dist/effect/schemas/org/usage/retrieve.d.mts +16 -0
- package/dist/effect/schemas/org/usage/retrieve.mjs +18 -0
- package/dist/effect/schemas/project/usage/retrieve-summary.d.mts +13 -0
- package/dist/effect/schemas/project/usage/retrieve-summary.mjs +15 -0
- package/dist/effect/schemas/project/usage/retrieve.d.mts +16 -0
- package/dist/effect/schemas/project/usage/retrieve.mjs +18 -0
- package/dist/effect/schemas/session-configs/list.d.mts +15 -0
- package/dist/effect/schemas/session-configs/list.mjs +26 -0
- package/dist/effect/schemas/session-configs/retrieve.d.mts +34 -0
- package/dist/effect/schemas/session-configs/retrieve.mjs +59 -0
- package/dist/effect/schemas/tool-router/session/attach.d.mts +128 -0
- package/dist/effect/schemas/tool-router/session/attach.mjs +30 -0
- package/dist/effect/schemas/tool-router/session/config-history.d.mts +93 -0
- package/dist/effect/schemas/tool-router/session/config-history.mjs +8 -0
- package/dist/effect/schemas/tool-router/session/create.d.mts +128 -0
- package/dist/effect/schemas/tool-router/session/create.mjs +45 -0
- package/dist/effect/schemas/tool-router/session/delete.d.mts +9 -0
- package/dist/effect/schemas/tool-router/session/delete.mjs +18 -0
- package/dist/effect/schemas/tool-router/session/execute-meta.d.mts +35 -0
- package/dist/effect/schemas/tool-router/session/execute-meta.mjs +15 -0
- package/dist/effect/schemas/tool-router/session/execute.d.mts +35 -0
- package/dist/effect/schemas/tool-router/session/execute.mjs +15 -0
- package/dist/effect/schemas/tool-router/session/files/create-download-url.d.mts +11 -0
- package/dist/effect/schemas/tool-router/session/files/create-download-url.mjs +13 -0
- package/dist/effect/schemas/tool-router/session/files/create-upload-url.d.mts +11 -0
- package/dist/effect/schemas/tool-router/session/files/create-upload-url.mjs +13 -0
- package/dist/effect/schemas/tool-router/session/files/delete.d.mts +9 -0
- package/dist/effect/schemas/tool-router/session/files/delete.mjs +11 -0
- package/dist/effect/schemas/tool-router/session/files/list.d.mts +14 -0
- package/dist/effect/schemas/tool-router/session/files/list.mjs +16 -0
- package/dist/effect/schemas/tool-router/session/link.d.mts +18 -0
- package/dist/effect/schemas/tool-router/session/link.mjs +25 -0
- package/dist/effect/schemas/tool-router/session/patch.d.mts +128 -0
- package/dist/effect/schemas/tool-router/session/patch.mjs +30 -0
- package/dist/effect/schemas/tool-router/session/proxy-execute.d.mts +26 -0
- package/dist/effect/schemas/tool-router/session/proxy-execute.mjs +10 -0
- package/dist/effect/schemas/tool-router/session/retrieve.d.mts +128 -0
- package/dist/effect/schemas/tool-router/session/retrieve.mjs +30 -0
- package/dist/effect/schemas/tool-router/session/search.d.mts +76 -0
- package/dist/effect/schemas/tool-router/session/search.mjs +74 -0
- package/dist/effect/schemas/tool-router/session/toolkits.d.mts +33 -0
- package/dist/effect/schemas/tool-router/session/toolkits.mjs +8 -0
- package/dist/effect/schemas/tool-router/session/tools.d.mts +56 -0
- package/dist/effect/schemas/tool-router/session/tools.mjs +8 -0
- package/dist/effect/schemas/toolkits/list.d.mts +42 -0
- package/dist/effect/schemas/toolkits/list.mjs +15 -0
- package/dist/effect/schemas/toolkits/recommend-scopes.d.mts +19 -0
- package/dist/effect/schemas/toolkits/recommend-scopes.mjs +21 -0
- package/dist/effect/schemas/toolkits/retrieve-categories.d.mts +15 -0
- package/dist/effect/schemas/toolkits/retrieve-categories.mjs +23 -0
- package/dist/effect/schemas/toolkits/retrieve-changelog.d.mts +16 -0
- package/dist/effect/schemas/toolkits/retrieve-changelog.mjs +16 -0
- package/dist/effect/schemas/toolkits/retrieve-multi.d.mts +42 -0
- package/dist/effect/schemas/toolkits/retrieve-multi.mjs +15 -0
- package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.d.mts +15 -0
- package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.mjs +17 -0
- package/dist/effect/schemas/toolkits/retrieve.d.mts +110 -0
- package/dist/effect/schemas/toolkits/retrieve.mjs +202 -0
- package/dist/effect/schemas/tools/execute.d.mts +12 -0
- package/dist/effect/schemas/tools/execute.mjs +35 -0
- package/dist/effect/schemas/tools/get-input.d.mts +9 -0
- package/dist/effect/schemas/tools/get-input.mjs +22 -0
- package/dist/effect/schemas/tools/list.d.mts +56 -0
- package/dist/effect/schemas/tools/list.mjs +8 -0
- package/dist/effect/schemas/tools/proxy.d.mts +16 -0
- package/dist/effect/schemas/tools/proxy.mjs +36 -0
- package/dist/effect/schemas/tools/retrieve-enum.d.mts +6 -0
- package/dist/effect/schemas/tools/retrieve-enum.mjs +8 -0
- package/dist/effect/schemas/tools/retrieve-required-scopes.d.mts +22 -0
- package/dist/effect/schemas/tools/retrieve-required-scopes.mjs +33 -0
- package/dist/effect/schemas/tools/retrieve.d.mts +50 -0
- package/dist/effect/schemas/tools/retrieve.mjs +8 -0
- package/dist/effect/schemas/trigger-instances/list-active.d.mts +34 -0
- package/dist/effect/schemas/trigger-instances/list-active.mjs +37 -0
- package/dist/effect/schemas/trigger-instances/manage/delete.d.mts +8 -0
- package/dist/effect/schemas/trigger-instances/manage/delete.mjs +11 -0
- package/dist/effect/schemas/trigger-instances/manage/update.d.mts +8 -0
- package/dist/effect/schemas/trigger-instances/manage/update.mjs +8 -0
- package/dist/effect/schemas/trigger-instances/upsert.d.mts +8 -0
- package/dist/effect/schemas/trigger-instances/upsert.mjs +8 -0
- package/dist/effect/schemas/triggers-types/list.d.mts +27 -0
- package/dist/effect/schemas/triggers-types/list.mjs +86 -0
- package/dist/effect/schemas/triggers-types/retrieve-enum.d.mts +6 -0
- package/dist/effect/schemas/triggers-types/retrieve-enum.mjs +8 -0
- package/dist/effect/schemas/triggers-types/retrieve.d.mts +21 -0
- package/dist/effect/schemas/triggers-types/retrieve.mjs +80 -0
- package/dist/effect/schemas/webhook-endpoints/create.d.mts +13 -0
- package/dist/effect/schemas/webhook-endpoints/create.mjs +15 -0
- package/dist/effect/schemas/webhook-endpoints/list.d.mts +12 -0
- package/dist/effect/schemas/webhook-endpoints/list.mjs +12 -0
- package/dist/effect/schemas/webhook-endpoints/replace.d.mts +13 -0
- package/dist/effect/schemas/webhook-endpoints/replace.mjs +15 -0
- package/dist/effect/schemas/webhook-endpoints/retrieve.d.mts +13 -0
- package/dist/effect/schemas/webhook-endpoints/retrieve.mjs +15 -0
- package/dist/effect/schemas/webhook-endpoints/update.d.mts +13 -0
- package/dist/effect/schemas/webhook-endpoints/update.mjs +15 -0
- package/dist/effect/schemas/webhook-subscriptions/create.d.mts +14 -0
- package/dist/effect/schemas/webhook-subscriptions/create.mjs +23 -0
- package/dist/effect/schemas/webhook-subscriptions/delete.d.mts +8 -0
- package/dist/effect/schemas/webhook-subscriptions/delete.mjs +8 -0
- package/dist/effect/schemas/webhook-subscriptions/list-event-types.d.mts +12 -0
- package/dist/effect/schemas/webhook-subscriptions/list-event-types.mjs +16 -0
- package/dist/effect/schemas/webhook-subscriptions/list.d.mts +20 -0
- package/dist/effect/schemas/webhook-subscriptions/list.mjs +29 -0
- package/dist/effect/schemas/webhook-subscriptions/retrieve.d.mts +14 -0
- package/dist/effect/schemas/webhook-subscriptions/retrieve.mjs +23 -0
- package/dist/effect/schemas/webhook-subscriptions/rotate-secret.d.mts +9 -0
- package/dist/effect/schemas/webhook-subscriptions/rotate-secret.mjs +14 -0
- package/dist/effect/schemas/webhook-subscriptions/update.d.mts +14 -0
- package/dist/effect/schemas/webhook-subscriptions/update.mjs +23 -0
- package/dist/effect/schemas.d.mts +9636 -0
- package/dist/effect/schemas.mjs +131 -0
- package/dist/effect.d.mts +749 -0
- package/dist/effect.mjs +1572 -0
- package/dist/{error-DLB1uKM3.mjs → error-D9cG225M.mjs} +15 -7
- package/dist/{files-RJPIH6iE.mjs → files-Azjc6Q8K.mjs} +1 -1
- package/dist/{files-DROCPzLP.mjs → files-D117G13q.mjs} +1 -1
- package/dist/{generate-mU4b3zJf.mjs → generate-CRTH0ELB.mjs} +1 -1
- package/dist/generated-deprecated-inputs-LDMdNcg5.mjs +201 -0
- package/dist/{generated-operations-CWhusMPU.mjs → generated-operations-CtVNMBUj.mjs} +13 -13
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +25 -212
- package/dist/{keyring-BzkcB1gu.mjs → keyring-Ct88j6tO.mjs} +1 -1
- package/dist/{link-CfIyH3nF.mjs → link-Cf--DVaO.mjs} +1 -1
- package/dist/{logs-D2wxXYiO.mjs → logs-Drxog1aA.mjs} +4 -5
- package/dist/{manage-Vc3jdRr_.mjs → manage-CE_6prdE.mjs} +1 -1
- package/dist/{mcp-DEe7xU7G.mjs → mcp-BH8R-5YV.mjs} +5 -5
- package/dist/{org-CYsl9O1u.mjs → org-Wf7f-Vv6.mjs} +7 -7
- package/dist/{owner-DmQb3AF5.mjs → owner-t5WgXUr3.mjs} +2 -2
- package/dist/pagination-rules-uMUdPq_7.mjs +36 -0
- package/dist/pagination.mjs +5 -9
- package/dist/{project-OSigfIdr.mjs → project-CbBPg2b6.mjs} +2 -2
- package/dist/{project-BVBWJzHm.mjs → project-CnnjwkO0.mjs} +2 -2
- package/dist/{project-DvSCDA9B.mjs → project-EfFVX-hX.mjs} +2 -2
- package/dist/{project-D-_r3H1_.mjs → project-p51XghZG.mjs} +2 -3
- package/dist/{realtime-Dsk1QGAl.mjs → realtime-BKG7w32e.mjs} +1 -1
- package/dist/resources/api-key-revocation.d.mts +1 -1
- package/dist/resources/api-key-revocation.mjs +1 -1
- package/dist/resources/auth/auth.d.mts +1 -1
- package/dist/resources/auth/auth.mjs +1 -1
- package/dist/resources/auth/index.d.mts +1 -1
- package/dist/resources/auth/index.mjs +2 -2
- package/dist/resources/auth/session.d.mts +1 -1
- package/dist/resources/auth/session.mjs +1 -1
- package/dist/resources/auth-configs.d.mts +1 -1
- package/dist/resources/auth-configs.mjs +1 -1
- package/dist/resources/auth.d.mts +1 -1
- package/dist/resources/auth.mjs +2 -2
- package/dist/resources/cli/cli.d.mts +1 -1
- package/dist/resources/cli/cli.mjs +1 -1
- package/dist/resources/cli/index.d.mts +1 -1
- package/dist/resources/cli/index.mjs +2 -2
- package/dist/resources/cli/realtime.d.mts +1 -1
- package/dist/resources/cli/realtime.mjs +1 -1
- package/dist/resources/cli.d.mts +1 -1
- package/dist/resources/cli.mjs +2 -2
- package/dist/resources/connected-accounts.d.mts +1 -1
- package/dist/resources/connected-accounts.mjs +1 -1
- package/dist/resources/custom.d.mts +1 -1
- package/dist/resources/custom.mjs +1 -1
- package/dist/resources/files.d.mts +1 -1
- package/dist/resources/files.mjs +1 -1
- package/dist/resources/index.d.mts +1 -1
- package/dist/resources/index.mjs +13 -13
- package/dist/resources/keyring.d.mts +1 -1
- package/dist/resources/keyring.mjs +1 -1
- package/dist/resources/link.d.mts +1 -1
- package/dist/resources/link.mjs +1 -1
- package/dist/resources/logs/index.d.mts +1 -1
- package/dist/resources/logs/index.mjs +3 -3
- package/dist/resources/logs/logs.d.mts +1 -1
- package/dist/resources/logs/logs.mjs +1 -1
- package/dist/resources/logs/tools.d.mts +1 -1
- package/dist/resources/logs/tools.mjs +1 -1
- package/dist/resources/logs/triggers.d.mts +1 -1
- package/dist/resources/logs/triggers.mjs +1 -1
- package/dist/resources/logs.d.mts +1 -1
- package/dist/resources/logs.mjs +3 -3
- package/dist/resources/mcp/custom.d.mts +1 -1
- package/dist/resources/mcp/custom.mjs +1 -1
- package/dist/resources/mcp/generate.d.mts +1 -1
- package/dist/resources/mcp/generate.mjs +1 -1
- package/dist/resources/mcp/index.d.mts +1 -1
- package/dist/resources/mcp/index.mjs +3 -3
- package/dist/resources/mcp/mcp.d.mts +1 -1
- package/dist/resources/mcp/mcp.mjs +1 -1
- package/dist/resources/mcp.d.mts +1 -1
- package/dist/resources/mcp.mjs +3 -3
- package/dist/resources/org/clanker.d.mts +1 -1
- package/dist/resources/org/clanker.mjs +1 -1
- package/dist/resources/org/consumer/consumer.d.mts +1 -1
- package/dist/resources/org/consumer/consumer.mjs +1 -1
- package/dist/resources/org/consumer/index.d.mts +1 -1
- package/dist/resources/org/consumer/index.mjs +2 -2
- package/dist/resources/org/consumer/project.d.mts +1 -1
- package/dist/resources/org/consumer/project.mjs +1 -1
- package/dist/resources/org/consumer.d.mts +1 -1
- package/dist/resources/org/consumer.mjs +2 -2
- package/dist/resources/org/index.d.mts +1 -1
- package/dist/resources/org/index.mjs +6 -6
- package/dist/resources/org/org.d.mts +1 -1
- package/dist/resources/org/org.mjs +1 -1
- package/dist/resources/org/owner/index.d.mts +1 -1
- package/dist/resources/org/owner/index.mjs +2 -2
- package/dist/resources/org/owner/owner.d.mts +1 -1
- package/dist/resources/org/owner/owner.mjs +1 -1
- package/dist/resources/org/owner/project.d.mts +1 -1
- package/dist/resources/org/owner/project.mjs +1 -1
- package/dist/resources/org/owner.d.mts +1 -1
- package/dist/resources/org/owner.mjs +2 -2
- package/dist/resources/org/project.d.mts +1 -1
- package/dist/resources/org/project.mjs +1 -1
- package/dist/resources/org/usage.d.mts +1 -1
- package/dist/resources/org/usage.mjs +1 -1
- package/dist/resources/org.d.mts +1 -1
- package/dist/resources/org.mjs +6 -6
- package/dist/resources/project/index.d.mts +1 -1
- package/dist/resources/project/index.mjs +1 -1
- package/dist/resources/project/project.d.mts +1 -1
- package/dist/resources/project/project.mjs +1 -1
- package/dist/resources/project/usage.d.mts +1 -1
- package/dist/resources/project/usage.mjs +1 -1
- package/dist/resources/project.d.mts +1 -1
- package/dist/resources/project.mjs +1 -1
- package/dist/resources/session-configs.d.mts +1 -1
- package/dist/resources/session-configs.mjs +1 -1
- package/dist/resources/tool-router/index.d.mts +1 -1
- package/dist/resources/tool-router/index.mjs +2 -2
- package/dist/resources/tool-router/session/files.d.mts +1 -1
- package/dist/resources/tool-router/session/files.mjs +1 -1
- package/dist/resources/tool-router/session/index.d.mts +1 -1
- package/dist/resources/tool-router/session/index.mjs +2 -2
- package/dist/resources/tool-router/session/session.d.mts +1 -1
- package/dist/resources/tool-router/session/session.mjs +1 -1
- package/dist/resources/tool-router/session.d.mts +1 -1
- package/dist/resources/tool-router/session.mjs +2 -2
- package/dist/resources/tool-router/tool-router.d.mts +1 -1
- package/dist/resources/tool-router/tool-router.mjs +1 -1
- package/dist/resources/tool-router.d.mts +1 -1
- package/dist/resources/tool-router.mjs +2 -2
- package/dist/resources/toolkits.d.mts +1 -1
- package/dist/resources/toolkits.mjs +1 -1
- package/dist/resources/tools.d.mts +1 -1
- package/dist/resources/tools.mjs +1 -1
- package/dist/resources/trigger-instances/index.d.mts +1 -1
- package/dist/resources/trigger-instances/index.mjs +2 -2
- package/dist/resources/trigger-instances/manage.d.mts +1 -1
- package/dist/resources/trigger-instances/manage.mjs +1 -1
- package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
- package/dist/resources/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances.mjs +2 -2
- package/dist/resources/triggers-types.d.mts +1 -1
- package/dist/resources/triggers-types.mjs +1 -1
- package/dist/resources/webhook-endpoints.d.mts +1 -1
- package/dist/resources/webhook-endpoints.mjs +1 -1
- package/dist/resources/webhook-subscriptions.d.mts +1 -1
- package/dist/resources/webhook-subscriptions.mjs +1 -1
- package/dist/{session-BUYbl8BA.mjs → session-BmNXoUzp.mjs} +3 -3
- package/dist/{session-DfISYrbs.mjs → session-Dr2pfpgr.mjs} +2 -3
- package/dist/{session-configs-CipRvstF.d.mts → session-configs-BCEkl1E-.d.mts} +67 -67
- package/dist/{tool-router-DJQ12uhs.mjs → tool-router-DUl_FyWW.mjs} +1 -1
- package/dist/{toolkits-CbdyRtvr.mjs → toolkits-NqNU3W0c.mjs} +2 -2
- package/dist/{tools-a29E_8La.mjs → tools-N4xcs_0a.mjs} +1 -1
- package/dist/{tools-DiH6dAto.mjs → tools-tclheOeG.mjs} +2 -2
- package/dist/{trigger-instances-Bg0n7X-d.mjs → trigger-instances-93_0xLWQ.mjs} +2 -2
- package/dist/{triggers-BoSFNGss.mjs → triggers-AZd9nfc9.mjs} +1 -1
- package/dist/{triggers-types-BPtTEwUA.mjs → triggers-types-Cop2FUpI.mjs} +1 -1
- package/dist/{usage-Cs10eWCd.mjs → usage-CGagRqsM.mjs} +2 -2
- package/dist/{usage-CHVyZ3tm.mjs → usage-CrsH3XJs.mjs} +2 -2
- package/dist/version-CVZVY0oU.d.mts +4 -0
- package/dist/{webhook-endpoints-B4lZc5YC.mjs → webhook-endpoints-B2b3GF14.mjs} +2 -3
- package/dist/{webhook-subscriptions-DJTSJd6K.mjs → webhook-subscriptions-CSP2_-0w.mjs} +2 -2
- package/package.json +27 -5
package/dist/effect.mjs
ADDED
|
@@ -0,0 +1,1572 @@
|
|
|
1
|
+
import { h as makeAPIErrorMessage, m as errorDetails, s as ComposioError } from "./error-D9cG225M.mjs";
|
|
2
|
+
import { A as resolveHTTPURL, C as inspectDeprecation, D as callerPlacedCredential, E as assertCredentialTransport, M as mergeHeaders, O as carriesCredentials, S as inspectDeprecatedInputs, T as SCHEME_HEADERS, _ as schemeForRequest, a as TOO_MANY_REDIRECTS, c as buildURL, d as path, f as printableURL, g as safeJSON, h as rewriteForRedirect, i as REDIRECT_STATUSES, j as buildHeaders, k as parseHTTPURL, m as retryDelayMillis, n as generatedOperation, o as buildBody, r as OPAQUE_REDIRECT, s as buildRequestHeaders, t as GENERATED_OPERATIONS, v as shouldRetryResponse, w as matchOperation, x as VERSION, y as validatePositiveInteger } from "./generated-operations-CtVNMBUj.mjs";
|
|
3
|
+
import { r as classifySuccessBody, t as GENERATED_DEPRECATED_INPUTS } from "./generated-deprecated-inputs-LDMdNcg5.mjs";
|
|
4
|
+
import { i as standardNextCursor, n as assertPageItems, r as isFinalCursor, t as assertCursorAdvanced } from "./pagination-rules-uMUdPq_7.mjs";
|
|
5
|
+
import { Config, Context, Data, Effect, Exit, Layer, Match, Option, Predicate, Redacted, Result, Stream, Tracer } from "effect";
|
|
6
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
7
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
8
|
+
import * as Headers from "effect/http/Headers";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as HttpBody from "effect/http/HttpBody";
|
|
11
|
+
import { StatusCodeError, isHttpClientError } from "effect/http/HttpClientError";
|
|
12
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
13
|
+
import * as UrlParams from "effect/http/UrlParams";
|
|
14
|
+
|
|
15
|
+
//#region src/effect/credentials.ts
|
|
16
|
+
/**
|
|
17
|
+
* How the Effect kernel holds credentials, and how it keeps them out of what
|
|
18
|
+
* the transport records.
|
|
19
|
+
*
|
|
20
|
+
* Which credential a request carries, and where it may go, is decided by the
|
|
21
|
+
* compat kernel's own functions (`../compat/credentials.ts`); nothing here
|
|
22
|
+
* restates a rule. What is specific to this surface is the wrapping — a
|
|
23
|
+
* credential is a `Redacted` for as long as the client holds it — and Effect's
|
|
24
|
+
* redaction list, which knows `x-api-key` and not the other two schemes.
|
|
25
|
+
*/
|
|
26
|
+
const reveal = (credential) => credential === null ? null : Redacted.value(credential);
|
|
27
|
+
/** The credentials in the plain form the compat functions take. Never stored. */
|
|
28
|
+
const revealCredentials = (held) => ({
|
|
29
|
+
apiKey: reveal(held.apiKey),
|
|
30
|
+
userApiKey: reveal(held.userApiKey),
|
|
31
|
+
orgApiKey: reveal(held.orgApiKey)
|
|
32
|
+
});
|
|
33
|
+
const OPTION_HEADERS = {
|
|
34
|
+
apiKey: SCHEME_HEADERS.ApiKeyAuth,
|
|
35
|
+
userApiKey: SCHEME_HEADERS.UserApiKeyAuth,
|
|
36
|
+
orgApiKey: SCHEME_HEADERS.OrgApiKeyAuth
|
|
37
|
+
};
|
|
38
|
+
const CREDENTIAL_OPTIONS = Object.keys(OPTION_HEADERS);
|
|
39
|
+
/** Whether the platform's `Headers` takes `value` under `name`. Its refusal quotes the value, so it stays here. */
|
|
40
|
+
const isSendable = (name, value) => {
|
|
41
|
+
try {
|
|
42
|
+
new globalThis.Headers().set(name, value);
|
|
43
|
+
return true;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The option naming a credential no header can carry (an interior CR, LF or
|
|
50
|
+
* NUL, or a character outside Latin-1), or `undefined` when all of them can be
|
|
51
|
+
* sent. The answer is the option's name and never the value.
|
|
52
|
+
*/
|
|
53
|
+
const unsendableCredential = (held) => CREDENTIAL_OPTIONS.find((option) => {
|
|
54
|
+
const credential = held[option];
|
|
55
|
+
return credential !== null && !isSendable(OPTION_HEADERS[option], Redacted.value(credential));
|
|
56
|
+
});
|
|
57
|
+
const CREDENTIAL_HEADER_NAMES = Object.values(SCHEME_HEADERS);
|
|
58
|
+
/** The extended list for each list seen, so a request does not rebuild it. */
|
|
59
|
+
const extended = /* @__PURE__ */ new WeakMap();
|
|
60
|
+
/**
|
|
61
|
+
* Effect's redaction list with every credential header name on it, so a span
|
|
62
|
+
* attribute or a rendering of the request made while the transport handles it
|
|
63
|
+
* shows `<redacted>` for all three.
|
|
64
|
+
*
|
|
65
|
+
* The list in context is extended, not replaced: an application that added
|
|
66
|
+
* names of its own keeps them.
|
|
67
|
+
*/
|
|
68
|
+
const withCredentialHeaderNames = (names) => {
|
|
69
|
+
const known = extended.get(names);
|
|
70
|
+
if (known !== void 0) return known;
|
|
71
|
+
const all = [...names, ...CREDENTIAL_HEADER_NAMES.filter((name) => !Headers.isRedactedName(name, names))];
|
|
72
|
+
extended.set(names, all);
|
|
73
|
+
return all;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/effect/errors.ts
|
|
78
|
+
/**
|
|
79
|
+
* The failure model of the Effect surface: flat tagged errors, one per status
|
|
80
|
+
* class the compat client distinguishes, plus the failures that have no HTTP
|
|
81
|
+
* status at all.
|
|
82
|
+
*
|
|
83
|
+
* Every error is built with `Data.TaggedError`, so recovery is
|
|
84
|
+
* `Effect.catchTag` on a tag rather than a walk through a cause chain, and no
|
|
85
|
+
* Schema module is evaluated to construct one.
|
|
86
|
+
*
|
|
87
|
+
* What an error value may hold is deliberately narrow. It names the request by
|
|
88
|
+
* its method and a label built from the operation template — never the
|
|
89
|
+
* `HttpClientRequest`, whose headers carry the credential, and never the
|
|
90
|
+
* transport's own error, which holds that request. A success body is where
|
|
91
|
+
* this API returns secrets, so the decode error carries where and what kind,
|
|
92
|
+
* not the body.
|
|
93
|
+
*/
|
|
94
|
+
var BadRequestError = class extends Data.TaggedError("@composio/client/BadRequestError") {};
|
|
95
|
+
var AuthenticationError = class extends Data.TaggedError("@composio/client/AuthenticationError") {};
|
|
96
|
+
var PermissionDeniedError = class extends Data.TaggedError("@composio/client/PermissionDeniedError") {};
|
|
97
|
+
var NotFoundError = class extends Data.TaggedError("@composio/client/NotFoundError") {};
|
|
98
|
+
var ConflictError = class extends Data.TaggedError("@composio/client/ConflictError") {};
|
|
99
|
+
var UnprocessableEntityError = class extends Data.TaggedError("@composio/client/UnprocessableEntityError") {};
|
|
100
|
+
var RateLimitError = class extends Data.TaggedError("@composio/client/RateLimitError") {};
|
|
101
|
+
/** Any status of 500 and above. */
|
|
102
|
+
var InternalServerError = class extends Data.TaggedError("@composio/client/InternalServerError") {};
|
|
103
|
+
/** A non-success status none of the other classes names. */
|
|
104
|
+
var APIError = class extends Data.TaggedError("@composio/client/APIError") {};
|
|
105
|
+
/**
|
|
106
|
+
* The request never produced a response: the transport failed below HTTP.
|
|
107
|
+
*
|
|
108
|
+
* The transport's error is reduced to `reason` (which of its failure kinds it
|
|
109
|
+
* was) and `description` (its own text, or its cause's messages).
|
|
110
|
+
*/
|
|
111
|
+
var APIConnectionError = class extends Data.TaggedError("@composio/client/APIConnectionError") {};
|
|
112
|
+
/** An attempt outlived its time budget. */
|
|
113
|
+
var APIConnectionTimeoutError = class extends Data.TaggedError("@composio/client/APIConnectionTimeoutError") {};
|
|
114
|
+
/** A success response whose body is not what it claims to be. */
|
|
115
|
+
var DecodeError = class extends Data.TaggedError("@composio/client/DecodeError") {};
|
|
116
|
+
/**
|
|
117
|
+
* The client or the call is set up in a way no request can be made from: a
|
|
118
|
+
* credentialed origin that cannot carry a credential, a path parameter that
|
|
119
|
+
* would rewrite the path, a body that does not serialize. Retrying cannot
|
|
120
|
+
* change the answer.
|
|
121
|
+
*/
|
|
122
|
+
var ConfigurationError = class extends Data.TaggedError("@composio/client/ConfigurationError") {};
|
|
123
|
+
/** What a caller is told when a request could not be built and the reason is not the kernel's own to give. */
|
|
124
|
+
const UNBUILDABLE = "The request could not be built: a header value, the URL or the body is not valid.";
|
|
125
|
+
/**
|
|
126
|
+
* Whatever a setup step threw, as a {@link ConfigurationError}.
|
|
127
|
+
*
|
|
128
|
+
* The message is copied only from an error the kernel itself raised: a
|
|
129
|
+
* rejected path parameter or option, an origin that cannot carry a credential,
|
|
130
|
+
* a pagination rule. Anything else comes from the platform or from the
|
|
131
|
+
* caller's own objects, and its text is not this client's to repeat. The
|
|
132
|
+
* platform's `Headers` quotes the value it refuses, and that value can be a
|
|
133
|
+
* credential.
|
|
134
|
+
*/
|
|
135
|
+
const configurationErrorFrom = (cause) => new ConfigurationError({ message: cause instanceof ComposioError ? cause.message : UNBUILDABLE });
|
|
136
|
+
/** The status mapping of the compat client's `APIError.generate`. */
|
|
137
|
+
const apiErrorFromResponse = (fields) => {
|
|
138
|
+
const { status } = fields;
|
|
139
|
+
if (status === 400) return new BadRequestError(fields);
|
|
140
|
+
if (status === 401) return new AuthenticationError(fields);
|
|
141
|
+
if (status === 403) return new PermissionDeniedError(fields);
|
|
142
|
+
if (status === 404) return new NotFoundError(fields);
|
|
143
|
+
if (status === 409) return new ConflictError(fields);
|
|
144
|
+
if (status === 422) return new UnprocessableEntityError(fields);
|
|
145
|
+
if (status === 429) return new RateLimitError(fields);
|
|
146
|
+
if (status >= 500) return new InternalServerError(fields);
|
|
147
|
+
return new APIError(fields);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Every tag this surface fails with, and whether it is a status class. Typed
|
|
151
|
+
* against the union, so an error class added to it and not here does not compile.
|
|
152
|
+
*/
|
|
153
|
+
const TAG_KINDS = {
|
|
154
|
+
"@composio/client/BadRequestError": "status",
|
|
155
|
+
"@composio/client/AuthenticationError": "status",
|
|
156
|
+
"@composio/client/PermissionDeniedError": "status",
|
|
157
|
+
"@composio/client/NotFoundError": "status",
|
|
158
|
+
"@composio/client/ConflictError": "status",
|
|
159
|
+
"@composio/client/UnprocessableEntityError": "status",
|
|
160
|
+
"@composio/client/RateLimitError": "status",
|
|
161
|
+
"@composio/client/InternalServerError": "status",
|
|
162
|
+
"@composio/client/APIError": "status",
|
|
163
|
+
"@composio/client/APIConnectionError": "other",
|
|
164
|
+
"@composio/client/APIConnectionTimeoutError": "other",
|
|
165
|
+
"@composio/client/DecodeError": "other",
|
|
166
|
+
"@composio/client/ConfigurationError": "other"
|
|
167
|
+
};
|
|
168
|
+
const tagOf = (value) => Predicate.hasProperty(value, "_tag") && typeof value._tag === "string" ? value._tag : void 0;
|
|
169
|
+
const kindOf = (value) => {
|
|
170
|
+
const tag = tagOf(value);
|
|
171
|
+
return tag !== void 0 && Object.hasOwn(TAG_KINDS, tag) ? TAG_KINDS[tag] : void 0;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Whether a value is an error for a non-success HTTP response, of any status
|
|
175
|
+
* class. Structural, so it holds across duplicated copies of this module.
|
|
176
|
+
*/
|
|
177
|
+
const isAPIError = (value) => kindOf(value) === "status";
|
|
178
|
+
/** Whether a value is any error this surface produces. Structural, like {@link isAPIError}. */
|
|
179
|
+
const isComposioError = (value) => kindOf(value) !== void 0;
|
|
180
|
+
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/effect/decode.ts
|
|
183
|
+
/**
|
|
184
|
+
* Opt-in response validation: a success body checked against the operation's
|
|
185
|
+
* generated schema.
|
|
186
|
+
*
|
|
187
|
+
* Decoding is off unless a call or the client asks for it, and the schemas are
|
|
188
|
+
* not this module's to find. They arrive as a loader table the caller imports
|
|
189
|
+
* from `@composio/client/effect/schemas` and hands to the client, one dynamic
|
|
190
|
+
* `import()` per operation. Nothing the default entry reaches names that table
|
|
191
|
+
* or a schema module, so a client that never decodes never evaluates one, and
|
|
192
|
+
* a bundle of an application that never imports the table contains none.
|
|
193
|
+
*
|
|
194
|
+
* A schema here is a validator, not a parser. The caller gets the body exactly
|
|
195
|
+
* as it was parsed — a field the API returns ahead of the spec is not
|
|
196
|
+
* stripped — and this module's only answer is what, if anything, is wrong with
|
|
197
|
+
* it: where, and what kind of problem. Never the value found there, and never
|
|
198
|
+
* Effect's own rendering of the failure, which quotes it; a success body is
|
|
199
|
+
* where this API returns secrets.
|
|
200
|
+
*/
|
|
201
|
+
/** What a client or a call that asks for decoding is told when no table was supplied. */
|
|
202
|
+
const SCHEMAS_MISSING = "Decoding needs the response schemas, and this client was given none: import { schemaLoaders } from '@composio/client/effect/schemas' and pass it as the `schemas` option.";
|
|
203
|
+
/** The same configuration message before dispatch and after a failed dynamic import. */
|
|
204
|
+
const schemaUnavailableMessage = (key) => `The response schema of '${key}' could not be loaded.`;
|
|
205
|
+
const segment = (key) => typeof key === "symbol" ? String(key) : key;
|
|
206
|
+
/**
|
|
207
|
+
* The leaves of an issue tree, each with the path the tree led to it by. The
|
|
208
|
+
* leaf's kind is its tag: `MissingKey`, `InvalidType`, `InvalidValue`, …
|
|
209
|
+
*/
|
|
210
|
+
const leaves = (issue, path) => {
|
|
211
|
+
const leaf = ({ _tag }) => [{
|
|
212
|
+
path,
|
|
213
|
+
kind: _tag
|
|
214
|
+
}];
|
|
215
|
+
return Match.valueTags(issue, {
|
|
216
|
+
Pointer: (pointer) => leaves(pointer.issue, [...path, ...pointer.path.map(segment)]),
|
|
217
|
+
Composite: (composite) => composite.issues.flatMap((child) => leaves(child, path)),
|
|
218
|
+
AnyOf: (anyOf) => anyOf.issues.length === 0 ? leaf(anyOf) : anyOf.issues.flatMap((child) => leaves(child, path)),
|
|
219
|
+
Filter: (filter) => leaves(filter.issue, path),
|
|
220
|
+
Encoding: (encoding) => leaves(encoding.issue, path),
|
|
221
|
+
InvalidType: leaf,
|
|
222
|
+
InvalidValue: leaf,
|
|
223
|
+
MissingKey: leaf,
|
|
224
|
+
UnexpectedKey: leaf,
|
|
225
|
+
Forbidden: leaf,
|
|
226
|
+
OneOf: leaf
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
/** A union reports a problem once per member it tried; one mention of each is enough. */
|
|
230
|
+
const distinct = (issues) => [...new Map(issues.map((issue) => [JSON.stringify([issue.path, issue.kind]), issue])).values()];
|
|
231
|
+
/** What is wrong with `body` as a value of `schema`; empty when nothing is. */
|
|
232
|
+
const issuesOf = (schema, body) => {
|
|
233
|
+
const result = Schema.decodeUnknownResult(schema, { errors: "all" })(body);
|
|
234
|
+
return Result.isFailure(result) ? distinct(leaves(result.failure.issue, [])) : [];
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Validates a success body against the response schema of the operation
|
|
238
|
+
* `key` names (`toolkits.list`), loading the schema from `loaders` first.
|
|
239
|
+
* Succeeds with the issues found, empty for a body that is what the spec says.
|
|
240
|
+
*
|
|
241
|
+
* A schema that cannot be loaded is a broken installation — a bundle that left
|
|
242
|
+
* the module out — and no request would change that.
|
|
243
|
+
*/
|
|
244
|
+
const responseIssues = (loaders, key, body) => {
|
|
245
|
+
const unavailable = () => new ConfigurationError({ message: schemaUnavailableMessage(key) });
|
|
246
|
+
const load = loaders[key];
|
|
247
|
+
if (load === void 0) return Effect.fail(unavailable());
|
|
248
|
+
return Effect.map(Effect.tryPromise({
|
|
249
|
+
try: load,
|
|
250
|
+
catch: unavailable
|
|
251
|
+
}), (schema) => issuesOf(schema, body));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/effect/deprecation.ts
|
|
256
|
+
/**
|
|
257
|
+
* Deprecation notices on the Effect surface.
|
|
258
|
+
*
|
|
259
|
+
* Deciding that a notice exists, wording it, and remembering that it was
|
|
260
|
+
* already given are the compat module's functions (`../compat/deprecation.ts`),
|
|
261
|
+
* called here with the same tables. This module owns only the way out: a
|
|
262
|
+
* notice is a `Warn` record on Effect's logger, so the application's logger
|
|
263
|
+
* and minimum log level decide what becomes of it.
|
|
264
|
+
*/
|
|
265
|
+
const makeNoticeRecord = (mode) => ({
|
|
266
|
+
mode: mode ?? "warn",
|
|
267
|
+
seen: /* @__PURE__ */ new Set()
|
|
268
|
+
});
|
|
269
|
+
/** The compat inspectors report through a callback; this collects what one of them said. */
|
|
270
|
+
const warnings = (inspect) => {
|
|
271
|
+
const messages = [];
|
|
272
|
+
inspect((message) => messages.push(message));
|
|
273
|
+
return messages.length === 0 ? Effect.void : Effect.forEach(messages, (message) => Effect.logWarning(message), { discard: true });
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* The notice for inputs the spec marks deprecated, decided from the request
|
|
277
|
+
* alone — so it is given before dispatch, whatever the transport then does.
|
|
278
|
+
*/
|
|
279
|
+
const noticeDeprecatedInputs = (record, input) => record.mode === "off" || input.operation === null ? Effect.void : Effect.suspend(() => warnings((warn) => inspectDeprecatedInputs({
|
|
280
|
+
operation: input.operation,
|
|
281
|
+
query: input.query,
|
|
282
|
+
body: input.body,
|
|
283
|
+
headers: input.headers(),
|
|
284
|
+
table: GENERATED_DEPRECATED_INPUTS,
|
|
285
|
+
seen: record.seen,
|
|
286
|
+
warn
|
|
287
|
+
})));
|
|
288
|
+
/**
|
|
289
|
+
* The notice a response carries in its `Deprecation`, `Sunset` and `Link`
|
|
290
|
+
* fields. Given for the response a call ends with, never for one that is
|
|
291
|
+
* discarded and retried or for a hop of a redirect chain.
|
|
292
|
+
*/
|
|
293
|
+
const noticeDeprecatedResponse = (record, input) => record.mode === "off" || input.headers["deprecation"] === void 0 ? Effect.void : Effect.suspend(() => warnings((warn) => inspectDeprecation({
|
|
294
|
+
response: {
|
|
295
|
+
headers: new globalThis.Headers(input.headers),
|
|
296
|
+
url: input.url
|
|
297
|
+
},
|
|
298
|
+
method: input.method,
|
|
299
|
+
path: input.path,
|
|
300
|
+
operation: input.operation ?? void 0,
|
|
301
|
+
baseURL: input.baseURL,
|
|
302
|
+
operations: GENERATED_OPERATIONS,
|
|
303
|
+
seen: record.seen,
|
|
304
|
+
warn
|
|
305
|
+
})));
|
|
306
|
+
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/effect/pagination.ts
|
|
309
|
+
/**
|
|
310
|
+
* Cursor pagination as a `Stream`: the items of a standard `items` /
|
|
311
|
+
* `next_cursor` operation, one page requested at a time and only when the
|
|
312
|
+
* stream is pulled that far, so a consumer that stops — or is interrupted —
|
|
313
|
+
* causes no further request.
|
|
314
|
+
*
|
|
315
|
+
* The cursor rules are the ones `./pagination` traverses by, called rather
|
|
316
|
+
* than restated: an absent, null or empty `next_cursor` ends the stream, a
|
|
317
|
+
* cursor the server repeats fails it, and so does a page-number envelope that
|
|
318
|
+
* leaves `next_cursor` out before its last page.
|
|
319
|
+
*/
|
|
320
|
+
/**
|
|
321
|
+
* One page's items and the position after it, or the reason the traversal
|
|
322
|
+
* cannot go on. No request would change that reason, so it is a
|
|
323
|
+
* {@link ConfigurationError} carrying the message `./pagination` throws.
|
|
324
|
+
*/
|
|
325
|
+
const advance = (page, seen) => Result.try({
|
|
326
|
+
try: () => {
|
|
327
|
+
const items = page.items;
|
|
328
|
+
assertPageItems(items);
|
|
329
|
+
const cursor = standardNextCursor(page);
|
|
330
|
+
if (isFinalCursor(cursor)) return [items, Option.none()];
|
|
331
|
+
assertCursorAdvanced(seen, cursor);
|
|
332
|
+
seen.add(cursor);
|
|
333
|
+
return [items, Option.some(cursor)];
|
|
334
|
+
},
|
|
335
|
+
catch: configurationErrorFrom
|
|
336
|
+
});
|
|
337
|
+
/**
|
|
338
|
+
* The items of every page `fetchPage` returns, in order. `fetchPage` is first
|
|
339
|
+
* called with no cursor, then with each `next_cursor` in turn.
|
|
340
|
+
*/
|
|
341
|
+
const cursorStream = (fetchPage) => Stream.suspend(() => {
|
|
342
|
+
const seen = /* @__PURE__ */ new Set();
|
|
343
|
+
return Stream.paginate(void 0, (cursor) => Effect.flatMap(fetchPage(cursor), (page) => Effect.fromResult(advance(page, seen))));
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/effect/request.ts
|
|
348
|
+
/**
|
|
349
|
+
* The Effect kernel's request path: an operation and its arguments in, an
|
|
350
|
+
* `Effect` of the parsed response out.
|
|
351
|
+
*
|
|
352
|
+
* Everything that decides *what* is sent — the URL, the query string, the
|
|
353
|
+
* body, the header precedence, which credential a request carries — is the
|
|
354
|
+
* compat kernel's own function, called here rather than restated, so the two
|
|
355
|
+
* surfaces cannot drift apart on the wire. This module owns only what differs:
|
|
356
|
+
* the transport is Effect's `HttpClient`, and failures are values.
|
|
357
|
+
*/
|
|
358
|
+
const PLACEHOLDER = /\{[^}]+\}/;
|
|
359
|
+
/** An operation's public chain, dotted: the key its schema is loaded by and the name a `DecodeError` gives it. */
|
|
360
|
+
const operationKey = (operation) => operation?.chain.join(".");
|
|
361
|
+
/**
|
|
362
|
+
* A template's parameters filled in through the compat `path` tag, so encoding
|
|
363
|
+
* and the rejection of `.`/`..` segments are that function's and not a copy.
|
|
364
|
+
*/
|
|
365
|
+
const substitute = (template, params) => {
|
|
366
|
+
const statics = template.split(PLACEHOLDER);
|
|
367
|
+
return path(Object.assign(statics, { raw: statics }), ...params);
|
|
368
|
+
};
|
|
369
|
+
const hopHeaders = (prepared, hop) => buildRequestHeaders(prepared.headerConfig, { headers: prepared.callHeaders }, hop.url, hop.bodyHeaders, hop.withdrawn, prepared.scheme, prepared.callerPlaced);
|
|
370
|
+
const prepare = (kernel, call) => {
|
|
371
|
+
const callHeaders = call.headers();
|
|
372
|
+
const path = call.path();
|
|
373
|
+
if (call.options?.timeout !== void 0) validatePositiveInteger("timeout", call.options.timeout);
|
|
374
|
+
const maxRetries = call.options?.maxRetries ?? kernel.maxRetries;
|
|
375
|
+
validatePositiveInteger("maxRetries", maxRetries);
|
|
376
|
+
const decode = call.options?.decode ?? kernel.decode;
|
|
377
|
+
if (decode) {
|
|
378
|
+
if (kernel.schemas === void 0) throw new ComposioError(SCHEMAS_MISSING);
|
|
379
|
+
const operation = operationKey(call.operation);
|
|
380
|
+
if (operation !== void 0 && kernel.schemas[operation] === void 0) throw new ComposioError(schemaUnavailableMessage(operation));
|
|
381
|
+
}
|
|
382
|
+
const { url, query } = buildURL(kernel, {
|
|
383
|
+
path,
|
|
384
|
+
query: call.query
|
|
385
|
+
});
|
|
386
|
+
const { body, bodyHeaders } = buildBody({ body: call.body });
|
|
387
|
+
const credentials = revealCredentials(kernel);
|
|
388
|
+
const shared = {
|
|
389
|
+
method: call.method,
|
|
390
|
+
path,
|
|
391
|
+
label: printableURL(url, call.operation),
|
|
392
|
+
operation: call.operation,
|
|
393
|
+
query,
|
|
394
|
+
headerConfig: {
|
|
395
|
+
baseURL: kernel.baseURL,
|
|
396
|
+
credentials,
|
|
397
|
+
allowedHTTPOrigin: kernel.allowedHTTPOrigin,
|
|
398
|
+
userAgent: kernel.userAgent,
|
|
399
|
+
defaultHeaders: kernel.defaultHeaders
|
|
400
|
+
},
|
|
401
|
+
callHeaders,
|
|
402
|
+
scheme: schemeForRequest({ credentials }, call.operation),
|
|
403
|
+
callerPlaced: callerPlacedCredential([kernel.defaultHeaders, callHeaders]),
|
|
404
|
+
maxRetries,
|
|
405
|
+
timeout: call.options?.timeout ?? kernel.timeout,
|
|
406
|
+
schemas: decode ? kernel.schemas : void 0
|
|
407
|
+
};
|
|
408
|
+
const first = {
|
|
409
|
+
url,
|
|
410
|
+
method: call.method.toUpperCase(),
|
|
411
|
+
body,
|
|
412
|
+
bodyHeaders,
|
|
413
|
+
withdrawn: false,
|
|
414
|
+
index: 0
|
|
415
|
+
};
|
|
416
|
+
return {
|
|
417
|
+
...shared,
|
|
418
|
+
first: {
|
|
419
|
+
...first,
|
|
420
|
+
headers: hopHeaders(shared, first)
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Built from its parts rather than through `HttpClientRequest.make`: the URL
|
|
426
|
+
* already carries its query, serialized by the compat rules, and must reach
|
|
427
|
+
* the transport as that exact string. The body goes out as the same JSON text
|
|
428
|
+
* the compat client hands `fetch`.
|
|
429
|
+
*/
|
|
430
|
+
const toRequest = (hop) => HttpClientRequest.makeWith(hop.method, hop.url, UrlParams.empty, Option.none(), Headers.fromInput(hop.headers), hop.body === void 0 ? HttpBody.empty : HttpBody.raw(hop.body, { contentType: "application/json" }));
|
|
431
|
+
/** A transport cause's own words, following `cause` a few levels down. */
|
|
432
|
+
const describeCause = (cause, depth = 0) => {
|
|
433
|
+
if (typeof cause === "string") return cause;
|
|
434
|
+
if (typeof cause !== "object" || cause === null) return void 0;
|
|
435
|
+
const message = "message" in cause && typeof cause.message === "string" ? cause.message : void 0;
|
|
436
|
+
const nested = depth < 3 && "cause" in cause ? describeCause(cause.cause, depth + 1) : void 0;
|
|
437
|
+
if (message === void 0 || message === "") return nested;
|
|
438
|
+
return nested === void 0 || nested === "" ? message : `${message}: ${nested}`;
|
|
439
|
+
};
|
|
440
|
+
/** The transport's error reduced to text; the error itself holds the request. */
|
|
441
|
+
const describeTransport = (error) => error.reason.description ?? describeCause(error.reason.cause);
|
|
442
|
+
const connectionError = (prepared, error) => new APIConnectionError({
|
|
443
|
+
message: "Connection error.",
|
|
444
|
+
method: prepared.first.method,
|
|
445
|
+
url: prepared.label,
|
|
446
|
+
reason: error.reason._tag,
|
|
447
|
+
description: describeTransport(error)
|
|
448
|
+
});
|
|
449
|
+
const timeoutError = (prepared) => new APIConnectionTimeoutError({
|
|
450
|
+
message: "Request timed out.",
|
|
451
|
+
method: prepared.first.method,
|
|
452
|
+
url: prepared.label
|
|
453
|
+
});
|
|
454
|
+
const terminal = (error) => ({
|
|
455
|
+
error,
|
|
456
|
+
retryable: false
|
|
457
|
+
});
|
|
458
|
+
const refusedChain = (prepared, reason, message) => terminal(new APIConnectionError({
|
|
459
|
+
message,
|
|
460
|
+
method: prepared.first.method,
|
|
461
|
+
url: prepared.label,
|
|
462
|
+
reason,
|
|
463
|
+
description: void 0
|
|
464
|
+
}));
|
|
465
|
+
/** The compat kernel reads a transport failure that says it timed out as a timeout; so does this one. */
|
|
466
|
+
const TIMED_OUT = /timed? ?out/i;
|
|
467
|
+
const transportFailure = (prepared, error) => {
|
|
468
|
+
const failed = connectionError(prepared, error);
|
|
469
|
+
return {
|
|
470
|
+
error: TIMED_OUT.test(failed.description ?? "") ? timeoutError(prepared) : failed,
|
|
471
|
+
retryable: true
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
const untraced = () => true;
|
|
475
|
+
/**
|
|
476
|
+
* What a span of this request may end on in place of the transport's error.
|
|
477
|
+
*
|
|
478
|
+
* Effect ends a client span on an `HttpClientError` — for a failure below
|
|
479
|
+
* HTTP, and for a 4xx or 5xx answer too, which it marks failed with one it
|
|
480
|
+
* builds itself. That error holds the request, credential headers and all, and
|
|
481
|
+
* a tracer keeps it past the scope the redaction list is extended in. The span
|
|
482
|
+
* gets the error this client would fail with instead, as far as it is known
|
|
483
|
+
* when the span ends: the status class, before the body is read.
|
|
484
|
+
*/
|
|
485
|
+
const spanError = (prepared, error) => {
|
|
486
|
+
if (!isHttpClientError(error)) return error;
|
|
487
|
+
const response = error.response;
|
|
488
|
+
if (response === void 0 || response.status < 400) return transportFailure(prepared, error).error;
|
|
489
|
+
return apiErrorFromResponse({
|
|
490
|
+
message: makeAPIErrorMessage(response.status, void 0, void 0),
|
|
491
|
+
method: prepared.first.method,
|
|
492
|
+
url: prepared.label,
|
|
493
|
+
status: response.status,
|
|
494
|
+
requestId: requestIdOf(response),
|
|
495
|
+
details: void 0,
|
|
496
|
+
body: void 0
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* The tracer in context, with every span it opens for this request using only
|
|
501
|
+
* the operation template in URL attributes and ending on {@link spanError}.
|
|
502
|
+
* The span is the tracer's own object, changed in place:
|
|
503
|
+
* a tracer recognizes its spans by identity, which a wrapper would not have.
|
|
504
|
+
*/
|
|
505
|
+
const guardingSpans = (prepared) => (tracer) => Tracer.make({
|
|
506
|
+
span: (options) => {
|
|
507
|
+
const span = tracer.span(options);
|
|
508
|
+
const attribute = span.attribute.bind(span);
|
|
509
|
+
span.attribute = (key, value) => {
|
|
510
|
+
if (key === "url.full") return attribute(key, prepared.label);
|
|
511
|
+
if (key === "url.path") return attribute(key, prepared.operation?.path ?? "/<custom>");
|
|
512
|
+
if (key === "url.query") return;
|
|
513
|
+
attribute(key, value);
|
|
514
|
+
};
|
|
515
|
+
const end = span.end.bind(span);
|
|
516
|
+
span.end = (endTime, exit) => {
|
|
517
|
+
end(endTime, Exit.mapError(exit, (error) => spanError(prepared, error)));
|
|
518
|
+
};
|
|
519
|
+
return span;
|
|
520
|
+
},
|
|
521
|
+
context: tracer.context?.bind(tracer)
|
|
522
|
+
});
|
|
523
|
+
/**
|
|
524
|
+
* One exchange with the transport: a hop in, a response or a failure out.
|
|
525
|
+
*
|
|
526
|
+
* This is the single point every request crosses, and where the client's own
|
|
527
|
+
* configuration is laid over whatever `HttpClient` it was given: the redirect
|
|
528
|
+
* mode a fetch-backed transport dispatches in, the tracing mode, and the
|
|
529
|
+
* credential header names on the redaction list. The application's
|
|
530
|
+
* `RequestInit` is kept except for `redirect`, which is the kernel's — a
|
|
531
|
+
* transport that followed a credentialed request on its own would forward the
|
|
532
|
+
* credential across origins.
|
|
533
|
+
*
|
|
534
|
+
* All of it is one edit of the context, each value read from the context the
|
|
535
|
+
* call runs in.
|
|
536
|
+
*/
|
|
537
|
+
const exchange = (kernel, prepared, hop, redirect) => Effect.suspend(() => kernel.httpClient.execute(toRequest(hop))).pipe(Effect.updateContext((context) => {
|
|
538
|
+
const overlay = Context.empty().pipe(Context.add(FetchHttpClient.RequestInit, {
|
|
539
|
+
...Context.getOrUndefined(context, FetchHttpClient.RequestInit),
|
|
540
|
+
redirect
|
|
541
|
+
}), Context.add(Headers.CurrentRedactedNames, withCredentialHeaderNames(Context.get(context, Headers.CurrentRedactedNames))), kernel.tracing === "off" ? Context.add(HttpClient.TracerDisabledWhen, untraced) : Context.add(Tracer.Tracer, guardingSpans(prepared)(Context.get(context, Tracer.Tracer))), kernel.tracing === "propagate" ? (self) => self : Context.add(HttpClient.TracerPropagationEnabled, false));
|
|
542
|
+
return Context.merge(context, overlay);
|
|
543
|
+
}), Effect.catch((error) => error.response !== void 0 && error.reason instanceof StatusCodeError ? Effect.succeed(error.response) : Effect.fail(transportFailure(prepared, error))));
|
|
544
|
+
/**
|
|
545
|
+
* Gives up a response the kernel will not read: one it retries past, or a
|
|
546
|
+
* redirect it follows by hand. Left alone, its request is aborted only when
|
|
547
|
+
* the response is garbage-collected, and the connection stays checked out
|
|
548
|
+
* until then.
|
|
549
|
+
*
|
|
550
|
+
* The body is opened and closed without a read, so its size does not matter.
|
|
551
|
+
* Closing it cancels the underlying stream and ends that request, which is
|
|
552
|
+
* the one request this response came from: the next attempt or hop has its
|
|
553
|
+
* own. It happens on a fiber of its own, since the call does not wait for it
|
|
554
|
+
* and nothing that goes wrong in it is the call's failure. A response with no
|
|
555
|
+
* body, or from a transport that has nothing to cancel, loses nothing.
|
|
556
|
+
*/
|
|
557
|
+
const discard = (response) => Effect.asVoid(Effect.forkDetach(Effect.ignoreCause(Effect.suspend(() => Effect.scoped(Stream.toPull(response.stream)))), { startImmediately: true }));
|
|
558
|
+
/**
|
|
559
|
+
* One attempt: the request, plus however many redirects it takes to land on a
|
|
560
|
+
* response that is not one.
|
|
561
|
+
*
|
|
562
|
+
* The loop is the compat kernel's `dispatchWithRedirects`, hop for hop. The
|
|
563
|
+
* headers of every hop are rebuilt from the URL that hop goes to, so a hop
|
|
564
|
+
* off the configured origin carries no credential; once the chain has changed
|
|
565
|
+
* origin the caller's own credential headers are withdrawn too, for the rest
|
|
566
|
+
* of it. The method and body follow fetch's 301/302/303 rewrite.
|
|
567
|
+
*
|
|
568
|
+
* A first dispatch that carries nothing credential-bearing is handed to the
|
|
569
|
+
* platform to follow, as there: nothing can leak, and it is the only way a
|
|
570
|
+
* browser follows at all. Reading a `Location` needs a transport that returns
|
|
571
|
+
* the 3xx itself — a fetch-backed one in `redirect: 'manual'` does, on Node
|
|
572
|
+
* and on Bun.
|
|
573
|
+
*/
|
|
574
|
+
const followChain = (kernel, prepared, hop) => {
|
|
575
|
+
const delegated = hop.index === 0 && !carriesCredentials(hop.headers);
|
|
576
|
+
return Effect.flatMap(exchange(kernel, prepared, hop, delegated ? "follow" : "manual"), (response) => {
|
|
577
|
+
if (delegated) return Effect.succeed(response);
|
|
578
|
+
if (response.status === 0) return Effect.fail(refusedChain(prepared, "OpaqueRedirect", OPAQUE_REDIRECT));
|
|
579
|
+
if (!REDIRECT_STATUSES.has(response.status)) return Effect.succeed(response);
|
|
580
|
+
const location = response.headers["location"];
|
|
581
|
+
if (location === void 0) return Effect.succeed(response);
|
|
582
|
+
const target = resolveHTTPURL(location, hop.url);
|
|
583
|
+
if (target === null) return Effect.succeed(response);
|
|
584
|
+
if (hop.index >= 20) return Effect.andThen(discard(response), Effect.fail(refusedChain(prepared, "TooManyRedirects", TOO_MANY_REDIRECTS)));
|
|
585
|
+
const rewritten = rewriteForRedirect(response.status, hop.method);
|
|
586
|
+
const next = {
|
|
587
|
+
url: target.href,
|
|
588
|
+
method: rewritten ? "GET" : hop.method,
|
|
589
|
+
body: rewritten ? void 0 : hop.body,
|
|
590
|
+
bodyHeaders: rewritten ? void 0 : hop.bodyHeaders,
|
|
591
|
+
withdrawn: hop.withdrawn || target.origin !== new URL(hop.url).origin,
|
|
592
|
+
index: hop.index + 1
|
|
593
|
+
};
|
|
594
|
+
return Effect.andThen(discard(response), Effect.flatMap(Effect.try({
|
|
595
|
+
try: () => ({
|
|
596
|
+
...next,
|
|
597
|
+
headers: hopHeaders(prepared, next)
|
|
598
|
+
}),
|
|
599
|
+
catch: (cause) => terminal(configurationErrorFrom(cause))
|
|
600
|
+
}), (following) => followChain(kernel, prepared, following)));
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* One attempt inside its time budget. The whole redirect chain shares the
|
|
605
|
+
* budget, so a chain cannot multiply it by the hop limit; running out
|
|
606
|
+
* interrupts the exchange in flight, which aborts its request.
|
|
607
|
+
*/
|
|
608
|
+
const attempt = (kernel, prepared) => Effect.timeoutOrElse(followChain(kernel, prepared, prepared.first), {
|
|
609
|
+
duration: prepared.timeout,
|
|
610
|
+
orElse: () => Effect.fail({
|
|
611
|
+
error: timeoutError(prepared),
|
|
612
|
+
retryable: true
|
|
613
|
+
})
|
|
614
|
+
});
|
|
615
|
+
/**
|
|
616
|
+
* The attempt loop, with the compat kernel's schedule: a connection failure
|
|
617
|
+
* or a timeout is retried, as is a response the server marks retryable
|
|
618
|
+
* (`x-should-retry`) or whose status is 408, 409, 429 or 5xx, whatever the
|
|
619
|
+
* method. The wait is `retry-after-ms`, then `retry-after`, then exponential
|
|
620
|
+
* backoff — that module's `retryDelayMillis`, slept on Effect's clock.
|
|
621
|
+
*
|
|
622
|
+
* A retry re-issues the original request, redirect chain and all.
|
|
623
|
+
*/
|
|
624
|
+
const withRetries = (kernel, prepared, numRetries) => Effect.flatMap(Effect.result(attempt(kernel, prepared)), (result) => {
|
|
625
|
+
const retriesRemaining = prepared.maxRetries - numRetries;
|
|
626
|
+
if (Result.isFailure(result)) {
|
|
627
|
+
const { error, retryable } = result.failure;
|
|
628
|
+
return retryable && retriesRemaining > 0 ? retryAfter(kernel, prepared, numRetries, retryDelayMillis(numRetries)) : Effect.fail(error);
|
|
629
|
+
}
|
|
630
|
+
const response = result.success;
|
|
631
|
+
if (retriesRemaining > 0 && (response.status < 200 || response.status > 299)) {
|
|
632
|
+
const headers = new globalThis.Headers(response.headers);
|
|
633
|
+
if (shouldRetryResponse({
|
|
634
|
+
status: response.status,
|
|
635
|
+
headers
|
|
636
|
+
})) return Effect.andThen(discard(response), retryAfter(kernel, prepared, numRetries, retryDelayMillis(numRetries, headers)));
|
|
637
|
+
}
|
|
638
|
+
return Effect.succeed(response);
|
|
639
|
+
});
|
|
640
|
+
/** The next attempt, once the wait before it is over. */
|
|
641
|
+
const retryAfter = (kernel, prepared, numRetries, delayMillis) => Effect.flatMap(Effect.sleep(delayMillis), () => withRetries(kernel, prepared, numRetries + 1));
|
|
642
|
+
/** `APIError.requestId`'s rule: an empty header is "no id", so the envelope still wins. */
|
|
643
|
+
const requestIdOf = (response, envelopeId) => response.headers["x-request-id"] || envelopeId;
|
|
644
|
+
const failForStatus = (prepared, response) => response.text.pipe(Effect.catch((error) => Effect.succeed(describeTransport(error) ?? "")), Effect.flatMap((text) => {
|
|
645
|
+
const body = safeJSON(text);
|
|
646
|
+
const details = errorDetails(body);
|
|
647
|
+
return Effect.fail(apiErrorFromResponse({
|
|
648
|
+
message: makeAPIErrorMessage(response.status, body, body ? void 0 : text),
|
|
649
|
+
method: prepared.first.method,
|
|
650
|
+
url: prepared.label,
|
|
651
|
+
status: response.status,
|
|
652
|
+
requestId: requestIdOf(response, details?.request_id),
|
|
653
|
+
details,
|
|
654
|
+
body
|
|
655
|
+
}));
|
|
656
|
+
}));
|
|
657
|
+
const invalidJSON = (prepared, response) => new DecodeError({
|
|
658
|
+
message: "The response body is not valid JSON.",
|
|
659
|
+
method: prepared.first.method,
|
|
660
|
+
url: prepared.label,
|
|
661
|
+
status: response.status,
|
|
662
|
+
requestId: requestIdOf(response),
|
|
663
|
+
operation: operationKey(prepared.operation),
|
|
664
|
+
issues: [{
|
|
665
|
+
path: [],
|
|
666
|
+
kind: "InvalidJSON"
|
|
667
|
+
}]
|
|
668
|
+
});
|
|
669
|
+
/**
|
|
670
|
+
* The body, once it has passed the operation's schema — when the call asked
|
|
671
|
+
* for that and there is an operation to have one. What comes back is the value
|
|
672
|
+
* that went in, never the schema's output, so nothing the spec does not
|
|
673
|
+
* declare is lost.
|
|
674
|
+
*/
|
|
675
|
+
const validated = (prepared, response, body) => {
|
|
676
|
+
const operation = operationKey(prepared.operation);
|
|
677
|
+
if (prepared.schemas === void 0 || operation === void 0) return Effect.succeed(body);
|
|
678
|
+
return Effect.flatMap(responseIssues(prepared.schemas, operation, body), (issues) => issues.length === 0 ? Effect.succeed(body) : Effect.fail(new DecodeError({
|
|
679
|
+
message: `The response body does not match the schema of '${operation}'.`,
|
|
680
|
+
method: prepared.first.method,
|
|
681
|
+
url: prepared.label,
|
|
682
|
+
status: response.status,
|
|
683
|
+
requestId: requestIdOf(response),
|
|
684
|
+
operation,
|
|
685
|
+
issues
|
|
686
|
+
})));
|
|
687
|
+
};
|
|
688
|
+
/**
|
|
689
|
+
* Response parsing by the compat rules: a non-2xx is its status class, a 204
|
|
690
|
+
* is `null`, a JSON media type is parsed (or `undefined` when empty), anything
|
|
691
|
+
* else is text. A 204 has no body to validate; every other success is held to
|
|
692
|
+
* the schema when decoding is on, whatever it was read as.
|
|
693
|
+
*/
|
|
694
|
+
const parse = (prepared, response, headers) => {
|
|
695
|
+
if (response.status < 200 || response.status > 299) return failForStatus(prepared, response);
|
|
696
|
+
const kind = classifySuccessBody(response.status, headers["content-type"], headers["content-length"]);
|
|
697
|
+
if (kind === "null") return Effect.succeed(null);
|
|
698
|
+
if (kind === "undefined") return validated(prepared, response, void 0);
|
|
699
|
+
const text = Effect.mapError(response.text, (error) => connectionError(prepared, error));
|
|
700
|
+
if (kind === "text") return Effect.flatMap(text, (body) => validated(prepared, response, body));
|
|
701
|
+
return Effect.flatMap(text, (json) => Effect.flatMap(Effect.try({
|
|
702
|
+
try: () => JSON.parse(json),
|
|
703
|
+
catch: () => invalidJSON(prepared, response)
|
|
704
|
+
}), (body) => validated(prepared, response, body)));
|
|
705
|
+
};
|
|
706
|
+
const dispatch = (kernel, call) => Effect.try({
|
|
707
|
+
try: () => prepare(kernel, call),
|
|
708
|
+
catch: configurationErrorFrom
|
|
709
|
+
}).pipe(Effect.flatMap((prepared) => {
|
|
710
|
+
const noticed = call.recovered || prepared.operation?.hasDeprecatedInputs === true ? noticeDeprecatedInputs(kernel.notices, {
|
|
711
|
+
operation: prepared.operation,
|
|
712
|
+
query: prepared.query,
|
|
713
|
+
body: call.body,
|
|
714
|
+
headers: () => buildHeaders([kernel.defaultHeaders, prepared.callHeaders])
|
|
715
|
+
}) : void 0;
|
|
716
|
+
const exchanged = withRetries(kernel, prepared, 0);
|
|
717
|
+
return Effect.flatMap(noticed === void 0 ? exchanged : Effect.andThen(noticed, exchanged), (response) => {
|
|
718
|
+
const headers = response.headers;
|
|
719
|
+
if (kernel.notices.mode === "off" || headers["deprecation"] === void 0) return parse(prepared, response, headers);
|
|
720
|
+
return Effect.flatMap(noticeDeprecatedResponse(kernel.notices, {
|
|
721
|
+
method: prepared.method,
|
|
722
|
+
path: prepared.path,
|
|
723
|
+
operation: prepared.operation,
|
|
724
|
+
baseURL: kernel.baseURL,
|
|
725
|
+
url: response.url,
|
|
726
|
+
headers
|
|
727
|
+
}), () => parse(prepared, response, headers));
|
|
728
|
+
});
|
|
729
|
+
}));
|
|
730
|
+
/**
|
|
731
|
+
* Runs one declared operation. This is what every generated resource method
|
|
732
|
+
* calls: the operation's own descriptor, its arguments, and the caller's
|
|
733
|
+
* per-call options.
|
|
734
|
+
*/
|
|
735
|
+
const executeOperation = (kernel, operation, args, options) => dispatch(kernel, {
|
|
736
|
+
method: operation.method,
|
|
737
|
+
path: () => substitute(operation.path, args.path ?? []),
|
|
738
|
+
query: args.query,
|
|
739
|
+
body: args.body,
|
|
740
|
+
headers: () => args.headers === void 0 ? options?.headers : mergeHeaders([args.headers, options?.headers]),
|
|
741
|
+
operation,
|
|
742
|
+
recovered: false,
|
|
743
|
+
options
|
|
744
|
+
});
|
|
745
|
+
/**
|
|
746
|
+
* Runs a request to a path given verbatim — the raw `get`/`post`/`put`/
|
|
747
|
+
* `patch`/`delete` methods. The operation is recovered by matching the path
|
|
748
|
+
* against the table, as the compat client does, so a raw call to a declared
|
|
749
|
+
* path authenticates the way its typed twin would.
|
|
750
|
+
*/
|
|
751
|
+
const executeRaw = (kernel, method, path, options) => dispatch(kernel, {
|
|
752
|
+
method,
|
|
753
|
+
path: () => path,
|
|
754
|
+
query: options?.query,
|
|
755
|
+
body: options?.body,
|
|
756
|
+
headers: () => options?.headers,
|
|
757
|
+
operation: matchOperation(method, path, GENERATED_OPERATIONS),
|
|
758
|
+
recovered: true,
|
|
759
|
+
options
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/effect/generated/resources/tool-router/session/files.ts
|
|
764
|
+
const OP_LIST$15 = generatedOperation("toolRouter.session.files.list");
|
|
765
|
+
const OP_DELETE$7 = generatedOperation("toolRouter.session.files.delete");
|
|
766
|
+
const OP_CREATE_DOWNLOAD_URL = generatedOperation("toolRouter.session.files.createDownloadURL");
|
|
767
|
+
const OP_CREATE_UPLOAD_URL = generatedOperation("toolRouter.session.files.createUploadURL");
|
|
768
|
+
const makeFiles$1 = (kernel) => {
|
|
769
|
+
const resource = {
|
|
770
|
+
list: (mountID, params, options) => {
|
|
771
|
+
const { session_id, ...query } = params;
|
|
772
|
+
return executeOperation(kernel, OP_LIST$15, {
|
|
773
|
+
path: [session_id, mountID],
|
|
774
|
+
query
|
|
775
|
+
}, options);
|
|
776
|
+
},
|
|
777
|
+
listStream: (mountID, params, options) => cursorStream((cursor) => resource.list(mountID, cursor === void 0 ? params : {
|
|
778
|
+
...params,
|
|
779
|
+
cursor
|
|
780
|
+
}, options)),
|
|
781
|
+
delete: (mountID, params, options) => {
|
|
782
|
+
const { session_id, ...body } = params;
|
|
783
|
+
return executeOperation(kernel, OP_DELETE$7, {
|
|
784
|
+
path: [session_id, mountID],
|
|
785
|
+
body
|
|
786
|
+
}, options);
|
|
787
|
+
},
|
|
788
|
+
createDownloadURL: (mountID, params, options) => {
|
|
789
|
+
const { session_id, ...body } = params;
|
|
790
|
+
return executeOperation(kernel, OP_CREATE_DOWNLOAD_URL, {
|
|
791
|
+
path: [session_id, mountID],
|
|
792
|
+
body
|
|
793
|
+
}, options);
|
|
794
|
+
},
|
|
795
|
+
createUploadURL: (mountID, params, options) => {
|
|
796
|
+
const { session_id, ...body } = params;
|
|
797
|
+
return executeOperation(kernel, OP_CREATE_UPLOAD_URL, {
|
|
798
|
+
path: [session_id, mountID],
|
|
799
|
+
body
|
|
800
|
+
}, options);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
return resource;
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/effect/generated/resources/tool-router/session/session.ts
|
|
808
|
+
const OP_CREATE$9 = generatedOperation("toolRouter.session.create");
|
|
809
|
+
const OP_RETRIEVE$14 = generatedOperation("toolRouter.session.retrieve");
|
|
810
|
+
const OP_DELETE$6 = generatedOperation("toolRouter.session.delete");
|
|
811
|
+
const OP_ATTACH = generatedOperation("toolRouter.session.attach");
|
|
812
|
+
const OP_CONFIG_HISTORY = generatedOperation("toolRouter.session.configHistory");
|
|
813
|
+
const OP_EXECUTE$1 = generatedOperation("toolRouter.session.execute");
|
|
814
|
+
const OP_EXECUTE_META = generatedOperation("toolRouter.session.executeMeta");
|
|
815
|
+
const OP_LINK = generatedOperation("toolRouter.session.link");
|
|
816
|
+
const OP_PATCH$1 = generatedOperation("toolRouter.session.patch");
|
|
817
|
+
const OP_PROXY_EXECUTE = generatedOperation("toolRouter.session.proxyExecute");
|
|
818
|
+
const OP_SEARCH = generatedOperation("toolRouter.session.search");
|
|
819
|
+
const OP_TOOLKITS = generatedOperation("toolRouter.session.toolkits");
|
|
820
|
+
const OP_TOOLS = generatedOperation("toolRouter.session.tools");
|
|
821
|
+
const makeSession$1 = (kernel) => {
|
|
822
|
+
const resource = {
|
|
823
|
+
files: makeFiles$1(kernel),
|
|
824
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$9, { body }, options),
|
|
825
|
+
retrieve: (sessionID, options) => executeOperation(kernel, OP_RETRIEVE$14, { path: [sessionID] }, options),
|
|
826
|
+
delete: (sessionID, options) => executeOperation(kernel, OP_DELETE$6, { path: [sessionID] }, options),
|
|
827
|
+
attach: (sessionID, body = {}, options) => executeOperation(kernel, OP_ATTACH, {
|
|
828
|
+
path: [sessionID],
|
|
829
|
+
body
|
|
830
|
+
}, options),
|
|
831
|
+
configHistory: (sessionID, query = {}, options) => executeOperation(kernel, OP_CONFIG_HISTORY, {
|
|
832
|
+
path: [sessionID],
|
|
833
|
+
query
|
|
834
|
+
}, options),
|
|
835
|
+
configHistoryStream: (sessionID, query, options) => cursorStream((cursor) => resource.configHistory(sessionID, cursor === void 0 ? query : {
|
|
836
|
+
...query,
|
|
837
|
+
cursor
|
|
838
|
+
}, options)),
|
|
839
|
+
execute: (sessionID, body, options) => executeOperation(kernel, OP_EXECUTE$1, {
|
|
840
|
+
path: [sessionID],
|
|
841
|
+
body
|
|
842
|
+
}, options),
|
|
843
|
+
executeMeta: (sessionID, body, options) => executeOperation(kernel, OP_EXECUTE_META, {
|
|
844
|
+
path: [sessionID],
|
|
845
|
+
body
|
|
846
|
+
}, options),
|
|
847
|
+
link: (sessionID, body, options) => executeOperation(kernel, OP_LINK, {
|
|
848
|
+
path: [sessionID],
|
|
849
|
+
body
|
|
850
|
+
}, options),
|
|
851
|
+
patch: (sessionID, body = {}, options) => executeOperation(kernel, OP_PATCH$1, {
|
|
852
|
+
path: [sessionID],
|
|
853
|
+
body
|
|
854
|
+
}, options),
|
|
855
|
+
proxyExecute: (sessionID, body, options) => executeOperation(kernel, OP_PROXY_EXECUTE, {
|
|
856
|
+
path: [sessionID],
|
|
857
|
+
body
|
|
858
|
+
}, options),
|
|
859
|
+
search: (sessionID, body, options) => executeOperation(kernel, OP_SEARCH, {
|
|
860
|
+
path: [sessionID],
|
|
861
|
+
body
|
|
862
|
+
}, options),
|
|
863
|
+
toolkits: (sessionID, query = {}, options) => executeOperation(kernel, OP_TOOLKITS, {
|
|
864
|
+
path: [sessionID],
|
|
865
|
+
query
|
|
866
|
+
}, options),
|
|
867
|
+
toolkitsStream: (sessionID, query, options) => cursorStream((cursor) => resource.toolkits(sessionID, cursor === void 0 ? query : {
|
|
868
|
+
...query,
|
|
869
|
+
cursor
|
|
870
|
+
}, options)),
|
|
871
|
+
tools: (sessionID, query = {}, options) => executeOperation(kernel, OP_TOOLS, {
|
|
872
|
+
path: [sessionID],
|
|
873
|
+
query
|
|
874
|
+
}, options),
|
|
875
|
+
toolsStream: (sessionID, query, options) => cursorStream((cursor) => resource.tools(sessionID, cursor === void 0 ? query : {
|
|
876
|
+
...query,
|
|
877
|
+
cursor
|
|
878
|
+
}, options))
|
|
879
|
+
};
|
|
880
|
+
return resource;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/effect/generated/resources/tool-router/tool-router.ts
|
|
885
|
+
const makeToolRouter = (kernel) => ({ session: makeSession$1(kernel) });
|
|
886
|
+
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/effect/generated/resources/tools.ts
|
|
889
|
+
const OP_RETRIEVE$13 = generatedOperation("tools.retrieve");
|
|
890
|
+
const OP_LIST$14 = generatedOperation("tools.list");
|
|
891
|
+
const OP_EXECUTE = generatedOperation("tools.execute");
|
|
892
|
+
const OP_GET_INPUT = generatedOperation("tools.getInput");
|
|
893
|
+
const OP_PROXY = generatedOperation("tools.proxy");
|
|
894
|
+
const OP_RETRIEVE_ENUM$1 = generatedOperation("tools.retrieveEnum");
|
|
895
|
+
const OP_RETRIEVE_REQUIRED_SCOPES = generatedOperation("tools.retrieveRequiredScopes");
|
|
896
|
+
const makeTools$1 = (kernel) => {
|
|
897
|
+
const resource = {
|
|
898
|
+
retrieve: (toolSlug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$13, {
|
|
899
|
+
path: [toolSlug],
|
|
900
|
+
query
|
|
901
|
+
}, options),
|
|
902
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$14, { query }, options),
|
|
903
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
904
|
+
...query,
|
|
905
|
+
cursor
|
|
906
|
+
}, options)),
|
|
907
|
+
execute: (toolSlug, params = {}, options) => {
|
|
908
|
+
const { "x-llm-gateway-headers": xLlmGatewayHeaders, ...body } = params ?? {};
|
|
909
|
+
return executeOperation(kernel, OP_EXECUTE, {
|
|
910
|
+
path: [toolSlug],
|
|
911
|
+
body,
|
|
912
|
+
headers: { ...xLlmGatewayHeaders != null ? { "x-llm-gateway-headers": xLlmGatewayHeaders } : void 0 }
|
|
913
|
+
}, options);
|
|
914
|
+
},
|
|
915
|
+
getInput: (toolSlug, body, options) => executeOperation(kernel, OP_GET_INPUT, {
|
|
916
|
+
path: [toolSlug],
|
|
917
|
+
body
|
|
918
|
+
}, options),
|
|
919
|
+
proxy: (body, options) => executeOperation(kernel, OP_PROXY, { body }, options),
|
|
920
|
+
retrieveEnum: (options) => executeOperation(kernel, OP_RETRIEVE_ENUM$1, {}, options),
|
|
921
|
+
retrieveRequiredScopes: (body, options) => executeOperation(kernel, OP_RETRIEVE_REQUIRED_SCOPES, { body }, options)
|
|
922
|
+
};
|
|
923
|
+
return resource;
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region src/effect/generated/resources/files.ts
|
|
928
|
+
const OP_LIST$13 = generatedOperation("files.list");
|
|
929
|
+
const OP_CREATE_PRESIGNED_URL = generatedOperation("files.createPresignedURL");
|
|
930
|
+
const makeFiles = (kernel) => {
|
|
931
|
+
const resource = {
|
|
932
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$13, { query }, options),
|
|
933
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
934
|
+
...query,
|
|
935
|
+
cursor
|
|
936
|
+
}, options)),
|
|
937
|
+
createPresignedURL: (body, options) => executeOperation(kernel, OP_CREATE_PRESIGNED_URL, { body }, options)
|
|
938
|
+
};
|
|
939
|
+
return resource;
|
|
940
|
+
};
|
|
941
|
+
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/effect/generated/resources/connected-accounts.ts
|
|
944
|
+
const OP_CREATE$8 = generatedOperation("connectedAccounts.create");
|
|
945
|
+
const OP_RETRIEVE$12 = generatedOperation("connectedAccounts.retrieve");
|
|
946
|
+
const OP_LIST$12 = generatedOperation("connectedAccounts.list");
|
|
947
|
+
const OP_DELETE$5 = generatedOperation("connectedAccounts.delete");
|
|
948
|
+
const OP_COMPLETE_AUTH = generatedOperation("connectedAccounts.completeAuth");
|
|
949
|
+
const OP_PATCH = generatedOperation("connectedAccounts.patch");
|
|
950
|
+
const OP_REFRESH = generatedOperation("connectedAccounts.refresh");
|
|
951
|
+
const OP_REVOKE = generatedOperation("connectedAccounts.revoke");
|
|
952
|
+
const OP_UPDATE_STATUS$1 = generatedOperation("connectedAccounts.updateStatus");
|
|
953
|
+
const makeConnectedAccounts = (kernel) => {
|
|
954
|
+
const resource = {
|
|
955
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$8, { body }, options),
|
|
956
|
+
retrieve: (nanoid, options) => executeOperation(kernel, OP_RETRIEVE$12, { path: [nanoid] }, options),
|
|
957
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$12, { query }, options),
|
|
958
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
959
|
+
...query,
|
|
960
|
+
cursor
|
|
961
|
+
}, options)),
|
|
962
|
+
delete: (nanoid, query = {}, options) => executeOperation(kernel, OP_DELETE$5, {
|
|
963
|
+
path: [nanoid],
|
|
964
|
+
query
|
|
965
|
+
}, options),
|
|
966
|
+
completeAuth: (body, options) => executeOperation(kernel, OP_COMPLETE_AUTH, { body }, options),
|
|
967
|
+
patch: (nanoid, body = {}, options) => executeOperation(kernel, OP_PATCH, {
|
|
968
|
+
path: [nanoid],
|
|
969
|
+
body
|
|
970
|
+
}, options),
|
|
971
|
+
refresh: (nanoid, params = {}, options) => {
|
|
972
|
+
const { query_redirect_url, body_redirect_url, ...body } = params ?? {};
|
|
973
|
+
return executeOperation(kernel, OP_REFRESH, {
|
|
974
|
+
path: [nanoid],
|
|
975
|
+
query: { redirect_url: query_redirect_url },
|
|
976
|
+
body: {
|
|
977
|
+
...body,
|
|
978
|
+
redirect_url: body_redirect_url
|
|
979
|
+
}
|
|
980
|
+
}, options);
|
|
981
|
+
},
|
|
982
|
+
revoke: (nanoid, options) => executeOperation(kernel, OP_REVOKE, { path: [nanoid] }, options),
|
|
983
|
+
updateStatus: (nanoID, body, options) => executeOperation(kernel, OP_UPDATE_STATUS$1, {
|
|
984
|
+
path: [nanoID],
|
|
985
|
+
body
|
|
986
|
+
}, options)
|
|
987
|
+
};
|
|
988
|
+
return resource;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region src/effect/generated/resources/link.ts
|
|
993
|
+
const OP_CREATE$7 = generatedOperation("link.create");
|
|
994
|
+
const makeLink = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE$7, { body }, options) });
|
|
995
|
+
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/effect/generated/resources/toolkits.ts
|
|
998
|
+
const OP_RETRIEVE$11 = generatedOperation("toolkits.retrieve");
|
|
999
|
+
const OP_LIST$11 = generatedOperation("toolkits.list");
|
|
1000
|
+
const OP_RECOMMEND_SCOPES = generatedOperation("toolkits.recommendScopes");
|
|
1001
|
+
const OP_RETRIEVE_CATEGORIES = generatedOperation("toolkits.retrieveCategories");
|
|
1002
|
+
const OP_RETRIEVE_CHANGELOG = generatedOperation("toolkits.retrieveChangelog");
|
|
1003
|
+
const OP_RETRIEVE_MULTI = generatedOperation("toolkits.retrieveMulti");
|
|
1004
|
+
const OP_RETRIEVE_SCOPES_GRANT_CONTEXT = generatedOperation("toolkits.retrieveScopesGrantContext");
|
|
1005
|
+
const makeToolkits = (kernel) => {
|
|
1006
|
+
const resource = {
|
|
1007
|
+
retrieve: (slug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$11, {
|
|
1008
|
+
path: [slug],
|
|
1009
|
+
query
|
|
1010
|
+
}, options),
|
|
1011
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$11, { query }, options),
|
|
1012
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
1013
|
+
...query,
|
|
1014
|
+
cursor
|
|
1015
|
+
}, options)),
|
|
1016
|
+
recommendScopes: (toolkitSlug, body, options) => executeOperation(kernel, OP_RECOMMEND_SCOPES, {
|
|
1017
|
+
path: [toolkitSlug],
|
|
1018
|
+
body
|
|
1019
|
+
}, options),
|
|
1020
|
+
retrieveCategories: (options) => executeOperation(kernel, OP_RETRIEVE_CATEGORIES, {}, options),
|
|
1021
|
+
retrieveChangelog: (options) => executeOperation(kernel, OP_RETRIEVE_CHANGELOG, {}, options),
|
|
1022
|
+
retrieveMulti: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_MULTI, { body }, options),
|
|
1023
|
+
retrieveMultiStream: (body, options) => cursorStream((cursor) => resource.retrieveMulti(cursor === void 0 ? body : {
|
|
1024
|
+
...body,
|
|
1025
|
+
cursor
|
|
1026
|
+
}, options)),
|
|
1027
|
+
retrieveScopesGrantContext: (toolkitSlug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE_SCOPES_GRANT_CONTEXT, {
|
|
1028
|
+
path: [toolkitSlug],
|
|
1029
|
+
query
|
|
1030
|
+
}, options)
|
|
1031
|
+
};
|
|
1032
|
+
return resource;
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/effect/generated/resources/auth-configs.ts
|
|
1037
|
+
const OP_CREATE$6 = generatedOperation("authConfigs.create");
|
|
1038
|
+
const OP_RETRIEVE$10 = generatedOperation("authConfigs.retrieve");
|
|
1039
|
+
const OP_UPDATE$4 = generatedOperation("authConfigs.update");
|
|
1040
|
+
const OP_LIST$10 = generatedOperation("authConfigs.list");
|
|
1041
|
+
const OP_DELETE$4 = generatedOperation("authConfigs.delete");
|
|
1042
|
+
const OP_UPDATE_STATUS = generatedOperation("authConfigs.updateStatus");
|
|
1043
|
+
const makeAuthConfigs = (kernel) => {
|
|
1044
|
+
const resource = {
|
|
1045
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$6, { body }, options),
|
|
1046
|
+
retrieve: (nanoid, options) => executeOperation(kernel, OP_RETRIEVE$10, { path: [nanoid] }, options),
|
|
1047
|
+
update: (nanoid, body, options) => executeOperation(kernel, OP_UPDATE$4, {
|
|
1048
|
+
path: [nanoid],
|
|
1049
|
+
body
|
|
1050
|
+
}, options),
|
|
1051
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$10, { query }, options),
|
|
1052
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
1053
|
+
...query,
|
|
1054
|
+
cursor
|
|
1055
|
+
}, options)),
|
|
1056
|
+
delete: (nanoid, query = {}, options) => executeOperation(kernel, OP_DELETE$4, {
|
|
1057
|
+
path: [nanoid],
|
|
1058
|
+
query
|
|
1059
|
+
}, options),
|
|
1060
|
+
updateStatus: (status, params, options) => {
|
|
1061
|
+
const { nanoid } = params;
|
|
1062
|
+
return executeOperation(kernel, OP_UPDATE_STATUS, { path: [nanoid, status] }, options);
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
return resource;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/effect/generated/resources/triggers-types.ts
|
|
1070
|
+
const OP_RETRIEVE$9 = generatedOperation("triggersTypes.retrieve");
|
|
1071
|
+
const OP_LIST$9 = generatedOperation("triggersTypes.list");
|
|
1072
|
+
const OP_RETRIEVE_ENUM = generatedOperation("triggersTypes.retrieveEnum");
|
|
1073
|
+
const makeTriggersTypes = (kernel) => {
|
|
1074
|
+
const resource = {
|
|
1075
|
+
retrieve: (slug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$9, {
|
|
1076
|
+
path: [slug],
|
|
1077
|
+
query
|
|
1078
|
+
}, options),
|
|
1079
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$9, { query }, options),
|
|
1080
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
1081
|
+
...query,
|
|
1082
|
+
cursor
|
|
1083
|
+
}, options)),
|
|
1084
|
+
retrieveEnum: (options) => executeOperation(kernel, OP_RETRIEVE_ENUM, {}, options)
|
|
1085
|
+
};
|
|
1086
|
+
return resource;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region src/effect/generated/resources/trigger-instances/manage.ts
|
|
1091
|
+
const OP_UPDATE$3 = generatedOperation("triggerInstances.manage.update");
|
|
1092
|
+
const OP_DELETE$3 = generatedOperation("triggerInstances.manage.delete");
|
|
1093
|
+
const makeManage = (kernel) => ({
|
|
1094
|
+
update: (triggerID, body = {}, options) => executeOperation(kernel, OP_UPDATE$3, {
|
|
1095
|
+
path: [triggerID],
|
|
1096
|
+
body
|
|
1097
|
+
}, options),
|
|
1098
|
+
delete: (triggerID, options) => executeOperation(kernel, OP_DELETE$3, { path: [triggerID] }, options)
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src/effect/generated/resources/trigger-instances/trigger-instances.ts
|
|
1103
|
+
const OP_LIST_ACTIVE = generatedOperation("triggerInstances.listActive");
|
|
1104
|
+
const OP_UPSERT$1 = generatedOperation("triggerInstances.upsert");
|
|
1105
|
+
const makeTriggerInstances = (kernel) => {
|
|
1106
|
+
const resource = {
|
|
1107
|
+
manage: makeManage(kernel),
|
|
1108
|
+
listActive: (query = {}, options) => executeOperation(kernel, OP_LIST_ACTIVE, { query }, options),
|
|
1109
|
+
listActiveStream: (query, options) => cursorStream((cursor) => resource.listActive(cursor === void 0 ? query : {
|
|
1110
|
+
...query,
|
|
1111
|
+
cursor
|
|
1112
|
+
}, options)),
|
|
1113
|
+
upsert: (slug, body = {}, options) => executeOperation(kernel, OP_UPSERT$1, {
|
|
1114
|
+
path: [slug],
|
|
1115
|
+
body
|
|
1116
|
+
}, options)
|
|
1117
|
+
};
|
|
1118
|
+
return resource;
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/effect/generated/resources/mcp/custom.ts
|
|
1123
|
+
const OP_CREATE$5 = generatedOperation("mcp.custom.create");
|
|
1124
|
+
const makeCustom$1 = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE$5, { body }, options) });
|
|
1125
|
+
|
|
1126
|
+
//#endregion
|
|
1127
|
+
//#region src/effect/generated/resources/mcp/generate.ts
|
|
1128
|
+
const OP_URL = generatedOperation("mcp.generate.url");
|
|
1129
|
+
const makeGenerate = (kernel) => ({ url: (body, options) => executeOperation(kernel, OP_URL, { body }, options) });
|
|
1130
|
+
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region src/effect/generated/resources/mcp/mcp.ts
|
|
1133
|
+
const OP_CREATE$4 = generatedOperation("mcp.create");
|
|
1134
|
+
const OP_RETRIEVE$8 = generatedOperation("mcp.retrieve");
|
|
1135
|
+
const OP_UPDATE$2 = generatedOperation("mcp.update");
|
|
1136
|
+
const OP_LIST$8 = generatedOperation("mcp.list");
|
|
1137
|
+
const OP_DELETE$2 = generatedOperation("mcp.delete");
|
|
1138
|
+
const OP_CREATE_INSTANCE = generatedOperation("mcp.createInstance");
|
|
1139
|
+
const OP_DELETE_INSTANCE = generatedOperation("mcp.deleteInstance");
|
|
1140
|
+
const OP_LIST_INSTANCES = generatedOperation("mcp.listInstances");
|
|
1141
|
+
const OP_RETRIEVE_APP = generatedOperation("mcp.retrieveApp");
|
|
1142
|
+
const makeMcp = (kernel) => ({
|
|
1143
|
+
custom: makeCustom$1(kernel),
|
|
1144
|
+
generate: makeGenerate(kernel),
|
|
1145
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$4, { body }, options),
|
|
1146
|
+
retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$8, { path: [id] }, options),
|
|
1147
|
+
update: (id, body = {}, options) => executeOperation(kernel, OP_UPDATE$2, {
|
|
1148
|
+
path: [id],
|
|
1149
|
+
body
|
|
1150
|
+
}, options),
|
|
1151
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$8, { query }, options),
|
|
1152
|
+
delete: (id, options) => executeOperation(kernel, OP_DELETE$2, { path: [id] }, options),
|
|
1153
|
+
createInstance: (serverID, body, options) => executeOperation(kernel, OP_CREATE_INSTANCE, {
|
|
1154
|
+
path: [serverID],
|
|
1155
|
+
body
|
|
1156
|
+
}, options),
|
|
1157
|
+
deleteInstance: (instanceID, params, options) => {
|
|
1158
|
+
const { serverId } = params;
|
|
1159
|
+
return executeOperation(kernel, OP_DELETE_INSTANCE, { path: [serverId, instanceID] }, options);
|
|
1160
|
+
},
|
|
1161
|
+
listInstances: (serverID, query = {}, options) => executeOperation(kernel, OP_LIST_INSTANCES, {
|
|
1162
|
+
path: [serverID],
|
|
1163
|
+
query
|
|
1164
|
+
}, options),
|
|
1165
|
+
retrieveApp: (appKey, query = {}, options) => executeOperation(kernel, OP_RETRIEVE_APP, {
|
|
1166
|
+
path: [appKey],
|
|
1167
|
+
query
|
|
1168
|
+
}, options)
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region src/effect/generated/resources/cli/realtime.ts
|
|
1173
|
+
const OP_AUTH = generatedOperation("cli.realtime.auth");
|
|
1174
|
+
const OP_CREDENTIALS = generatedOperation("cli.realtime.credentials");
|
|
1175
|
+
const makeRealtime = (kernel) => ({
|
|
1176
|
+
auth: (body, options) => executeOperation(kernel, OP_AUTH, { body }, options),
|
|
1177
|
+
credentials: (options) => executeOperation(kernel, OP_CREDENTIALS, {}, options)
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/effect/generated/resources/cli/cli.ts
|
|
1182
|
+
const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
|
|
1183
|
+
const OP_CREATE_SESSION = generatedOperation("cli.createSession");
|
|
1184
|
+
const OP_GET_SESSION = generatedOperation("cli.getSession");
|
|
1185
|
+
const makeCli = (kernel) => ({
|
|
1186
|
+
realtime: makeRealtime(kernel),
|
|
1187
|
+
createCodactFailure: (params, options) => {
|
|
1188
|
+
const { "x-user-api-key": xUserApiKey, ...body } = params;
|
|
1189
|
+
return executeOperation(kernel, OP_CREATE_CODACT_FAILURE, {
|
|
1190
|
+
body,
|
|
1191
|
+
headers: { ...xUserApiKey != null ? { "x-user-api-key": xUserApiKey } : void 0 }
|
|
1192
|
+
}, options);
|
|
1193
|
+
},
|
|
1194
|
+
createSession: (body = {}, options) => executeOperation(kernel, OP_CREATE_SESSION, { body }, options),
|
|
1195
|
+
getSession: (query, options) => executeOperation(kernel, OP_GET_SESSION, { query }, options)
|
|
1196
|
+
});
|
|
1197
|
+
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/effect/generated/resources/logs/triggers.ts
|
|
1200
|
+
const OP_RETRIEVE$7 = generatedOperation("logs.triggers.retrieve");
|
|
1201
|
+
const OP_LIST$7 = generatedOperation("logs.triggers.list");
|
|
1202
|
+
const makeTriggers = (kernel) => ({
|
|
1203
|
+
retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$7, { path: [id] }, options),
|
|
1204
|
+
list: (body = {}, options) => executeOperation(kernel, OP_LIST$7, { body }, options)
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region src/effect/generated/resources/logs/tools.ts
|
|
1209
|
+
const OP_RETRIEVE$6 = generatedOperation("logs.tools.retrieve");
|
|
1210
|
+
const OP_LIST$6 = generatedOperation("logs.tools.list");
|
|
1211
|
+
const OP_LIST_FIELDS = generatedOperation("logs.tools.listFields");
|
|
1212
|
+
const makeTools = (kernel) => ({
|
|
1213
|
+
retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$6, { path: [id] }, options),
|
|
1214
|
+
list: (body, options) => executeOperation(kernel, OP_LIST$6, { body }, options),
|
|
1215
|
+
listFields: (options) => executeOperation(kernel, OP_LIST_FIELDS, {}, options)
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
//#endregion
|
|
1219
|
+
//#region src/effect/generated/resources/logs/logs.ts
|
|
1220
|
+
const OP_CREATE_TOOL_EXECUTION = generatedOperation("logs.createToolExecution");
|
|
1221
|
+
const OP_RETRIEVE_TOOL_EXECUTION = generatedOperation("logs.retrieveToolExecution");
|
|
1222
|
+
const makeLogs = (kernel) => ({
|
|
1223
|
+
triggers: makeTriggers(kernel),
|
|
1224
|
+
tools: makeTools(kernel),
|
|
1225
|
+
createToolExecution: (body = {}, options) => executeOperation(kernel, OP_CREATE_TOOL_EXECUTION, { body }, options),
|
|
1226
|
+
retrieveToolExecution: (id, options) => executeOperation(kernel, OP_RETRIEVE_TOOL_EXECUTION, { path: [id] }, options)
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1229
|
+
//#endregion
|
|
1230
|
+
//#region src/effect/generated/resources/project/usage.ts
|
|
1231
|
+
const OP_RETRIEVE$5 = generatedOperation("project.usage.retrieve");
|
|
1232
|
+
const OP_RETRIEVE_SUMMARY$1 = generatedOperation("project.usage.retrieveSummary");
|
|
1233
|
+
const makeUsage$1 = (kernel) => ({
|
|
1234
|
+
retrieve: (entityType, body = {}, options) => executeOperation(kernel, OP_RETRIEVE$5, {
|
|
1235
|
+
path: [entityType],
|
|
1236
|
+
body
|
|
1237
|
+
}, options),
|
|
1238
|
+
retrieveSummary: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_SUMMARY$1, { body }, options)
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/effect/generated/resources/project/project.ts
|
|
1243
|
+
const makeProject$3 = (kernel) => ({ usage: makeUsage$1(kernel) });
|
|
1244
|
+
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/effect/generated/resources/webhook-subscriptions.ts
|
|
1247
|
+
const OP_CREATE$3 = generatedOperation("webhookSubscriptions.create");
|
|
1248
|
+
const OP_RETRIEVE$4 = generatedOperation("webhookSubscriptions.retrieve");
|
|
1249
|
+
const OP_UPDATE$1 = generatedOperation("webhookSubscriptions.update");
|
|
1250
|
+
const OP_LIST$5 = generatedOperation("webhookSubscriptions.list");
|
|
1251
|
+
const OP_DELETE$1 = generatedOperation("webhookSubscriptions.delete");
|
|
1252
|
+
const OP_LIST_EVENT_TYPES = generatedOperation("webhookSubscriptions.listEventTypes");
|
|
1253
|
+
const OP_ROTATE_SECRET = generatedOperation("webhookSubscriptions.rotateSecret");
|
|
1254
|
+
const makeWebhookSubscriptions = (kernel) => {
|
|
1255
|
+
const resource = {
|
|
1256
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$3, { body }, options),
|
|
1257
|
+
retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$4, { path: [id] }, options),
|
|
1258
|
+
update: (id, body = {}, options) => executeOperation(kernel, OP_UPDATE$1, {
|
|
1259
|
+
path: [id],
|
|
1260
|
+
body
|
|
1261
|
+
}, options),
|
|
1262
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$5, { query }, options),
|
|
1263
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
1264
|
+
...query,
|
|
1265
|
+
cursor
|
|
1266
|
+
}, options)),
|
|
1267
|
+
delete: (id, options) => executeOperation(kernel, OP_DELETE$1, { path: [id] }, options),
|
|
1268
|
+
listEventTypes: (options) => executeOperation(kernel, OP_LIST_EVENT_TYPES, {}, options),
|
|
1269
|
+
rotateSecret: (id, options) => executeOperation(kernel, OP_ROTATE_SECRET, { path: [id] }, options)
|
|
1270
|
+
};
|
|
1271
|
+
return resource;
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
//#endregion
|
|
1275
|
+
//#region src/effect/generated/resources/webhook-endpoints.ts
|
|
1276
|
+
const OP_CREATE$2 = generatedOperation("webhookEndpoints.create");
|
|
1277
|
+
const OP_RETRIEVE$3 = generatedOperation("webhookEndpoints.retrieve");
|
|
1278
|
+
const OP_UPDATE = generatedOperation("webhookEndpoints.update");
|
|
1279
|
+
const OP_LIST$4 = generatedOperation("webhookEndpoints.list");
|
|
1280
|
+
const OP_REPLACE = generatedOperation("webhookEndpoints.replace");
|
|
1281
|
+
const makeWebhookEndpoints = (kernel) => ({
|
|
1282
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$2, { body }, options),
|
|
1283
|
+
retrieve: (nanoID, options) => executeOperation(kernel, OP_RETRIEVE$3, { path: [nanoID] }, options),
|
|
1284
|
+
update: (nanoID, body, options) => executeOperation(kernel, OP_UPDATE, {
|
|
1285
|
+
path: [nanoID],
|
|
1286
|
+
body
|
|
1287
|
+
}, options),
|
|
1288
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$4, { query }, options),
|
|
1289
|
+
replace: (nanoID, body, options) => executeOperation(kernel, OP_REPLACE, {
|
|
1290
|
+
path: [nanoID],
|
|
1291
|
+
body
|
|
1292
|
+
}, options)
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/effect/generated/resources/org/owner/project.ts
|
|
1297
|
+
const OP_CREATE$1 = generatedOperation("org.owner.project.create");
|
|
1298
|
+
const OP_RETRIEVE$2 = generatedOperation("org.owner.project.retrieve");
|
|
1299
|
+
const OP_LIST$3 = generatedOperation("org.owner.project.list");
|
|
1300
|
+
const OP_DELETE = generatedOperation("org.owner.project.delete");
|
|
1301
|
+
const OP_REGENERATE_APIKEY = generatedOperation("org.owner.project.regenerateAPIKey");
|
|
1302
|
+
const makeProject$2 = (kernel) => ({
|
|
1303
|
+
create: (body, options) => executeOperation(kernel, OP_CREATE$1, { body }, options),
|
|
1304
|
+
retrieve: (nanoID, options) => executeOperation(kernel, OP_RETRIEVE$2, { path: [nanoID] }, options),
|
|
1305
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$3, { query }, options),
|
|
1306
|
+
delete: (nanoID, query = {}, options) => executeOperation(kernel, OP_DELETE, {
|
|
1307
|
+
path: [nanoID],
|
|
1308
|
+
query
|
|
1309
|
+
}, options),
|
|
1310
|
+
regenerateAPIKey: (nanoID, options) => executeOperation(kernel, OP_REGENERATE_APIKEY, { path: [nanoID] }, options)
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region src/effect/generated/resources/org/owner/owner.ts
|
|
1315
|
+
const makeOwner = (kernel) => ({ project: makeProject$2(kernel) });
|
|
1316
|
+
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/effect/generated/resources/org/consumer/project.ts
|
|
1319
|
+
const OP_RESOLVE = generatedOperation("org.consumer.project.resolve");
|
|
1320
|
+
const makeProject$1 = (kernel) => ({ resolve: (params, options) => {
|
|
1321
|
+
const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId } = params;
|
|
1322
|
+
return executeOperation(kernel, OP_RESOLVE, { headers: {
|
|
1323
|
+
...xUserApiKey != null ? { "x-user-api-key": xUserApiKey } : void 0,
|
|
1324
|
+
...xOrgId != null ? { "x-org-id": xOrgId } : void 0
|
|
1325
|
+
} }, options);
|
|
1326
|
+
} });
|
|
1327
|
+
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/effect/generated/resources/org/consumer/consumer.ts
|
|
1330
|
+
const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
|
|
1331
|
+
const makeConsumer = (kernel) => ({
|
|
1332
|
+
project: makeProject$1(kernel),
|
|
1333
|
+
listConnectedToolkits: (params, options) => {
|
|
1334
|
+
const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId, ...query } = params;
|
|
1335
|
+
return executeOperation(kernel, OP_LIST_CONNECTED_TOOLKITS, {
|
|
1336
|
+
query,
|
|
1337
|
+
headers: {
|
|
1338
|
+
...xUserApiKey != null ? { "x-user-api-key": xUserApiKey } : void 0,
|
|
1339
|
+
...xOrgId != null ? { "x-org-id": xOrgId } : void 0
|
|
1340
|
+
}
|
|
1341
|
+
}, options);
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
//#endregion
|
|
1346
|
+
//#region src/effect/generated/resources/org/project.ts
|
|
1347
|
+
const OP_LIST$2 = generatedOperation("org.project.list");
|
|
1348
|
+
const makeProject = (kernel) => ({ list: (query = {}, options) => executeOperation(kernel, OP_LIST$2, { query }, options) });
|
|
1349
|
+
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/effect/generated/resources/org/usage.ts
|
|
1352
|
+
const OP_RETRIEVE$1 = generatedOperation("org.usage.retrieve");
|
|
1353
|
+
const OP_RETRIEVE_SUMMARY = generatedOperation("org.usage.retrieveSummary");
|
|
1354
|
+
const makeUsage = (kernel) => ({
|
|
1355
|
+
retrieve: (entityType, body = {}, options) => executeOperation(kernel, OP_RETRIEVE$1, {
|
|
1356
|
+
path: [entityType],
|
|
1357
|
+
body
|
|
1358
|
+
}, options),
|
|
1359
|
+
retrieveSummary: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_SUMMARY, { body }, options)
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
//#endregion
|
|
1363
|
+
//#region src/effect/generated/resources/org/clanker.ts
|
|
1364
|
+
const OP_CREATE_CLAIM = generatedOperation("org.clanker.createClaim");
|
|
1365
|
+
const makeClanker = (kernel) => ({ createClaim: (body, options) => executeOperation(kernel, OP_CREATE_CLAIM, { body }, options) });
|
|
1366
|
+
|
|
1367
|
+
//#endregion
|
|
1368
|
+
//#region src/effect/generated/resources/org/org.ts
|
|
1369
|
+
const OP_LIST$1 = generatedOperation("org.list");
|
|
1370
|
+
const makeOrg = (kernel) => ({
|
|
1371
|
+
owner: makeOwner(kernel),
|
|
1372
|
+
consumer: makeConsumer(kernel),
|
|
1373
|
+
project: makeProject(kernel),
|
|
1374
|
+
usage: makeUsage(kernel),
|
|
1375
|
+
clanker: makeClanker(kernel),
|
|
1376
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST$1, { query }, options)
|
|
1377
|
+
});
|
|
1378
|
+
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/effect/generated/resources/auth/session.ts
|
|
1381
|
+
const OP_RETRIEVE_INFO = generatedOperation("auth.session.retrieveInfo");
|
|
1382
|
+
const makeSession = (kernel) => ({ retrieveInfo: (options) => executeOperation(kernel, OP_RETRIEVE_INFO, {}, options) });
|
|
1383
|
+
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region src/effect/generated/resources/auth/auth.ts
|
|
1386
|
+
const makeAuth = (kernel) => ({ session: makeSession(kernel) });
|
|
1387
|
+
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/effect/generated/resources/api-key-revocation.ts
|
|
1390
|
+
const OP_CREATE = generatedOperation("apiKeyRevocation.create");
|
|
1391
|
+
const makeApiKeyRevocation = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE, { body }, options) });
|
|
1392
|
+
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/effect/generated/resources/custom.ts
|
|
1395
|
+
const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
|
|
1396
|
+
const OP_SYNC = generatedOperation("custom.sync");
|
|
1397
|
+
const OP_UPSERT = generatedOperation("custom.upsert");
|
|
1398
|
+
const makeCustom = (kernel) => ({
|
|
1399
|
+
deleteToolkit: (slug, query = {}, options) => executeOperation(kernel, OP_DELETE_TOOLKIT, {
|
|
1400
|
+
path: [slug],
|
|
1401
|
+
query
|
|
1402
|
+
}, options),
|
|
1403
|
+
sync: (body, options) => executeOperation(kernel, OP_SYNC, { body }, options),
|
|
1404
|
+
upsert: (body, options) => executeOperation(kernel, OP_UPSERT, { body }, options)
|
|
1405
|
+
});
|
|
1406
|
+
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/effect/generated/resources/keyring.ts
|
|
1409
|
+
const OP_LIST_TRANSFER_KEYS = generatedOperation("keyring.listTransferKeys");
|
|
1410
|
+
const makeKeyring = (kernel) => ({ listTransferKeys: (options) => executeOperation(kernel, OP_LIST_TRANSFER_KEYS, {}, options) });
|
|
1411
|
+
|
|
1412
|
+
//#endregion
|
|
1413
|
+
//#region src/effect/generated/resources/session-configs.ts
|
|
1414
|
+
const OP_RETRIEVE = generatedOperation("sessionConfigs.retrieve");
|
|
1415
|
+
const OP_LIST = generatedOperation("sessionConfigs.list");
|
|
1416
|
+
const makeSessionConfigs = (kernel) => {
|
|
1417
|
+
const resource = {
|
|
1418
|
+
retrieve: (sessionConfigID, options) => executeOperation(kernel, OP_RETRIEVE, { path: [sessionConfigID] }, options),
|
|
1419
|
+
list: (query = {}, options) => executeOperation(kernel, OP_LIST, { query }, options),
|
|
1420
|
+
listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
|
|
1421
|
+
...query,
|
|
1422
|
+
cursor
|
|
1423
|
+
}, options))
|
|
1424
|
+
};
|
|
1425
|
+
return resource;
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
//#endregion
|
|
1429
|
+
//#region src/effect/generated/resource-wiring.ts
|
|
1430
|
+
const createClientResources = (kernel) => ({
|
|
1431
|
+
toolRouter: makeToolRouter(kernel),
|
|
1432
|
+
tools: makeTools$1(kernel),
|
|
1433
|
+
files: makeFiles(kernel),
|
|
1434
|
+
connectedAccounts: makeConnectedAccounts(kernel),
|
|
1435
|
+
link: makeLink(kernel),
|
|
1436
|
+
toolkits: makeToolkits(kernel),
|
|
1437
|
+
authConfigs: makeAuthConfigs(kernel),
|
|
1438
|
+
triggersTypes: makeTriggersTypes(kernel),
|
|
1439
|
+
triggerInstances: makeTriggerInstances(kernel),
|
|
1440
|
+
mcp: makeMcp(kernel),
|
|
1441
|
+
cli: makeCli(kernel),
|
|
1442
|
+
logs: makeLogs(kernel),
|
|
1443
|
+
project: makeProject$3(kernel),
|
|
1444
|
+
webhookSubscriptions: makeWebhookSubscriptions(kernel),
|
|
1445
|
+
webhookEndpoints: makeWebhookEndpoints(kernel),
|
|
1446
|
+
org: makeOrg(kernel),
|
|
1447
|
+
auth: makeAuth(kernel),
|
|
1448
|
+
apiKeyRevocation: makeApiKeyRevocation(kernel),
|
|
1449
|
+
custom: makeCustom(kernel),
|
|
1450
|
+
keyring: makeKeyring(kernel),
|
|
1451
|
+
sessionConfigs: makeSessionConfigs(kernel)
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1454
|
+
//#endregion
|
|
1455
|
+
//#region src/effect/client.ts
|
|
1456
|
+
/**
|
|
1457
|
+
* The Effect client: a `Context.Service`, layers that build it from the
|
|
1458
|
+
* `HttpClient` in context (or bring a fetch-backed one), and a plain
|
|
1459
|
+
* constructor for callers who already hold one.
|
|
1460
|
+
*
|
|
1461
|
+
* Options are fixed at construction. Nothing here reads the environment except
|
|
1462
|
+
* {@link layerConfig}, which reads the `COMPOSIO_*` settings through Effect's
|
|
1463
|
+
* `Config` — so the `ConfigProvider` in context decides where they come from.
|
|
1464
|
+
*/
|
|
1465
|
+
var ComposioClient = class extends Context.Service()("@composio/client/effect/ComposioClient") {};
|
|
1466
|
+
const DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
1467
|
+
const DEFAULT_MAX_RETRIES = 2;
|
|
1468
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
1469
|
+
const hold = (credential) => {
|
|
1470
|
+
if (credential === null || credential === void 0) return null;
|
|
1471
|
+
return Redacted.isRedacted(credential) ? credential : Redacted.make(credential);
|
|
1472
|
+
};
|
|
1473
|
+
const resolveKernel = (options, httpClient) => {
|
|
1474
|
+
const baseURL = options.baseURL || DEFAULT_BASE_URL;
|
|
1475
|
+
if (options.decode === true && options.schemas === void 0) return Result.fail(new ConfigurationError({ message: SCHEMAS_MISSING }));
|
|
1476
|
+
const kernel = {
|
|
1477
|
+
httpClient,
|
|
1478
|
+
baseURL,
|
|
1479
|
+
apiKey: hold(options.apiKey),
|
|
1480
|
+
userApiKey: hold(options.userApiKey),
|
|
1481
|
+
orgApiKey: hold(options.orgApiKey),
|
|
1482
|
+
allowedHTTPOrigin: options.allowInsecureHTTP ? parseHTTPURL(baseURL)?.origin ?? null : null,
|
|
1483
|
+
userAgent: `Composio/JS ${VERSION}`,
|
|
1484
|
+
defaultHeaders: options.defaultHeaders,
|
|
1485
|
+
defaultQuery: options.defaultQuery,
|
|
1486
|
+
maxRetries: options.maxRetries ?? DEFAULT_MAX_RETRIES,
|
|
1487
|
+
timeout: options.timeout ?? DEFAULT_TIMEOUT,
|
|
1488
|
+
tracing: options.tracing ?? "off",
|
|
1489
|
+
decode: options.decode ?? false,
|
|
1490
|
+
schemas: options.schemas,
|
|
1491
|
+
notices: makeNoticeRecord(options.deprecationNotices)
|
|
1492
|
+
};
|
|
1493
|
+
const unsendable = unsendableCredential(kernel);
|
|
1494
|
+
if (unsendable !== void 0) return Result.fail(new ConfigurationError({ message: `The \`${unsendable}\` option cannot be sent as a header: it contains a line break, a NUL or a character outside Latin-1.` }));
|
|
1495
|
+
return Result.try({
|
|
1496
|
+
try: () => {
|
|
1497
|
+
assertCredentialTransport(baseURL, revealCredentials(kernel), kernel.allowedHTTPOrigin);
|
|
1498
|
+
return kernel;
|
|
1499
|
+
},
|
|
1500
|
+
catch: configurationErrorFrom
|
|
1501
|
+
});
|
|
1502
|
+
};
|
|
1503
|
+
const fromKernel = (kernel) => ({
|
|
1504
|
+
...createClientResources(kernel),
|
|
1505
|
+
get: (path, options) => executeRaw(kernel, "get", path, options),
|
|
1506
|
+
post: (path, options) => executeRaw(kernel, "post", path, options),
|
|
1507
|
+
put: (path, options) => executeRaw(kernel, "put", path, options),
|
|
1508
|
+
patch: (path, options) => executeRaw(kernel, "patch", path, options),
|
|
1509
|
+
delete: (path, options) => executeRaw(kernel, "delete", path, options)
|
|
1510
|
+
});
|
|
1511
|
+
/**
|
|
1512
|
+
* The kernel a client dispatches through. Internal: the generated resources
|
|
1513
|
+
* are built over it, and it is not part of the entry's exports.
|
|
1514
|
+
*
|
|
1515
|
+
* @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
|
|
1516
|
+
* credential cannot be sent as a header, or the client is to decode and was
|
|
1517
|
+
* given no schemas.
|
|
1518
|
+
*/
|
|
1519
|
+
const makeKernel = (options, httpClient) => Result.getOrThrow(resolveKernel(options, httpClient));
|
|
1520
|
+
/**
|
|
1521
|
+
* Builds a client synchronously from an `HttpClient` the caller already holds.
|
|
1522
|
+
* Reads no environment variable.
|
|
1523
|
+
*
|
|
1524
|
+
* @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
|
|
1525
|
+
* credential cannot be sent as a header, or the client is to decode and was
|
|
1526
|
+
* given no schemas.
|
|
1527
|
+
*/
|
|
1528
|
+
const make = (options, httpClient) => fromKernel(makeKernel(options, httpClient));
|
|
1529
|
+
/**
|
|
1530
|
+
* Provides the client from explicit options and the `HttpClient` in context.
|
|
1531
|
+
* Reads no environment variable.
|
|
1532
|
+
*/
|
|
1533
|
+
const layer = (options = {}) => Layer.effect(ComposioClient, Effect.flatMap(HttpClient.HttpClient, (httpClient) => Effect.map(Effect.fromResult(resolveKernel(options, httpClient)), fromKernel)));
|
|
1534
|
+
/**
|
|
1535
|
+
* {@link layer} over a fetch-backed `HttpClient`, for an application that has
|
|
1536
|
+
* no transport of its own to supply. `fetch` is the platform's, or whatever
|
|
1537
|
+
* the `FetchHttpClient.Fetch` reference in context names.
|
|
1538
|
+
*/
|
|
1539
|
+
const layerFetch = (options = {}) => Layer.provide(layer(options), FetchHttpClient.layer);
|
|
1540
|
+
/** A setting as the compat client reads one: trimmed, and absent when empty. */
|
|
1541
|
+
const setting = (name) => Config.map(Config.option(Config.String(name)), (value) => Option.getOrUndefined(Option.filter(Option.map(value, (text) => text.trim()), (text) => text !== "")));
|
|
1542
|
+
const settings = Config.all({
|
|
1543
|
+
apiKey: setting("COMPOSIO_API_KEY"),
|
|
1544
|
+
userApiKey: setting("COMPOSIO_USER_API_KEY"),
|
|
1545
|
+
orgApiKey: setting("COMPOSIO_ORG_API_KEY"),
|
|
1546
|
+
baseURL: setting("COMPOSIO_BASE_URL"),
|
|
1547
|
+
allowInsecureHTTP: setting("COMPOSIO_ALLOW_INSECURE_HTTP")
|
|
1548
|
+
});
|
|
1549
|
+
/**
|
|
1550
|
+
* Provides the client from the `COMPOSIO_*` settings — `COMPOSIO_API_KEY`,
|
|
1551
|
+
* `COMPOSIO_USER_API_KEY`, `COMPOSIO_ORG_API_KEY`, `COMPOSIO_BASE_URL` and
|
|
1552
|
+
* `COMPOSIO_ALLOW_INSECURE_HTTP=1` — read through the `ConfigProvider` in
|
|
1553
|
+
* context, which is the process environment unless the application says
|
|
1554
|
+
* otherwise. An option given here wins over its setting; `null` for a
|
|
1555
|
+
* credential means "none", whatever is configured.
|
|
1556
|
+
*/
|
|
1557
|
+
const layerConfig = (options = {}) => Layer.effect(ComposioClient, Effect.gen(function* () {
|
|
1558
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
1559
|
+
const env = yield* Effect.mapError(settings, () => new ConfigurationError({ message: "The COMPOSIO_* configuration could not be read." }));
|
|
1560
|
+
const kernel = yield* Effect.fromResult(resolveKernel({
|
|
1561
|
+
...options,
|
|
1562
|
+
apiKey: options.apiKey !== void 0 ? options.apiKey : env.apiKey,
|
|
1563
|
+
userApiKey: options.userApiKey !== void 0 ? options.userApiKey : env.userApiKey,
|
|
1564
|
+
orgApiKey: options.orgApiKey !== void 0 ? options.orgApiKey : env.orgApiKey,
|
|
1565
|
+
baseURL: options.baseURL ?? env.baseURL,
|
|
1566
|
+
allowInsecureHTTP: options.allowInsecureHTTP ?? env.allowInsecureHTTP === "1"
|
|
1567
|
+
}, httpClient));
|
|
1568
|
+
return fromKernel(kernel);
|
|
1569
|
+
}));
|
|
1570
|
+
|
|
1571
|
+
//#endregion
|
|
1572
|
+
export { APIConnectionError, APIConnectionTimeoutError, APIError, AuthenticationError, BadRequestError, ComposioClient, ConfigurationError, ConflictError, DecodeError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, VERSION, isAPIError, isComposioError, layer, layerConfig, layerFetch, make };
|