@shipfox/api-integration-gitea-dto 2.0.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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +46 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/gitea.d.ts +28 -0
- package/dist/schemas/gitea.d.ts.map +1 -0
- package/dist/schemas/gitea.js +9 -0
- package/dist/schemas/gitea.js.map +1 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +4 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/webhooks.d.ts +15 -0
- package/dist/schemas/webhooks.d.ts.map +1 -0
- package/dist/schemas/webhooks.js +15 -0
- package/dist/schemas/webhooks.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +54 -0
- package/src/index.ts +3 -0
- package/src/schemas/gitea.ts +11 -0
- package/src/schemas/index.ts +2 -0
- package/src/schemas/webhooks.ts +13 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +9 -0
- package/vitest.config.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-emit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-check
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @shipfox/api-integration-gitea-dto
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1b0d344: Publishes the complete API runtime closure with packed-consumer-safe internal imports and records its exact package set in application releases.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [1b0d344]
|
|
12
|
+
- @shipfox/api-integration-core-dto@2.0.0
|
|
13
|
+
|
|
14
|
+
## 0.0.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 58f51bd: Scaffold an empty `gitea` integration provider that mirrors the `github` package structure, ahead of any behavior.
|
|
19
|
+
- New `@shipfox/api-integration-gitea` + `@shipfox/api-integration-gitea-dto` packages: `createGiteaIntegrationProvider()` returns an empty provider (`{provider: 'gitea', displayName: 'Gitea', adapters: {}, routes: []}`), plus a `src/config.ts` documenting the self-hoster variables (`GITEA_BASE_URL`, `GITEA_SERVICE_USERNAME`, `GITEA_SERVICE_TOKEN`, `GITEA_WEBHOOK_SECRET`, `GITEA_WEBHOOK_TARGET_URL`, `GITEA_CHECKOUT_TTL_SECONDS`) and an empty provider database wired with the stable migrations table `__drizzle_migrations_integrations_gitea`.
|
|
20
|
+
- `@shipfox/api-integration-core`: register the Gitea provider behind `INTEGRATIONS_ENABLE_GITEA_PROVIDER` (default false). With the flag enabled, `gitea` appears in `GET /integration-providers`. Dormant scaffold; no runtime behavior yet.
|
|
21
|
+
|
|
22
|
+
- 570ac69: Add the Gitea connection flow so a workspace member can link a Gitea org with a single authenticated request (no OAuth, no redirect).
|
|
23
|
+
- `@shipfox/api-integration-gitea-dto`: `createGiteaConnectionBodySchema` (`{workspace_id, org}`); the response reuses the shared `integrationConnectionDtoSchema`.
|
|
24
|
+
- `@shipfox/api-integration-gitea`: `POST /integrations/gitea/connections` (`AUTH_USER`, workspace membership) canonicalizes the org to lower case (Gitea routes org names case-insensitively, so this keeps the case-sensitive ownership lookup and unique indexes from being bypassed by a case variant), validates the org via the API, rejects an org already linked to another workspace (409), registers an org-level push webhook (`POST /orgs/{org}/hooks` with `GITEA_WEBHOOK_SECRET`/`GITEA_WEBHOOK_TARGET_URL`), and in one transaction upserts the core connection (`provider: 'gitea'`, `externalAccountId: org`) and a new `integrations_gitea_connections` row (`connection_id`/`org` unique, stored `webhook_id`). Re-connecting an already-active org is idempotent and skips a second webhook. Webhook registration itself is idempotent (an existing org hook for the target URL is reused) and compensated (a hook created before a transaction that then rolls back is deleted), so concurrent or retried connects do not leave orphaned hooks. The `GiteaApiClient` gains `organizationExists`, `createOrgPushWebhook`, and `deleteOrgWebhook`, and the provider exposes `connectionExternalUrl` pointing at the org on the Gitea instance.
|
|
25
|
+
- `@shipfox/api-integration-core`: wire the Gitea connect closure (`connectGiteaConnection`) and the cross-tenant lookup (`getExistingGiteaConnection`) into the provider, mirroring `connectGithubInstallation`.
|
|
26
|
+
|
|
27
|
+
Connecting an org creates an active connection visible in `GET /integration-connections` and registers a Gitea webhook whose id is stored.
|
|
28
|
+
|
|
29
|
+
- 857fd73: Receive Gitea push webhooks and trigger runs through the existing source-push pipeline.
|
|
30
|
+
- `@shipfox/api-integration-gitea-dto`: `giteaPushPayloadSchema` (`{ref, after, repository: {name, full_name, default_branch, owner: {username}}}`).
|
|
31
|
+
- `@shipfox/api-integration-gitea`: `POST /webhooks/integrations/gitea` (`auth: []`, `rawBodyPlugin`, standard webhook body limit). It verifies the `X-Gitea-Signature` header as hex HMAC-SHA256 of the raw body keyed by `GITEA_WEBHOOK_SECRET` (401 on mismatch), records non-`push` events for delivery dedup and returns 204, and on a `push` resolves the org (`repository.owner.username`, lower-cased to match the stored org) to its connection, drops branch deletions and unknown orgs, and publishes a normalized `SourcePushPayload` (`externalRepositoryId: gitea:<owner>/<repo>` built from `owner.username`/`repository.name` to match the source-control adapter, `refs/heads/` stripped, `headCommitSha: after`, `isDefaultBranch`). `getGiteaConnectionByOrg` gains an optional transaction executor so the lookup runs inside the publishing transaction. The webhook is registered out of band by the Gitea instance admin, so the connect flow registers nothing.
|
|
32
|
+
- `@shipfox/api-integration-core`: wire `publishSourcePush`, `recordDeliveryOnly`, `getIntegrationConnectionById`, and the core database into the Gitea provider, mirroring GitHub.
|
|
33
|
+
- `@shipfox/node-fastify`: add a shared `verifyHexHmacSignature` helper for hex HMAC-SHA256 webhook signatures.
|
|
34
|
+
- `@shipfox/api-integration-sentry`: `verifySentrySignature` now delegates to the shared helper.
|
|
35
|
+
|
|
36
|
+
A push to a connected org's repo creates a workflow run through the existing pipeline. Duplicate POSTs of the same delivery are deduped via `X-Gitea-Delivery`; note that a manual "Redeliver" in Gitea mints a new delivery id and intentionally produces a fresh run (unlike GitHub, whose redelivery reuses the original id and is suppressed).
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [115655e]
|
|
39
|
+
- Updated dependencies [ce062a9]
|
|
40
|
+
- Updated dependencies [f3614ae]
|
|
41
|
+
- Updated dependencies [f8f339a]
|
|
42
|
+
- Updated dependencies [b8e49ff]
|
|
43
|
+
- Updated dependencies [d6d4862]
|
|
44
|
+
- Updated dependencies [01be723]
|
|
45
|
+
- Updated dependencies [2933c33]
|
|
46
|
+
- @shipfox/api-integration-core-dto@0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shipfox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,eAAO,MAAM,iBAAiB,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './schemas/index.js';\n\nexport const giteaProviderKind = 'gitea';\n"],"names":["giteaProviderKind"],"mappings":"AAAA,cAAc,qBAAqB;AAEnC,OAAO,MAAMA,oBAAoB,QAAQ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createGiteaConnectionBodySchema: z.ZodObject<{
|
|
3
|
+
workspace_id: z.ZodString;
|
|
4
|
+
org: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type CreateGiteaConnectionBodyDto = z.infer<typeof createGiteaConnectionBodySchema>;
|
|
7
|
+
export declare const createGiteaConnectionResponseSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
workspace_id: z.ZodString;
|
|
10
|
+
provider: z.ZodString;
|
|
11
|
+
external_account_id: z.ZodString;
|
|
12
|
+
slug: z.ZodString;
|
|
13
|
+
display_name: z.ZodString;
|
|
14
|
+
lifecycle_status: z.ZodEnum<{
|
|
15
|
+
error: "error";
|
|
16
|
+
active: "active";
|
|
17
|
+
disabled: "disabled";
|
|
18
|
+
}>;
|
|
19
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
20
|
+
source_control: "source_control";
|
|
21
|
+
agent_tools: "agent_tools";
|
|
22
|
+
}>>;
|
|
23
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
24
|
+
created_at: z.ZodString;
|
|
25
|
+
updated_at: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type CreateGiteaConnectionResponseDto = z.infer<typeof createGiteaConnectionResponseSchema>;
|
|
28
|
+
//# sourceMappingURL=gitea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitea.d.ts","sourceRoot":"","sources":["../../src/schemas/gitea.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE3F,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;iBAAiC,CAAC;AAClF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { integrationConnectionDtoSchema } from '@shipfox/api-integration-core-dto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const createGiteaConnectionBodySchema = z.object({
|
|
4
|
+
workspace_id: z.string().uuid(),
|
|
5
|
+
org: z.string().min(1)
|
|
6
|
+
});
|
|
7
|
+
export const createGiteaConnectionResponseSchema = integrationConnectionDtoSchema;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=gitea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/gitea.ts"],"sourcesContent":["import {integrationConnectionDtoSchema} from '@shipfox/api-integration-core-dto';\nimport {z} from 'zod';\n\nexport const createGiteaConnectionBodySchema = z.object({\n workspace_id: z.string().uuid(),\n org: z.string().min(1),\n});\nexport type CreateGiteaConnectionBodyDto = z.infer<typeof createGiteaConnectionBodySchema>;\n\nexport const createGiteaConnectionResponseSchema = integrationConnectionDtoSchema;\nexport type CreateGiteaConnectionResponseDto = z.infer<typeof createGiteaConnectionResponseSchema>;\n"],"names":["integrationConnectionDtoSchema","z","createGiteaConnectionBodySchema","object","workspace_id","string","uuid","org","min","createGiteaConnectionResponseSchema"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,oCAAoC;AACjF,SAAQC,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,kCAAkCD,EAAEE,MAAM,CAAC;IACtDC,cAAcH,EAAEI,MAAM,GAAGC,IAAI;IAC7BC,KAAKN,EAAEI,MAAM,GAAGG,GAAG,CAAC;AACtB,GAAG;AAGH,OAAO,MAAMC,sCAAsCT,+BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/index.ts"],"sourcesContent":["export * from './gitea.js';\nexport * from './webhooks.js';\n"],"names":[],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,gBAAgB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const giteaPushPayloadSchema: z.ZodObject<{
|
|
3
|
+
ref: z.ZodString;
|
|
4
|
+
after: z.ZodString;
|
|
5
|
+
repository: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
full_name: z.ZodString;
|
|
8
|
+
default_branch: z.ZodString;
|
|
9
|
+
owner: z.ZodObject<{
|
|
10
|
+
username: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type GiteaPushPayloadDto = z.infer<typeof giteaPushPayloadSchema>;
|
|
15
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/schemas/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBASjC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const giteaPushPayloadSchema = z.object({
|
|
3
|
+
ref: z.string().min(1),
|
|
4
|
+
after: z.string().min(1),
|
|
5
|
+
repository: z.object({
|
|
6
|
+
name: z.string().min(1),
|
|
7
|
+
full_name: z.string().min(1),
|
|
8
|
+
default_branch: z.string().min(1),
|
|
9
|
+
owner: z.object({
|
|
10
|
+
username: z.string().min(1)
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/webhooks.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const giteaPushPayloadSchema = z.object({\n ref: z.string().min(1),\n after: z.string().min(1),\n repository: z.object({\n name: z.string().min(1),\n full_name: z.string().min(1),\n default_branch: z.string().min(1),\n owner: z.object({username: z.string().min(1)}),\n }),\n});\nexport type GiteaPushPayloadDto = z.infer<typeof giteaPushPayloadSchema>;\n"],"names":["z","giteaPushPayloadSchema","object","ref","string","min","after","repository","name","full_name","default_branch","owner","username"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,yBAAyBD,EAAEE,MAAM,CAAC;IAC7CC,KAAKH,EAAEI,MAAM,GAAGC,GAAG,CAAC;IACpBC,OAAON,EAAEI,MAAM,GAAGC,GAAG,CAAC;IACtBE,YAAYP,EAAEE,MAAM,CAAC;QACnBM,MAAMR,EAAEI,MAAM,GAAGC,GAAG,CAAC;QACrBI,WAAWT,EAAEI,MAAM,GAAGC,GAAG,CAAC;QAC1BK,gBAAgBV,EAAEI,MAAM,GAAGC,GAAG,CAAC;QAC/BM,OAAOX,EAAEE,MAAM,CAAC;YAACU,UAAUZ,EAAEI,MAAM,GAAGC,GAAG,CAAC;QAAE;IAC9C;AACF,GAAG"}
|