@shipfox/api-integration-github 8.0.0 → 9.0.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +37 -0
- package/dist/api/client.js +1 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/installation-token-envelope.d.ts +1 -1
- package/dist/api/installation-token-envelope.d.ts.map +1 -1
- package/dist/api/installation-token-envelope.js +1 -1
- package/dist/api/installation-token-envelope.js.map +1 -1
- package/dist/api/installation-token-provider.d.ts +1 -1
- package/dist/api/installation-token-provider.d.ts.map +1 -1
- package/dist/api/installation-token-provider.js.map +1 -1
- package/dist/core/actions-logs.d.ts +1 -1
- package/dist/core/actions-logs.d.ts.map +1 -1
- package/dist/core/actions-logs.js +2 -2
- package/dist/core/actions-logs.js.map +1 -1
- package/dist/core/agent-tool-selection.d.ts +1 -1
- package/dist/core/agent-tool-selection.d.ts.map +1 -1
- package/dist/core/agent-tool-selection.js +1 -1
- package/dist/core/agent-tool-selection.js.map +1 -1
- package/dist/core/agent-tools.d.ts +4 -4
- package/dist/core/agent-tools.d.ts.map +1 -1
- package/dist/core/agent-tools.js +2 -2
- package/dist/core/agent-tools.js.map +1 -1
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +1 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/github-agent-tool-catalog.d.ts +49 -0
- package/dist/core/github-agent-tool-catalog.d.ts.map +1 -0
- package/dist/core/github-agent-tool-catalog.js +867 -0
- package/dist/core/github-agent-tool-catalog.js.map +1 -0
- package/dist/core/install.d.ts +1 -1
- package/dist/core/install.d.ts.map +1 -1
- package/dist/core/install.js.map +1 -1
- package/dist/core/source-control.d.ts +1 -1
- package/dist/core/source-control.d.ts.map +1 -1
- package/dist/core/source-control.js +1 -1
- package/dist/core/source-control.js.map +1 -1
- package/dist/core/webhook-processor.d.ts +1 -1
- package/dist/core/webhook-processor.d.ts.map +1 -1
- package/dist/core/webhook-processor.js +1 -1
- package/dist/core/webhook-processor.js.map +1 -1
- package/dist/core/webhook.d.ts +1 -1
- package/dist/core/webhook.d.ts.map +1 -1
- package/dist/core/webhook.js +1 -1
- package/dist/core/webhook.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/instance.d.ts +1 -1
- package/dist/metrics/instance.d.ts.map +1 -1
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/integrations.d.ts +8 -7
- package/dist/presentation/dto/integrations.d.ts.map +1 -1
- package/dist/presentation/dto/integrations.js +18 -7
- package/dist/presentation/dto/integrations.js.map +1 -1
- package/dist/presentation/e2eRoutes/create-connection.d.ts +1 -1
- package/dist/presentation/e2eRoutes/create-connection.d.ts.map +1 -1
- package/dist/presentation/e2eRoutes/create-connection.js +1 -1
- package/dist/presentation/e2eRoutes/create-connection.js.map +1 -1
- package/dist/presentation/routes/errors.js +1 -1
- package/dist/presentation/routes/errors.js.map +1 -1
- package/dist/presentation/routes/install.d.ts +1 -1
- package/dist/presentation/routes/install.d.ts.map +1 -1
- package/dist/presentation/routes/install.js.map +1 -1
- package/dist/presentation/routes/webhooks.d.ts +1 -1
- package/dist/presentation/routes/webhooks.d.ts.map +1 -1
- package/dist/presentation/routes/webhooks.js +1 -1
- package/dist/presentation/routes/webhooks.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +17 -14
- package/src/api/client.ts +1 -1
- package/src/api/installation-token-envelope.ts +1 -1
- package/src/api/installation-token-provider.test.ts +1 -1
- package/src/api/installation-token-provider.ts +1 -1
- package/src/core/actions-logs.ts +2 -2
- package/src/core/agent-tool-selection.ts +1 -1
- package/src/core/agent-tools.ts +10 -10
- package/src/core/errors.ts +1 -1
- package/src/core/github-agent-tool-catalog.ts +963 -0
- package/src/core/install.test.ts +1 -1
- package/src/core/install.ts +1 -1
- package/src/core/source-control.ts +1 -1
- package/src/core/webhook-processor.test.ts +1 -1
- package/src/core/webhook-processor.ts +1 -1
- package/src/core/webhook.test.ts +1 -1
- package/src/core/webhook.ts +7 -7
- package/src/index.ts +2 -1
- package/src/metrics/instance.ts +1 -1
- package/src/presentation/dto/integrations.ts +24 -6
- package/src/presentation/e2eRoutes/create-connection.ts +2 -2
- package/src/presentation/e2eRoutes/index.test.ts +1 -1
- package/src/presentation/routes/errors.ts +1 -1
- package/src/presentation/routes/install.test.ts +1 -1
- package/src/presentation/routes/install.ts +1 -1
- package/src/presentation/routes/webhooks.test.ts +1 -1
- package/src/presentation/routes/webhooks.ts +2 -5
- package/tsconfig.build.tsbuildinfo +1 -1
package/src/core/install.test.ts
CHANGED
package/src/core/install.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {UserContextMembership} from '@shipfox/api-auth-context';
|
|
2
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-
|
|
2
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
3
3
|
import type {GithubApiClient, GithubInstallationDetails} from '#api/client.js';
|
|
4
4
|
import {
|
|
5
5
|
GithubInstallationAlreadyLinkedError,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type RepositoryVisibility,
|
|
17
17
|
type ResolveRepositoryInput,
|
|
18
18
|
type SourceControlProvider,
|
|
19
|
-
} from '@shipfox/api-integration-
|
|
19
|
+
} from '@shipfox/api-integration-spi';
|
|
20
20
|
import type {GithubApiClient, GithubRepository} from '#api/client.js';
|
|
21
21
|
import {config} from '#config.js';
|
|
22
22
|
import {getGithubInstallationByConnectionId} from '#db/installations.js';
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createStoredWebhookRequest,
|
|
4
4
|
decodeWebhookBody,
|
|
5
5
|
type IntegrationConnection,
|
|
6
|
-
} from '@shipfox/api-integration-
|
|
6
|
+
} from '@shipfox/api-integration-spi';
|
|
7
7
|
import {db} from '#db/db.js';
|
|
8
8
|
import {githubInstallations} from '#db/schema/installations.js';
|
|
9
9
|
import {githubInstallationFactory} from '#test/index.js';
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type RecordDeliveryOnlyFn,
|
|
9
9
|
type StoredWebhookRequest,
|
|
10
10
|
type WebhookProcessingResult,
|
|
11
|
-
} from '@shipfox/api-integration-
|
|
11
|
+
} from '@shipfox/api-integration-spi';
|
|
12
12
|
import {logger} from '@shipfox/node-opentelemetry';
|
|
13
13
|
import type {NodePgDatabase} from 'drizzle-orm/node-postgres';
|
|
14
14
|
import {config} from '#config.js';
|
package/src/core/webhook.test.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
PublishIntegrationEventReceivedFn,
|
|
6
6
|
PublishSourcePushFn,
|
|
7
7
|
RecordDeliveryOnlyFn,
|
|
8
|
-
} from '@shipfox/api-integration-
|
|
8
|
+
} from '@shipfox/api-integration-spi';
|
|
9
9
|
import {db} from '#db/db.js';
|
|
10
10
|
import {githubInstallations} from '#db/schema/installations.js';
|
|
11
11
|
import {githubInstallationFactory, githubPushPayload} from '#test/index.js';
|
package/src/core/webhook.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GithubPushPayloadDto,
|
|
3
|
+
githubPushPayloadSchema,
|
|
4
|
+
githubWebhookActionSchema,
|
|
5
|
+
githubWebhookInstallationSchema,
|
|
6
|
+
} from '@shipfox/api-integration-github-dto';
|
|
1
7
|
import {
|
|
2
8
|
buildProviderRepositoryId,
|
|
3
9
|
type GetIntegrationConnectionByIdFn,
|
|
@@ -6,13 +12,7 @@ import {
|
|
|
6
12
|
type PublishSourcePushFn,
|
|
7
13
|
type RecordDeliveryOnlyFn,
|
|
8
14
|
type SourcePushPayload,
|
|
9
|
-
} from '@shipfox/api-integration-
|
|
10
|
-
import {
|
|
11
|
-
type GithubPushPayloadDto,
|
|
12
|
-
githubPushPayloadSchema,
|
|
13
|
-
githubWebhookActionSchema,
|
|
14
|
-
githubWebhookInstallationSchema,
|
|
15
|
-
} from '@shipfox/api-integration-github-dto';
|
|
15
|
+
} from '@shipfox/api-integration-spi';
|
|
16
16
|
import {logger} from '@shipfox/node-opentelemetry';
|
|
17
17
|
import {getGithubInstallationByInstallationId} from '#db/installations.js';
|
|
18
18
|
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
PublishIntegrationEventReceivedFn,
|
|
4
4
|
PublishSourcePushFn,
|
|
5
5
|
RecordDeliveryOnlyFn,
|
|
6
|
-
} from '@shipfox/api-integration-
|
|
6
|
+
} from '@shipfox/api-integration-spi';
|
|
7
7
|
import type {NodePgDatabase} from 'drizzle-orm/node-postgres';
|
|
8
8
|
import {createGithubApiClient, type GithubApiClient} from '#api/client.js';
|
|
9
9
|
import type {GithubInstallationTokenProvider} from '#api/installation-token-provider.js';
|
|
@@ -43,6 +43,7 @@ export {
|
|
|
43
43
|
type GithubAgentToolRequiredScope,
|
|
44
44
|
GithubAgentToolsProvider,
|
|
45
45
|
githubAgentToolCatalog,
|
|
46
|
+
githubAgentToolSelectionCatalog,
|
|
46
47
|
} from '#core/agent-tools.js';
|
|
47
48
|
export {GithubIntegrationProviderError} from '#core/errors.js';
|
|
48
49
|
export type {ConnectGithubInstallationInput} from '#core/install.js';
|
package/src/metrics/instance.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {IntegrationProviderErrorReason} from '@shipfox/api-integration-
|
|
1
|
+
import type {IntegrationProviderErrorReason} from '@shipfox/api-integration-spi';
|
|
2
2
|
import {instanceMetrics} from '@shipfox/node-opentelemetry';
|
|
3
3
|
import type {MintErrorClass} from '#api/installation-token-envelope.js';
|
|
4
4
|
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type IntegrationConnection,
|
|
3
|
-
toIntegrationConnectionDto as toCoreIntegrationConnectionDto,
|
|
4
|
-
} from '@shipfox/api-integration-core-dto';
|
|
1
|
+
import type {IntegrationCapability, IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
5
2
|
|
|
6
|
-
export function toIntegrationConnectionDto(
|
|
7
|
-
|
|
3
|
+
export function toIntegrationConnectionDto(
|
|
4
|
+
connection: IntegrationConnection<'github'>,
|
|
5
|
+
options: {capabilities?: IntegrationCapability[]} = {},
|
|
6
|
+
) {
|
|
7
|
+
return mapIntegrationConnection(connection, options.capabilities ?? ['source_control']);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function mapIntegrationConnection(
|
|
11
|
+
connection: IntegrationConnection,
|
|
12
|
+
capabilities: IntegrationCapability[],
|
|
13
|
+
) {
|
|
14
|
+
return {
|
|
15
|
+
id: connection.id,
|
|
16
|
+
workspace_id: connection.workspaceId,
|
|
17
|
+
provider: connection.provider,
|
|
18
|
+
external_account_id: connection.externalAccountId,
|
|
19
|
+
slug: connection.slug,
|
|
20
|
+
display_name: connection.displayName,
|
|
21
|
+
lifecycle_status: connection.lifecycleStatus,
|
|
22
|
+
capabilities,
|
|
23
|
+
created_at: connection.createdAt.toISOString(),
|
|
24
|
+
updated_at: connection.updatedAt.toISOString(),
|
|
25
|
+
};
|
|
8
26
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {IntegrationCapability, IntegrationConnection} from '@shipfox/api-integration-core-dto';
|
|
2
|
-
import {toIntegrationConnectionDto} from '@shipfox/api-integration-core-dto';
|
|
3
1
|
import {
|
|
4
2
|
createE2eGithubConnectionBodySchema,
|
|
5
3
|
createE2eGithubConnectionResponseSchema,
|
|
6
4
|
} from '@shipfox/api-integration-github-dto';
|
|
5
|
+
import type {IntegrationCapability, IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
7
6
|
import {ClientError, defineRoute} from '@shipfox/node-fastify';
|
|
8
7
|
import type {ConnectGithubInstallationInput} from '#core/install.js';
|
|
8
|
+
import {toIntegrationConnectionDto} from '#presentation/dto/integrations.js';
|
|
9
9
|
|
|
10
10
|
export interface CreateE2eGithubConnectionRouteOptions {
|
|
11
11
|
getExistingGithubConnection: (input: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionSlugConflictError,
|
|
3
3
|
type IntegrationProviderErrorReason,
|
|
4
|
-
} from '@shipfox/api-integration-
|
|
4
|
+
} from '@shipfox/api-integration-spi';
|
|
5
5
|
import {ClientError} from '@shipfox/node-fastify';
|
|
6
6
|
import {
|
|
7
7
|
GithubInstallationAlreadyLinkedError,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ConnectionSlugConflictError,
|
|
9
9
|
type IntegrationConnection,
|
|
10
|
-
} from '@shipfox/api-integration-
|
|
10
|
+
} from '@shipfox/api-integration-spi';
|
|
11
11
|
import {type AuthMethod, ClientError, closeApp, createApp} from '@shipfox/node-fastify';
|
|
12
12
|
import type {FastifyInstance, FastifyRequest} from 'fastify';
|
|
13
13
|
import type {GithubApiClient} from '#api/client.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {AUTH_USER, requireUserContext, requireWorkspaceAccess} from '@shipfox/api-auth-context';
|
|
2
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-core-dto';
|
|
3
2
|
import {
|
|
4
3
|
createGithubInstallBodySchema,
|
|
5
4
|
createGithubInstallResponseSchema,
|
|
6
5
|
githubCallbackQuerySchema,
|
|
7
6
|
githubCallbackResponseSchema,
|
|
8
7
|
} from '@shipfox/api-integration-github-dto';
|
|
8
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
9
9
|
import {defineRoute, type RouteGroup} from '@shipfox/node-fastify';
|
|
10
10
|
import type {GithubApiClient} from '#api/client.js';
|
|
11
11
|
import {config} from '#config.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {createHmac, randomUUID} from 'node:crypto';
|
|
2
2
|
import {Webhooks} from '@octokit/webhooks';
|
|
3
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-
|
|
3
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
4
4
|
import {closeApp, createApp} from '@shipfox/node-fastify';
|
|
5
5
|
import type {FastifyInstance} from 'fastify';
|
|
6
6
|
import {db} from '#db/db.js';
|
|
@@ -6,11 +6,8 @@ import type {
|
|
|
6
6
|
RecordDeliveryOnlyFn,
|
|
7
7
|
StoredWebhookRequest,
|
|
8
8
|
WebhookProcessingResult,
|
|
9
|
-
} from '@shipfox/api-integration-
|
|
10
|
-
import {
|
|
11
|
-
createStoredWebhookRequest,
|
|
12
|
-
WEBHOOK_MAX_RAW_BODY_BYTES,
|
|
13
|
-
} from '@shipfox/api-integration-core-dto';
|
|
9
|
+
} from '@shipfox/api-integration-spi';
|
|
10
|
+
import {createStoredWebhookRequest, WEBHOOK_MAX_RAW_BODY_BYTES} from '@shipfox/api-integration-spi';
|
|
14
11
|
import {
|
|
15
12
|
ClientError,
|
|
16
13
|
defineRoute,
|