@graph8/sdk 0.251.0 → 0.262.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/README.md +9 -2
- package/dist/cli.js +216 -0
- package/dist/index.d.mts +105 -7
- package/dist/index.d.ts +105 -7
- package/dist/index.js +44 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +103 -7
- package/dist/react.d.ts +103 -7
- package/dist/react.js +62 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +53 -12
- package/dist/react.mjs.map +1 -1
- package/dist/types/README.md +7 -0
- package/dist/types/agency.d.ts +20 -0
- package/dist/types/agentSetup.d.ts +57 -0
- package/dist/types/api.d.ts +127 -0
- package/dist/types/appClient.d.ts +99 -0
- package/dist/types/appPlatform.d.ts +269 -0
- package/dist/types/appTokens.d.ts +125 -0
- package/dist/types/apps.d.ts +130 -0
- package/dist/types/audiences.d.ts +88 -0
- package/dist/types/calendar.d.ts +55 -0
- package/dist/types/campaigns.d.ts +61 -0
- package/dist/types/chat.d.ts +35 -0
- package/dist/types/cli.d.ts +14 -0
- package/dist/types/companies.d.ts +123 -0
- package/dist/types/contacts.d.ts +200 -0
- package/dist/types/copilot.d.ts +31 -0
- package/dist/types/core.d.ts +1052 -0
- package/dist/types/deals.d.ts +215 -0
- package/dist/types/enrich.d.ts +51 -0
- package/dist/types/fields.d.ts +84 -0
- package/dist/types/forms.d.ts +16 -0
- package/dist/types/http.d.ts +141 -0
- package/dist/types/inbox.d.ts +123 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/intent.d.ts +196 -0
- package/dist/types/lists.d.ts +44 -0
- package/dist/types/mailboxes.d.ts +240 -0
- package/dist/types/marketplace.d.ts +62 -0
- package/dist/types/meetings.d.ts +70 -0
- package/dist/types/newsletter.d.ts +212 -0
- package/dist/types/notes.d.ts +57 -0
- package/dist/types/objects.d.ts +281 -0
- package/dist/types/pipelines.d.ts +135 -0
- package/dist/types/quotes.d.ts +143 -0
- package/dist/types/react.d.ts +978 -0
- package/dist/types/search.d.ts +99 -0
- package/dist/types/sequences.d.ts +255 -0
- package/dist/types/signals.d.ts +28 -0
- package/dist/types/skills.d.ts +176 -0
- package/dist/types/snippet.d.ts +24 -0
- package/dist/types/studio.d.ts +161 -0
- package/dist/types/tasks.d.ts +101 -0
- package/dist/types/types.d.ts +45 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/types/version.d.ts +10 -0
- package/dist/types/visitors.d.ts +29 -0
- package/dist/types/voice.d.ts +304 -0
- package/dist/types/webhooks.d.ts +71 -0
- package/dist/types/workflows.d.ts +229 -0
- package/docs/agents.md +748 -0
- package/docs/api/README.md +165 -0
- package/docs/api/accounts.d.ts +396 -0
- package/docs/api/accounts.md +644 -0
- package/docs/api/adCampaigns.d.ts +707 -0
- package/docs/api/adCampaigns.md +1091 -0
- package/docs/api/adCreatives.d.ts +996 -0
- package/docs/api/adCreatives.md +1708 -0
- package/docs/api/agency.d.ts +556 -0
- package/docs/api/agency.md +845 -0
- package/docs/api/agent.d.ts +330 -0
- package/docs/api/agent.md +514 -0
- package/docs/api/agents.d.ts +1622 -0
- package/docs/api/agents.md +2860 -0
- package/docs/api/aiInbox.d.ts +1984 -0
- package/docs/api/aiInbox.md +3490 -0
- package/docs/api/analytics.d.ts +1273 -0
- package/docs/api/analytics.md +2095 -0
- package/docs/api/apiKeys.d.ts +252 -0
- package/docs/api/apiKeys.md +318 -0
- package/docs/api/appDeployments.d.ts +236 -0
- package/docs/api/appDeployments.md +471 -0
- package/docs/api/appDomains.d.ts +171 -0
- package/docs/api/appDomains.md +281 -0
- package/docs/api/appLogs.d.ts +120 -0
- package/docs/api/appLogs.md +159 -0
- package/docs/api/appObjects.d.ts +415 -0
- package/docs/api/appObjects.md +568 -0
- package/docs/api/appPages.d.ts +557 -0
- package/docs/api/appPages.md +796 -0
- package/docs/api/appPlatformTokens.d.ts +123 -0
- package/docs/api/appPlatformTokens.md +172 -0
- package/docs/api/appointments.d.ts +2361 -0
- package/docs/api/appointments.md +3917 -0
- package/docs/api/apps.d.ts +822 -0
- package/docs/api/apps.md +1342 -0
- package/docs/api/assertUpsert.d.ts +286 -0
- package/docs/api/assertUpsert.md +370 -0
- package/docs/api/audienceSyncs.d.ts +259 -0
- package/docs/api/audienceSyncs.md +395 -0
- package/docs/api/brandKit.d.ts +686 -0
- package/docs/api/brandKit.md +1133 -0
- package/docs/api/bugReports.d.ts +181 -0
- package/docs/api/bugReports.md +268 -0
- package/docs/api/by-path.md +3260 -0
- package/docs/api/calendarInvites.d.ts +117 -0
- package/docs/api/calendarInvites.md +148 -0
- package/docs/api/campaignWorkflows.d.ts +152 -0
- package/docs/api/campaignWorkflows.md +200 -0
- package/docs/api/campaigns.d.ts +721 -0
- package/docs/api/campaigns.md +1236 -0
- package/docs/api/channels.d.ts +171 -0
- package/docs/api/channels.md +235 -0
- package/docs/api/cliCampaigns.d.ts +205 -0
- package/docs/api/cliCampaigns.md +256 -0
- package/docs/api/cliPipelines.d.ts +324 -0
- package/docs/api/cliPipelines.md +562 -0
- package/docs/api/clickHouse.d.ts +115 -0
- package/docs/api/clickHouse.md +138 -0
- package/docs/api/companies.d.ts +1636 -0
- package/docs/api/companies.md +2211 -0
- package/docs/api/companyIntelligence.d.ts +299 -0
- package/docs/api/companyIntelligence.md +488 -0
- package/docs/api/contacts.d.ts +2173 -0
- package/docs/api/contacts.md +3143 -0
- package/docs/api/content.d.ts +968 -0
- package/docs/api/content.md +1667 -0
- package/docs/api/contentGridSkills.d.ts +177 -0
- package/docs/api/contentGridSkills.md +271 -0
- package/docs/api/copilot.d.ts +1017 -0
- package/docs/api/copilot.md +1765 -0
- package/docs/api/crmSyncs.d.ts +215 -0
- package/docs/api/crmSyncs.md +301 -0
- package/docs/api/customerSuccess.d.ts +491 -0
- package/docs/api/customerSuccess.md +776 -0
- package/docs/api/deals.d.ts +1697 -0
- package/docs/api/deals.md +2436 -0
- package/docs/api/deliverability.d.ts +418 -0
- package/docs/api/deliverability.md +677 -0
- package/docs/api/desk.d.ts +1765 -0
- package/docs/api/desk.md +3007 -0
- package/docs/api/dialer.d.ts +1185 -0
- package/docs/api/dialer.md +2166 -0
- package/docs/api/dialerAnalytics.d.ts +187 -0
- package/docs/api/dialerAnalytics.md +257 -0
- package/docs/api/documents.d.ts +895 -0
- package/docs/api/documents.md +1440 -0
- package/docs/api/duplicates.d.ts +195 -0
- package/docs/api/duplicates.md +315 -0
- package/docs/api/eSign.d.ts +38 -0
- package/docs/api/eSign.md +54 -0
- package/docs/api/eSignature.d.ts +242 -0
- package/docs/api/eSignature.md +341 -0
- package/docs/api/enrichment.d.ts +3207 -0
- package/docs/api/enrichment.md +5225 -0
- package/docs/api/events.d.ts +115 -0
- package/docs/api/events.md +105 -0
- package/docs/api/fields.d.ts +482 -0
- package/docs/api/fields.md +566 -0
- package/docs/api/forms.d.ts +1012 -0
- package/docs/api/forms.md +1542 -0
- package/docs/api/gtmCampaigns.d.ts +662 -0
- package/docs/api/gtmCampaigns.md +1044 -0
- package/docs/api/gtmContext.d.ts +1187 -0
- package/docs/api/gtmContext.md +2112 -0
- package/docs/api/gtmDeliverability.d.ts +60 -0
- package/docs/api/gtmDeliverability.md +63 -0
- package/docs/api/gtmKnowledgeBase.d.ts +76 -0
- package/docs/api/gtmKnowledgeBase.md +91 -0
- package/docs/api/gtmLaunchHelpers.d.ts +123 -0
- package/docs/api/gtmLaunchHelpers.md +148 -0
- package/docs/api/gtmLibrary.d.ts +448 -0
- package/docs/api/gtmLibrary.md +780 -0
- package/docs/api/health.d.ts +39 -0
- package/docs/api/health.md +58 -0
- package/docs/api/imageLibrary.d.ts +341 -0
- package/docs/api/imageLibrary.md +569 -0
- package/docs/api/imports.d.ts +157 -0
- package/docs/api/imports.md +174 -0
- package/docs/api/inbox.d.ts +709 -0
- package/docs/api/inbox.md +1067 -0
- package/docs/api/install.d.ts +213 -0
- package/docs/api/install.md +317 -0
- package/docs/api/installedApps.d.ts +131 -0
- package/docs/api/installedApps.md +241 -0
- package/docs/api/integrationStatus.d.ts +142 -0
- package/docs/api/integrationStatus.md +205 -0
- package/docs/api/integrations.d.ts +2327 -0
- package/docs/api/integrations.md +3791 -0
- package/docs/api/intent.d.ts +482 -0
- package/docs/api/intent.md +858 -0
- package/docs/api/knowledge.d.ts +501 -0
- package/docs/api/knowledge.md +843 -0
- package/docs/api/knowledgeBase.d.ts +84 -0
- package/docs/api/knowledgeBase.md +96 -0
- package/docs/api/landingPages.d.ts +1411 -0
- package/docs/api/landingPages.md +2488 -0
- package/docs/api/leads.d.ts +133 -0
- package/docs/api/leads.md +180 -0
- package/docs/api/library.d.ts +217 -0
- package/docs/api/library.md +338 -0
- package/docs/api/linkedIn.d.ts +227 -0
- package/docs/api/linkedIn.md +289 -0
- package/docs/api/linkedInOutreach.d.ts +727 -0
- package/docs/api/linkedInOutreach.md +990 -0
- package/docs/api/lists.d.ts +1106 -0
- package/docs/api/lists.md +1609 -0
- package/docs/api/logs.d.ts +71 -0
- package/docs/api/logs.md +70 -0
- package/docs/api/mailboxes.d.ts +1050 -0
- package/docs/api/mailboxes.md +1690 -0
- package/docs/api/marketingIntelligence.d.ts +256 -0
- package/docs/api/marketingIntelligence.md +454 -0
- package/docs/api/marketplace.d.ts +3173 -0
- package/docs/api/marketplace.md +5953 -0
- package/docs/api/mcp.d.ts +69 -0
- package/docs/api/mcp.md +69 -0
- package/docs/api/me.d.ts +54 -0
- package/docs/api/me.md +56 -0
- package/docs/api/meetings.d.ts +539 -0
- package/docs/api/meetings.md +747 -0
- package/docs/api/newsletter.d.ts +1613 -0
- package/docs/api/newsletter.md +2746 -0
- package/docs/api/notes.d.ts +517 -0
- package/docs/api/notes.md +888 -0
- package/docs/api/notifications.d.ts +94 -0
- package/docs/api/notifications.md +105 -0
- package/docs/api/objects.d.ts +621 -0
- package/docs/api/objects.md +1098 -0
- package/docs/api/openSearch.d.ts +234 -0
- package/docs/api/openSearch.md +297 -0
- package/docs/api/ops.d.ts +299 -0
- package/docs/api/ops.md +339 -0
- package/docs/api/orgGovernance.d.ts +393 -0
- package/docs/api/orgGovernance.md +623 -0
- package/docs/api/orgVideos.d.ts +184 -0
- package/docs/api/orgVideos.md +252 -0
- package/docs/api/organizationSettings.d.ts +626 -0
- package/docs/api/organizationSettings.md +911 -0
- package/docs/api/phoneNumbers.d.ts +484 -0
- package/docs/api/phoneNumbers.md +777 -0
- package/docs/api/profile.d.ts +329 -0
- package/docs/api/profile.md +540 -0
- package/docs/api/programmaticPages.d.ts +400 -0
- package/docs/api/programmaticPages.md +626 -0
- package/docs/api/providerDomains.d.ts +866 -0
- package/docs/api/providerDomains.md +1446 -0
- package/docs/api/providerUsage.d.ts +129 -0
- package/docs/api/providerUsage.md +186 -0
- package/docs/api/public.d.ts +69 -0
- package/docs/api/public.md +78 -0
- package/docs/api/publicCopilot.d.ts +67 -0
- package/docs/api/publicCopilot.md +80 -0
- package/docs/api/publicSignals.d.ts +66 -0
- package/docs/api/publicSignals.md +71 -0
- package/docs/api/publicVisitors.d.ts +97 -0
- package/docs/api/publicVisitors.md +118 -0
- package/docs/api/quotes.d.ts +1564 -0
- package/docs/api/quotes.md +2553 -0
- package/docs/api/radar.d.ts +808 -0
- package/docs/api/radar.md +1431 -0
- package/docs/api/radarReports.d.ts +208 -0
- package/docs/api/radarReports.md +306 -0
- package/docs/api/recordRoles.d.ts +143 -0
- package/docs/api/recordRoles.md +175 -0
- package/docs/api/repos.d.ts +146 -0
- package/docs/api/repos.md +211 -0
- package/docs/api/research.d.ts +295 -0
- package/docs/api/research.md +534 -0
- package/docs/api/revenue.d.ts +402 -0
- package/docs/api/revenue.md +608 -0
- package/docs/api/revenueAnalytics.d.ts +147 -0
- package/docs/api/revenueAnalytics.md +212 -0
- package/docs/api/revenueLifecycle.d.ts +207 -0
- package/docs/api/revenueLifecycle.md +274 -0
- package/docs/api/revenueRecords.d.ts +372 -0
- package/docs/api/revenueRecords.md +563 -0
- package/docs/api/roles.d.ts +431 -0
- package/docs/api/roles.md +812 -0
- package/docs/api/salesCoach.d.ts +877 -0
- package/docs/api/salesCoach.md +1540 -0
- package/docs/api/sandbox.d.ts +210 -0
- package/docs/api/sandbox.md +380 -0
- package/docs/api/scans.d.ts +104 -0
- package/docs/api/scans.md +136 -0
- package/docs/api/scheduleBuy.d.ts +293 -0
- package/docs/api/scheduleBuy.md +431 -0
- package/docs/api/scraping.d.ts +266 -0
- package/docs/api/scraping.md +383 -0
- package/docs/api/sdrAnalytics.d.ts +138 -0
- package/docs/api/sdrAnalytics.md +246 -0
- package/docs/api/search.d.ts +598 -0
- package/docs/api/search.md +866 -0
- package/docs/api/seo.d.ts +447 -0
- package/docs/api/seo.md +660 -0
- package/docs/api/sequenceLifecycle.d.ts +439 -0
- package/docs/api/sequenceLifecycle.md +513 -0
- package/docs/api/sequences.d.ts +1936 -0
- package/docs/api/sequences.md +3232 -0
- package/docs/api/settings.d.ts +448 -0
- package/docs/api/settings.md +731 -0
- package/docs/api/signals.d.ts +1441 -0
- package/docs/api/signals.md +2526 -0
- package/docs/api/signatures.d.ts +719 -0
- package/docs/api/signatures.md +1247 -0
- package/docs/api/skills.d.ts +230 -0
- package/docs/api/skills.md +466 -0
- package/docs/api/snippet.d.ts +85 -0
- package/docs/api/snippet.md +106 -0
- package/docs/api/socialPublishing.d.ts +824 -0
- package/docs/api/socialPublishing.md +1245 -0
- package/docs/api/studioDocuments.d.ts +244 -0
- package/docs/api/studioDocuments.md +348 -0
- package/docs/api/support.d.ts +90 -0
- package/docs/api/support.md +76 -0
- package/docs/api/suppressions.d.ts +241 -0
- package/docs/api/suppressions.md +343 -0
- package/docs/api/surveys.d.ts +847 -0
- package/docs/api/surveys.md +1223 -0
- package/docs/api/tasks.d.ts +813 -0
- package/docs/api/tasks.md +1344 -0
- package/docs/api/teamMembers.d.ts +668 -0
- package/docs/api/teamMembers.md +1040 -0
- package/docs/api/teams.d.ts +784 -0
- package/docs/api/teams.md +1395 -0
- package/docs/api/usage.d.ts +277 -0
- package/docs/api/usage.md +389 -0
- package/docs/api/visitors.d.ts +690 -0
- package/docs/api/visitors.md +1075 -0
- package/docs/api/voice.d.ts +4661 -0
- package/docs/api/voice.md +7905 -0
- package/docs/api/webAnalytics.d.ts +964 -0
- package/docs/api/webAnalytics.md +1452 -0
- package/docs/api/webChat.d.ts +1704 -0
- package/docs/api/webChat.md +2048 -0
- package/docs/api/webhooks.d.ts +251 -0
- package/docs/api/webhooks.md +386 -0
- package/docs/api/websiteEditor.d.ts +324 -0
- package/docs/api/websiteEditor.md +517 -0
- package/docs/api/work.d.ts +2298 -0
- package/docs/api/work.md +3096 -0
- package/docs/api/workbench.d.ts +2962 -0
- package/docs/api/workbench.md +4884 -0
- package/docs/api/workflows.d.ts +1218 -0
- package/docs/api/workflows.md +2302 -0
- package/docs/sdk-clients.md +4339 -0
- package/package.json +10 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# dist/types: readable declarations
|
|
2
|
+
|
|
3
|
+
One file per hand-written client (`contacts.d.ts`, `deals.d.ts`, `sequences.d.ts`, ...). For reading:
|
|
4
|
+
the compiler uses the bundled `dist/index.d.ts`, so import types from `@graph8/sdk` in code.
|
|
5
|
+
|
|
6
|
+
The generated `g8.api` types are not here. Each namespace has a self-contained slice in
|
|
7
|
+
`docs/api/<namespace>.d.ts` (for example `docs/api/contacts.d.ts`). Start at `docs/agents.md`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AgencyInfo {
|
|
2
|
+
agency_org_id: string;
|
|
3
|
+
agency_org_name: string | null;
|
|
4
|
+
is_agency: boolean;
|
|
5
|
+
client_count: number;
|
|
6
|
+
/** Request header to set when operating a client org (e.g. "X-Target-Org-Id"). */
|
|
7
|
+
target_header: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AgencyClient {
|
|
10
|
+
/** Pass this as the `X-Target-Org-Id` header to operate this client org. */
|
|
11
|
+
org_id: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const createAgencyClient: (apiKey: string, apiUrl?: string) => {
|
|
14
|
+
/** Describe the agency credential: agency org + authorized client count. */
|
|
15
|
+
me(): Promise<AgencyInfo>;
|
|
16
|
+
/** List the client orgs this agency key may target via `X-Target-Org-Id`. */
|
|
17
|
+
clients(): Promise<{
|
|
18
|
+
data: AgencyClient[];
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `npx @graph8/sdk init-agent`: tell the coding agents in a project how to use
|
|
3
|
+
* this SDK.
|
|
4
|
+
*
|
|
5
|
+
* WHY
|
|
6
|
+
* ---
|
|
7
|
+
* The package ships a full agent guide (`docs/agents.md`), but an agent only
|
|
8
|
+
* reads it if something points it there. Each agent looks for instructions in
|
|
9
|
+
* its own place, in the USER'S project:
|
|
10
|
+
*
|
|
11
|
+
* Claude Code .claude/skills/graph8-sdk/SKILL.md (a skill: loaded only when
|
|
12
|
+
* the task involves graph8)
|
|
13
|
+
* Codex (and Cursor, Copilot, Jules, Amp, ...) AGENTS.md
|
|
14
|
+
* Cursor .cursor/rules/graph8-sdk.mdc
|
|
15
|
+
*
|
|
16
|
+
* This writes a short, version-independent pointer into each: the rules that
|
|
17
|
+
* prevent the common mistakes, and where in node_modules the full guide and
|
|
18
|
+
* per-area reference live. It never touches the user's own text: the AGENTS.md
|
|
19
|
+
* section sits between markers and is replaced in place on re-runs, and the
|
|
20
|
+
* other two files are owned by this tool.
|
|
21
|
+
*
|
|
22
|
+
* Pure functions here; the CLI in ./cli.ts does the file I/O.
|
|
23
|
+
*/
|
|
24
|
+
export type AgentTarget = "claude" | "codex" | "cursor";
|
|
25
|
+
export declare const ALL_TARGETS: readonly AgentTarget[];
|
|
26
|
+
export declare const MARKER_START = "<!-- graph8-sdk:start (managed by `npx @graph8/sdk init-agent`; edits inside are overwritten) -->";
|
|
27
|
+
export declare const MARKER_END = "<!-- graph8-sdk:end -->";
|
|
28
|
+
/** The rules every agent gets, whatever file they land in. */
|
|
29
|
+
export declare function coreInstructions(): string;
|
|
30
|
+
export declare function claudeSkill(): string;
|
|
31
|
+
export declare function cursorRule(): string;
|
|
32
|
+
export declare function agentsMdSection(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Insert or replace the managed section in an existing AGENTS.md, leaving
|
|
35
|
+
* everything outside the markers byte-for-byte unchanged.
|
|
36
|
+
*/
|
|
37
|
+
export declare function upsertAgentsMd(existing: string | null): string;
|
|
38
|
+
export interface PlannedWrite {
|
|
39
|
+
target: AgentTarget;
|
|
40
|
+
path: string;
|
|
41
|
+
/** Content after the write. */
|
|
42
|
+
content: string;
|
|
43
|
+
/** "create" | "update" | "unchanged" */
|
|
44
|
+
action: "create" | "update" | "unchanged";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Work out every file change for the chosen agents. `read` returns a file's
|
|
48
|
+
* current content (or null when it does not exist); paths are relative to the
|
|
49
|
+
* project root.
|
|
50
|
+
*/
|
|
51
|
+
export declare function planAgentSetup(targets: readonly AgentTarget[], read: (path: string) => string | null): PlannedWrite[];
|
|
52
|
+
export interface InitAgentOptions {
|
|
53
|
+
targets: AgentTarget[];
|
|
54
|
+
dryRun: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare const INIT_AGENT_USAGE = "Usage: npx @graph8/sdk init-agent [--claude] [--codex] [--cursor] [--dry-run]\n\nPoint the coding agents in this project at the @graph8/sdk agent guide.\nWith no agent flag, sets up all three:\n --claude .claude/skills/graph8-sdk/SKILL.md (Claude Code skill)\n --codex AGENTS.md, managed section (Codex, Cursor, Copilot, ...)\n --cursor .cursor/rules/graph8-sdk.mdc (Cursor rule)\n --dry-run print what would change, write nothing\nRe-running updates the files in place; your own AGENTS.md text is never touched.";
|
|
57
|
+
export declare function parseInitAgentArgs(argv: string[]): InitAgentOptions;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated-contract client: every published Developer API operation,
|
|
3
|
+
* typed, reachable from one object.
|
|
4
|
+
*
|
|
5
|
+
* WHAT THIS IS FOR
|
|
6
|
+
* ----------------
|
|
7
|
+
* The hand-written clients in this package (`g8.contacts`, `g8.deals`, ...) are
|
|
8
|
+
* the ergonomic layer. They are deliberately opinionated — they unwrap
|
|
9
|
+
* envelopes, rename fields, and only exist for surfaces someone sat down and
|
|
10
|
+
* wrote. That is exactly why they covered 260 of 587 operations: writing one
|
|
11
|
+
* per surface does not keep pace with the API.
|
|
12
|
+
*
|
|
13
|
+
* `g8.api` is the other half. It is generated from
|
|
14
|
+
* `developer-contract/openapi.json`, so it covers 100% of the contract by
|
|
15
|
+
* construction and a CI drift check keeps it there. It returns the response
|
|
16
|
+
* envelope EXACTLY as the contract declares it and renames nothing.
|
|
17
|
+
*
|
|
18
|
+
* NOTHING HERE REPLACES ANYTHING. Every existing export keeps its shape; this
|
|
19
|
+
* is a new namespace alongside them.
|
|
20
|
+
*
|
|
21
|
+
* const contacts = await g8.api.contacts.listContacts({ query: { limit: 50 } });
|
|
22
|
+
* const meeting = await g8.api.call("get_meeting_meetings__meeting_id__get", {
|
|
23
|
+
* path: { meeting_id: "..." },
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* WHY A DISPATCHER RATHER THAN 587 GENERATED METHODS
|
|
27
|
+
* --------------------------------------------------
|
|
28
|
+
* Generated methods would be ~6k lines of runtime JavaScript that no bundler
|
|
29
|
+
* can drop from a singleton client. Here the runtime is one data table
|
|
30
|
+
* (`API_OPERATIONS`) plus the ~100 lines below; the 587 typed signatures live
|
|
31
|
+
* in `.d.ts` and are erased before anything reaches a browser. Namespaces are
|
|
32
|
+
* materialised lazily, so touching `g8.api.contacts` allocates closures for
|
|
33
|
+
* Contacts only.
|
|
34
|
+
*
|
|
35
|
+
* It reuses `request()` from `./http` — the same transport, retries,
|
|
36
|
+
* idempotency-key minting and typed `G8Error` every other client already uses.
|
|
37
|
+
* There is exactly one transport in this package and this does not add a
|
|
38
|
+
* second.
|
|
39
|
+
*/
|
|
40
|
+
import { type RequestOptions } from "./http";
|
|
41
|
+
import { type ApiHttpMethod, type ApiOperationId, type ApiTag } from "./generated/operations";
|
|
42
|
+
import type { ApiOperationMap } from "./generated/operation-types";
|
|
43
|
+
import type { ApiNamespaceMap } from "./generated/namespaces";
|
|
44
|
+
/**
|
|
45
|
+
* Prefix every contract path is relative to.
|
|
46
|
+
*
|
|
47
|
+
* The contract's `servers` block is `https://be.graph8.com/api/v1`, so its paths
|
|
48
|
+
* omit the prefix while the SDK's own call sites include it. Recording it once
|
|
49
|
+
* here keeps the route table small and the two conventions reconciled in one
|
|
50
|
+
* place.
|
|
51
|
+
*/
|
|
52
|
+
export declare const API_BASE_PATH = "/api/v1";
|
|
53
|
+
/** A route-table row, expanded into something readable. */
|
|
54
|
+
export interface ApiOperationInfo {
|
|
55
|
+
/** Frozen public operationId. */
|
|
56
|
+
id: ApiOperationId;
|
|
57
|
+
method: ApiHttpMethod;
|
|
58
|
+
/** Full path including `/api/v1`. */
|
|
59
|
+
path: string;
|
|
60
|
+
/** Namespace this operation is reachable under (`g8.api[tag][member]`). */
|
|
61
|
+
tag: ApiTag;
|
|
62
|
+
/** Member name inside that namespace. */
|
|
63
|
+
member: string;
|
|
64
|
+
/** `x-graph8-tier` — read / write / destructive / billable / external. */
|
|
65
|
+
tier: string | null;
|
|
66
|
+
/** `x-graph8-scope` — the API-key scope that gates this operation. */
|
|
67
|
+
scope: string | null;
|
|
68
|
+
}
|
|
69
|
+
/** Typed input accepted by an operation: `{ path?, query?, headers?, body? }`. */
|
|
70
|
+
export type ApiInput<Id extends ApiOperationId> = ApiOperationMap[Id]["input"];
|
|
71
|
+
/** Typed response envelope an operation resolves to. */
|
|
72
|
+
export type ApiOutput<Id extends ApiOperationId> = ApiOperationMap[Id]["output"];
|
|
73
|
+
/**
|
|
74
|
+
* Item type yielded by `paginate()` — the element type of the envelope's `data`
|
|
75
|
+
* array when there is one, `unknown` otherwise.
|
|
76
|
+
*/
|
|
77
|
+
export type ApiPageItem<Id extends ApiOperationId> = ApiOutput<Id> extends {
|
|
78
|
+
data?: infer D;
|
|
79
|
+
} ? D extends readonly (infer Item)[] ? Item : unknown : unknown;
|
|
80
|
+
/**
|
|
81
|
+
* Per-call transport overrides. `method`, `body` and `query` are owned by the
|
|
82
|
+
* dispatcher (they come from the contract and the typed input), so they are not
|
|
83
|
+
* overridable — everything else `request()` accepts is.
|
|
84
|
+
*/
|
|
85
|
+
export type ApiCallOptions = Omit<RequestOptions, "method" | "body" | "query">;
|
|
86
|
+
/**
|
|
87
|
+
* `input` becomes optional exactly when every member of it is optional.
|
|
88
|
+
*
|
|
89
|
+
* `{} extends T` is true only when T has no required property, so an operation
|
|
90
|
+
* with a required body still forces the caller to pass one, and a pure GET with
|
|
91
|
+
* optional filters can be called with no arguments at all.
|
|
92
|
+
*/
|
|
93
|
+
type ApiArgs<Id extends ApiOperationId> = {} extends ApiInput<Id> ? [input?: ApiInput<Id>, options?: ApiCallOptions] : [input: ApiInput<Id>, options?: ApiCallOptions];
|
|
94
|
+
/** One generated namespace member, e.g. `client.contacts.listContacts`. */
|
|
95
|
+
export type ApiMethod<Id extends ApiOperationId> = (...args: ApiArgs<Id>) => Promise<ApiOutput<Id>>;
|
|
96
|
+
/**
|
|
97
|
+
* The tag namespaces, derived from the generated name map. Adding an operation
|
|
98
|
+
* to the contract adds a member here with no hand-written code.
|
|
99
|
+
*/
|
|
100
|
+
export type ApiNamespaces = {
|
|
101
|
+
[Tag in keyof ApiNamespaceMap]: {
|
|
102
|
+
[Member in keyof ApiNamespaceMap[Tag]]: ApiMethod<ApiNamespaceMap[Tag][Member] & ApiOperationId>;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/** The dispatcher half of the client, without the generated namespaces. */
|
|
106
|
+
export interface ApiDispatcher {
|
|
107
|
+
/** Call any published operation by its frozen operationId. */
|
|
108
|
+
call<Id extends ApiOperationId>(operationId: Id, ...args: ApiArgs<Id>): Promise<ApiOutput<Id>>;
|
|
109
|
+
/**
|
|
110
|
+
* Iterate every item of a cursor-paginated list operation, following
|
|
111
|
+
* `pagination.next_cursor` until it runs out.
|
|
112
|
+
*/
|
|
113
|
+
paginate<Id extends ApiOperationId>(operationId: Id, ...args: ApiArgs<Id>): AsyncGenerator<ApiPageItem<Id>, void, unknown>;
|
|
114
|
+
/** Metadata for one operation — method, full path, tier and required scope. */
|
|
115
|
+
operation(operationId: ApiOperationId): ApiOperationInfo;
|
|
116
|
+
/** Metadata for every published operation, sorted by operationId. */
|
|
117
|
+
operations(): ApiOperationInfo[];
|
|
118
|
+
}
|
|
119
|
+
export type ApiClient = ApiDispatcher & ApiNamespaces;
|
|
120
|
+
/**
|
|
121
|
+
* Build a client covering every operation the Developer API publishes.
|
|
122
|
+
*
|
|
123
|
+
* Additive: `g8.api` is wired to this in `core.ts`, and no existing client,
|
|
124
|
+
* export or signature changes.
|
|
125
|
+
*/
|
|
126
|
+
export declare function createApiClient(apiKey: string, apiUrl?: string): ApiClient;
|
|
127
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted app-platform clients (M6-9).
|
|
3
|
+
*
|
|
4
|
+
* Two entry points, both additive to `@graph8/sdk` and independent of the
|
|
5
|
+
* `g8` tracking/API-key singleton:
|
|
6
|
+
*
|
|
7
|
+
* - `createGraph8AppClient` — BROWSER client. Exchanges the caller's
|
|
8
|
+
* PropelAuth token for a short-lived app token, refreshes it on/near expiry,
|
|
9
|
+
* and attaches `Authorization: Bearer <app-token>` to every call. It NEVER
|
|
10
|
+
* accepts a permanent org API key for browser init (the whole reason the
|
|
11
|
+
* token-exchange exists).
|
|
12
|
+
* - `createGraph8ServiceClient` — BACKEND client. Exchanges service
|
|
13
|
+
* client-credentials for a service app token and sends `X-Target-Org-Id`
|
|
14
|
+
* for the single configured tenant on every call.
|
|
15
|
+
*
|
|
16
|
+
* Both expose a token-bound `request()` — the hardened `request()` core with the
|
|
17
|
+
* minted app token attached — so callers reach Developer API routes with the
|
|
18
|
+
* app token and reuse the core's typed `G8Error`, retries, idempotency, and
|
|
19
|
+
* cursor pagination. The typed `apps` (control-plane) and `objects`
|
|
20
|
+
* (custom-object CRUD) resource modules are DEFERRED until their backend routes
|
|
21
|
+
* ship and freeze (M6-3 / M6-5); only the auth clients ship here.
|
|
22
|
+
*/
|
|
23
|
+
import { type AppRequest } from "./appTokens";
|
|
24
|
+
export type { AppTokenResponse, TokenManager, AppRequest, AppRequestOptions } from "./appTokens";
|
|
25
|
+
/** Config for {@link createGraph8AppClient} (browser). No API key is accepted. */
|
|
26
|
+
export interface Graph8AppClientConfig {
|
|
27
|
+
/** Target app id (dapp_-prefixed). */
|
|
28
|
+
appId: string;
|
|
29
|
+
/** The client org this browser session acts in (informational; the server
|
|
30
|
+
* derives the authoritative tenant from the validated PropelAuth principal). */
|
|
31
|
+
tenantOrgId: string;
|
|
32
|
+
/** Returns the caller's current PropelAuth token (sync or async). */
|
|
33
|
+
getPropelAuthToken: () => string | Promise<string>;
|
|
34
|
+
/** Scopes to embed in the minted app token. */
|
|
35
|
+
scopes?: string[];
|
|
36
|
+
/** Backend API URL (default https://be.graph8.com). */
|
|
37
|
+
apiUrl?: string;
|
|
38
|
+
/** Refresh this many ms before expiry (default 60_000). */
|
|
39
|
+
refreshSkewMs?: number;
|
|
40
|
+
/** Injected for tests; defaults to global fetch. */
|
|
41
|
+
fetchImpl?: typeof fetch;
|
|
42
|
+
/** Injected for tests; defaults to a real setTimeout sleep. */
|
|
43
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
44
|
+
/** Injected for tests; defaults to Date.now. */
|
|
45
|
+
now?: () => number;
|
|
46
|
+
}
|
|
47
|
+
/** A browser app-platform client. */
|
|
48
|
+
export interface Graph8AppClient {
|
|
49
|
+
readonly appId: string;
|
|
50
|
+
readonly tenantOrgId: string;
|
|
51
|
+
/** Token-bound requester: mints/refreshes the app token and attaches
|
|
52
|
+
* `Authorization: Bearer <app-token>` to every Developer API call. */
|
|
53
|
+
readonly request: AppRequest;
|
|
54
|
+
/** Return the current app token, refreshing on/near expiry (`force` refreshes now). */
|
|
55
|
+
getAppToken(force?: boolean): Promise<string>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a BROWSER app-platform client backed by PropelAuth->app-token exchange.
|
|
59
|
+
* Refuses an org API key / write key — those must never reach a browser.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createGraph8AppClient(config: Graph8AppClientConfig): Graph8AppClient;
|
|
62
|
+
/** Config for {@link createGraph8ServiceClient} (backend / server-to-server). */
|
|
63
|
+
export interface Graph8ServiceClientConfig {
|
|
64
|
+
/** Service credential client id. */
|
|
65
|
+
clientId: string;
|
|
66
|
+
/** Service credential client secret (checked against the stored hash). */
|
|
67
|
+
clientSecret: string;
|
|
68
|
+
/** The single consented client org this backend acts for (sent as X-Target-Org-Id). */
|
|
69
|
+
tenantOrgId: string;
|
|
70
|
+
/** Scopes to embed in the minted service token. */
|
|
71
|
+
scopes?: string[];
|
|
72
|
+
/** Requested token TTL; the server clamps it into its service band. */
|
|
73
|
+
ttlSeconds?: number;
|
|
74
|
+
/** Backend API URL (default https://be.graph8.com). */
|
|
75
|
+
apiUrl?: string;
|
|
76
|
+
/** Refresh this many ms before expiry (default 60_000). */
|
|
77
|
+
refreshSkewMs?: number;
|
|
78
|
+
/** Injected for tests; defaults to global fetch. */
|
|
79
|
+
fetchImpl?: typeof fetch;
|
|
80
|
+
/** Injected for tests; defaults to a real setTimeout sleep. */
|
|
81
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
82
|
+
/** Injected for tests; defaults to Date.now. */
|
|
83
|
+
now?: () => number;
|
|
84
|
+
}
|
|
85
|
+
/** A backend service app-platform client. */
|
|
86
|
+
export interface Graph8ServiceClient {
|
|
87
|
+
readonly tenantOrgId: string;
|
|
88
|
+
/** Token-bound requester: mints/refreshes the service token, attaches it, and
|
|
89
|
+
* sends `X-Target-Org-Id` for the one consented tenant on every call. */
|
|
90
|
+
readonly request: AppRequest;
|
|
91
|
+
/** Return the current service token, refreshing on/near expiry (`force` refreshes now). */
|
|
92
|
+
getServiceToken(force?: boolean): Promise<string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a BACKEND service client backed by client-credentials->service-token
|
|
96
|
+
* exchange. Every request carries `X-Target-Org-Id: <tenantOrgId>` for the one
|
|
97
|
+
* configured consented tenant.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createGraph8ServiceClient(config: Graph8ServiceClientConfig): Graph8ServiceClient;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted app platform — deployments, domains, secrets, source and logs (M9 J14).
|
|
3
|
+
*
|
|
4
|
+
* WHAT WAS MISSING. `apps.ts` covered creating an app and reading its installs,
|
|
5
|
+
* usage and limit. Everything that actually SHIPS one -- binding a source,
|
|
6
|
+
* queueing a deployment, promoting it, attaching a hostname, reading why a build
|
|
7
|
+
* failed -- had no client at all. That is why the build portal is read-only: not
|
|
8
|
+
* because the routes are absent, but because nothing typed reached them.
|
|
9
|
+
*
|
|
10
|
+
* EVERY RESPONSE ON THIS SURFACE IS WRAPPED as `{data, pagination}`, and
|
|
11
|
+
* `pagination` is always null here -- none of these routes paginate. The helpers
|
|
12
|
+
* below unwrap `data` so callers work with the record, except where the list IS
|
|
13
|
+
* the answer.
|
|
14
|
+
*
|
|
15
|
+
* DELIBERATELY ABSENT, and each for a reason:
|
|
16
|
+
*
|
|
17
|
+
* * `POST /apps/{id}/deployments/{id}/status` -- authenticated with the build
|
|
18
|
+
* CONTROLLER credential, not a builder's API key. An SDK method for it would
|
|
19
|
+
* imply a customer can move their own deployment through the state machine.
|
|
20
|
+
* * `GET /app-platform/tls-authorize` -- Caddy's on-demand-TLS ask hook. Public,
|
|
21
|
+
* unauthenticated, returns a bare 200 or 404 with no body. It is edge
|
|
22
|
+
* plumbing, not a customer API.
|
|
23
|
+
*/
|
|
24
|
+
/** The six frozen values. Not widened to `string`: a client that switches on the
|
|
25
|
+
* status should get a compile error when a new state is added. */
|
|
26
|
+
export type DeploymentStatus = "queued" | "building" | "promoting" | "deployed" | "failed" | "rolled_back";
|
|
27
|
+
export type DomainVerificationStatus = "pending" | "verified" | "failed" | "revoked";
|
|
28
|
+
export type SourceProvider = "github" | "gitlab" | "bitbucket";
|
|
29
|
+
export type SchemaVersionStatus = "draft" | "published" | "deprecated";
|
|
30
|
+
export interface Deployment {
|
|
31
|
+
deployment_id: string;
|
|
32
|
+
app_id: string;
|
|
33
|
+
/** One of `DeploymentStatus`. Typed as the union, but the server sends a plain
|
|
34
|
+
* string -- treat an unrecognised value as forward compatibility, not an error. */
|
|
35
|
+
status: DeploymentStatus;
|
|
36
|
+
source_ref: string | null;
|
|
37
|
+
image_digest: string | null;
|
|
38
|
+
schema_version_id: string | null;
|
|
39
|
+
/** Sanitized at the WRITE. One line. The detail is in `logs()`. */
|
|
40
|
+
last_error_sanitized: string | null;
|
|
41
|
+
created_at: string | null;
|
|
42
|
+
deployed_at: string | null;
|
|
43
|
+
build_started_at: string | null;
|
|
44
|
+
build_finished_at: string | null;
|
|
45
|
+
/** Measured `building` -> `promoting`, NOT to `deployed`: `deployed` is reached
|
|
46
|
+
* after traffic is taken, so measuring to it would count the promotion too. */
|
|
47
|
+
build_seconds: number | null;
|
|
48
|
+
}
|
|
49
|
+
export interface CreateDeploymentParams {
|
|
50
|
+
/** A COMMIT-ish, never a branch name. A branch moves, so a deployment recorded
|
|
51
|
+
* against one cannot answer "what is running right now" a week later. The
|
|
52
|
+
* server enforces length only -- this convention is the caller's to keep. */
|
|
53
|
+
source_ref: string;
|
|
54
|
+
/** Pins the custom-object schema this build expects, so a rollback restores the
|
|
55
|
+
* matching schema and not merely the matching image. */
|
|
56
|
+
schema_version_id?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface AppDomain {
|
|
59
|
+
domain_id: string;
|
|
60
|
+
app_id: string;
|
|
61
|
+
/** The canonical normalized form -- lowercased, trailing dot stripped, IDNA
|
|
62
|
+
* encoded. NOT what you submitted. */
|
|
63
|
+
hostname: string;
|
|
64
|
+
status: DomainVerificationStatus;
|
|
65
|
+
verification_token: string | null;
|
|
66
|
+
created_at: string | null;
|
|
67
|
+
verified_at: string | null;
|
|
68
|
+
}
|
|
69
|
+
export interface DomainVerificationInstructions {
|
|
70
|
+
domain: AppDomain;
|
|
71
|
+
record_type: "TXT";
|
|
72
|
+
record_name: string;
|
|
73
|
+
record_value: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AppSecretMetadata {
|
|
76
|
+
secret_key: string;
|
|
77
|
+
/** A POINTER into your secret manager, never the secret. graph8 has no column
|
|
78
|
+
* for a value and cannot grow one. */
|
|
79
|
+
provider_ref: string | null;
|
|
80
|
+
created_at: string | null;
|
|
81
|
+
rotated_at: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface AppSourceParams {
|
|
84
|
+
repo_url: string;
|
|
85
|
+
provider: SourceProvider;
|
|
86
|
+
default_branch?: string;
|
|
87
|
+
credential_ref?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface SchemaVersion {
|
|
90
|
+
schema_version_id: string;
|
|
91
|
+
app_id: string;
|
|
92
|
+
version: number;
|
|
93
|
+
digest: string;
|
|
94
|
+
status: SchemaVersionStatus;
|
|
95
|
+
manifest: Record<string, unknown>;
|
|
96
|
+
created_at: string | null;
|
|
97
|
+
published_at: string | null;
|
|
98
|
+
deprecated_at: string | null;
|
|
99
|
+
}
|
|
100
|
+
export interface ContainerLog {
|
|
101
|
+
pod: string;
|
|
102
|
+
container: string;
|
|
103
|
+
/** `init` steps run to completion before the pod's containers start. A build is
|
|
104
|
+
* four init steps (fetch, scan-source, build, scan-image) then one container
|
|
105
|
+
* (push), so this is how you tell which step you are looking at. */
|
|
106
|
+
kind: "init" | "container";
|
|
107
|
+
text: string;
|
|
108
|
+
/** The tail hit the per-container byte cap. Earlier output exists and was not
|
|
109
|
+
* returned. */
|
|
110
|
+
truncated: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface AppLogs {
|
|
113
|
+
app_id: string;
|
|
114
|
+
/** Set for build logs; null for the running app's logs. */
|
|
115
|
+
deployment_id: string | null;
|
|
116
|
+
namespace: string;
|
|
117
|
+
tail_lines: number;
|
|
118
|
+
/**
|
|
119
|
+
* Always true, and it means only that graph8's credential patterns ran.
|
|
120
|
+
* It is NOT a claim the output is safe to publish: these are your own build and
|
|
121
|
+
* application logs, and an application can print a secret in a shape no pattern
|
|
122
|
+
* matches.
|
|
123
|
+
*/
|
|
124
|
+
redacted: boolean;
|
|
125
|
+
containers: ContainerLog[];
|
|
126
|
+
}
|
|
127
|
+
/** Lines per container. The server refuses anything outside 1-2000 with a 422
|
|
128
|
+
* rather than clamping, so the bound is worth knowing before you send it. */
|
|
129
|
+
export declare const MIN_TAIL_LINES = 1;
|
|
130
|
+
export declare const MAX_TAIL_LINES = 2000;
|
|
131
|
+
export declare const createAppPlatformClient: (apiKey: string, apiUrl?: string) => {
|
|
132
|
+
/**
|
|
133
|
+
* Bind the repository an app builds from.
|
|
134
|
+
*
|
|
135
|
+
* `repo_url` must be fetchable -- `https://`, `ssh://` or `git@`, with no
|
|
136
|
+
* whitespace. A `file://` or bare path is refused with 422, because a build
|
|
137
|
+
* that can read the builder's filesystem is a build that can read ours.
|
|
138
|
+
*
|
|
139
|
+
* `credential_ref` is a POINTER into your secret manager, not a token.
|
|
140
|
+
*/
|
|
141
|
+
setSource(appId: string, params: AppSourceParams): Promise<Record<string, unknown>>;
|
|
142
|
+
/** Unbind the source. Returns the full app with every source field null. */
|
|
143
|
+
clearSource(appId: string): Promise<Record<string, unknown>>;
|
|
144
|
+
/** Every deployment for this app, newest first. Never 404s for an app with none. */
|
|
145
|
+
listDeployments(appId: string): Promise<{
|
|
146
|
+
data: Deployment[];
|
|
147
|
+
}>;
|
|
148
|
+
/**
|
|
149
|
+
* Queue a deployment. Returns `201` with `status: "queued"` -- nothing builds
|
|
150
|
+
* as a side effect of this call; the build controller picks it up.
|
|
151
|
+
*
|
|
152
|
+
* NOT idempotent: two identical calls create two deployments.
|
|
153
|
+
*/
|
|
154
|
+
deploy(appId: string, params: CreateDeploymentParams): Promise<Deployment>;
|
|
155
|
+
/** Fetch one deployment. The polling endpoint for a build loop. */
|
|
156
|
+
getDeployment(appId: string, deploymentId: string): Promise<Deployment>;
|
|
157
|
+
/**
|
|
158
|
+
* The deployment currently serving traffic, or `null`.
|
|
159
|
+
*
|
|
160
|
+
* `null` is a real answer with a 200, not a 404: "this app has never shipped"
|
|
161
|
+
* is information, while a 404 would read as "no such app".
|
|
162
|
+
*/
|
|
163
|
+
activeDeployment(appId: string): Promise<Deployment | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Promote a built deployment to serve traffic. Anything it displaces moves to
|
|
166
|
+
* `rolled_back` in the same transaction, so there is never a moment with two
|
|
167
|
+
* live deployments.
|
|
168
|
+
*
|
|
169
|
+
* `409` when the state machine forbids it -- a deployment cannot become
|
|
170
|
+
* `deployed` without having been built, and a `failed` one cannot be revived.
|
|
171
|
+
* A retry is a new deployment, not a resurrection.
|
|
172
|
+
*/
|
|
173
|
+
promote(appId: string, deploymentId: string, imageDigest: string): Promise<Deployment>;
|
|
174
|
+
/** Roll back a deployment that is currently serving. Only a `deployed` one may be. */
|
|
175
|
+
rollback(appId: string, deploymentId: string): Promise<Deployment>;
|
|
176
|
+
/**
|
|
177
|
+
* Why a build failed. Returns every step of the build pod in the order
|
|
178
|
+
* Kubernetes runs them; a step that has not started yet is omitted rather
|
|
179
|
+
* than returned empty.
|
|
180
|
+
*
|
|
181
|
+
* An empty `containers` list is not an error -- build pods are reaped an hour
|
|
182
|
+
* after they finish, so logs for an older deployment are genuinely gone.
|
|
183
|
+
* `last_error_sanitized` on the deployment is what survives.
|
|
184
|
+
*
|
|
185
|
+
* `503` means graph8 could not reach the cluster, which is deliberately
|
|
186
|
+
* different from an empty `200`: one means we could not look, the other means
|
|
187
|
+
* your build produced no output.
|
|
188
|
+
*/
|
|
189
|
+
deploymentLogs(appId: string, deploymentId: string, tailLines?: number): Promise<AppLogs>;
|
|
190
|
+
/**
|
|
191
|
+
* What the running app is printing. The app's own pods only -- the per-app
|
|
192
|
+
* egress proxy shares the namespace and is deliberately excluded.
|
|
193
|
+
*
|
|
194
|
+
* Empty until a deployment reaches `deployed`.
|
|
195
|
+
*/
|
|
196
|
+
logs(appId: string, tailLines?: number): Promise<AppLogs>;
|
|
197
|
+
/** Every hostname claimed for this app, whatever its verification state. */
|
|
198
|
+
listDomains(appId: string): Promise<{
|
|
199
|
+
data: AppDomain[];
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Claim a hostname and get the TXT record that proves you own it.
|
|
203
|
+
*
|
|
204
|
+
* Returns `201`, and the domain is NESTED at `data.domain` -- this is the one
|
|
205
|
+
* route on the surface whose payload is not the record itself. Hostnames are
|
|
206
|
+
* globally unique, so a host another app holds is refused.
|
|
207
|
+
*/
|
|
208
|
+
claimDomain(appId: string, hostname: string): Promise<DomainVerificationInstructions>;
|
|
209
|
+
/**
|
|
210
|
+
* Check DNS for the TXT record and advance the domain to `verified`.
|
|
211
|
+
*
|
|
212
|
+
* Idempotent: verifying an already-verified domain re-checks and stays
|
|
213
|
+
* verified, so it is safe to re-run after a DNS change. Send no body -- the
|
|
214
|
+
* record in DNS is the payload.
|
|
215
|
+
*/
|
|
216
|
+
verifyDomain(appId: string, hostname: string): Promise<AppDomain>;
|
|
217
|
+
/**
|
|
218
|
+
* Release a claimed hostname.
|
|
219
|
+
*
|
|
220
|
+
* A HARD delete. Hostnames are globally unique, so a row left behind in any
|
|
221
|
+
* status keeps the host burned for every other builder. Releasing one you
|
|
222
|
+
* already released is a `404`, because after the first call the claim
|
|
223
|
+
* genuinely does not exist.
|
|
224
|
+
*
|
|
225
|
+
* Returns the NORMALIZED hostname, which may differ from what you passed.
|
|
226
|
+
*/
|
|
227
|
+
releaseDomain(appId: string, hostname: string): Promise<{
|
|
228
|
+
hostname: string;
|
|
229
|
+
released: boolean;
|
|
230
|
+
}>;
|
|
231
|
+
/**
|
|
232
|
+
* Which secrets this app declares, and when each was last rotated.
|
|
233
|
+
*
|
|
234
|
+
* NEVER returns a value. graph8 stores a POINTER into your secret manager and
|
|
235
|
+
* has no column for the secret itself.
|
|
236
|
+
*/
|
|
237
|
+
listSecrets(appId: string): Promise<{
|
|
238
|
+
data: AppSecretMetadata[];
|
|
239
|
+
}>;
|
|
240
|
+
/**
|
|
241
|
+
* Declare a secret, or rotate the pointer to it.
|
|
242
|
+
*
|
|
243
|
+
* `providerRef` is a REFERENCE, and the server rejects anything that looks
|
|
244
|
+
* like a credential -- a value starting `bearer `, `sk-`, `ghp_`, `xox` and
|
|
245
|
+
* friends is a 422. That refusal is the feature: it catches the mistake of
|
|
246
|
+
* pasting the secret where its address belongs.
|
|
247
|
+
*/
|
|
248
|
+
putSecret(appId: string, secretKey: string, providerRef?: string): Promise<AppSecretMetadata>;
|
|
249
|
+
/** Undeclare a secret. A key the app never declared is a 404, so a typo is
|
|
250
|
+
* never reported as a successful removal. */
|
|
251
|
+
deleteSecret(appId: string, secretKey: string): Promise<{
|
|
252
|
+
secret_key: string;
|
|
253
|
+
removed: boolean;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Publish a custom-object schema version. Returns `201`.
|
|
257
|
+
*
|
|
258
|
+
* Takes only the `objects` list, not a whole `graph8.app.yaml`: the rest of
|
|
259
|
+
* that file is app metadata the control plane already holds, and accepting it
|
|
260
|
+
* here would create a second place for it to disagree.
|
|
261
|
+
*/
|
|
262
|
+
publishSchemaVersion(appId: string, objects: unknown[]): Promise<{
|
|
263
|
+
version: SchemaVersion;
|
|
264
|
+
}>;
|
|
265
|
+
/** Every schema version this app has published. Empty array, never 404. */
|
|
266
|
+
listSchemaVersions(appId: string): Promise<{
|
|
267
|
+
data: SchemaVersion[];
|
|
268
|
+
}>;
|
|
269
|
+
};
|