@treeseed/sdk 0.10.28 → 0.11.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 +207 -6
- package/dist/capacity-provider.d.ts +3 -1
- package/dist/capacity-provider.js +25 -5
- package/dist/control-plane.d.ts +1 -0
- package/dist/control-plane.js +38 -13
- package/dist/db/market-schema.d.ts +8860 -6172
- package/dist/db/market-schema.js +108 -0
- package/dist/db/node-sqlite.js +7 -2
- package/dist/hosting/apps.d.ts +12 -0
- package/dist/hosting/apps.js +107 -0
- package/dist/hosting/builtins.d.ts +25 -0
- package/dist/hosting/builtins.js +791 -0
- package/dist/hosting/contracts.d.ts +207 -0
- package/dist/hosting/contracts.js +0 -0
- package/dist/hosting/graph.d.ts +192 -0
- package/dist/hosting/graph.js +1106 -0
- package/dist/hosting/index.d.ts +4 -0
- package/dist/hosting/index.js +4 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +63 -6
- package/dist/managed-dependencies.js +1 -2
- package/dist/market-client.d.ts +63 -3
- package/dist/market-client.js +83 -11
- package/dist/operations/services/bootstrap-runner.d.ts +3 -1
- package/dist/operations/services/bootstrap-runner.js +22 -2
- package/dist/operations/services/config-runtime.d.ts +10 -5
- package/dist/operations/services/config-runtime.js +209 -66
- package/dist/operations/services/deploy.d.ts +70 -7
- package/dist/operations/services/deploy.js +579 -64
- package/dist/operations/services/deployment-readiness.d.ts +30 -0
- package/dist/operations/services/deployment-readiness.js +175 -0
- package/dist/operations/services/git-workflow.d.ts +2 -1
- package/dist/operations/services/git-workflow.js +9 -3
- package/dist/operations/services/github-actions-verification.d.ts +1 -0
- package/dist/operations/services/github-actions-verification.js +1 -0
- package/dist/operations/services/github-api.js +1 -1
- package/dist/operations/services/github-automation.d.ts +1 -1
- package/dist/operations/services/github-automation.js +4 -3
- package/dist/operations/services/github-credentials.d.ts +13 -0
- package/dist/operations/services/github-credentials.js +58 -0
- package/dist/operations/services/hosted-service-checks.d.ts +63 -0
- package/dist/operations/services/hosted-service-checks.js +327 -0
- package/dist/operations/services/hub-provider-launch.js +3 -3
- package/dist/operations/services/live-hosted-service-checks.d.ts +25 -0
- package/dist/operations/services/live-hosted-service-checks.js +350 -0
- package/dist/operations/services/managed-host-security.js +1 -1
- package/dist/operations/services/operations-runner-smoke.d.ts +30 -0
- package/dist/operations/services/operations-runner-smoke.js +180 -0
- package/dist/operations/services/package-adapters.d.ts +95 -0
- package/dist/operations/services/package-adapters.js +288 -0
- package/dist/operations/services/package-reference-policy.d.ts +1 -0
- package/dist/operations/services/package-reference-policy.js +15 -2
- package/dist/operations/services/project-platform.d.ts +80 -22
- package/dist/operations/services/project-platform.js +49 -8
- package/dist/operations/services/project-web-monitor.js +26 -4
- package/dist/operations/services/railway-api.d.ts +88 -5
- package/dist/operations/services/railway-api.js +626 -35
- package/dist/operations/services/railway-deploy.d.ts +46 -40
- package/dist/operations/services/railway-deploy.js +261 -293
- package/dist/operations/services/release-candidate.d.ts +19 -0
- package/dist/operations/services/release-candidate.js +375 -38
- package/dist/operations/services/repository-save-orchestrator.d.ts +3 -1
- package/dist/operations/services/repository-save-orchestrator.js +279 -66
- package/dist/operations/services/runtime-tools.d.ts +1 -0
- package/dist/operations/services/runtime-tools.js +10 -9
- package/dist/operations/services/verification-cache.d.ts +25 -0
- package/dist/operations/services/verification-cache.js +71 -0
- package/dist/operations/services/workspace-dependency-mode.js +9 -1
- package/dist/operations/services/workspace-save.js +1 -1
- package/dist/operations/services/workspace-tools.js +2 -1
- package/dist/platform/contracts.d.ts +32 -1
- package/dist/platform/deploy-config.js +73 -8
- package/dist/platform/env.yaml +163 -35
- package/dist/platform/environment.d.ts +1 -0
- package/dist/platform/environment.js +74 -5
- package/dist/platform/plugin.d.ts +9 -0
- package/dist/platform-operation-store.js +2 -2
- package/dist/platform-operations.js +1 -1
- package/dist/reconcile/bootstrap-systems.js +2 -2
- package/dist/reconcile/builtin-adapters.js +372 -189
- package/dist/reconcile/contracts.d.ts +9 -5
- package/dist/reconcile/desired-state.d.ts +1 -0
- package/dist/reconcile/desired-state.js +5 -5
- package/dist/reconcile/engine.d.ts +5 -2
- package/dist/reconcile/engine.js +53 -32
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +2 -0
- package/dist/reconcile/live-acceptance.d.ts +79 -0
- package/dist/reconcile/live-acceptance.js +1615 -0
- package/dist/reconcile/platform.d.ts +104 -0
- package/dist/reconcile/platform.js +100 -0
- package/dist/reconcile/state.js +4 -4
- package/dist/reconcile/units.js +2 -2
- package/dist/scripts/deployment-readiness.js +20 -0
- package/dist/scripts/generate-treedx-openapi-types.js +186 -0
- package/dist/scripts/operations-runner-smoke.js +16 -0
- package/dist/scripts/release-verify.js +4 -1
- package/dist/scripts/tenant-workflow-action.js +10 -1
- package/dist/sdk-types.d.ts +169 -4
- package/dist/sdk-types.js +20 -2
- package/dist/sdk.d.ts +35 -24
- package/dist/sdk.js +186 -17
- package/dist/template-launch-requirements.js +9 -0
- package/dist/treedx/adapters.d.ts +6 -0
- package/dist/treedx/adapters.js +36 -0
- package/dist/treedx/client.d.ts +222 -0
- package/dist/treedx/client.js +871 -0
- package/dist/treedx/errors.d.ts +13 -0
- package/dist/treedx/errors.js +17 -0
- package/dist/treedx/federated-client.d.ts +27 -0
- package/dist/treedx/federated-client.js +158 -0
- package/dist/treedx/generated/openapi-types.d.ts +3558 -0
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/graph-adapter.d.ts +33 -0
- package/dist/treedx/graph-adapter.js +156 -0
- package/dist/treedx/index.d.ts +14 -0
- package/dist/treedx/index.js +48 -0
- package/dist/treedx/market-integration.d.ts +27 -0
- package/dist/treedx/market-integration.js +131 -0
- package/dist/treedx/ports.d.ts +166 -0
- package/dist/treedx/ports.js +231 -0
- package/dist/treedx/query-adapter.d.ts +19 -0
- package/dist/treedx/query-adapter.js +62 -0
- package/dist/treedx/registry-client.d.ts +11 -0
- package/dist/treedx/registry-client.js +19 -0
- package/dist/treedx/repository-adapter.d.ts +45 -0
- package/dist/treedx/repository-adapter.js +308 -0
- package/dist/treedx/sdk-integration.d.ts +27 -0
- package/dist/treedx/sdk-integration.js +63 -0
- package/dist/treedx/types.d.ts +1084 -0
- package/dist/treedx/types.js +8 -0
- package/dist/treedx/workspace-adapter.d.ts +27 -0
- package/dist/treedx/workspace-adapter.js +65 -0
- package/dist/treedx-backends.d.ts +218 -0
- package/dist/treedx-backends.js +632 -0
- package/dist/treedx-client.d.ts +86 -0
- package/dist/treedx-client.js +175 -0
- package/dist/treeseed/template-catalog/catalog.fixture.json +23 -23
- package/dist/workflow/operations.d.ts +119 -13
- package/dist/workflow/operations.js +309 -53
- package/dist/workflow-state.d.ts +13 -0
- package/dist/workflow-state.js +43 -26
- package/dist/workflow-support.d.ts +11 -3
- package/dist/workflow-support.js +67 -3
- package/dist/workflow.d.ts +5 -0
- package/drizzle/market/0004_treedx_market_integration.sql +99 -0
- package/package.json +34 -3
- package/templates/github/deploy-web.workflow.yml +39 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TreeDxErrorCode } from './types.ts';
|
|
2
|
+
export declare class TreeDxApiError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly code: TreeDxErrorCode;
|
|
5
|
+
readonly details: Record<string, unknown>;
|
|
6
|
+
readonly payload: unknown;
|
|
7
|
+
constructor(message: string, options: {
|
|
8
|
+
status: number;
|
|
9
|
+
code?: TreeDxErrorCode;
|
|
10
|
+
details?: Record<string, unknown>;
|
|
11
|
+
payload?: unknown;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class TreeDxApiError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
code;
|
|
4
|
+
details;
|
|
5
|
+
payload;
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "TreeDxApiError";
|
|
9
|
+
this.status = options.status;
|
|
10
|
+
this.code = options.code ?? "treedx_api_error";
|
|
11
|
+
this.details = options.details ?? {};
|
|
12
|
+
this.payload = options.payload;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
TreeDxApiError
|
|
17
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TreeDxClient } from './client.ts';
|
|
2
|
+
import { TreeDxRegistryClient, type TreeDxRegistryClientOptions } from './registry-client.ts';
|
|
3
|
+
import type { TreeDxFederatedContextRequest, TreeDxFederatedContextResult, TreeDxFederatedGraphRequest, TreeDxFederatedGraphResult, TreeDxFederatedQueryRequest, TreeDxFederatedQueryResult, TreeDxFederatedSearchRequest, TreeDxFederatedSearchResult, TreeDxFederationQueryPlan, TreeDxFederationQueryPlanRequest } from './types.ts';
|
|
4
|
+
export interface TreeDxFederatedClientOptions {
|
|
5
|
+
registry: TreeDxRegistryClientOptions | TreeDxRegistryClient;
|
|
6
|
+
token?: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
nodeBaseUrls?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export declare class TreeDxFederatedClient {
|
|
11
|
+
private readonly registry;
|
|
12
|
+
private readonly token?;
|
|
13
|
+
private readonly fetchImpl?;
|
|
14
|
+
private readonly nodeBaseUrls;
|
|
15
|
+
constructor(options: TreeDxFederatedClientOptions);
|
|
16
|
+
resolveRepository(repoId: string): Promise<TreeDxClient>;
|
|
17
|
+
resolveRepositoryForRead(repoId: string): Promise<TreeDxClient>;
|
|
18
|
+
resolveRepositoryForWrite(repoId: string): Promise<TreeDxClient>;
|
|
19
|
+
planQuery(input: TreeDxFederationQueryPlanRequest): Promise<TreeDxFederationQueryPlan>;
|
|
20
|
+
query(input: TreeDxFederatedQueryRequest): Promise<TreeDxFederatedQueryResult>;
|
|
21
|
+
search(input: TreeDxFederatedSearchRequest): Promise<TreeDxFederatedSearchResult>;
|
|
22
|
+
federatedSearch(input: TreeDxFederatedSearchRequest): Promise<TreeDxFederatedSearchResult>;
|
|
23
|
+
federatedQuery(input: TreeDxFederatedQueryRequest): Promise<TreeDxFederatedQueryResult>;
|
|
24
|
+
federatedContext(input: TreeDxFederatedContextRequest): Promise<TreeDxFederatedContextResult>;
|
|
25
|
+
federatedGraph(input: TreeDxFederatedGraphRequest): Promise<TreeDxFederatedGraphResult>;
|
|
26
|
+
private clientForPlacement;
|
|
27
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { TreeDxClient } from "./client.js";
|
|
2
|
+
import { TreeDxApiError } from "./errors.js";
|
|
3
|
+
import { TreeDxRegistryClient } from "./registry-client.js";
|
|
4
|
+
function placementRepoId(placement, fallback) {
|
|
5
|
+
return placement.repositoryId ?? placement.repoId ?? fallback;
|
|
6
|
+
}
|
|
7
|
+
class TreeDxFederatedClient {
|
|
8
|
+
registry;
|
|
9
|
+
token;
|
|
10
|
+
fetchImpl;
|
|
11
|
+
nodeBaseUrls;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.registry = options.registry instanceof TreeDxRegistryClient ? options.registry : new TreeDxRegistryClient(options.registry);
|
|
14
|
+
this.token = options.token;
|
|
15
|
+
this.fetchImpl = options.fetch;
|
|
16
|
+
this.nodeBaseUrls = options.nodeBaseUrls ?? {};
|
|
17
|
+
}
|
|
18
|
+
async resolveRepository(repoId) {
|
|
19
|
+
return this.resolveRepositoryForWrite(repoId);
|
|
20
|
+
}
|
|
21
|
+
async resolveRepositoryForRead(repoId) {
|
|
22
|
+
return this.clientForPlacement(await this.registry.resolveRepository(repoId), repoId);
|
|
23
|
+
}
|
|
24
|
+
async resolveRepositoryForWrite(repoId) {
|
|
25
|
+
return this.clientForPlacement(await this.registry.resolveRepository(repoId), repoId);
|
|
26
|
+
}
|
|
27
|
+
async planQuery(input) {
|
|
28
|
+
return this.registry.client.planFederatedQuery(input);
|
|
29
|
+
}
|
|
30
|
+
async query(input) {
|
|
31
|
+
const repoIds = input.repoIds ?? (input.repoId ? [input.repoId] : []);
|
|
32
|
+
if (repoIds.length !== 1) {
|
|
33
|
+
return this.federatedQuery({ ...input, repoIds });
|
|
34
|
+
}
|
|
35
|
+
const repoId = repoIds[0];
|
|
36
|
+
try {
|
|
37
|
+
const client = await this.resolveRepositoryForRead(repoId);
|
|
38
|
+
const result = await client.queryRepository({ ...input, repoId });
|
|
39
|
+
return singleQueryResult(repoId, input.type, result);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (input.includeErrors && error instanceof TreeDxApiError) {
|
|
42
|
+
return {
|
|
43
|
+
type: input.type,
|
|
44
|
+
results: [],
|
|
45
|
+
page: { limit: input.limit ?? 20, hasMore: false, cursor: null },
|
|
46
|
+
diagnostics: singleDiagnostics(repoId, 1),
|
|
47
|
+
errors: [{ repoId, code: error.code, message: error.message, status: error.status }]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async search(input) {
|
|
54
|
+
const repoIds = input.repoIds ?? (input.repoId ? [input.repoId] : []);
|
|
55
|
+
if (repoIds.length !== 1) {
|
|
56
|
+
return this.federatedSearch({ ...input, repoIds });
|
|
57
|
+
}
|
|
58
|
+
const repoId = repoIds[0];
|
|
59
|
+
try {
|
|
60
|
+
const client = await this.resolveRepositoryForRead(repoId);
|
|
61
|
+
const result = await client.searchRepositoryFiles({ ...input, repoId });
|
|
62
|
+
return singleSearchResult(repoId, input.query, result);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (input.includeErrors && error instanceof TreeDxApiError) {
|
|
65
|
+
return {
|
|
66
|
+
query: input.query,
|
|
67
|
+
results: [],
|
|
68
|
+
page: { limit: input.limit ?? 20, hasMore: false, cursor: null },
|
|
69
|
+
diagnostics: singleDiagnostics(repoId, 1),
|
|
70
|
+
errors: [{ repoId, code: error.code, message: error.message, status: error.status }]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async federatedSearch(input) {
|
|
77
|
+
return this.registry.client.federatedSearch(input);
|
|
78
|
+
}
|
|
79
|
+
async federatedQuery(input) {
|
|
80
|
+
return this.registry.client.federatedQuery(input);
|
|
81
|
+
}
|
|
82
|
+
async federatedContext(input) {
|
|
83
|
+
return this.registry.client.federatedContext(input);
|
|
84
|
+
}
|
|
85
|
+
async federatedGraph(input) {
|
|
86
|
+
return this.registry.client.federatedGraph(input);
|
|
87
|
+
}
|
|
88
|
+
async clientForPlacement(placement, fallbackRepoId) {
|
|
89
|
+
const nodeId = placement.primaryNodeId;
|
|
90
|
+
let baseUrl = this.nodeBaseUrls[nodeId];
|
|
91
|
+
if (!baseUrl) {
|
|
92
|
+
const nodes = await this.registry.listNodes();
|
|
93
|
+
baseUrl = nodes.find((node) => node.id === nodeId)?.baseUrl;
|
|
94
|
+
}
|
|
95
|
+
if (!baseUrl) {
|
|
96
|
+
throw new TreeDxApiError(`TreeDX node "${nodeId}" is not configured.`, {
|
|
97
|
+
status: 404,
|
|
98
|
+
code: "node_not_configured",
|
|
99
|
+
details: { nodeId }
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return new TreeDxClient({
|
|
103
|
+
baseUrl,
|
|
104
|
+
token: this.token,
|
|
105
|
+
fetch: this.fetchImpl,
|
|
106
|
+
repoId: placementRepoId(placement, fallbackRepoId)
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function singleDiagnostics(repoId, partialFailureCount = 0) {
|
|
111
|
+
return {
|
|
112
|
+
requestedRepoCount: 1,
|
|
113
|
+
executedRepoCount: partialFailureCount === 0 ? 1 : 0,
|
|
114
|
+
rejectedRepoCount: 0,
|
|
115
|
+
partialFailureCount,
|
|
116
|
+
routing: [
|
|
117
|
+
{
|
|
118
|
+
repoId,
|
|
119
|
+
source: "remote",
|
|
120
|
+
status: partialFailureCount === 0 ? "ok" : "partial_failure"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function resultItems(result, repoId) {
|
|
126
|
+
const ref = typeof result.ref === "string" ? result.ref : "refs/heads/main";
|
|
127
|
+
const items = Array.isArray(result.results) ? result.results : [];
|
|
128
|
+
return items.map((item) => ({
|
|
129
|
+
...typeof item === "object" && item !== null ? item : { value: item },
|
|
130
|
+
repoId,
|
|
131
|
+
ref,
|
|
132
|
+
source: "remote"
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
function resultPage(result, limit = 20) {
|
|
136
|
+
return typeof result.page === "object" && result.page !== null ? result.page : { limit, hasMore: false, cursor: null };
|
|
137
|
+
}
|
|
138
|
+
function singleQueryResult(repoId, type, result) {
|
|
139
|
+
return {
|
|
140
|
+
type: typeof result.type === "string" ? result.type : type,
|
|
141
|
+
results: resultItems(result, repoId),
|
|
142
|
+
page: resultPage(result),
|
|
143
|
+
diagnostics: singleDiagnostics(repoId),
|
|
144
|
+
errors: []
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function singleSearchResult(repoId, query, result) {
|
|
148
|
+
return {
|
|
149
|
+
query,
|
|
150
|
+
results: resultItems(result, repoId),
|
|
151
|
+
page: resultPage(result),
|
|
152
|
+
diagnostics: singleDiagnostics(repoId),
|
|
153
|
+
errors: []
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
TreeDxFederatedClient
|
|
158
|
+
};
|