@cat-factory/worker 0.6.0 → 0.7.3
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/LICENSE +21 -21
- package/dist/infrastructure/config/agents.d.ts.map +1 -1
- package/dist/infrastructure/config/agents.js +10 -0
- package/dist/infrastructure/config/agents.js.map +1 -1
- package/dist/infrastructure/container.d.ts.map +1 -1
- package/dist/infrastructure/container.js +36 -2
- package/dist/infrastructure/container.js.map +1 -1
- package/dist/infrastructure/repositories/D1BootstrapJobRepository.js +4 -4
- package/dist/infrastructure/repositories/D1ModelDefaultsRepository.js +1 -1
- package/dist/infrastructure/repositories/D1PipelineScheduleRepository.js +25 -25
- package/dist/infrastructure/repositories/D1RepoProjectionRepository.js +6 -6
- package/dist/infrastructure/repositories/D1ServiceRepository.js +1 -1
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts.map +1 -1
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js +12 -6
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js.map +1 -1
- package/dist/infrastructure/repositories/D1WorkspaceMountRepository.js +8 -8
- package/migrations/0005_issue_tracker_writeback.sql +11 -0
- package/package.json +18 -13
- package/dist/infrastructure/ai/CloudflareModelProvider.d.ts +0 -23
- package/dist/infrastructure/ai/CloudflareModelProvider.d.ts.map +0 -1
- package/dist/infrastructure/ai/CloudflareModelProvider.js +0 -62
- package/dist/infrastructure/ai/CloudflareModelProvider.js.map +0 -1
- package/dist/infrastructure/ai/ContainerRepoScanner.d.ts +0 -39
- package/dist/infrastructure/ai/ContainerRepoScanner.d.ts.map +0 -1
- package/dist/infrastructure/ai/ContainerRepoScanner.js +0 -115
- package/dist/infrastructure/ai/ContainerRepoScanner.js.map +0 -1
- package/dist/infrastructure/documents/ConfluenceProvider.d.ts +0 -29
- package/dist/infrastructure/documents/ConfluenceProvider.d.ts.map +0 -1
- package/dist/infrastructure/documents/ConfluenceProvider.js +0 -179
- package/dist/infrastructure/documents/ConfluenceProvider.js.map +0 -1
- package/dist/infrastructure/documents/GitHubDocsProvider.d.ts +0 -42
- package/dist/infrastructure/documents/GitHubDocsProvider.d.ts.map +0 -1
- package/dist/infrastructure/documents/GitHubDocsProvider.js +0 -85
- package/dist/infrastructure/documents/GitHubDocsProvider.js.map +0 -1
- package/dist/infrastructure/documents/NotionProvider.d.ts +0 -32
- package/dist/infrastructure/documents/NotionProvider.d.ts.map +0 -1
- package/dist/infrastructure/documents/NotionProvider.js +0 -220
- package/dist/infrastructure/documents/NotionProvider.js.map +0 -1
- package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts +0 -27
- package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts.map +0 -1
- package/dist/infrastructure/environments/HttpEnvironmentProvider.js +0 -314
- package/dist/infrastructure/environments/HttpEnvironmentProvider.js.map +0 -1
- package/dist/infrastructure/events/InAppNotificationChannel.d.ts +0 -19
- package/dist/infrastructure/events/InAppNotificationChannel.d.ts.map +0 -1
- package/dist/infrastructure/events/InAppNotificationChannel.js +0 -22
- package/dist/infrastructure/events/InAppNotificationChannel.js.map +0 -1
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts +0 -20
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts.map +0 -1
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js +0 -64
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js.map +0 -1
- package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts +0 -50
- package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts.map +0 -1
- package/dist/infrastructure/tasks/GitHubIssuesProvider.js +0 -91
- package/dist/infrastructure/tasks/GitHubIssuesProvider.js.map +0 -1
- package/dist/infrastructure/tasks/JiraProvider.d.ts +0 -29
- package/dist/infrastructure/tasks/JiraProvider.d.ts.map +0 -1
- package/dist/infrastructure/tasks/JiraProvider.js +0 -109
- package/dist/infrastructure/tasks/JiraProvider.js.map +0 -1
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ConflictError, ValidationError, } from '@cat-factory/kernel';
|
|
2
|
-
import { GITHUB_DOCS_DESCRIPTOR, githubDocsLogic } from '@cat-factory/integrations';
|
|
3
|
-
export class GitHubDocsProvider {
|
|
4
|
-
deps;
|
|
5
|
-
kind = 'github';
|
|
6
|
-
descriptor = GITHUB_DOCS_DESCRIPTOR;
|
|
7
|
-
constructor(deps) {
|
|
8
|
-
this.deps = deps;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* GitHub docs piggyback on the installed GitHub App, so there is nothing to
|
|
12
|
-
* validate or persist — the connection is a marker. Any supplied fields are
|
|
13
|
-
* ignored (the connect form has none).
|
|
14
|
-
*/
|
|
15
|
-
normalizeConnection(_input) {
|
|
16
|
-
return { credentials: {}, label: 'GitHub' };
|
|
17
|
-
}
|
|
18
|
-
parseRef(input) {
|
|
19
|
-
return githubDocsLogic.parseGitHubDocRef(input);
|
|
20
|
-
}
|
|
21
|
-
async fetchDocument(_credentials, externalId) {
|
|
22
|
-
const id = githubDocsLogic.parseGitHubDocExternalId(externalId);
|
|
23
|
-
if (!id) {
|
|
24
|
-
throw new ValidationError(`"${externalId}" is not a valid GitHub doc reference`);
|
|
25
|
-
}
|
|
26
|
-
const installationId = await this.resolveInstallationId(id.owner);
|
|
27
|
-
const file = await this.deps.githubClient.getFileContent(installationId, { owner: id.owner, repo: id.repo }, id.path);
|
|
28
|
-
if (!file) {
|
|
29
|
-
throw new ConflictError(`GitHub file "${id.path}" was not found in ${id.owner}/${id.repo}`);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
externalId: githubDocsLogic.githubDocExternalId(id),
|
|
33
|
-
title: githubDocsLogic.githubDocTitle(id.path),
|
|
34
|
-
url: githubDocsLogic.githubDocUrl(id),
|
|
35
|
-
body: file.content,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
async search(_credentials, query, workspaceId) {
|
|
39
|
-
// Scope to *this workspace's* installation so docs never leak across tenants
|
|
40
|
-
// (a deployment may host many installations; a workspace owns exactly one).
|
|
41
|
-
// Code search is account-scoped anyway (GitHub requires an org/user
|
|
42
|
-
// qualifier), which we build from the installation's account.
|
|
43
|
-
const installation = await this.deps.installations.getByWorkspace(workspaceId);
|
|
44
|
-
if (!installation)
|
|
45
|
-
return [];
|
|
46
|
-
const scoped = githubDocsLogic.buildGitHubCodeSearchQuery(query, installation.accountLogin, installation.targetType);
|
|
47
|
-
const hits = await this.deps.githubClient
|
|
48
|
-
.searchCode(installation.installationId, scoped, 20)
|
|
49
|
-
.catch(() => []);
|
|
50
|
-
const out = [];
|
|
51
|
-
const seen = new Set();
|
|
52
|
-
for (const hit of hits) {
|
|
53
|
-
const externalId = githubDocsLogic.githubDocExternalId({
|
|
54
|
-
owner: hit.owner,
|
|
55
|
-
repo: hit.repo,
|
|
56
|
-
path: hit.path,
|
|
57
|
-
});
|
|
58
|
-
if (seen.has(externalId))
|
|
59
|
-
continue;
|
|
60
|
-
seen.add(externalId);
|
|
61
|
-
out.push({
|
|
62
|
-
source: 'github',
|
|
63
|
-
externalId,
|
|
64
|
-
title: githubDocsLogic.githubDocTitle(hit.path),
|
|
65
|
-
url: hit.url,
|
|
66
|
-
excerpt: '',
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return out.slice(0, 20);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Find the GitHub App installation whose account owns `owner`. The
|
|
73
|
-
* installation token for that account is what can read the repo's contents,
|
|
74
|
-
* regardless of which workspace triggered the import.
|
|
75
|
-
*/
|
|
76
|
-
async resolveInstallationId(owner) {
|
|
77
|
-
const active = await this.deps.installations.listActive();
|
|
78
|
-
const match = active.find((i) => i.accountLogin.toLowerCase() === owner.toLowerCase());
|
|
79
|
-
if (!match) {
|
|
80
|
-
throw new ConflictError(`No GitHub App installation found for "${owner}". Install the GitHub App on that account to link its docs.`);
|
|
81
|
-
}
|
|
82
|
-
return match.installationId;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=GitHubDocsProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocsProvider.js","sourceRoot":"","sources":["../../../src/infrastructure/documents/GitHubDocsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,GAQhB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAmBnF,MAAM,OAAO,kBAAkB;IAIA,IAAI;IAHxB,IAAI,GAAG,QAAiB,CAAA;IACxB,UAAU,GAAG,sBAAsB,CAAA;IAE5C,YAA6B,IAAoC;oBAApC,IAAI;IAAmC,CAAC;IAErE;;;;OAIG;IACH,mBAAmB,CAAC,MAA2B;QAC7C,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;IAC7C,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,OAAO,eAAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACjD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,YAAiC,EACjC,UAAkB;QAElB,MAAM,EAAE,GAAG,eAAe,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAA;QAC/D,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,eAAe,CAAC,IAAI,UAAU,uCAAuC,CAAC,CAAA;QAClF,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACjE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CACtD,cAAc,EACd,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAClC,EAAE,CAAC,IAAI,CACR,CAAA;QACD,IAAI,CA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d,IAAI,EAAE,GAAG,CAAC,IAAI;aACf,CAAC,CAAA;YACF,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;gBAAE,SAAQ;YAClC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YACpB,GAAG,CAAC,IAAI,CAAC;gBACP,MAAM,EAAE,QAAQ;gBAChB,UAAU;gBACV,KAAK,EAAE,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;gBAC/C,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,OAAO,EAAE,EAAE;aACZ,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACzB,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,qBAAqB,CAAC,KAAa;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAA;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;QACtF,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,aAAa,CACrB,yCAAyC,KAAK,6DAA6D,CAC5G,CAAA;QACH,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAA;IAC7B,CAAC;CACF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type DocumentContent, type DocumentCredentials, type DocumentSearchResult, type DocumentSourceProvider, type NormalizedConnection } from '@cat-factory/kernel';
|
|
2
|
-
/** Carries the HTTP status so callers can surface a meaningful error. */
|
|
3
|
-
export declare class NotionApiError extends Error {
|
|
4
|
-
readonly status: number;
|
|
5
|
-
constructor(status: number, message: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class NotionProvider implements DocumentSourceProvider {
|
|
8
|
-
readonly kind: 'notion';
|
|
9
|
-
readonly descriptor: {
|
|
10
|
-
source: "confluence" | "github" | "notion";
|
|
11
|
-
label: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
credentialFields: {
|
|
14
|
-
key: string;
|
|
15
|
-
label: string;
|
|
16
|
-
help?: string | undefined;
|
|
17
|
-
placeholder?: string | undefined;
|
|
18
|
-
secret?: boolean | undefined;
|
|
19
|
-
}[];
|
|
20
|
-
refLabel: string;
|
|
21
|
-
refPlaceholder: string;
|
|
22
|
-
searchable?: boolean | undefined;
|
|
23
|
-
};
|
|
24
|
-
normalizeConnection(input: DocumentCredentials): NormalizedConnection;
|
|
25
|
-
parseRef(input: string): string | null;
|
|
26
|
-
fetchDocument(credentials: DocumentCredentials, externalId: string): Promise<DocumentContent>;
|
|
27
|
-
search(credentials: DocumentCredentials, query: string): Promise<DocumentSearchResult[]>;
|
|
28
|
-
/** Page through a page's top-level blocks (bounded), returning them in order. */
|
|
29
|
-
private fetchBlocks;
|
|
30
|
-
private get;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=NotionProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotionProvider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/documents/NotionProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAA;AAsB5B,yEAAyE;AACzE,qBAAa,cAAe,SAAQ,KAAK;IAErC,QAAQ,CAAC,MAAM,EAAE,MAAM;IADzB,YACW,MAAM,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAIhB;CACF;AAkGD,qBAAa,cAAe,YAAW,sBAAsB;IAC3D,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAS;IACjC,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;MAAoB;IAEvC,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAMpE;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAErC;IAEK,aAAa,CACjB,WAAW,EAAE,mBAAmB,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAe1B;IAEK,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA6B7F;IAED,iFAAiF;YACnE,WAAW;YAqBX,GAAG;CA+BlB"}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { ValidationError, } from '@cat-factory/kernel';
|
|
2
|
-
import { NOTION_DESCRIPTOR, notionLogic } from '@cat-factory/integrations';
|
|
3
|
-
// NotionProvider: the document-source provider for Notion. It authenticates with
|
|
4
|
-
// a single internal-integration token (Bearer), fetches a page for its title and
|
|
5
|
-
// URL, then pages through the page's top-level blocks and converts them to the
|
|
6
|
-
// Markdown the planner consumes. Because the API host is fixed
|
|
7
|
-
// (`api.notion.com`) and there is no per-site base URL, there is no SSRF surface.
|
|
8
|
-
// Notion-specific *pure* logic (ref parsing, block → Markdown) lives in
|
|
9
|
-
// `@cat-factory/integrations`; this class is the thin `fetch` shell.
|
|
10
|
-
const API_BASE = 'https://api.notion.com/v1';
|
|
11
|
-
const NOTION_API_HOST = 'api.notion.com';
|
|
12
|
-
const NOTION_VERSION = '2022-06-28';
|
|
13
|
-
const USER_AGENT = 'cat-factory';
|
|
14
|
-
/** Bound the block backfill so a huge page can't stall an import (100 blocks/page). */
|
|
15
|
-
const MAX_BLOCK_PAGES = 5;
|
|
16
|
-
/** Bound the redirect chain so the fixed API host can't 302 us elsewhere. */
|
|
17
|
-
const MAX_REDIRECTS = 5;
|
|
18
|
-
/** Hard cap on the bytes read off any response body, to protect the isolate. */
|
|
19
|
-
const MAX_RESPONSE_BYTES = 5_000_000;
|
|
20
|
-
/** Carries the HTTP status so callers can surface a meaningful error. */
|
|
21
|
-
export class NotionApiError extends Error {
|
|
22
|
-
status;
|
|
23
|
-
constructor(status, message) {
|
|
24
|
-
super(message);
|
|
25
|
-
this.status = status;
|
|
26
|
-
this.name = 'NotionApiError';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The Notion API host is fixed, so any redirect must stay on `api.notion.com`
|
|
31
|
-
* over https. A redirect off-host (e.g. to an internal address) is treated as an
|
|
32
|
-
* SSRF attempt and rejected. Mirrors the per-hop guard the site-configurable
|
|
33
|
-
* providers run.
|
|
34
|
-
*/
|
|
35
|
-
function assertSafeNotionUrl(url) {
|
|
36
|
-
let parsed;
|
|
37
|
-
try {
|
|
38
|
-
parsed = new URL(url);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
throw new NotionApiError(502, `Notion request URL is invalid: ${url}`);
|
|
42
|
-
}
|
|
43
|
-
if (parsed.protocol !== 'https:') {
|
|
44
|
-
throw new NotionApiError(502, 'Notion request must use https');
|
|
45
|
-
}
|
|
46
|
-
if (parsed.hostname.toLowerCase() !== NOTION_API_HOST) {
|
|
47
|
-
throw new NotionApiError(502, `Notion redirect to a disallowed host: ${parsed.hostname}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* `fetch` with redirects followed by hand so the host guard runs against EVERY
|
|
52
|
-
* hop. With the default `redirect: 'follow'` a 302 from the API could be chased
|
|
53
|
-
* to an internal target (or downgraded to http), leaking the Bearer token. We
|
|
54
|
-
* force `redirect: 'manual'`, re-resolve the `Location`, and re-validate.
|
|
55
|
-
*/
|
|
56
|
-
async function safeFetch(url, init) {
|
|
57
|
-
let current = url;
|
|
58
|
-
for (let hop = 0;; hop++) {
|
|
59
|
-
assertSafeNotionUrl(current);
|
|
60
|
-
const res = await fetch(current, { ...init, redirect: 'manual' });
|
|
61
|
-
if (res.status >= 300 && res.status < 400) {
|
|
62
|
-
const location = res.headers.get('location');
|
|
63
|
-
if (!location)
|
|
64
|
-
return res;
|
|
65
|
-
if (hop >= MAX_REDIRECTS) {
|
|
66
|
-
throw new NotionApiError(502, 'Notion returned too many redirects');
|
|
67
|
-
}
|
|
68
|
-
current = new URL(location, current).toString();
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
return res;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Read a response body with a running byte cap so a hostile/huge response can't
|
|
76
|
-
* OOM the isolate. Checks the declared Content-Length first, then enforces the
|
|
77
|
-
* cap while streaming.
|
|
78
|
-
*/
|
|
79
|
-
async function readCappedText(res, maxBytes) {
|
|
80
|
-
const declared = res.headers.get('content-length');
|
|
81
|
-
if (declared && Number(declared) > maxBytes) {
|
|
82
|
-
throw new NotionApiError(502, 'Notion response too large');
|
|
83
|
-
}
|
|
84
|
-
const body = res.body;
|
|
85
|
-
if (!body)
|
|
86
|
-
return '';
|
|
87
|
-
const reader = body.getReader();
|
|
88
|
-
const chunks = [];
|
|
89
|
-
let total = 0;
|
|
90
|
-
try {
|
|
91
|
-
for (;;) {
|
|
92
|
-
const { done, value } = await reader.read();
|
|
93
|
-
if (done)
|
|
94
|
-
break;
|
|
95
|
-
if (!value)
|
|
96
|
-
continue;
|
|
97
|
-
total += value.byteLength;
|
|
98
|
-
if (total > maxBytes) {
|
|
99
|
-
await reader.cancel();
|
|
100
|
-
throw new NotionApiError(502, 'Notion response too large');
|
|
101
|
-
}
|
|
102
|
-
chunks.push(value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
finally {
|
|
106
|
-
reader.releaseLock();
|
|
107
|
-
}
|
|
108
|
-
const merged = new Uint8Array(total);
|
|
109
|
-
let offset = 0;
|
|
110
|
-
for (const c of chunks) {
|
|
111
|
-
merged.set(c, offset);
|
|
112
|
-
offset += c.byteLength;
|
|
113
|
-
}
|
|
114
|
-
return new TextDecoder().decode(merged);
|
|
115
|
-
}
|
|
116
|
-
export class NotionProvider {
|
|
117
|
-
kind = 'notion';
|
|
118
|
-
descriptor = NOTION_DESCRIPTOR;
|
|
119
|
-
normalizeConnection(input) {
|
|
120
|
-
const apiToken = input.apiToken?.trim();
|
|
121
|
-
if (!apiToken) {
|
|
122
|
-
throw new ValidationError('Notion requires an internal integration token');
|
|
123
|
-
}
|
|
124
|
-
return { credentials: { apiToken }, label: 'Notion workspace' };
|
|
125
|
-
}
|
|
126
|
-
parseRef(input) {
|
|
127
|
-
return notionLogic.parseNotionRef(input);
|
|
128
|
-
}
|
|
129
|
-
async fetchDocument(credentials, externalId) {
|
|
130
|
-
const page = await this.get(credentials, `/pages/${encodeURIComponent(externalId)}`);
|
|
131
|
-
if (!page.id) {
|
|
132
|
-
throw new NotionApiError(502, `Notion returned an unexpected body for page ${externalId}`);
|
|
133
|
-
}
|
|
134
|
-
const blocks = await this.fetchBlocks(credentials, page.id);
|
|
135
|
-
return {
|
|
136
|
-
externalId: page.id,
|
|
137
|
-
title: notionLogic.notionPageTitle(page.properties),
|
|
138
|
-
url: page.url ?? `https://www.notion.so/${page.id.replace(/-/g, '')}`,
|
|
139
|
-
body: notionLogic.notionBlocksToMarkdown(blocks),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
async search(credentials, query) {
|
|
143
|
-
const res = await safeFetch(`${API_BASE}/search`, {
|
|
144
|
-
method: 'POST',
|
|
145
|
-
headers: {
|
|
146
|
-
authorization: `Bearer ${credentials.apiToken}`,
|
|
147
|
-
'notion-version': NOTION_VERSION,
|
|
148
|
-
accept: 'application/json',
|
|
149
|
-
'content-type': 'application/json',
|
|
150
|
-
'user-agent': USER_AGENT,
|
|
151
|
-
},
|
|
152
|
-
body: JSON.stringify({
|
|
153
|
-
query,
|
|
154
|
-
filter: { property: 'object', value: 'page' },
|
|
155
|
-
page_size: 20,
|
|
156
|
-
}),
|
|
157
|
-
});
|
|
158
|
-
if (!res.ok) {
|
|
159
|
-
const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
|
|
160
|
-
throw new NotionApiError(res.status, `Notion search → ${res.status}: ${text.slice(0, 300)}`);
|
|
161
|
-
}
|
|
162
|
-
const text = await readCappedText(res, MAX_RESPONSE_BYTES);
|
|
163
|
-
const json = (() => {
|
|
164
|
-
try {
|
|
165
|
-
return JSON.parse(text);
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
})();
|
|
171
|
-
return notionLogic.parseNotionSearchResults(json);
|
|
172
|
-
}
|
|
173
|
-
/** Page through a page's top-level blocks (bounded), returning them in order. */
|
|
174
|
-
async fetchBlocks(credentials, pageId) {
|
|
175
|
-
const blocks = [];
|
|
176
|
-
let cursor;
|
|
177
|
-
for (let i = 0; i < MAX_BLOCK_PAGES; i++) {
|
|
178
|
-
const query = cursor
|
|
179
|
-
? `?page_size=100&start_cursor=${encodeURIComponent(cursor)}`
|
|
180
|
-
: '?page_size=100';
|
|
181
|
-
const res = await this.get(credentials, `/blocks/${encodeURIComponent(pageId)}/children${query}`);
|
|
182
|
-
if (Array.isArray(res.results))
|
|
183
|
-
blocks.push(...res.results);
|
|
184
|
-
if (!res.has_more || !res.next_cursor)
|
|
185
|
-
break;
|
|
186
|
-
cursor = res.next_cursor;
|
|
187
|
-
}
|
|
188
|
-
return blocks;
|
|
189
|
-
}
|
|
190
|
-
async get(credentials, path) {
|
|
191
|
-
const url = `${API_BASE}${path}`;
|
|
192
|
-
const res = await safeFetch(url, {
|
|
193
|
-
method: 'GET',
|
|
194
|
-
headers: {
|
|
195
|
-
authorization: `Bearer ${credentials.apiToken}`,
|
|
196
|
-
'notion-version': NOTION_VERSION,
|
|
197
|
-
accept: 'application/json',
|
|
198
|
-
'user-agent': USER_AGENT,
|
|
199
|
-
},
|
|
200
|
-
});
|
|
201
|
-
if (!res.ok) {
|
|
202
|
-
const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
|
|
203
|
-
throw new NotionApiError(res.status, `Notion GET ${url} → ${res.status}: ${text.slice(0, 300)}`);
|
|
204
|
-
}
|
|
205
|
-
const text = await readCappedText(res, MAX_RESPONSE_BYTES);
|
|
206
|
-
const json = (() => {
|
|
207
|
-
try {
|
|
208
|
-
return JSON.parse(text);
|
|
209
|
-
}
|
|
210
|
-
catch {
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
})();
|
|
214
|
-
if (json === null) {
|
|
215
|
-
throw new NotionApiError(502, `Notion returned an unparseable body for ${path}`);
|
|
216
|
-
}
|
|
217
|
-
return json;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
//# sourceMappingURL=NotionProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotionProvider.js","sourceRoot":"","sources":["../../../src/infrastructure/documents/NotionProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAMhB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE1E,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,+DAA+D;AAC/D,kFAAkF;AAClF,wEAAwE;AACxE,qEAAqE;AAErE,MAAM,QAAQ,GAAG,2BAA2B,CAAA;AAC5C,MAAM,eAAe,GAAG,gBAAgB,CAAA;AACxC,MAAM,cAAc,GAAG,YAAY,CAAA;AACnC,MAAM,UAAU,GAAG,aAAa,CAAA;AAChC,uFAAuF;AACvF,MAAM,eAAe,GAAG,CAAC,CAAA;AACzB,6EAA6E;AAC7E,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,SAAS,CAAA;AAEpC,yEAAyE;AACzE,MAAM,OAAO,cAAe,SAAQ,KAAK;IAE5B,MAAM;IADjB,YACW,MAAc,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;sBAHL,MAAM;QAIf,IAAI,CAAC,IAA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;gBACP,aAAa,EAAE,UAAU,WAAW,CAAC,QAAQ,EAAE;gBAC/C,gBAAgB,EAAE,cAAc;gBAChC,MAAM,EAAE,kBAAkB;gBAC1B,YAAY,EAAE,UAAU;aACzB;SACF,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;YAC1E,MAAM,IAAI,cAAc,CACtB,GAAG,CAAC,MAAM,EACV,cAAc,GAAG,MAAM,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAC3D,CAAA;QACH,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;QAC1D,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAA;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC,CAAC,EAAE,CAAA;QACJ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,cAAc,CAAC,GAAG,EAAE,2CAA2C,IAAI,EAAE,CAAC,CAAA;QAClF,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type EnvironmentProvider, type EnvironmentStatusRequest, type EnvironmentTeardownRequest, type EnvironmentStatus, type ProvisionEnvironmentRequest, type ProvisionedEnvironment } from '@cat-factory/kernel';
|
|
2
|
-
/** Carries the HTTP status so the API can surface a meaningful (redacted) error. */
|
|
3
|
-
export declare class EnvironmentApiError extends Error {
|
|
4
|
-
readonly status: number;
|
|
5
|
-
constructor(status: number, message: string);
|
|
6
|
-
}
|
|
7
|
-
export interface HttpEnvironmentProviderOptions {
|
|
8
|
-
defaultTimeoutMs?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class HttpEnvironmentProvider implements EnvironmentProvider {
|
|
11
|
-
private readonly defaultTimeoutMs;
|
|
12
|
-
/** Per-isolate OAuth token cache, keyed by token URL + client id. */
|
|
13
|
-
private readonly oauthCache;
|
|
14
|
-
constructor(options?: HttpEnvironmentProviderOptions);
|
|
15
|
-
provision(req: ProvisionEnvironmentRequest): Promise<ProvisionedEnvironment>;
|
|
16
|
-
status(req: EnvironmentStatusRequest): Promise<ProvisionedEnvironment>;
|
|
17
|
-
teardown(req: EnvironmentTeardownRequest): Promise<{
|
|
18
|
-
status: EnvironmentStatus;
|
|
19
|
-
}>;
|
|
20
|
-
private execute;
|
|
21
|
-
private buildUrl;
|
|
22
|
-
private authHeaders;
|
|
23
|
-
private oauthToken;
|
|
24
|
-
private mapResponse;
|
|
25
|
-
private mapAccess;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=HttpEnvironmentProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpEnvironmentProvider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/environments/HttpEnvironmentProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,mBAAmB,EAExB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAEhC,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAA;AAqB5B,oFAAoF;AACpF,qBAAa,mBAAoB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,MAAM,EAAE,MAAM;IADzB,YACW,MAAM,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAIhB;CACF;AAqFD,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0D;IAErF,YAAY,OAAO,GAAE,8BAAmC,EAEvD;IAEK,SAAS,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAajF;IAEK,MAAM,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAwB3E;IAEK,QAAQ,CAAC,GAAG,EAAE,0BAA0B,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAatF;YAIa,OAAO;IAmDrB,OAAO,CAAC,QAAQ;YAoBF,WAAW;YAgCX,UAAU;IAsDxB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,SAAS;CAiBlB"}
|