@inkeep/agents-manage-mcp 0.39.4 → 0.40.0
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/.vscode/settings.json +5 -0
- package/README.md +38 -139
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +27 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7775 -6996
- package/dist/index.js.map +1 -1
- package/manifest.json +61 -6
- package/package.json +12 -12
- package/scripts/fetch-openapi.mjs +22 -40
- package/scripts/generate.mjs +33 -66
- package/src/core.ts +3 -1
- package/src/funcs/agentArtifactComponentRelationsAssociateArtifactComponentWithAgent.ts +94 -78
- package/src/funcs/agentArtifactComponentRelationsCheckArtifactComponentAgentAssociation.ts +98 -81
- package/src/funcs/agentArtifactComponentRelationsGetAgentsUsingArtifactComponent.ts +94 -78
- package/src/funcs/agentArtifactComponentRelationsGetArtifactComponentsForAgent.ts +91 -76
- package/src/funcs/agentArtifactComponentRelationsRemoveArtifactComponentFromAgent.ts +96 -80
- package/src/funcs/agentDataComponentRelationsAssociateDataComponentWithAgent.ts +92 -77
- package/src/funcs/agentDataComponentRelationsCheckDataComponentAgentAssociation.ts +95 -79
- package/src/funcs/agentDataComponentRelationsGetAgentsUsingDataComponent.ts +91 -76
- package/src/funcs/agentDataComponentRelationsGetDataComponentsForAgent.ts +91 -76
- package/src/funcs/agentDataComponentRelationsRemoveDataComponentFromAgent.ts +93 -78
- package/src/funcs/agentGetFullAgentDefinition.ts +89 -74
- package/src/funcs/agentGetRelatedAgentInfos.ts +91 -76
- package/src/funcs/agentsCreateAgent.ts +88 -73
- package/src/funcs/agentsDeleteAgent.ts +74 -58
- package/src/funcs/agentsGetAgent.ts +90 -73
- package/src/funcs/agentsListAgents.ts +89 -74
- package/src/funcs/agentsUpdateAgent.ts +92 -75
- package/src/funcs/apiKeysCreateAPIKey.ts +88 -73
- package/src/funcs/apiKeysDeleteAPIKey.ts +74 -58
- package/src/funcs/apiKeysGetAPIKeyById.ts +90 -73
- package/src/funcs/apiKeysListAPIKeys.ts +90 -75
- package/src/funcs/apiKeysUpdateAPIKey.ts +92 -75
- package/src/funcs/artifactComponentCreateArtifactComponent.ts +89 -74
- package/src/funcs/artifactComponentDeleteArtifactComponent.ts +74 -60
- package/src/funcs/artifactComponentGetArtifactComponentById.ts +89 -74
- package/src/funcs/artifactComponentListArtifactComponents.ts +90 -75
- package/src/funcs/artifactComponentUpdateArtifactComponent.ts +91 -76
- package/src/funcs/cliGetApiCliMe.ts +144 -0
- package/src/funcs/contextConfigCreateContextConfig.ts +91 -76
- package/src/funcs/contextConfigDeleteContextConfig.ts +87 -73
- package/src/funcs/contextConfigGetContextConfigById.ts +91 -76
- package/src/funcs/contextConfigListContextConfigs.ts +92 -77
- package/src/funcs/contextConfigUpdateContextConfig.ts +93 -78
- package/src/funcs/conversationsGetConversation.ts +92 -77
- package/src/funcs/credentialCreateCredential.ts +90 -73
- package/src/funcs/credentialDeleteCredential.ts +73 -59
- package/src/funcs/credentialGetCredentialById.ts +89 -74
- package/src/funcs/credentialListCredentials.ts +91 -74
- package/src/funcs/credentialStoreCreateCredentialInStore.ts +91 -76
- package/src/funcs/credentialStoreListCredentialStores.ts +87 -72
- package/src/funcs/credentialUpdateCredential.ts +91 -76
- package/src/funcs/dataComponentCreateDataComponent.ts +90 -73
- package/src/funcs/dataComponentDeleteDataComponent.ts +74 -60
- package/src/funcs/dataComponentGetDataComponentById.ts +89 -74
- package/src/funcs/dataComponentListDataComponents.ts +91 -74
- package/src/funcs/dataComponentUpdateDataComponent.ts +91 -76
- package/src/funcs/externalAgentsCreateExternalAgent.ts +90 -73
- package/src/funcs/externalAgentsDeleteExternalAgent.ts +74 -60
- package/src/funcs/externalAgentsGetExternalAgentById.ts +89 -74
- package/src/funcs/externalAgentsListExternalAgents.ts +91 -74
- package/src/funcs/externalAgentsUpdateExternalAgent.ts +91 -76
- package/src/funcs/fullAgentCreateFullAgent.ts +89 -74
- package/src/funcs/fullAgentDeleteFullAgent.ts +86 -70
- package/src/funcs/fullAgentGetFullAgent.ts +90 -73
- package/src/funcs/fullAgentUpdateFullAgent.ts +92 -75
- package/src/funcs/fullProjectCreateFullProject.ts +87 -72
- package/src/funcs/fullProjectDeleteFullProject.ts +82 -68
- package/src/funcs/fullProjectGetFullProject.ts +86 -71
- package/src/funcs/fullProjectUpdateFullProject.ts +88 -73
- package/src/funcs/functionToolsCreateFunctionTool.ts +91 -76
- package/src/funcs/functionToolsDeleteFunctionTool.ts +87 -73
- package/src/funcs/functionToolsGetFunctionTool.ts +91 -76
- package/src/funcs/functionToolsListFunctionTools.ts +92 -77
- package/src/funcs/functionToolsUpdateFunctionTool.ts +93 -78
- package/src/funcs/functionsCreateFunction.ts +90 -73
- package/src/funcs/functionsDeleteFunction.ts +86 -70
- package/src/funcs/functionsGetFunction.ts +90 -73
- package/src/funcs/functionsListFunctions.ts +91 -74
- package/src/funcs/functionsUpdateFunction.ts +92 -75
- package/src/funcs/health.ts +61 -45
- package/src/funcs/invitationsGetApiInvitationsPending.ts +60 -52
- package/src/funcs/mcpCatalogListMCPCatalog.ts +88 -71
- package/src/funcs/oAuthInitiateOauthLoginPublic.ts +74 -62
- package/src/funcs/oAuthOauthCallback.ts +73 -61
- package/src/funcs/playgroundCreatePlaygroundToken.ts +75 -62
- package/src/funcs/projectsCreateProject.ts +87 -72
- package/src/funcs/projectsDeleteProject.ts +86 -71
- package/src/funcs/projectsGetProjectById.ts +86 -71
- package/src/funcs/projectsListProjects.ts +87 -72
- package/src/funcs/projectsUpdateProject.ts +88 -73
- package/src/funcs/subAgentCreateSubagent.ts +91 -76
- package/src/funcs/subAgentDeleteSubagent.ts +77 -61
- package/src/funcs/subAgentExternalAgentRelationsCreateSubAgentExternalAgentRelation.ts +95 -79
- package/src/funcs/subAgentExternalAgentRelationsDeleteSubAgentExternalAgentRelation.ts +80 -65
- package/src/funcs/subAgentExternalAgentRelationsGetSubAgentExternalAgentRelationById.ts +95 -79
- package/src/funcs/subAgentExternalAgentRelationsListSubAgentExternalAgentRelations.ts +96 -80
- package/src/funcs/subAgentExternalAgentRelationsUpdateSubAgentExternalAgentRelation.ts +97 -81
- package/src/funcs/subAgentGetSubagentById.ts +91 -76
- package/src/funcs/subAgentListSubagents.ts +92 -77
- package/src/funcs/subAgentRelationsCreateSubAgentRelation.ts +91 -76
- package/src/funcs/subAgentRelationsDeleteSubAgentRelation.ts +76 -62
- package/src/funcs/subAgentRelationsGetSubAgentRelationById.ts +91 -76
- package/src/funcs/subAgentRelationsListSubAgentRelations.ts +96 -81
- package/src/funcs/subAgentRelationsUpdateSubAgentRelation.ts +93 -78
- package/src/funcs/subAgentTeamAgentRelationsCreateSubAgentTeamAgentRelation.ts +93 -78
- package/src/funcs/subAgentTeamAgentRelationsDeleteSubAgentTeamAgentRelation.ts +78 -64
- package/src/funcs/subAgentTeamAgentRelationsGetSubAgentTeamAgentRelationById.ts +93 -78
- package/src/funcs/subAgentTeamAgentRelationsListSubAgentTeamAgentRelations.ts +94 -79
- package/src/funcs/subAgentTeamAgentRelationsUpdateSubAgentTeamAgentRelation.ts +95 -80
- package/src/funcs/subAgentToolRelationsCreateSubagentToolRelation.ts +91 -76
- package/src/funcs/subAgentToolRelationsDeleteSubagentToolRelation.ts +76 -62
- package/src/funcs/subAgentToolRelationsGetSubagentToolRelation.ts +91 -76
- package/src/funcs/subAgentToolRelationsGetSubagentsForTool.ts +94 -79
- package/src/funcs/subAgentToolRelationsListSubagentToolRelations.ts +94 -79
- package/src/funcs/subAgentToolRelationsUpdateSubagentToolRelation.ts +93 -78
- package/src/funcs/subAgentUpdateSubagent.ts +93 -78
- package/src/funcs/thirdPartyMCPServersGetOauthRedirectUrl.ts +209 -0
- package/src/funcs/thirdPartyMCPServersGetThirdPartyMCPServer.ts +89 -74
- package/src/funcs/toolsCreateTool.ts +88 -73
- package/src/funcs/toolsDeleteTool.ts +97 -58
- package/src/funcs/toolsGetTool.ts +90 -73
- package/src/funcs/toolsGetUserCredentialForTool.ts +211 -0
- package/src/funcs/toolsListTools.ts +90 -75
- package/src/funcs/toolsUpdateTool.ts +92 -75
- package/src/funcs/userOrganizationsGetApiUsersUserIdOrganizations.ts +62 -52
- package/src/funcs/userOrganizationsPostApiUsersUserIdOrganizations.ts +64 -54
- package/src/hooks/hooks.ts +25 -14
- package/src/hooks/registration.ts +5 -4
- package/src/hooks/types.ts +18 -8
- package/src/index.ts +2 -1
- package/src/lib/base64.ts +8 -3
- package/src/lib/config.ts +19 -11
- package/src/lib/dlv.ts +3 -2
- package/src/lib/encodings.ts +118 -87
- package/src/lib/env.ts +17 -7
- package/src/lib/files.ts +29 -28
- package/src/lib/http.ts +66 -46
- package/src/lib/is-plain-object.ts +2 -1
- package/src/lib/logger.ts +1 -0
- package/src/lib/matchers.ts +111 -94
- package/src/lib/primitives.ts +14 -8
- package/src/lib/result.ts +4 -1
- package/src/lib/retries.ts +26 -18
- package/src/lib/schemas.ts +20 -26
- package/src/lib/sdks.ts +115 -85
- package/src/lib/security.ts +90 -46
- package/src/lib/url.ts +10 -5
- package/src/mcp-server/cli/start/command.ts +54 -41
- package/src/mcp-server/cli/start/impl.ts +52 -38
- package/src/mcp-server/cli.ts +2 -1
- package/src/mcp-server/console-logger.ts +27 -12
- package/src/mcp-server/extensions.ts +11 -6
- package/src/mcp-server/mcp-server.ts +8 -7
- package/src/mcp-server/prompts.ts +64 -51
- package/src/mcp-server/resources.ts +54 -35
- package/src/mcp-server/scopes.ts +1 -0
- package/src/mcp-server/server.ts +25 -6
- package/src/mcp-server/shared.ts +35 -24
- package/src/mcp-server/tools/agentArtifactComponentRelationsAssociateArtifactComponentWithAgent.ts +34 -33
- package/src/mcp-server/tools/agentArtifactComponentRelationsCheckArtifactComponentAgentAssociation.ts +34 -33
- package/src/mcp-server/tools/agentArtifactComponentRelationsGetAgentsUsingArtifactComponent.ts +34 -32
- package/src/mcp-server/tools/agentArtifactComponentRelationsGetArtifactComponentsForAgent.ts +34 -32
- package/src/mcp-server/tools/agentArtifactComponentRelationsRemoveArtifactComponentFromAgent.ts +34 -32
- package/src/mcp-server/tools/agentDataComponentRelationsAssociateDataComponentWithAgent.ts +33 -32
- package/src/mcp-server/tools/agentDataComponentRelationsCheckDataComponentAgentAssociation.ts +34 -32
- package/src/mcp-server/tools/agentDataComponentRelationsGetAgentsUsingDataComponent.ts +33 -32
- package/src/mcp-server/tools/agentDataComponentRelationsGetDataComponentsForAgent.ts +33 -32
- package/src/mcp-server/tools/agentDataComponentRelationsRemoveDataComponentFromAgent.ts +33 -32
- package/src/mcp-server/tools/agentGetFullAgentDefinition.ts +16 -13
- package/src/mcp-server/tools/agentGetRelatedAgentInfos.ts +16 -13
- package/src/mcp-server/tools/agentsCreateAgent.ts +16 -13
- package/src/mcp-server/tools/agentsDeleteAgent.ts +16 -13
- package/src/mcp-server/tools/agentsGetAgent.ts +16 -13
- package/src/mcp-server/tools/agentsListAgents.ts +16 -13
- package/src/mcp-server/tools/agentsUpdateAgent.ts +16 -13
- package/src/mcp-server/tools/apiKeysCreateAPIKey.ts +16 -13
- package/src/mcp-server/tools/apiKeysDeleteAPIKey.ts +16 -13
- package/src/mcp-server/tools/apiKeysGetAPIKeyById.ts +16 -13
- package/src/mcp-server/tools/apiKeysListAPIKeys.ts +16 -13
- package/src/mcp-server/tools/apiKeysUpdateAPIKey.ts +16 -13
- package/src/mcp-server/tools/artifactComponentCreateArtifactComponent.ts +19 -14
- package/src/mcp-server/tools/artifactComponentDeleteArtifactComponent.ts +19 -14
- package/src/mcp-server/tools/artifactComponentGetArtifactComponentById.ts +15 -12
- package/src/mcp-server/tools/artifactComponentListArtifactComponents.ts +19 -14
- package/src/mcp-server/tools/artifactComponentUpdateArtifactComponent.ts +19 -14
- package/src/mcp-server/tools/cliGetApiCliMe.ts +38 -0
- package/src/mcp-server/tools/contextConfigCreateContextConfig.ts +19 -14
- package/src/mcp-server/tools/contextConfigDeleteContextConfig.ts +19 -14
- package/src/mcp-server/tools/contextConfigGetContextConfigById.ts +19 -14
- package/src/mcp-server/tools/contextConfigListContextConfigs.ts +32 -28
- package/src/mcp-server/tools/contextConfigUpdateContextConfig.ts +19 -14
- package/src/mcp-server/tools/conversationsGetConversation.ts +16 -13
- package/src/mcp-server/tools/credentialCreateCredential.ts +16 -13
- package/src/mcp-server/tools/credentialDeleteCredential.ts +16 -13
- package/src/mcp-server/tools/credentialGetCredentialById.ts +16 -13
- package/src/mcp-server/tools/credentialListCredentials.ts +16 -13
- package/src/mcp-server/tools/credentialStoreCreateCredentialInStore.ts +19 -14
- package/src/mcp-server/tools/credentialStoreListCredentialStores.ts +19 -14
- package/src/mcp-server/tools/credentialUpdateCredential.ts +16 -13
- package/src/mcp-server/tools/dataComponentCreateDataComponent.ts +19 -14
- package/src/mcp-server/tools/dataComponentDeleteDataComponent.ts +19 -14
- package/src/mcp-server/tools/dataComponentGetDataComponentById.ts +19 -14
- package/src/mcp-server/tools/dataComponentListDataComponents.ts +32 -28
- package/src/mcp-server/tools/dataComponentUpdateDataComponent.ts +19 -14
- package/src/mcp-server/tools/externalAgentsCreateExternalAgent.ts +19 -14
- package/src/mcp-server/tools/externalAgentsDeleteExternalAgent.ts +19 -14
- package/src/mcp-server/tools/externalAgentsGetExternalAgentById.ts +19 -14
- package/src/mcp-server/tools/externalAgentsListExternalAgents.ts +19 -14
- package/src/mcp-server/tools/externalAgentsUpdateExternalAgent.ts +19 -14
- package/src/mcp-server/tools/fullAgentCreateFullAgent.ts +16 -13
- package/src/mcp-server/tools/fullAgentDeleteFullAgent.ts +16 -13
- package/src/mcp-server/tools/fullAgentGetFullAgent.ts +16 -13
- package/src/mcp-server/tools/fullAgentUpdateFullAgent.ts +16 -13
- package/src/mcp-server/tools/fullProjectCreateFullProject.ts +16 -13
- package/src/mcp-server/tools/fullProjectDeleteFullProject.ts +16 -13
- package/src/mcp-server/tools/fullProjectGetFullProject.ts +16 -13
- package/src/mcp-server/tools/fullProjectUpdateFullProject.ts +16 -13
- package/src/mcp-server/tools/functionToolsCreateFunctionTool.ts +32 -28
- package/src/mcp-server/tools/functionToolsDeleteFunctionTool.ts +32 -28
- package/src/mcp-server/tools/functionToolsGetFunctionTool.ts +16 -13
- package/src/mcp-server/tools/functionToolsListFunctionTools.ts +32 -28
- package/src/mcp-server/tools/functionToolsUpdateFunctionTool.ts +32 -28
- package/src/mcp-server/tools/functionsCreateFunction.ts +16 -13
- package/src/mcp-server/tools/functionsDeleteFunction.ts +16 -13
- package/src/mcp-server/tools/functionsGetFunction.ts +16 -13
- package/src/mcp-server/tools/functionsListFunctions.ts +16 -13
- package/src/mcp-server/tools/functionsUpdateFunction.ts +16 -13
- package/src/mcp-server/tools/health.ts +14 -12
- package/src/mcp-server/tools/invitationsGetApiInvitationsPending.ts +19 -14
- package/src/mcp-server/tools/mcpCatalogListMCPCatalog.ts +16 -13
- package/src/mcp-server/tools/oAuthInitiateOauthLoginPublic.ts +16 -13
- package/src/mcp-server/tools/oAuthOauthCallback.ts +16 -13
- package/src/mcp-server/tools/projectsCreateProject.ts +16 -13
- package/src/mcp-server/tools/projectsDeleteProject.ts +16 -13
- package/src/mcp-server/tools/projectsGetProjectById.ts +16 -13
- package/src/mcp-server/tools/projectsListProjects.ts +16 -13
- package/src/mcp-server/tools/projectsUpdateProject.ts +16 -13
- package/src/mcp-server/tools/subAgentCreateSubagent.ts +16 -13
- package/src/mcp-server/tools/subAgentDeleteSubagent.ts +16 -13
- package/src/mcp-server/tools/subAgentExternalAgentRelationsCreateSubAgentExternalAgentRelation.ts +34 -33
- package/src/mcp-server/tools/subAgentExternalAgentRelationsDeleteSubAgentExternalAgentRelation.ts +34 -33
- package/src/mcp-server/tools/subAgentExternalAgentRelationsGetSubAgentExternalAgentRelationById.ts +34 -33
- package/src/mcp-server/tools/subAgentExternalAgentRelationsListSubAgentExternalAgentRelations.ts +34 -31
- package/src/mcp-server/tools/subAgentExternalAgentRelationsUpdateSubAgentExternalAgentRelation.ts +34 -33
- package/src/mcp-server/tools/subAgentGetSubagentById.ts +16 -13
- package/src/mcp-server/tools/subAgentListSubagents.ts +16 -13
- package/src/mcp-server/tools/subAgentRelationsCreateSubAgentRelation.ts +19 -14
- package/src/mcp-server/tools/subAgentRelationsDeleteSubAgentRelation.ts +19 -14
- package/src/mcp-server/tools/subAgentRelationsGetSubAgentRelationById.ts +19 -14
- package/src/mcp-server/tools/subAgentRelationsListSubAgentRelations.ts +19 -14
- package/src/mcp-server/tools/subAgentRelationsUpdateSubAgentRelation.ts +19 -14
- package/src/mcp-server/tools/subAgentTeamAgentRelationsCreateSubAgentTeamAgentRelation.ts +33 -32
- package/src/mcp-server/tools/subAgentTeamAgentRelationsDeleteSubAgentTeamAgentRelation.ts +33 -32
- package/src/mcp-server/tools/subAgentTeamAgentRelationsGetSubAgentTeamAgentRelationById.ts +34 -32
- package/src/mcp-server/tools/subAgentTeamAgentRelationsListSubAgentTeamAgentRelations.ts +33 -32
- package/src/mcp-server/tools/subAgentTeamAgentRelationsUpdateSubAgentTeamAgentRelation.ts +33 -32
- package/src/mcp-server/tools/subAgentToolRelationsCreateSubagentToolRelation.ts +33 -30
- package/src/mcp-server/tools/subAgentToolRelationsDeleteSubagentToolRelation.ts +33 -30
- package/src/mcp-server/tools/subAgentToolRelationsGetSubagentToolRelation.ts +20 -16
- package/src/mcp-server/tools/subAgentToolRelationsGetSubagentsForTool.ts +19 -14
- package/src/mcp-server/tools/subAgentToolRelationsListSubagentToolRelations.ts +33 -30
- package/src/mcp-server/tools/subAgentToolRelationsUpdateSubagentToolRelation.ts +33 -30
- package/src/mcp-server/tools/subAgentUpdateSubagent.ts +16 -13
- package/src/mcp-server/tools/thirdPartyMCPServersGetOauthRedirectUrl.ts +47 -0
- package/src/mcp-server/tools/thirdPartyMCPServersGetThirdPartyMCPServer.ts +15 -12
- package/src/mcp-server/tools/toolsCreateTool.ts +16 -13
- package/src/mcp-server/tools/toolsDeleteTool.ts +16 -13
- package/src/mcp-server/tools/toolsGetTool.ts +16 -13
- package/src/mcp-server/tools/toolsGetUserCredentialForTool.ts +43 -0
- package/src/mcp-server/tools/toolsListTools.ts +16 -13
- package/src/mcp-server/tools/toolsUpdateTool.ts +16 -13
- package/src/mcp-server/tools/userOrganizationsGetApiUsersUserIdOrganizations.ts +33 -30
- package/src/mcp-server/tools/userOrganizationsPostApiUsersUserIdOrganizations.ts +33 -30
- package/src/mcp-server/tools.ts +111 -79
- package/src/models/agent.ts +3 -2
- package/src/models/agentcreate.ts +3 -2
- package/src/models/agentlistresponse.ts +6 -5
- package/src/models/agentresponse.ts +4 -3
- package/src/models/agentstopwhen.ts +3 -2
- package/src/models/agentupdate.ts +3 -2
- package/src/models/agentwithincontextofproject.ts +30 -21
- package/src/models/agentwithincontextofprojectresponse.ts +5 -6
- package/src/models/apikey.ts +3 -2
- package/src/models/apikeycreate.ts +3 -2
- package/src/models/apikeylistresponse.ts +6 -5
- package/src/models/apikeyresponse.ts +4 -3
- package/src/models/apikeyupdate.ts +3 -2
- package/src/models/artifactcomponent.ts +6 -5
- package/src/models/artifactcomponentarrayresponse.ts +7 -5
- package/src/models/artifactcomponentcreate.ts +5 -6
- package/src/models/artifactcomponentlistresponse.ts +8 -6
- package/src/models/artifactcomponentresponse.ts +7 -5
- package/src/models/artifactcomponentupdate.ts +5 -6
- package/src/models/associateartifactcomponentwithagentop.ts +36 -32
- package/src/models/associatedatacomponentwithagentop.ts +28 -25
- package/src/models/badrequest.ts +28 -16
- package/src/models/candelegatetoexternalagent.ts +4 -5
- package/src/models/candelegatetoteamagent.ts +4 -5
- package/src/models/canuseitem.ts +9 -10
- package/src/models/checkartifactcomponentagentassociationop.ts +33 -31
- package/src/models/checkdatacomponentagentassociationop.ts +22 -19
- package/src/models/componentassociation.ts +7 -9
- package/src/models/componentassociationlistresponse.ts +5 -6
- package/src/models/contextconfig.ts +5 -6
- package/src/models/contextconfigcreate.ts +15 -13
- package/src/models/contextconfiglistresponse.ts +5 -6
- package/src/models/contextconfigresponse.ts +7 -9
- package/src/models/contextconfigupdate.ts +15 -13
- package/src/models/conversationwithformattedmessagesresponse.ts +5 -8
- package/src/models/createagentop.ts +23 -16
- package/src/models/createapikeyop.ts +41 -40
- package/src/models/createartifactcomponentop.ts +23 -20
- package/src/models/createcontextconfigop.ts +26 -20
- package/src/models/createcredentialinstoreop.ts +26 -22
- package/src/models/createcredentialinstorerequest.ts +4 -5
- package/src/models/createcredentialinstoreresponse.ts +4 -7
- package/src/models/createcredentialop.ts +23 -20
- package/src/models/createdatacomponentop.ts +25 -19
- package/src/models/createexternalagentop.ts +25 -19
- package/src/models/createfullagentop.ts +29 -23
- package/src/models/createfullprojectop.ts +25 -21
- package/src/models/createfunctionop.ts +27 -22
- package/src/models/createfunctiontoolop.ts +26 -20
- package/src/models/createplaygroundtokenop.ts +17 -30
- package/src/models/createprojectop.ts +39 -35
- package/src/models/createsubagentexternalagentrelationop.ts +30 -24
- package/src/models/createsubagentop.ts +28 -23
- package/src/models/createsubagentrelationop.ts +24 -21
- package/src/models/createsubagentteamagentrelationop.ts +30 -24
- package/src/models/createsubagenttoolrelationop.ts +26 -22
- package/src/models/createtoolop.ts +26 -16
- package/src/models/credentialreference.ts +35 -14
- package/src/models/credentialreferencecreate.ts +25 -7
- package/src/models/credentialreferencelistresponse.ts +8 -6
- package/src/models/credentialreferenceresponse.ts +7 -5
- package/src/models/credentialreferenceupdate.ts +25 -7
- package/src/models/credentialstore.ts +20 -10
- package/src/models/credentialstorelistresponse.ts +7 -5
- package/src/models/datacomponent.ts +5 -4
- package/src/models/datacomponentarrayresponse.ts +4 -5
- package/src/models/datacomponentcreate.ts +6 -5
- package/src/models/datacomponentlistresponse.ts +5 -6
- package/src/models/datacomponentresponse.ts +7 -9
- package/src/models/datacomponentupdate.ts +6 -5
- package/src/models/deleteagentop.ts +11 -10
- package/src/models/deleteapikeyop.ts +15 -17
- package/src/models/deleteartifactcomponentop.ts +9 -12
- package/src/models/deletecontextconfigop.ts +21 -18
- package/src/models/deletecredentialop.ts +9 -12
- package/src/models/deletedatacomponentop.ts +9 -12
- package/src/models/deleteexternalagentop.ts +9 -12
- package/src/models/deletefullagentop.ts +20 -17
- package/src/models/deletefullprojectop.ts +19 -16
- package/src/models/deletefunctionop.ts +22 -20
- package/src/models/deletefunctiontoolop.ts +21 -18
- package/src/models/deleteprojectop.ts +33 -32
- package/src/models/deletesubagentexternalagentrelationop.ts +11 -14
- package/src/models/deletesubagentop.ts +12 -16
- package/src/models/deletesubagentrelationop.ts +10 -13
- package/src/models/deletesubagentteamagentrelationop.ts +11 -14
- package/src/models/deletesubagenttoolrelationop.ts +10 -13
- package/src/models/deletetoolop.ts +34 -12
- package/src/models/errorresponse.ts +3 -2
- package/src/models/errors/apierror.ts +5 -4
- package/src/models/errors/httpclienterrors.ts +8 -7
- package/src/models/errors/sdkvalidationerror.ts +7 -58
- package/src/models/existsresponse.ts +3 -2
- package/src/models/externalagent.ts +5 -4
- package/src/models/externalagentcreate.ts +6 -5
- package/src/models/externalagentlistresponse.ts +5 -6
- package/src/models/externalagentresponse.ts +7 -9
- package/src/models/externalagentupdate.ts +6 -5
- package/src/models/forbidden.ts +28 -16
- package/src/models/fullagentagentinsert.ts +50 -39
- package/src/models/fullprojectdefinition.ts +52 -38
- package/src/models/fullprojectdefinitionresponse.ts +5 -6
- package/src/models/function.ts +3 -2
- package/src/models/functioncreate.ts +3 -2
- package/src/models/functionlistresponse.ts +9 -11
- package/src/models/functionresponse.ts +7 -5
- package/src/models/functiontool.ts +3 -2
- package/src/models/functiontoolcreate.ts +4 -3
- package/src/models/functiontoollistresponse.ts +5 -6
- package/src/models/functiontoolresponse.ts +7 -9
- package/src/models/functiontoolupdate.ts +4 -3
- package/src/models/functionupdate.ts +3 -2
- package/src/models/getagentop.ts +25 -18
- package/src/models/getagentsusingartifactcomponentop.ts +27 -21
- package/src/models/getagentsusingdatacomponentop.ts +27 -21
- package/src/models/getapiclimeop.ts +58 -0
- package/src/models/getapiinvitationspendingop.ts +10 -16
- package/src/models/getapikeybyidop.ts +34 -33
- package/src/models/getapiusersuseridorganizationsop.ts +13 -17
- package/src/models/getartifactcomponentbyidop.ts +22 -19
- package/src/models/getartifactcomponentsforagentop.ts +25 -21
- package/src/models/getcontextconfigbyidop.ts +23 -20
- package/src/models/getconversationop.ts +25 -20
- package/src/models/getcredentialbyidop.ts +22 -19
- package/src/models/getdatacomponentbyidop.ts +22 -19
- package/src/models/getdatacomponentsforagentop.ts +23 -20
- package/src/models/getexternalagentbyidop.ts +22 -19
- package/src/models/getfullagentdefinitionop.ts +27 -21
- package/src/models/getfullagentop.ts +38 -31
- package/src/models/getfullprojectop.ts +25 -22
- package/src/models/getfunctionop.ts +26 -16
- package/src/models/getfunctiontoolop.ts +23 -20
- package/src/models/getoauthredirecturlop.ts +111 -0
- package/src/models/getprojectbyidop.ts +25 -20
- package/src/models/getrelatedagentinfosop.ts +25 -21
- package/src/models/getsubagentbyidop.ts +25 -19
- package/src/models/getsubagentexternalagentrelationbyidop.ts +29 -23
- package/src/models/getsubagentrelationbyidop.ts +23 -20
- package/src/models/getsubagentsfortoolop.ts +27 -21
- package/src/models/getsubagentteamagentrelationbyidop.ts +29 -23
- package/src/models/getsubagenttoolrelationop.ts +25 -21
- package/src/models/getthirdpartymcpserverop.ts +43 -22
- package/src/models/gettoolop.ts +34 -25
- package/src/models/getusercredentialfortoolop.ts +64 -0
- package/src/models/healthop.ts +4 -3
- package/src/models/initiateoauthloginpublicop.ts +11 -13
- package/src/models/internalservererror.ts +34 -20
- package/src/models/listagentsop.ts +25 -15
- package/src/models/listapikeysop.ts +26 -16
- package/src/models/listartifactcomponentsop.ts +23 -19
- package/src/models/listcontextconfigsop.ts +22 -19
- package/src/models/listcredentialsop.ts +23 -19
- package/src/models/listcredentialstoresop.ts +21 -18
- package/src/models/listdatacomponentsop.ts +21 -18
- package/src/models/listexternalagentsop.ts +21 -18
- package/src/models/listfunctionsop.ts +36 -35
- package/src/models/listfunctiontoolsop.ts +22 -19
- package/src/models/listmcpcatalogop.ts +23 -21
- package/src/models/listprojectsop.ts +34 -27
- package/src/models/listsubagentexternalagentrelationsop.ts +26 -21
- package/src/models/listsubagentrelationsop.ts +24 -20
- package/src/models/listsubagentsop.ts +37 -36
- package/src/models/listsubagentteamagentrelationsop.ts +28 -22
- package/src/models/listsubagenttoolrelationsop.ts +27 -21
- package/src/models/listtoolsop.ts +41 -18
- package/src/models/mcpcataloglistresponse.ts +19 -13
- package/src/models/mcptool.ts +54 -25
- package/src/models/mcptoollistresponse.ts +6 -5
- package/src/models/mcptoolresponse.ts +6 -6
- package/src/models/model.ts +4 -3
- package/src/models/modelsettings.ts +4 -3
- package/src/models/notfound.ts +28 -16
- package/src/models/oauthcallbackop.ts +20 -22
- package/src/models/pagination.ts +3 -2
- package/src/models/postapiusersuseridorganizationsop.ts +18 -25
- package/src/models/project.ts +7 -6
- package/src/models/projectcreate.ts +7 -6
- package/src/models/projectlistresponse.ts +6 -5
- package/src/models/projectmodel.ts +4 -3
- package/src/models/projectresponse.ts +6 -6
- package/src/models/projectupdate.ts +7 -6
- package/src/models/relatedagentinfo.ts +8 -6
- package/src/models/relatedagentinfolistresponse.ts +8 -6
- package/src/models/removeartifactcomponentfromagentop.ts +25 -19
- package/src/models/removedatacomponentfromagentop.ts +25 -19
- package/src/models/removedresponse.ts +6 -6
- package/src/models/security.ts +9 -12
- package/src/models/statuscomponent.ts +17 -11
- package/src/models/statusupdate.ts +7 -3
- package/src/models/stopwhen.ts +3 -2
- package/src/models/subagent.ts +7 -6
- package/src/models/subagentartifactcomponentresponse.ts +4 -7
- package/src/models/subagentcreate.ts +8 -7
- package/src/models/subagentdatacomponentresponse.ts +4 -7
- package/src/models/subagentexternalagentrelation.ts +3 -4
- package/src/models/subagentexternalagentrelationcreate.ts +4 -5
- package/src/models/subagentexternalagentrelationlistresponse.ts +6 -7
- package/src/models/subagentexternalagentrelationresponse.ts +5 -6
- package/src/models/subagentexternalagentrelationupdate.ts +4 -5
- package/src/models/subagentlistresponse.ts +9 -11
- package/src/models/subagentrelation.ts +6 -4
- package/src/models/subagentrelationcreate.ts +15 -8
- package/src/models/subagentrelationlistresponse.ts +8 -6
- package/src/models/subagentrelationresponse.ts +7 -5
- package/src/models/subagentrelationupdate.ts +15 -8
- package/src/models/subagentresponse.ts +7 -5
- package/src/models/subagentteamagentrelation.ts +3 -4
- package/src/models/subagentteamagentrelationcreate.ts +4 -5
- package/src/models/subagentteamagentrelationlistresponse.ts +6 -7
- package/src/models/subagentteamagentrelationresponse.ts +5 -6
- package/src/models/subagentteamagentrelationupdate.ts +4 -5
- package/src/models/subagenttoolrelation.ts +13 -15
- package/src/models/subagenttoolrelationcreate.ts +13 -13
- package/src/models/subagenttoolrelationlistresponse.ts +6 -7
- package/src/models/subagenttoolrelationresponse.ts +5 -6
- package/src/models/subagenttoolrelationupdate.ts +13 -13
- package/src/models/subagentupdate.ts +8 -7
- package/src/models/teamagent.ts +3 -2
- package/src/models/thirdpartymcpserverresponse.ts +19 -13
- package/src/models/toolcreate.ts +43 -24
- package/src/models/toolupdate.ts +43 -24
- package/src/models/unauthorized.ts +26 -13
- package/src/models/unprocessableentity.ts +34 -20
- package/src/models/updateagentop.ts +24 -17
- package/src/models/updateapikeyop.ts +34 -30
- package/src/models/updateartifactcomponentop.ts +24 -21
- package/src/models/updatecontextconfigop.ts +27 -21
- package/src/models/updatecredentialop.ts +24 -21
- package/src/models/updatedatacomponentop.ts +26 -20
- package/src/models/updateexternalagentop.ts +26 -20
- package/src/models/updatefullagentop.ts +29 -23
- package/src/models/updatefullprojectop.ts +25 -21
- package/src/models/updatefunctionop.ts +28 -23
- package/src/models/updatefunctiontoolop.ts +27 -21
- package/src/models/updateprojectop.ts +38 -34
- package/src/models/updatesubagentexternalagentrelationop.ts +31 -25
- package/src/models/updatesubagentop.ts +29 -24
- package/src/models/updatesubagentrelationop.ts +25 -22
- package/src/models/updatesubagentteamagentrelationop.ts +31 -25
- package/src/models/updatesubagenttoolrelationop.ts +27 -23
- package/src/models/updatetoolop.ts +27 -17
- package/src/types/async.ts +24 -9
- package/src/types/bigint.ts +88 -0
- package/src/types/blobs.ts +5 -4
- package/src/types/enums.ts +2 -1
- package/src/types/fp.ts +4 -1
- package/src/types/rfcdate.ts +8 -5
- package/src/types/streams.ts +8 -5
- package/src/zod-int.ts +9 -0
- package/tsconfig.json +3 -2
- package/openapi.json +0 -17114
- package/scripts/watch-and-fetch.mjs +0 -72
- package/src/hooks/auth-hook.ts +0 -32
- package/src/http-server.ts +0 -34
package/src/lib/encodings.ts
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 6809fa25f96d
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
|
-
import { bytesToBase64 } from
|
|
6
|
-
import { isPlainObject } from
|
|
6
|
+
import { bytesToBase64 } from "./base64.js";
|
|
7
|
+
import { isPlainObject } from "./is-plain-object.js";
|
|
7
8
|
|
|
8
9
|
export class EncodingError extends Error {
|
|
9
10
|
constructor(message: string) {
|
|
10
11
|
super(message);
|
|
11
|
-
this.name =
|
|
12
|
+
this.name = "EncodingError";
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function encodeMatrix(
|
|
16
17
|
key: string,
|
|
17
18
|
value: unknown,
|
|
18
|
-
options?: { explode?: boolean; charEncoding?:
|
|
19
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
19
20
|
): string | undefined {
|
|
20
|
-
let out =
|
|
21
|
-
const pairs: [string, unknown][] = options?.explode
|
|
21
|
+
let out = "";
|
|
22
|
+
const pairs: [string, unknown][] = options?.explode
|
|
23
|
+
? explode(key, value)
|
|
24
|
+
: [[key, value]];
|
|
22
25
|
|
|
23
26
|
if (pairs.every(([_, v]) => v == null)) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
const encodeString = (v: string) => {
|
|
28
|
-
return options?.charEncoding ===
|
|
31
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
29
32
|
};
|
|
30
33
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
31
34
|
|
|
32
35
|
pairs.forEach(([pk, pv]) => {
|
|
33
|
-
let tmp =
|
|
36
|
+
let tmp = "";
|
|
34
37
|
let encValue: string | null | undefined = null;
|
|
35
38
|
|
|
36
39
|
if (pv == null) {
|
|
37
40
|
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(',');
|
|
41
|
+
} else if (Array.isArray(pv)) {
|
|
42
|
+
encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(",");
|
|
41
43
|
} else if (isPlainObject(pv)) {
|
|
42
44
|
const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
|
|
43
45
|
return `,${encodeString(k)},${encodeValue(v)}`;
|
|
44
46
|
});
|
|
45
|
-
encValue = mapped?.join(
|
|
47
|
+
encValue = mapped?.join("").slice(1);
|
|
46
48
|
} else {
|
|
47
49
|
encValue = `${encodeValue(pv)}`;
|
|
48
50
|
}
|
|
@@ -72,39 +74,42 @@ export function encodeMatrix(
|
|
|
72
74
|
export function encodeLabel(
|
|
73
75
|
key: string,
|
|
74
76
|
value: unknown,
|
|
75
|
-
options?: { explode?: boolean; charEncoding?:
|
|
77
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
76
78
|
): string | undefined {
|
|
77
|
-
let out =
|
|
78
|
-
const pairs: [string, unknown][] = options?.explode
|
|
79
|
+
let out = "";
|
|
80
|
+
const pairs: [string, unknown][] = options?.explode
|
|
81
|
+
? explode(key, value)
|
|
82
|
+
: [[key, value]];
|
|
79
83
|
|
|
80
84
|
if (pairs.every(([_, v]) => v == null)) {
|
|
81
85
|
return;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
const encodeString = (v: string) => {
|
|
85
|
-
return options?.charEncoding ===
|
|
89
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
86
90
|
};
|
|
87
91
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
88
92
|
|
|
89
93
|
pairs.forEach(([pk, pv]) => {
|
|
90
|
-
let encValue: string | null | undefined =
|
|
94
|
+
let encValue: string | null | undefined = "";
|
|
91
95
|
|
|
92
96
|
if (pv == null) {
|
|
93
97
|
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join('.');
|
|
98
|
+
} else if (Array.isArray(pv)) {
|
|
99
|
+
encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(".");
|
|
97
100
|
} else if (isPlainObject(pv)) {
|
|
98
101
|
const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
|
|
99
102
|
return `.${encodeString(k)}.${encodeValue(v)}`;
|
|
100
103
|
});
|
|
101
|
-
encValue = mapped?.join(
|
|
104
|
+
encValue = mapped?.join("").slice(1);
|
|
102
105
|
} else {
|
|
103
|
-
const k = options?.explode && isPlainObject(value)
|
|
106
|
+
const k = options?.explode && isPlainObject(value)
|
|
107
|
+
? `${encodeString(pk)}=`
|
|
108
|
+
: "";
|
|
104
109
|
encValue = `${k}${encodeValue(pv)}`;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
out += encValue == null ?
|
|
112
|
+
out += encValue == null ? "" : `.${encValue}`;
|
|
108
113
|
});
|
|
109
114
|
|
|
110
115
|
return out;
|
|
@@ -113,24 +118,26 @@ export function encodeLabel(
|
|
|
113
118
|
type FormEncoder = (
|
|
114
119
|
key: string,
|
|
115
120
|
value: unknown,
|
|
116
|
-
options?: { explode?: boolean; charEncoding?:
|
|
121
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
117
122
|
) => string | undefined;
|
|
118
123
|
|
|
119
124
|
function formEncoder(sep: string): FormEncoder {
|
|
120
125
|
return (
|
|
121
126
|
key: string,
|
|
122
127
|
value: unknown,
|
|
123
|
-
options?: { explode?: boolean; charEncoding?:
|
|
128
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
124
129
|
) => {
|
|
125
|
-
let out =
|
|
126
|
-
const pairs: [string, unknown][] = options?.explode
|
|
130
|
+
let out = "";
|
|
131
|
+
const pairs: [string, unknown][] = options?.explode
|
|
132
|
+
? explode(key, value)
|
|
133
|
+
: [[key, value]];
|
|
127
134
|
|
|
128
135
|
if (pairs.every(([_, v]) => v == null)) {
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
const encodeString = (v: string) => {
|
|
133
|
-
return options?.charEncoding ===
|
|
140
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
134
141
|
};
|
|
135
142
|
|
|
136
143
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
@@ -138,13 +145,12 @@ function formEncoder(sep: string): FormEncoder {
|
|
|
138
145
|
const encodedSep = encodeString(sep);
|
|
139
146
|
|
|
140
147
|
pairs.forEach(([pk, pv]) => {
|
|
141
|
-
let tmp =
|
|
148
|
+
let tmp = "";
|
|
142
149
|
let encValue: string | null | undefined = null;
|
|
143
150
|
|
|
144
151
|
if (pv == null) {
|
|
145
152
|
return;
|
|
146
|
-
}
|
|
147
|
-
if (Array.isArray(pv)) {
|
|
153
|
+
} else if (Array.isArray(pv)) {
|
|
148
154
|
encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(encodedSep);
|
|
149
155
|
} else if (isPlainObject(pv)) {
|
|
150
156
|
encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
|
|
@@ -161,7 +167,7 @@ function formEncoder(sep: string): FormEncoder {
|
|
|
161
167
|
tmp = `${encodeString(pk)}=${encValue}`;
|
|
162
168
|
|
|
163
169
|
// If we end up with the nothing then skip forward
|
|
164
|
-
if (!tmp || tmp ===
|
|
170
|
+
if (!tmp || tmp === "=") {
|
|
165
171
|
return;
|
|
166
172
|
}
|
|
167
173
|
|
|
@@ -172,32 +178,33 @@ function formEncoder(sep: string): FormEncoder {
|
|
|
172
178
|
};
|
|
173
179
|
}
|
|
174
180
|
|
|
175
|
-
export const encodeForm = formEncoder(
|
|
176
|
-
export const encodeSpaceDelimited = formEncoder(
|
|
177
|
-
export const encodePipeDelimited = formEncoder(
|
|
181
|
+
export const encodeForm = formEncoder(",");
|
|
182
|
+
export const encodeSpaceDelimited = formEncoder(" ");
|
|
183
|
+
export const encodePipeDelimited = formEncoder("|");
|
|
178
184
|
|
|
179
185
|
export function encodeBodyForm(
|
|
180
186
|
key: string,
|
|
181
187
|
value: unknown,
|
|
182
|
-
options?: { explode?: boolean; charEncoding?:
|
|
188
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
183
189
|
): string {
|
|
184
|
-
let out =
|
|
185
|
-
const pairs: [string, unknown][] = options?.explode
|
|
190
|
+
let out = "";
|
|
191
|
+
const pairs: [string, unknown][] = options?.explode
|
|
192
|
+
? explode(key, value)
|
|
193
|
+
: [[key, value]];
|
|
186
194
|
|
|
187
195
|
const encodeString = (v: string) => {
|
|
188
|
-
return options?.charEncoding ===
|
|
196
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
189
197
|
};
|
|
190
198
|
|
|
191
199
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
192
200
|
|
|
193
201
|
pairs.forEach(([pk, pv]) => {
|
|
194
|
-
let tmp =
|
|
195
|
-
let encValue =
|
|
202
|
+
let tmp = "";
|
|
203
|
+
let encValue = "";
|
|
196
204
|
|
|
197
205
|
if (pv == null) {
|
|
198
206
|
return;
|
|
199
|
-
}
|
|
200
|
-
if (Array.isArray(pv)) {
|
|
207
|
+
} else if (Array.isArray(pv)) {
|
|
201
208
|
encValue = JSON.stringify(pv, jsonReplacer);
|
|
202
209
|
} else if (isPlainObject(pv)) {
|
|
203
210
|
encValue = JSON.stringify(pv, jsonReplacer);
|
|
@@ -208,7 +215,7 @@ export function encodeBodyForm(
|
|
|
208
215
|
tmp = `${encodeString(pk)}=${encValue}`;
|
|
209
216
|
|
|
210
217
|
// If we end up with the nothing then skip forward
|
|
211
|
-
if (!tmp || tmp ===
|
|
218
|
+
if (!tmp || tmp === "=") {
|
|
212
219
|
return;
|
|
213
220
|
}
|
|
214
221
|
|
|
@@ -221,7 +228,7 @@ export function encodeBodyForm(
|
|
|
221
228
|
export function encodeDeepObject(
|
|
222
229
|
key: string,
|
|
223
230
|
value: unknown,
|
|
224
|
-
options?: { charEncoding?:
|
|
231
|
+
options?: { charEncoding?: "percent" | "none" },
|
|
225
232
|
): string | undefined {
|
|
226
233
|
if (value == null) {
|
|
227
234
|
return;
|
|
@@ -229,7 +236,7 @@ export function encodeDeepObject(
|
|
|
229
236
|
|
|
230
237
|
if (!isPlainObject(value)) {
|
|
231
238
|
throw new EncodingError(
|
|
232
|
-
`Value of parameter '${key}' which uses deepObject encoding must be an object or null
|
|
239
|
+
`Value of parameter '${key}' which uses deepObject encoding must be an object or null`,
|
|
233
240
|
);
|
|
234
241
|
}
|
|
235
242
|
|
|
@@ -239,16 +246,16 @@ export function encodeDeepObject(
|
|
|
239
246
|
export function encodeDeepObjectObject(
|
|
240
247
|
key: string,
|
|
241
248
|
value: unknown,
|
|
242
|
-
options?: { charEncoding?:
|
|
249
|
+
options?: { charEncoding?: "percent" | "none" },
|
|
243
250
|
): string | undefined {
|
|
244
251
|
if (value == null) {
|
|
245
252
|
return;
|
|
246
253
|
}
|
|
247
254
|
|
|
248
|
-
let out =
|
|
255
|
+
let out = "";
|
|
249
256
|
|
|
250
257
|
const encodeString = (v: string) => {
|
|
251
|
-
return options?.charEncoding ===
|
|
258
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
252
259
|
};
|
|
253
260
|
|
|
254
261
|
if (!isPlainObject(value)) {
|
|
@@ -265,7 +272,7 @@ export function encodeDeepObjectObject(
|
|
|
265
272
|
if (isPlainObject(cv)) {
|
|
266
273
|
const objOut = encodeDeepObjectObject(pk, cv, options);
|
|
267
274
|
|
|
268
|
-
out += objOut == null ?
|
|
275
|
+
out += objOut == null ? "" : `&${objOut}`;
|
|
269
276
|
|
|
270
277
|
return;
|
|
271
278
|
}
|
|
@@ -273,9 +280,9 @@ export function encodeDeepObjectObject(
|
|
|
273
280
|
const pairs: unknown[] = Array.isArray(cv) ? cv : [cv];
|
|
274
281
|
const encoded = mapDefined(pairs, (v) => {
|
|
275
282
|
return `${encodeString(pk)}=${encodeString(serializeValue(v))}`;
|
|
276
|
-
})?.join(
|
|
283
|
+
})?.join("&");
|
|
277
284
|
|
|
278
|
-
out += encoded == null ?
|
|
285
|
+
out += encoded == null ? "" : `&${encoded}`;
|
|
279
286
|
});
|
|
280
287
|
|
|
281
288
|
return out.slice(1);
|
|
@@ -284,14 +291,14 @@ export function encodeDeepObjectObject(
|
|
|
284
291
|
export function encodeJSON(
|
|
285
292
|
key: string,
|
|
286
293
|
value: unknown,
|
|
287
|
-
options?: { explode?: boolean; charEncoding?:
|
|
294
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
288
295
|
): string | undefined {
|
|
289
|
-
if (typeof value ===
|
|
296
|
+
if (typeof value === "undefined") {
|
|
290
297
|
return;
|
|
291
298
|
}
|
|
292
299
|
|
|
293
300
|
const encodeString = (v: string) => {
|
|
294
|
-
return options?.charEncoding ===
|
|
301
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
295
302
|
};
|
|
296
303
|
|
|
297
304
|
const encVal = encodeString(JSON.stringify(value, jsonReplacer));
|
|
@@ -302,39 +309,40 @@ export function encodeJSON(
|
|
|
302
309
|
export const encodeSimple = (
|
|
303
310
|
key: string,
|
|
304
311
|
value: unknown,
|
|
305
|
-
options?: { explode?: boolean; charEncoding?:
|
|
312
|
+
options?: { explode?: boolean; charEncoding?: "percent" | "none" },
|
|
306
313
|
): string | undefined => {
|
|
307
|
-
let out =
|
|
308
|
-
const pairs: [string, unknown][] = options?.explode
|
|
314
|
+
let out = "";
|
|
315
|
+
const pairs: [string, unknown][] = options?.explode
|
|
316
|
+
? explode(key, value)
|
|
317
|
+
: [[key, value]];
|
|
309
318
|
|
|
310
319
|
if (pairs.every(([_, v]) => v == null)) {
|
|
311
320
|
return;
|
|
312
321
|
}
|
|
313
322
|
|
|
314
323
|
const encodeString = (v: string) => {
|
|
315
|
-
return options?.charEncoding ===
|
|
324
|
+
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
|
|
316
325
|
};
|
|
317
326
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
318
327
|
|
|
319
328
|
pairs.forEach(([pk, pv]) => {
|
|
320
|
-
let tmp: string | null | undefined =
|
|
329
|
+
let tmp: string | null | undefined = "";
|
|
321
330
|
|
|
322
331
|
if (pv == null) {
|
|
323
332
|
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
tmp = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(',');
|
|
333
|
+
} else if (Array.isArray(pv)) {
|
|
334
|
+
tmp = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(",");
|
|
327
335
|
} else if (isPlainObject(pv)) {
|
|
328
336
|
const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
|
|
329
337
|
return `,${encodeString(k)},${encodeValue(v)}`;
|
|
330
338
|
});
|
|
331
|
-
tmp = mapped?.join(
|
|
339
|
+
tmp = mapped?.join("").slice(1);
|
|
332
340
|
} else {
|
|
333
|
-
const k = options?.explode && isPlainObject(value) ? `${pk}=` :
|
|
341
|
+
const k = options?.explode && isPlainObject(value) ? `${pk}=` : "";
|
|
334
342
|
tmp = `${k}${encodeValue(pv)}`;
|
|
335
343
|
}
|
|
336
344
|
|
|
337
|
-
out += tmp ? `,${tmp}` :
|
|
345
|
+
out += tmp ? `,${tmp}` : "";
|
|
338
346
|
});
|
|
339
347
|
|
|
340
348
|
return out.slice(1);
|
|
@@ -343,25 +351,28 @@ export const encodeSimple = (
|
|
|
343
351
|
function explode(key: string, value: unknown): [string, unknown][] {
|
|
344
352
|
if (Array.isArray(value)) {
|
|
345
353
|
return value.map((v) => [key, v]);
|
|
346
|
-
}
|
|
347
|
-
if (isPlainObject(value)) {
|
|
354
|
+
} else if (isPlainObject(value)) {
|
|
348
355
|
const o = value ?? {};
|
|
349
356
|
return Object.entries(o).map(([k, v]) => [k, v]);
|
|
357
|
+
} else {
|
|
358
|
+
return [[key, value]];
|
|
350
359
|
}
|
|
351
|
-
return [[key, value]];
|
|
352
360
|
}
|
|
353
361
|
|
|
354
362
|
function serializeValue(value: unknown): string {
|
|
355
363
|
if (value == null) {
|
|
356
|
-
return
|
|
357
|
-
}
|
|
358
|
-
if (value instanceof Date) {
|
|
364
|
+
return "";
|
|
365
|
+
} else if (value instanceof Date) {
|
|
359
366
|
return value.toISOString();
|
|
360
|
-
}
|
|
361
|
-
if (value instanceof Uint8Array) {
|
|
367
|
+
} else if (value instanceof Uint8Array) {
|
|
362
368
|
return bytesToBase64(value);
|
|
363
|
-
}
|
|
364
|
-
|
|
369
|
+
} else if (typeof value === "object") {
|
|
370
|
+
if (
|
|
371
|
+
"toJSON" in value
|
|
372
|
+
&& typeof value.toJSON === "function"
|
|
373
|
+
) {
|
|
374
|
+
return String(value.toJSON());
|
|
375
|
+
}
|
|
365
376
|
return JSON.stringify(value, jsonReplacer);
|
|
366
377
|
}
|
|
367
378
|
|
|
@@ -371,8 +382,11 @@ function serializeValue(value: unknown): string {
|
|
|
371
382
|
function jsonReplacer(_: string, value: unknown): unknown {
|
|
372
383
|
if (value instanceof Uint8Array) {
|
|
373
384
|
return bytesToBase64(value);
|
|
385
|
+
} else if (typeof value === "bigint") {
|
|
386
|
+
return value.toString();
|
|
387
|
+
} else {
|
|
388
|
+
return value;
|
|
374
389
|
}
|
|
375
|
-
return value;
|
|
376
390
|
}
|
|
377
391
|
|
|
378
392
|
function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] | null {
|
|
@@ -394,7 +408,10 @@ function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] | null {
|
|
|
394
408
|
return res.length ? res : null;
|
|
395
409
|
}
|
|
396
410
|
|
|
397
|
-
function mapDefinedEntries<K, V, R>(
|
|
411
|
+
function mapDefinedEntries<K, V, R>(
|
|
412
|
+
inp: Iterable<[K, V]>,
|
|
413
|
+
mapper: (v: [K, V]) => R,
|
|
414
|
+
): R[] | null {
|
|
398
415
|
const acc: R[] = [];
|
|
399
416
|
for (const [k, v] of inp) {
|
|
400
417
|
if (v == null) {
|
|
@@ -413,28 +430,34 @@ function mapDefinedEntries<K, V, R>(inp: Iterable<[K, V]>, mapper: (v: [K, V]) =
|
|
|
413
430
|
}
|
|
414
431
|
|
|
415
432
|
export function queryJoin(...args: (string | undefined)[]): string {
|
|
416
|
-
return args.filter(Boolean).join(
|
|
433
|
+
return args.filter(Boolean).join("&");
|
|
417
434
|
}
|
|
418
435
|
|
|
419
436
|
type QueryEncoderOptions = {
|
|
420
437
|
explode?: boolean;
|
|
421
|
-
charEncoding?:
|
|
438
|
+
charEncoding?: "percent" | "none";
|
|
422
439
|
};
|
|
423
440
|
|
|
424
441
|
type QueryEncoder = (
|
|
425
442
|
key: string,
|
|
426
443
|
value: unknown,
|
|
427
|
-
options?: QueryEncoderOptions
|
|
444
|
+
options?: QueryEncoderOptions,
|
|
428
445
|
) => string | undefined;
|
|
429
446
|
|
|
430
|
-
type BulkQueryEncoder = (
|
|
447
|
+
type BulkQueryEncoder = (
|
|
448
|
+
values: Record<string, unknown>,
|
|
449
|
+
options?: QueryEncoderOptions,
|
|
450
|
+
) => string;
|
|
431
451
|
|
|
432
452
|
export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
|
|
433
|
-
const bulkEncode = (
|
|
453
|
+
const bulkEncode = function(
|
|
454
|
+
values: Record<string, unknown>,
|
|
455
|
+
options?: QueryEncoderOptions,
|
|
456
|
+
): string {
|
|
434
457
|
const opts: QueryEncoderOptions = {
|
|
435
458
|
...options,
|
|
436
459
|
explode: options?.explode ?? true,
|
|
437
|
-
charEncoding: options?.charEncoding ??
|
|
460
|
+
charEncoding: options?.charEncoding ?? "percent",
|
|
438
461
|
};
|
|
439
462
|
|
|
440
463
|
const encoded = Object.entries(values).map(([key, value]) => {
|
|
@@ -452,14 +475,22 @@ export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
|
|
|
452
475
|
export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
|
|
453
476
|
export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
|
|
454
477
|
|
|
455
|
-
export function appendForm(
|
|
478
|
+
export function appendForm(
|
|
479
|
+
fd: FormData,
|
|
480
|
+
key: string,
|
|
481
|
+
value: unknown,
|
|
482
|
+
fileName?: string,
|
|
483
|
+
): void {
|
|
456
484
|
if (value == null) {
|
|
457
485
|
return;
|
|
458
|
-
}
|
|
459
|
-
if (value instanceof Blob && fileName) {
|
|
486
|
+
} else if (value instanceof Blob && fileName) {
|
|
460
487
|
fd.append(key, value, fileName);
|
|
461
488
|
} else if (value instanceof Blob) {
|
|
462
489
|
fd.append(key, value);
|
|
490
|
+
} else if (Array.isArray(value)) {
|
|
491
|
+
value.forEach((v) => {
|
|
492
|
+
appendForm(fd, key, v);
|
|
493
|
+
});
|
|
463
494
|
} else {
|
|
464
495
|
fd.append(key, String(value));
|
|
465
496
|
}
|
package/src/lib/env.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9e795945f7bf
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
|
|
6
|
+
import { dlv } from "./dlv.js";
|
|
7
|
+
|
|
8
|
+
import * as z from "zod";
|
|
7
9
|
|
|
8
10
|
export interface Env {
|
|
9
|
-
|
|
11
|
+
INKEEPAGENTSMANAGE_COOKIE_AUTH?: string | undefined;
|
|
12
|
+
INKEEPAGENTSMANAGE_BEARER_AUTH?: string | undefined;
|
|
13
|
+
|
|
14
|
+
INKEEPAGENTSMANAGE_DEBUG?: boolean | undefined;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
export const envSchema: z.ZodType<Env
|
|
13
|
-
|
|
17
|
+
export const envSchema: z.ZodType<Env> = z.object({
|
|
18
|
+
INKEEPAGENTSMANAGE_COOKIE_AUTH: z.string().optional(),
|
|
19
|
+
INKEEPAGENTSMANAGE_BEARER_AUTH: z.string().optional(),
|
|
20
|
+
|
|
21
|
+
INKEEPAGENTSMANAGE_DEBUG: z.coerce.boolean().optional(),
|
|
14
22
|
});
|
|
15
23
|
|
|
16
|
-
let envMemo: Env | undefined;
|
|
24
|
+
let envMemo: Env | undefined = undefined;
|
|
17
25
|
/**
|
|
18
26
|
* Reads and validates environment variables.
|
|
19
27
|
*/
|
|
@@ -22,7 +30,9 @@ export function env(): Env {
|
|
|
22
30
|
return envMemo;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
|
-
envMemo = envSchema.parse(
|
|
33
|
+
envMemo = envSchema.parse(
|
|
34
|
+
dlv(globalThis, "process.env") ?? dlv(globalThis, "Deno.env") ?? {},
|
|
35
|
+
);
|
|
26
36
|
return envMemo;
|
|
27
37
|
}
|
|
28
38
|
|
package/src/lib/files.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4f64b199f510
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
* request structure.
|
|
10
11
|
*/
|
|
11
12
|
export async function readableStreamToArrayBuffer(
|
|
12
|
-
readable: ReadableStream<Uint8Array
|
|
13
|
+
readable: ReadableStream<Uint8Array>,
|
|
13
14
|
): Promise<ArrayBuffer> {
|
|
14
15
|
const reader = readable.getReader();
|
|
15
16
|
const chunks: Uint8Array[] = [];
|
|
@@ -46,36 +47,36 @@ export async function readableStreamToArrayBuffer(
|
|
|
46
47
|
export function getContentTypeFromFileName(fileName: string): string | null {
|
|
47
48
|
if (!fileName) return null;
|
|
48
49
|
|
|
49
|
-
const ext = fileName.toLowerCase().split(
|
|
50
|
+
const ext = fileName.toLowerCase().split(".").pop();
|
|
50
51
|
if (!ext) return null;
|
|
51
52
|
|
|
52
53
|
const mimeTypes: Record<string, string> = {
|
|
53
|
-
json:
|
|
54
|
-
xml:
|
|
55
|
-
html:
|
|
56
|
-
htm:
|
|
57
|
-
txt:
|
|
58
|
-
csv:
|
|
59
|
-
pdf:
|
|
60
|
-
png:
|
|
61
|
-
jpg:
|
|
62
|
-
jpeg:
|
|
63
|
-
gif:
|
|
64
|
-
svg:
|
|
65
|
-
js:
|
|
66
|
-
css:
|
|
67
|
-
zip:
|
|
68
|
-
tar:
|
|
69
|
-
gz:
|
|
70
|
-
mp4:
|
|
71
|
-
mp3:
|
|
72
|
-
wav:
|
|
73
|
-
webp:
|
|
74
|
-
ico:
|
|
75
|
-
woff:
|
|
76
|
-
woff2:
|
|
77
|
-
ttf:
|
|
78
|
-
otf:
|
|
54
|
+
json: "application/json",
|
|
55
|
+
xml: "application/xml",
|
|
56
|
+
html: "text/html",
|
|
57
|
+
htm: "text/html",
|
|
58
|
+
txt: "text/plain",
|
|
59
|
+
csv: "text/csv",
|
|
60
|
+
pdf: "application/pdf",
|
|
61
|
+
png: "image/png",
|
|
62
|
+
jpg: "image/jpeg",
|
|
63
|
+
jpeg: "image/jpeg",
|
|
64
|
+
gif: "image/gif",
|
|
65
|
+
svg: "image/svg+xml",
|
|
66
|
+
js: "application/javascript",
|
|
67
|
+
css: "text/css",
|
|
68
|
+
zip: "application/zip",
|
|
69
|
+
tar: "application/x-tar",
|
|
70
|
+
gz: "application/gzip",
|
|
71
|
+
mp4: "video/mp4",
|
|
72
|
+
mp3: "audio/mpeg",
|
|
73
|
+
wav: "audio/wav",
|
|
74
|
+
webp: "image/webp",
|
|
75
|
+
ico: "image/x-icon",
|
|
76
|
+
woff: "font/woff",
|
|
77
|
+
woff2: "font/woff2",
|
|
78
|
+
ttf: "font/ttf",
|
|
79
|
+
otf: "font/otf",
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
return mimeTypes[ext] || null;
|