@treeseed/sdk 0.5.2 → 0.6.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/dist/index.d.ts +2 -0
- package/dist/index.js +46 -0
- package/dist/operations/providers/default.js +1 -1
- package/dist/operations/services/config-runtime.d.ts +49 -42
- package/dist/operations/services/config-runtime.js +465 -142
- package/dist/operations/services/deploy.d.ts +298 -0
- package/dist/operations/services/deploy.js +381 -137
- package/dist/operations/services/git-workflow.d.ts +9 -0
- package/dist/operations/services/git-workflow.js +32 -0
- package/dist/operations/services/github-api.d.ts +115 -0
- package/dist/operations/services/github-api.js +455 -0
- package/dist/operations/services/github-automation.d.ts +19 -33
- package/dist/operations/services/github-automation.js +44 -131
- package/dist/operations/services/key-agent.d.ts +20 -1
- package/dist/operations/services/key-agent.js +267 -102
- package/dist/operations/services/knowledge-coop-launch.d.ts +2 -3
- package/dist/operations/services/knowledge-coop-launch.js +26 -12
- package/dist/operations/services/project-platform.d.ts +157 -150
- package/dist/operations/services/project-platform.js +129 -26
- package/dist/operations/services/railway-api.d.ts +244 -0
- package/dist/operations/services/railway-api.js +882 -0
- package/dist/operations/services/railway-deploy.d.ts +171 -27
- package/dist/operations/services/railway-deploy.js +672 -172
- package/dist/operations/services/runtime-tools.d.ts +18 -0
- package/dist/operations/services/runtime-tools.js +19 -6
- package/dist/operations/services/workspace-preflight.js +2 -2
- package/dist/platform/contracts.d.ts +7 -0
- package/dist/platform/deploy-config.js +23 -0
- package/dist/platform/deploy-runtime.d.ts +1 -0
- package/dist/platform/deploy-runtime.js +7 -9
- package/dist/platform/env.yaml +10 -9
- package/dist/platform/environment.js +4 -0
- package/dist/platform/plugin.d.ts +6 -0
- package/dist/platform/plugins/constants.d.ts +1 -0
- package/dist/platform/plugins/constants.js +1 -0
- package/dist/platform/plugins/runtime.d.ts +4 -0
- package/dist/platform/plugins/runtime.js +8 -1
- package/dist/platform/published-content.js +27 -4
- package/dist/platform/tenant/runtime-config.js +33 -24
- package/dist/plugin-default.d.ts +1 -0
- package/dist/plugin-default.js +1 -0
- package/dist/reconcile/builtin-adapters.d.ts +3 -0
- package/dist/reconcile/builtin-adapters.js +2093 -0
- package/dist/reconcile/contracts.d.ts +155 -0
- package/dist/reconcile/contracts.js +0 -0
- package/dist/reconcile/desired-state.d.ts +179 -0
- package/dist/reconcile/desired-state.js +319 -0
- package/dist/reconcile/engine.d.ts +405 -0
- package/dist/reconcile/engine.js +356 -0
- package/dist/reconcile/errors.d.ts +5 -0
- package/dist/reconcile/errors.js +13 -0
- package/dist/reconcile/index.d.ts +7 -0
- package/dist/reconcile/index.js +7 -0
- package/dist/reconcile/registry.d.ts +7 -0
- package/dist/reconcile/registry.js +64 -0
- package/dist/reconcile/state.d.ts +7 -0
- package/dist/reconcile/state.js +303 -0
- package/dist/reconcile/units.d.ts +6 -0
- package/dist/reconcile/units.js +68 -0
- package/dist/scripts/config-treeseed.js +27 -19
- package/dist/scripts/tenant-deploy.js +35 -14
- package/dist/workflow/operations.js +127 -22
- package/dist/workflow-support.d.ts +3 -1
- package/dist/workflow-support.js +50 -0
- package/dist/workflow.d.ts +2 -0
- package/package.json +7 -1
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
signEditorialPreviewToken
|
|
13
13
|
} from "../../platform/published-content.js";
|
|
14
14
|
import { createPublishedContentPipeline } from "../../platform/published-content-pipeline.js";
|
|
15
|
+
import { collectTreeseedReconcileStatus, reconcileTreeseedTarget } from "../../reconcile/index.js";
|
|
15
16
|
import { loadTreeseedManifest } from "../../platform/tenant-config.js";
|
|
16
|
-
import { applyTreeseedEnvironmentToProcess
|
|
17
|
+
import { applyTreeseedEnvironmentToProcess } from "./config-runtime.js";
|
|
17
18
|
import {
|
|
18
19
|
createPersistentDeployTarget,
|
|
19
20
|
deployTargetLabel,
|
|
@@ -21,9 +22,7 @@ import {
|
|
|
21
22
|
finalizeDeploymentState,
|
|
22
23
|
loadDeployState,
|
|
23
24
|
purgePublishedContentCaches,
|
|
24
|
-
|
|
25
|
-
syncCloudflareSecrets,
|
|
26
|
-
verifyProvisionedCloudflareResources,
|
|
25
|
+
resolveConfiguredSurfaceBaseUrl,
|
|
27
26
|
writeDeployState
|
|
28
27
|
} from "./deploy.js";
|
|
29
28
|
import { currentManagedBranch, PRODUCTION_BRANCH, STAGING_BRANCH } from "./git-workflow.js";
|
|
@@ -270,6 +269,54 @@ function queueClientConfig(siteConfig, state) {
|
|
|
270
269
|
apiBaseUrl: process.env.TREESEED_QUEUE_API_BASE_URL?.trim() || void 0
|
|
271
270
|
};
|
|
272
271
|
}
|
|
272
|
+
function findFirstMatchingString(value, matcher, seen = /* @__PURE__ */ new Set()) {
|
|
273
|
+
if (typeof value === "string") {
|
|
274
|
+
return matcher(value) ? value : null;
|
|
275
|
+
}
|
|
276
|
+
if (!value || typeof value !== "object") {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
if (seen.has(value)) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
seen.add(value);
|
|
283
|
+
if (Array.isArray(value)) {
|
|
284
|
+
for (const entry of value) {
|
|
285
|
+
const match = findFirstMatchingString(entry, matcher, seen);
|
|
286
|
+
if (match) {
|
|
287
|
+
return match;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
for (const entry of Object.values(value)) {
|
|
293
|
+
const match = findFirstMatchingString(entry, matcher, seen);
|
|
294
|
+
if (match) {
|
|
295
|
+
return match;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
function resolveImmediatePagesProbeUrl(siteConfig, state, target) {
|
|
301
|
+
if (target.kind === "persistent" && target.scope === "staging" && state.pages?.projectName) {
|
|
302
|
+
return `https://${state.pages?.stagingBranch ?? "staging"}.${state.pages.projectName}.pages.dev`;
|
|
303
|
+
}
|
|
304
|
+
return state.pages?.url ?? resolveConfiguredSurfaceBaseUrl(siteConfig, target, "web") ?? siteConfig.siteUrl;
|
|
305
|
+
}
|
|
306
|
+
function resolveImmediateApiProbeUrl(siteConfig, state, target) {
|
|
307
|
+
const configuredUrl = resolveConfiguredSurfaceBaseUrl(siteConfig, target, "api") ?? siteConfig.services?.api?.environments?.[target.kind === "persistent" ? target.scope : "prod"]?.baseUrl ?? siteConfig.services?.api?.publicBaseUrl ?? process.env.TREESEED_API_BASE_URL ?? state.services?.api?.lastDeployedUrl ?? null;
|
|
308
|
+
if (configuredUrl) {
|
|
309
|
+
return configuredUrl;
|
|
310
|
+
}
|
|
311
|
+
const railwayHost = findFirstMatchingString(
|
|
312
|
+
state,
|
|
313
|
+
(value) => /^[a-z0-9-]+\.up\.railway\.app$/iu.test(String(value).trim())
|
|
314
|
+
);
|
|
315
|
+
if (railwayHost) {
|
|
316
|
+
return `https://${railwayHost}`;
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
273
320
|
async function probeQueue(siteConfig, state) {
|
|
274
321
|
const config = queueClientConfig(siteConfig, state);
|
|
275
322
|
if (!config) {
|
|
@@ -291,10 +338,25 @@ async function probeQueue(siteConfig, state) {
|
|
|
291
338
|
budgetHint: 0
|
|
292
339
|
}
|
|
293
340
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
341
|
+
let pulled;
|
|
342
|
+
try {
|
|
343
|
+
pulled = await pullClient.pull({
|
|
344
|
+
batchSize: 1,
|
|
345
|
+
visibilityTimeoutMs: 1e4
|
|
346
|
+
});
|
|
347
|
+
} catch (error) {
|
|
348
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
349
|
+
if (/http_pull mode is enabled/iu.test(detail)) {
|
|
350
|
+
return {
|
|
351
|
+
ok: true,
|
|
352
|
+
skipped: true,
|
|
353
|
+
reason: "queue_push_only",
|
|
354
|
+
messageId,
|
|
355
|
+
detail
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
298
360
|
const message = pulled.messages.find((entry) => entry.body?.messageId === messageId) ?? pulled.messages[0] ?? null;
|
|
299
361
|
if (!message) {
|
|
300
362
|
return { ok: false, reason: "queue_pull_empty" };
|
|
@@ -360,12 +422,23 @@ function probeR2(tenantRoot, siteConfig, state, target) {
|
|
|
360
422
|
function probeScaleConfiguration(siteConfig, state) {
|
|
361
423
|
const worker = state.services?.worker ?? {};
|
|
362
424
|
const scalerKind = String(process.env.TREESEED_WORKER_POOL_SCALER ?? "").trim();
|
|
425
|
+
if (scalerKind !== "railway" && siteConfig.services?.worker?.provider !== "railway") {
|
|
426
|
+
return {
|
|
427
|
+
ok: true,
|
|
428
|
+
skipped: true,
|
|
429
|
+
reason: "scaler_unconfigured",
|
|
430
|
+
mocked: true,
|
|
431
|
+
serviceId: worker.serviceId ?? null
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const serviceIdentifier = worker.serviceId || process.env.TREESEED_RAILWAY_WORKER_SERVICE_ID || worker.serviceName;
|
|
435
|
+
const environmentIdentifier = process.env.TREESEED_RAILWAY_ENVIRONMENT_ID || worker.environment;
|
|
436
|
+
const projectIdentifier = process.env.TREESEED_RAILWAY_PROJECT_ID || worker.projectId || worker.projectName;
|
|
363
437
|
return {
|
|
364
|
-
ok: Boolean(
|
|
365
|
-
(scalerKind === "railway" || siteConfig.services?.worker?.provider === "railway") && (worker.serviceId || process.env.TREESEED_RAILWAY_WORKER_SERVICE_ID) && (process.env.TREESEED_RAILWAY_ENVIRONMENT_ID || process.env.TREESEED_RAILWAY_PROJECT_ID || worker.projectId)
|
|
366
|
-
),
|
|
438
|
+
ok: Boolean(serviceIdentifier && (environmentIdentifier || projectIdentifier)),
|
|
367
439
|
mocked: true,
|
|
368
|
-
serviceId: worker.serviceId ?? null
|
|
440
|
+
serviceId: worker.serviceId ?? null,
|
|
441
|
+
serviceName: worker.serviceName ?? null
|
|
369
442
|
};
|
|
370
443
|
}
|
|
371
444
|
async function publishContent(options, reporter) {
|
|
@@ -582,14 +655,25 @@ async function provisionProjectPlatform(options) {
|
|
|
582
655
|
const reporter = resolveReporter(options.tenantRoot, options.reporter);
|
|
583
656
|
const target = createPersistentDeployTarget(options.scope === "local" ? "staging" : options.scope);
|
|
584
657
|
const siteConfig = loadCliDeployConfig(options.tenantRoot);
|
|
585
|
-
const summary =
|
|
586
|
-
|
|
658
|
+
const summary = await reconcileTreeseedTarget({
|
|
659
|
+
tenantRoot: options.tenantRoot,
|
|
660
|
+
target,
|
|
661
|
+
env: process.env
|
|
662
|
+
});
|
|
663
|
+
const verification = await collectTreeseedReconcileStatus({
|
|
664
|
+
tenantRoot: options.tenantRoot,
|
|
665
|
+
target,
|
|
666
|
+
env: process.env
|
|
667
|
+
});
|
|
587
668
|
ensureGeneratedWranglerConfig(options.tenantRoot, { target });
|
|
588
|
-
const syncedSecrets = syncCloudflareSecrets(options.tenantRoot, { dryRun: options.dryRun, target });
|
|
589
|
-
const syncedRailway = options.scope === "local" ? [] : syncTreeseedRailwayEnvironment({ tenantRoot: options.tenantRoot, scope: options.scope, dryRun: options.dryRun });
|
|
590
669
|
const railwayValidation = options.scope === "local" ? validateRailwayServiceConfiguration(options.tenantRoot, options.scope) : validateRailwayDeployPrerequisites(options.tenantRoot, options.scope);
|
|
591
|
-
const railwaySchedules =
|
|
592
|
-
const railwayScheduleVerification =
|
|
670
|
+
const railwaySchedules = [];
|
|
671
|
+
const railwayScheduleVerification = {
|
|
672
|
+
ok: true,
|
|
673
|
+
checks: [],
|
|
674
|
+
skipped: true,
|
|
675
|
+
reason: "deploy_only"
|
|
676
|
+
};
|
|
593
677
|
const state = loadDeployState(options.tenantRoot, siteConfig, { target });
|
|
594
678
|
await reporter.reportEnvironment({
|
|
595
679
|
environment: options.scope,
|
|
@@ -694,8 +778,11 @@ async function provisionProjectPlatform(options) {
|
|
|
694
778
|
target: deployTargetLabel(target),
|
|
695
779
|
summary,
|
|
696
780
|
verification,
|
|
697
|
-
|
|
698
|
-
|
|
781
|
+
reconcileActions: summary.results.map((result) => ({
|
|
782
|
+
unitId: result.unit.unitId,
|
|
783
|
+
action: result.action,
|
|
784
|
+
provider: result.unit.provider
|
|
785
|
+
})),
|
|
699
786
|
railwayServices: railwayValidation.services.map((service) => service.key),
|
|
700
787
|
railwaySchedules,
|
|
701
788
|
railwayScheduleVerification
|
|
@@ -728,18 +815,31 @@ async function deployProjectPlatform(options) {
|
|
|
728
815
|
triggeredByType: "project_runner",
|
|
729
816
|
metadata: { scope: options.scope }
|
|
730
817
|
});
|
|
731
|
-
|
|
818
|
+
if (!options.skipProvision) {
|
|
819
|
+
await provisionProjectPlatform({ ...options, reporter });
|
|
820
|
+
}
|
|
732
821
|
runNodeScript(options.tenantRoot, "tenant-deploy", ["--environment", options.scope, ...options.dryRun ? ["--dry-run"] : []]);
|
|
733
822
|
const serviceResults = [];
|
|
734
823
|
if (options.scope !== "local") {
|
|
735
824
|
const validation = validateRailwayDeployPrerequisites(options.tenantRoot, options.scope);
|
|
736
825
|
for (const service of validation.services) {
|
|
737
|
-
serviceResults.push(deployRailwayService(options.tenantRoot, service, { dryRun: options.dryRun }));
|
|
826
|
+
serviceResults.push(await deployRailwayService(options.tenantRoot, service, { dryRun: options.dryRun }));
|
|
738
827
|
}
|
|
828
|
+
const railwaySchedules = options.scope === "prod" ? await ensureRailwayScheduledJobs(options.tenantRoot, options.scope, { dryRun: options.dryRun }) : [];
|
|
829
|
+
const railwayScheduleVerification = options.scope === "prod" && !options.dryRun ? await verifyRailwayScheduledJobs(options.tenantRoot, options.scope) : { ok: true, checks: railwaySchedules, skipped: options.scope !== "prod" ? true : options.dryRun, reason: options.scope !== "prod" ? "prod_only" : "dry_run" };
|
|
739
830
|
finalizeDeploymentState(options.tenantRoot, {
|
|
740
831
|
target: createPersistentDeployTarget(options.scope),
|
|
741
832
|
serviceResults
|
|
742
833
|
});
|
|
834
|
+
serviceResults.push({
|
|
835
|
+
service: "railway-schedules",
|
|
836
|
+
status: railwayScheduleVerification.ok ? "verified" : "failed",
|
|
837
|
+
command: "railway schedules reconcile",
|
|
838
|
+
cwd: options.tenantRoot,
|
|
839
|
+
publicBaseUrl: null,
|
|
840
|
+
schedules: railwaySchedules,
|
|
841
|
+
scheduleVerification: railwayScheduleVerification
|
|
842
|
+
});
|
|
743
843
|
}
|
|
744
844
|
const monitor = await monitorProjectPlatform({ ...options, reporter });
|
|
745
845
|
await reportDeployment(reporter, {
|
|
@@ -772,13 +872,14 @@ async function monitorProjectPlatform(options) {
|
|
|
772
872
|
const target = createPersistentDeployTarget(options.scope === "local" ? "staging" : options.scope);
|
|
773
873
|
const siteConfig = loadCliDeployConfig(options.tenantRoot);
|
|
774
874
|
const state = loadDeployState(options.tenantRoot, siteConfig, { target });
|
|
775
|
-
const
|
|
875
|
+
const webProbeUrl = resolveImmediatePagesProbeUrl(siteConfig, state, target);
|
|
876
|
+
const apiBaseUrl = resolveImmediateApiProbeUrl(siteConfig, state, target);
|
|
776
877
|
const checks = {
|
|
777
|
-
pages: await probeHttp(
|
|
878
|
+
pages: await probeHttp(webProbeUrl),
|
|
778
879
|
apiHealth: apiBaseUrl ? await probeHttp(`${String(apiBaseUrl).replace(/\/+$/u, "")}/healthz`) : { ok: false, skipped: true, reason: "api_url_unconfigured" },
|
|
779
880
|
apiReady: apiBaseUrl ? await probeHttp(`${String(apiBaseUrl).replace(/\/+$/u, "")}/readyz`) : { ok: false, skipped: true, reason: "api_url_unconfigured" },
|
|
780
881
|
d1Health: apiBaseUrl ? await probeHttp(`${String(apiBaseUrl).replace(/\/+$/u, "")}/healthz/deep`) : { ok: false, skipped: true, reason: "api_url_unconfigured" },
|
|
781
|
-
agentHealth: apiBaseUrl ? await probeHttp(`${String(apiBaseUrl).replace(/\/+$/u, "")}/agent/healthz`) : { ok: false, skipped: true, reason: "api_url_unconfigured" },
|
|
882
|
+
agentHealth: apiBaseUrl ? await probeHttp(`${String(apiBaseUrl).replace(/\/+$/u, "")}/internal/core/agent/healthz`) : { ok: false, skipped: true, reason: "api_url_unconfigured" },
|
|
782
883
|
r2: options.dryRun ? { ok: true, skipped: true, reason: "dry_run" } : probeR2(options.tenantRoot, siteConfig, state, target),
|
|
783
884
|
queue: options.dryRun ? Promise.resolve({ ok: true, skipped: true, reason: "dry_run" }) : probeQueue(siteConfig, state),
|
|
784
885
|
scaleProbe: probeScaleConfiguration(siteConfig, state),
|
|
@@ -800,7 +901,9 @@ async function monitorProjectPlatform(options) {
|
|
|
800
901
|
resolvedChecks.scaleProbe
|
|
801
902
|
].every((check) => check?.ok === true || check?.skipped === true);
|
|
802
903
|
if (!ok) {
|
|
803
|
-
|
|
904
|
+
const failedChecks = Object.entries(resolvedChecks).filter(([, check]) => check && typeof check === "object" && check.ok !== true && check.skipped !== true).map(([name, check]) => `${name}: ${JSON.stringify(check)}`);
|
|
905
|
+
throw new Error(`Treeseed monitor failed for ${options.scope}.
|
|
906
|
+
${failedChecks.join("\n")}`);
|
|
804
907
|
}
|
|
805
908
|
await reportDeployment(reporter, {
|
|
806
909
|
environment: options.scope,
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
export declare function normalizeRailwayEnvironmentName(value: string | null | undefined): string;
|
|
2
|
+
export type RailwayWorkspaceSummary = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export type RailwayEnvironmentSummary = {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export type RailwayServiceSummary = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
export type RailwayProjectSummary = {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
workspaceId: string | null;
|
|
18
|
+
environments: RailwayEnvironmentSummary[];
|
|
19
|
+
services: RailwayServiceSummary[];
|
|
20
|
+
};
|
|
21
|
+
export type RailwayServiceInstanceSummary = {
|
|
22
|
+
id: string | null;
|
|
23
|
+
buildCommand: string | null;
|
|
24
|
+
startCommand: string | null;
|
|
25
|
+
rootDirectory: string | null;
|
|
26
|
+
healthcheckPath: string | null;
|
|
27
|
+
healthcheckTimeoutSeconds: number | null;
|
|
28
|
+
healthcheckIntervalSeconds: number | null;
|
|
29
|
+
restartPolicy: string | null;
|
|
30
|
+
runtimeMode: string | null;
|
|
31
|
+
sleepApplication: boolean | null;
|
|
32
|
+
runtimeConfigSupported: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type RailwayCustomDomainDnsRecord = {
|
|
35
|
+
fqdn: string;
|
|
36
|
+
hostlabel: string;
|
|
37
|
+
recordType: string;
|
|
38
|
+
requiredValue: string;
|
|
39
|
+
currentValue: string;
|
|
40
|
+
status: string;
|
|
41
|
+
zone: string;
|
|
42
|
+
purpose: string;
|
|
43
|
+
};
|
|
44
|
+
export type RailwayCustomDomainSummary = {
|
|
45
|
+
id: string;
|
|
46
|
+
domain: string;
|
|
47
|
+
environmentId: string;
|
|
48
|
+
serviceId: string;
|
|
49
|
+
targetPort: number | null;
|
|
50
|
+
verified: boolean;
|
|
51
|
+
certificateStatus: string | null;
|
|
52
|
+
verificationDnsHost: string | null;
|
|
53
|
+
verificationToken: string | null;
|
|
54
|
+
dnsRecords: RailwayCustomDomainDnsRecord[];
|
|
55
|
+
};
|
|
56
|
+
export declare function isUsableRailwayToken(value: string | undefined | null): boolean;
|
|
57
|
+
export declare function resolveRailwayApiToken(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
|
|
58
|
+
export declare function resolveRailwayApiUrl(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
|
|
59
|
+
export declare function resolveRailwayWorkspace(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
|
|
60
|
+
export declare function railwayGraphqlRequest<TData = unknown>({ query, variables, env, apiToken, apiUrl, fetchImpl, timeoutMs, retries, }: {
|
|
61
|
+
query: string;
|
|
62
|
+
variables?: Record<string, unknown>;
|
|
63
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
64
|
+
apiToken?: string;
|
|
65
|
+
apiUrl?: string;
|
|
66
|
+
fetchImpl?: typeof fetch;
|
|
67
|
+
timeoutMs?: number;
|
|
68
|
+
retries?: number;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
data: TData;
|
|
71
|
+
}>;
|
|
72
|
+
export declare function getRailwayAuthProfile({ env, fetchImpl, }: {
|
|
73
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
74
|
+
fetchImpl?: typeof fetch;
|
|
75
|
+
}): Promise<{
|
|
76
|
+
id: string | null;
|
|
77
|
+
name: string | null;
|
|
78
|
+
email: string | null;
|
|
79
|
+
workspaces: RailwayWorkspaceSummary[];
|
|
80
|
+
}>;
|
|
81
|
+
export declare function resolveRailwayWorkspaceContext({ env, workspace, fetchImpl, }: {
|
|
82
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
83
|
+
workspace?: string;
|
|
84
|
+
fetchImpl?: typeof fetch;
|
|
85
|
+
}): Promise<RailwayWorkspaceSummary>;
|
|
86
|
+
export declare function listRailwayProjects({ env, workspaceId, fetchImpl, }: {
|
|
87
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
88
|
+
workspaceId: string;
|
|
89
|
+
fetchImpl?: typeof fetch;
|
|
90
|
+
}): Promise<RailwayProjectSummary[]>;
|
|
91
|
+
export declare function getRailwayProject({ projectId, env, fetchImpl, }: {
|
|
92
|
+
projectId: string;
|
|
93
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
94
|
+
fetchImpl?: typeof fetch;
|
|
95
|
+
}): Promise<RailwayProjectSummary | null>;
|
|
96
|
+
export declare function ensureRailwayProject({ projectName, projectId, defaultEnvironmentName, env, workspace, fetchImpl, }: {
|
|
97
|
+
projectName?: string | null;
|
|
98
|
+
projectId?: string | null;
|
|
99
|
+
defaultEnvironmentName?: string;
|
|
100
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
101
|
+
workspace?: string;
|
|
102
|
+
fetchImpl?: typeof fetch;
|
|
103
|
+
}): Promise<{
|
|
104
|
+
workspace: RailwayWorkspaceSummary;
|
|
105
|
+
project: RailwayProjectSummary;
|
|
106
|
+
created: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
export declare function ensureRailwayEnvironment({ projectId, environmentName, env, fetchImpl, }: {
|
|
109
|
+
projectId: string;
|
|
110
|
+
environmentName: string;
|
|
111
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
112
|
+
fetchImpl?: typeof fetch;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
environment: RailwayEnvironmentSummary;
|
|
115
|
+
created: boolean;
|
|
116
|
+
}>;
|
|
117
|
+
export declare function listRailwayEnvironments({ projectId, env, fetchImpl, }: {
|
|
118
|
+
projectId: string;
|
|
119
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
120
|
+
fetchImpl?: typeof fetch;
|
|
121
|
+
}): Promise<RailwayEnvironmentSummary[]>;
|
|
122
|
+
export declare function ensureRailwayService({ projectId, serviceName, serviceId, env, fetchImpl, }: {
|
|
123
|
+
projectId: string;
|
|
124
|
+
serviceName?: string | null;
|
|
125
|
+
serviceId?: string | null;
|
|
126
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
127
|
+
fetchImpl?: typeof fetch;
|
|
128
|
+
}): Promise<{
|
|
129
|
+
service: RailwayServiceSummary;
|
|
130
|
+
created: boolean;
|
|
131
|
+
}>;
|
|
132
|
+
export declare function listRailwayServices({ projectId, env, fetchImpl, }: {
|
|
133
|
+
projectId: string;
|
|
134
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
135
|
+
fetchImpl?: typeof fetch;
|
|
136
|
+
}): Promise<RailwayServiceSummary[]>;
|
|
137
|
+
export declare function getRailwayServiceInstance({ serviceId, environmentId, env, fetchImpl, }: {
|
|
138
|
+
serviceId: string;
|
|
139
|
+
environmentId: string;
|
|
140
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
141
|
+
fetchImpl?: typeof fetch;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
id: string | null;
|
|
144
|
+
buildCommand: string | null;
|
|
145
|
+
startCommand: string | null;
|
|
146
|
+
rootDirectory: string | null;
|
|
147
|
+
healthcheckPath: string | null;
|
|
148
|
+
healthcheckTimeoutSeconds: number | null;
|
|
149
|
+
healthcheckIntervalSeconds: null;
|
|
150
|
+
restartPolicy: null;
|
|
151
|
+
runtimeMode: string;
|
|
152
|
+
sleepApplication: boolean | null;
|
|
153
|
+
runtimeConfigSupported: true;
|
|
154
|
+
} | {
|
|
155
|
+
id: string | null;
|
|
156
|
+
buildCommand: string | null;
|
|
157
|
+
startCommand: string | null;
|
|
158
|
+
rootDirectory: string | null;
|
|
159
|
+
healthcheckPath: null;
|
|
160
|
+
healthcheckTimeoutSeconds: null;
|
|
161
|
+
healthcheckIntervalSeconds: null;
|
|
162
|
+
restartPolicy: null;
|
|
163
|
+
runtimeMode: null;
|
|
164
|
+
sleepApplication: null;
|
|
165
|
+
runtimeConfigSupported: false;
|
|
166
|
+
}>;
|
|
167
|
+
export declare function ensureRailwayServiceInstanceConfiguration({ serviceId, environmentId, buildCommand, startCommand, rootDirectory, healthcheckPath, healthcheckTimeoutSeconds, healthcheckIntervalSeconds, restartPolicy, runtimeMode, env, fetchImpl, }: {
|
|
168
|
+
serviceId: string;
|
|
169
|
+
environmentId: string;
|
|
170
|
+
buildCommand?: string | null;
|
|
171
|
+
startCommand?: string | null;
|
|
172
|
+
rootDirectory?: string | null;
|
|
173
|
+
healthcheckPath?: string | null;
|
|
174
|
+
healthcheckTimeoutSeconds?: number | null;
|
|
175
|
+
healthcheckIntervalSeconds?: number | null;
|
|
176
|
+
restartPolicy?: string | null;
|
|
177
|
+
runtimeMode?: string | null;
|
|
178
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
179
|
+
fetchImpl?: typeof fetch;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
instance: {
|
|
182
|
+
id: string | null;
|
|
183
|
+
buildCommand: string | null;
|
|
184
|
+
startCommand: string | null;
|
|
185
|
+
rootDirectory: string | null;
|
|
186
|
+
healthcheckPath: string | null;
|
|
187
|
+
healthcheckTimeoutSeconds: number | null;
|
|
188
|
+
healthcheckIntervalSeconds: null;
|
|
189
|
+
restartPolicy: null;
|
|
190
|
+
runtimeMode: string;
|
|
191
|
+
sleepApplication: boolean | null;
|
|
192
|
+
runtimeConfigSupported: true;
|
|
193
|
+
} | {
|
|
194
|
+
id: string | null;
|
|
195
|
+
buildCommand: string | null;
|
|
196
|
+
startCommand: string | null;
|
|
197
|
+
rootDirectory: string | null;
|
|
198
|
+
healthcheckPath: null;
|
|
199
|
+
healthcheckTimeoutSeconds: null;
|
|
200
|
+
healthcheckIntervalSeconds: null;
|
|
201
|
+
restartPolicy: null;
|
|
202
|
+
runtimeMode: null;
|
|
203
|
+
sleepApplication: null;
|
|
204
|
+
runtimeConfigSupported: false;
|
|
205
|
+
};
|
|
206
|
+
updated: boolean;
|
|
207
|
+
} | {
|
|
208
|
+
instance: {
|
|
209
|
+
id: string;
|
|
210
|
+
buildCommand: string | null;
|
|
211
|
+
startCommand: string | null;
|
|
212
|
+
rootDirectory: string | null;
|
|
213
|
+
healthcheckPath: string | null;
|
|
214
|
+
healthcheckTimeoutSeconds: number | null;
|
|
215
|
+
healthcheckIntervalSeconds: null;
|
|
216
|
+
restartPolicy: null;
|
|
217
|
+
runtimeMode: string | null;
|
|
218
|
+
sleepApplication: boolean | null;
|
|
219
|
+
runtimeConfigSupported: boolean;
|
|
220
|
+
};
|
|
221
|
+
updated: boolean;
|
|
222
|
+
}>;
|
|
223
|
+
export declare function listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl, }: {
|
|
224
|
+
projectId: string;
|
|
225
|
+
environmentId: string;
|
|
226
|
+
serviceId?: string | null;
|
|
227
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
228
|
+
fetchImpl?: typeof fetch;
|
|
229
|
+
}): Promise<Record<string, string | null>>;
|
|
230
|
+
export declare function upsertRailwayVariables({ projectId, environmentId, serviceId, variables, env, fetchImpl, }: {
|
|
231
|
+
projectId: string;
|
|
232
|
+
environmentId: string;
|
|
233
|
+
serviceId?: string | null;
|
|
234
|
+
variables: Record<string, string>;
|
|
235
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
236
|
+
fetchImpl?: typeof fetch;
|
|
237
|
+
}): Promise<void>;
|
|
238
|
+
export declare function listRailwayCustomDomains({ projectId, environmentId, serviceId, env, fetchImpl, }: {
|
|
239
|
+
projectId: string;
|
|
240
|
+
environmentId: string;
|
|
241
|
+
serviceId: string;
|
|
242
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
243
|
+
fetchImpl?: typeof fetch;
|
|
244
|
+
}): Promise<RailwayCustomDomainSummary[]>;
|