@shipfox/api-integration-gitea 8.0.0 → 9.0.2
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 +45 -0
- package/README.md +3 -8
- package/dist/api/client.js +1 -1
- package/dist/api/client.js.map +1 -1
- package/dist/core/connect.d.ts +1 -1
- package/dist/core/connect.d.ts.map +1 -1
- package/dist/core/connect.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/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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/presentation/dto/integrations.d.ts +3 -3
- package/dist/presentation/dto/integrations.d.ts.map +1 -1
- package/dist/presentation/dto/integrations.js +20 -7
- package/dist/presentation/dto/integrations.js.map +1 -1
- package/dist/presentation/routes/connections.d.ts +1 -1
- package/dist/presentation/routes/connections.d.ts.map +1 -1
- package/dist/presentation/routes/connections.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/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 +20 -13
- package/src/api/client.ts +1 -1
- package/src/core/connect.test.ts +1 -1
- package/src/core/connect.ts +1 -1
- package/src/core/errors.ts +1 -1
- package/src/core/source-control-clone-url.test.ts +1 -1
- package/src/core/source-control.test.ts +1 -1
- package/src/core/source-control.ts +2 -2
- 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 +6 -6
- package/src/index.ts +2 -2
- package/src/presentation/dto/integrations.ts +22 -8
- package/src/presentation/routes/connections.test.ts +1 -1
- package/src/presentation/routes/connections.ts +1 -1
- package/src/presentation/routes/errors.ts +1 -1
- package/src/presentation/routes/webhooks.ts +2 -5
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-integration-gitea",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
|
-
"imports": {
|
|
15
|
-
"#test/*": "./test/*",
|
|
16
|
-
"#*": "./dist/*"
|
|
17
|
-
},
|
|
18
14
|
"exports": {
|
|
19
15
|
".": {
|
|
20
16
|
"types": "./dist/index.d.ts",
|
|
@@ -23,14 +19,25 @@
|
|
|
23
19
|
},
|
|
24
20
|
"dependencies": {
|
|
25
21
|
"drizzle-orm": "^0.45.2",
|
|
26
|
-
"@shipfox/api-auth-context": "
|
|
27
|
-
"@shipfox/api-integration-
|
|
28
|
-
"@shipfox/
|
|
29
|
-
"@shipfox/
|
|
30
|
-
"@shipfox/
|
|
31
|
-
"@shipfox/node-fastify": "0.3.
|
|
32
|
-
"@shipfox/node-opentelemetry": "0.6.
|
|
33
|
-
"@shipfox/node-postgres": "0.4.
|
|
22
|
+
"@shipfox/api-auth-context": "9.0.2",
|
|
23
|
+
"@shipfox/api-integration-gitea-dto": "9.0.2",
|
|
24
|
+
"@shipfox/config": "1.2.4",
|
|
25
|
+
"@shipfox/node-drizzle": "0.3.4",
|
|
26
|
+
"@shipfox/api-integration-spi": "0.2.2",
|
|
27
|
+
"@shipfox/node-fastify": "0.3.2",
|
|
28
|
+
"@shipfox/node-opentelemetry": "0.6.2",
|
|
29
|
+
"@shipfox/node-postgres": "0.4.4"
|
|
30
|
+
},
|
|
31
|
+
"imports": {
|
|
32
|
+
"#*": "./dist/*"
|
|
33
|
+
},
|
|
34
|
+
"shipfox": {
|
|
35
|
+
"architecture": {
|
|
36
|
+
"schema": 1,
|
|
37
|
+
"realm": "source-available",
|
|
38
|
+
"kind": "implementation",
|
|
39
|
+
"context": "integrations"
|
|
40
|
+
}
|
|
34
41
|
},
|
|
35
42
|
"scripts": {
|
|
36
43
|
"build": "shipfox-swc",
|
package/src/api/client.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Buffer} from 'node:buffer';
|
|
2
|
-
import {MAX_REPOSITORY_FILE_BYTES} from '@shipfox/api-integration-
|
|
2
|
+
import {MAX_REPOSITORY_FILE_BYTES} from '@shipfox/api-integration-spi';
|
|
3
3
|
import {config} from '#config.js';
|
|
4
4
|
import {GiteaIntegrationProviderError} from '#core/errors.js';
|
|
5
5
|
|
package/src/core/connect.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-
|
|
1
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
2
2
|
import type {GiteaApiClient} from '#api/client.js';
|
|
3
3
|
import {handleGiteaConnect} from '#core/connect.js';
|
|
4
4
|
import {GiteaOrgAlreadyLinkedError, GiteaOrganizationNotFoundError} from '#core/errors.js';
|
package/src/core/connect.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-
|
|
1
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
2
2
|
import type {GiteaApiClient} from '#api/client.js';
|
|
3
3
|
import {GiteaOrgAlreadyLinkedError, GiteaOrganizationNotFoundError} from './errors.js';
|
|
4
4
|
|
package/src/core/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-
|
|
1
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
2
2
|
import type {GiteaApiClient, GiteaRepository} from '#api/client.js';
|
|
3
3
|
import {GiteaIntegrationProviderError} from './errors.js';
|
|
4
4
|
import {GiteaSourceControlProvider} from './source-control.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Buffer} from 'node:buffer';
|
|
2
|
+
import {giteaProviderKind} from '@shipfox/api-integration-gitea-dto';
|
|
2
3
|
import {
|
|
3
4
|
buildProviderRepositoryId,
|
|
4
5
|
type CheckoutSpec,
|
|
@@ -16,8 +17,7 @@ import {
|
|
|
16
17
|
type RepositoryVisibility,
|
|
17
18
|
type ResolveRepositoryInput,
|
|
18
19
|
type SourceControlProvider,
|
|
19
|
-
} from '@shipfox/api-integration-
|
|
20
|
-
import {giteaProviderKind} from '@shipfox/api-integration-gitea-dto';
|
|
20
|
+
} from '@shipfox/api-integration-spi';
|
|
21
21
|
import type {GiteaApiClient, GiteaRepository} from '#api/client.js';
|
|
22
22
|
import {config, giteaCloneBaseOrigin} from '#config.js';
|
|
23
23
|
import {GiteaIntegrationProviderError} from './errors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createHmac, randomUUID} from 'node:crypto';
|
|
2
|
-
import {createStoredWebhookRequest, decodeWebhookBody} from '@shipfox/api-integration-
|
|
2
|
+
import {createStoredWebhookRequest, decodeWebhookBody} from '@shipfox/api-integration-spi';
|
|
3
3
|
import {createGiteaWebhookProcessor} from './webhook-processor.js';
|
|
4
4
|
|
|
5
5
|
const WEBHOOK_SECRET = 'test-webhook-secret';
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type RecordDeliveryOnlyFn,
|
|
7
7
|
type StoredWebhookRequest,
|
|
8
8
|
type WebhookProcessingResult,
|
|
9
|
-
} from '@shipfox/api-integration-
|
|
9
|
+
} from '@shipfox/api-integration-spi';
|
|
10
10
|
import {verifyHexHmacSignature} from '@shipfox/node-fastify';
|
|
11
11
|
import {logger} from '@shipfox/node-opentelemetry';
|
|
12
12
|
import type {NodePgDatabase} from 'drizzle-orm/node-postgres';
|
package/src/core/webhook.test.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
IntegrationConnection,
|
|
5
5
|
PublishSourcePushFn,
|
|
6
6
|
RecordDeliveryOnlyFn,
|
|
7
|
-
} from '@shipfox/api-integration-
|
|
7
|
+
} from '@shipfox/api-integration-spi';
|
|
8
8
|
import {db} from '#db/db.js';
|
|
9
9
|
import {giteaConnections} from '#db/schema/connections.js';
|
|
10
10
|
import {capturedGiteaPushPayload, giteaConnectionFactory, giteaPushPayload} from '#test/index.js';
|
package/src/core/webhook.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GiteaPushPayloadDto,
|
|
3
|
+
giteaProviderKind,
|
|
4
|
+
giteaPushPayloadSchema,
|
|
5
|
+
} from '@shipfox/api-integration-gitea-dto';
|
|
1
6
|
import {
|
|
2
7
|
buildProviderRepositoryId,
|
|
3
8
|
type GetIntegrationConnectionByIdFn,
|
|
@@ -5,12 +10,7 @@ import {
|
|
|
5
10
|
type PublishSourcePushFn,
|
|
6
11
|
type RecordDeliveryOnlyFn,
|
|
7
12
|
type SourcePushPayload,
|
|
8
|
-
} from '@shipfox/api-integration-
|
|
9
|
-
import {
|
|
10
|
-
type GiteaPushPayloadDto,
|
|
11
|
-
giteaProviderKind,
|
|
12
|
-
giteaPushPayloadSchema,
|
|
13
|
-
} from '@shipfox/api-integration-gitea-dto';
|
|
13
|
+
} from '@shipfox/api-integration-spi';
|
|
14
14
|
import {logger} from '@shipfox/node-opentelemetry';
|
|
15
15
|
import {getGiteaConnectionByOrg} from '#db/connections.js';
|
|
16
16
|
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {giteaProviderKind} from '@shipfox/api-integration-gitea-dto';
|
|
1
2
|
import type {
|
|
2
3
|
GetIntegrationConnectionByIdFn,
|
|
3
4
|
IntegrationConnection,
|
|
4
5
|
PublishSourcePushFn,
|
|
5
6
|
RecordDeliveryOnlyFn,
|
|
6
|
-
} from '@shipfox/api-integration-
|
|
7
|
-
import {giteaProviderKind} from '@shipfox/api-integration-gitea-dto';
|
|
7
|
+
} from '@shipfox/api-integration-spi';
|
|
8
8
|
import type {NodePgDatabase} from 'drizzle-orm/node-postgres';
|
|
9
9
|
import {createGiteaApiClient, type GiteaApiClient} from '#api/client.js';
|
|
10
10
|
import type {ConnectGiteaConnectionInput} from '#core/connect.js';
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type IntegrationConnection,
|
|
3
|
-
toIntegrationConnectionDto as toCoreIntegrationConnectionDto,
|
|
4
|
-
} from '@shipfox/api-integration-core-dto';
|
|
1
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
5
2
|
|
|
6
3
|
export function toIntegrationConnectionDto(
|
|
7
4
|
connection: IntegrationConnection<'gitea'>,
|
|
8
5
|
options: {externalUrl?: string | undefined} = {},
|
|
9
6
|
) {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
return mapIntegrationConnection(connection, ['source_control'], options.externalUrl);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function mapIntegrationConnection(
|
|
11
|
+
connection: IntegrationConnection,
|
|
12
|
+
capabilities: string[],
|
|
13
|
+
externalUrl?: string,
|
|
14
|
+
) {
|
|
15
|
+
return {
|
|
16
|
+
id: connection.id,
|
|
17
|
+
workspace_id: connection.workspaceId,
|
|
18
|
+
provider: connection.provider,
|
|
19
|
+
external_account_id: connection.externalAccountId,
|
|
20
|
+
slug: connection.slug,
|
|
21
|
+
display_name: connection.displayName,
|
|
22
|
+
lifecycle_status: connection.lifecycleStatus,
|
|
23
|
+
capabilities,
|
|
24
|
+
...(externalUrl ? {external_url: externalUrl} : {}),
|
|
25
|
+
created_at: connection.createdAt.toISOString(),
|
|
26
|
+
updated_at: connection.updatedAt.toISOString(),
|
|
27
|
+
};
|
|
14
28
|
}
|
|
@@ -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 {GiteaApiClient} from '#api/client.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {AUTH_USER, requireWorkspaceAccess} from '@shipfox/api-auth-context';
|
|
2
|
-
import type {IntegrationConnection} from '@shipfox/api-integration-core-dto';
|
|
3
2
|
import {
|
|
4
3
|
createGiteaConnectionBodySchema,
|
|
5
4
|
createGiteaConnectionResponseSchema,
|
|
6
5
|
} from '@shipfox/api-integration-gitea-dto';
|
|
6
|
+
import type {IntegrationConnection} from '@shipfox/api-integration-spi';
|
|
7
7
|
import {defineRoute, type RouteGroup} from '@shipfox/node-fastify';
|
|
8
8
|
import type {GiteaApiClient} from '#api/client.js';
|
|
9
9
|
import {type ConnectGiteaConnectionInput, handleGiteaConnect} from '#core/connect.js';
|
|
@@ -5,11 +5,8 @@ import type {
|
|
|
5
5
|
RecordDeliveryOnlyFn,
|
|
6
6
|
StoredWebhookRequest,
|
|
7
7
|
WebhookProcessingResult,
|
|
8
|
-
} from '@shipfox/api-integration-
|
|
9
|
-
import {
|
|
10
|
-
createStoredWebhookRequest,
|
|
11
|
-
WEBHOOK_MAX_RAW_BODY_BYTES,
|
|
12
|
-
} from '@shipfox/api-integration-core-dto';
|
|
8
|
+
} from '@shipfox/api-integration-spi';
|
|
9
|
+
import {createStoredWebhookRequest, WEBHOOK_MAX_RAW_BODY_BYTES} from '@shipfox/api-integration-spi';
|
|
13
10
|
import {
|
|
14
11
|
ClientError,
|
|
15
12
|
defineRoute,
|