@treeseed/sdk 0.10.16 → 0.10.17
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/api/config.js +10 -3
- package/dist/operations/services/config-runtime.js +6 -1
- package/dist/operations/services/deploy.d.ts +107 -27
- package/dist/operations/services/deploy.js +852 -28
- package/dist/operations/services/project-platform.d.ts +4 -2
- package/dist/operations/services/project-platform.js +56 -27
- package/dist/operations/services/railway-api.d.ts +20 -0
- package/dist/operations/services/railway-api.js +153 -11
- package/dist/operations/services/railway-deploy.d.ts +7 -4
- package/dist/operations/services/railway-deploy.js +12 -4
- package/dist/platform/environment.js +3 -0
- package/dist/reconcile/builtin-adapters.js +34 -20
- package/dist/scripts/tenant-destroy.js +8 -2
- package/dist/workflow/operations.d.ts +92 -0
- package/dist/workflow/operations.js +11 -3
- package/dist/workflow.d.ts +1 -0
- package/package.json +1 -1
- package/templates/github/deploy-web.workflow.yml +8 -1
package/dist/api/config.js
CHANGED
|
@@ -28,6 +28,13 @@ function isLoopbackUrl(value) {
|
|
|
28
28
|
function parseCsv(value) {
|
|
29
29
|
return (value ?? "").split(",").map((entry) => entry.trim().toLowerCase()).filter(Boolean);
|
|
30
30
|
}
|
|
31
|
+
function firstEnvValue(env, ...keys) {
|
|
32
|
+
for (const key of keys) {
|
|
33
|
+
const value = env[key]?.trim();
|
|
34
|
+
if (value) return value;
|
|
35
|
+
}
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
31
38
|
function resolveBaseUrl(env, host, port) {
|
|
32
39
|
if (env.TREESEED_API_BASE_URL?.trim()) {
|
|
33
40
|
return normalizeUrl(env.TREESEED_API_BASE_URL.trim());
|
|
@@ -91,9 +98,9 @@ function resolveApiConfig(env = process.env) {
|
|
|
91
98
|
d1DatabaseName: env.TREESEED_API_D1_DATABASE_NAME?.trim() || env.SITE_DATA_DB?.trim() || void 0,
|
|
92
99
|
d1LocalPersistTo: env.TREESEED_API_D1_LOCAL_PERSIST_TO?.trim() || resolve(repoRoot, ".wrangler/state/v3/d1"),
|
|
93
100
|
d1WranglerConfigPath: resolveLocalWranglerConfigPath(repoRoot, env),
|
|
94
|
-
webServiceId: env
|
|
95
|
-
webServiceSecret: env
|
|
96
|
-
webAssertionSecret: env
|
|
101
|
+
webServiceId: firstEnvValue(env, "TREESEED_API_WEB_SERVICE_ID", "TREESEED_WEB_SERVICE_ID") || "web",
|
|
102
|
+
webServiceSecret: firstEnvValue(env, "TREESEED_API_WEB_SERVICE_SECRET", "TREESEED_WEB_SERVICE_SECRET") || "treeseed-web-service-dev-secret",
|
|
103
|
+
webAssertionSecret: firstEnvValue(env, "TREESEED_API_WEB_ASSERTION_SECRET", "TREESEED_WEB_ASSERTION_SECRET", "TREESEED_API_AUTH_SECRET") || "treeseed-web-assertion-dev-secret",
|
|
97
104
|
webExchangeTtlSeconds: parseInteger(env.TREESEED_API_WEB_EXCHANGE_TTL, 300),
|
|
98
105
|
bootstrapAdminAllowlist: parseCsv(env.TREESEED_API_BOOTSTRAP_ADMIN_ALLOWLIST),
|
|
99
106
|
accessTokenTtlSeconds: parseInteger(env.TREESEED_API_ACCESS_TOKEN_TTL, defaultAccessTokenTtl),
|
|
@@ -1598,7 +1598,12 @@ function resolveTreeseedLaunchEnvironment({
|
|
|
1598
1598
|
const nonSecretSuggestedValues = Object.fromEntries(
|
|
1599
1599
|
registry.entries.filter((entry) => entry.sensitivity !== "secret" && typeof suggestedValues[entry.id] === "string" && suggestedValues[entry.id].length > 0).map((entry) => [entry.id, suggestedValues[entry.id]])
|
|
1600
1600
|
);
|
|
1601
|
-
const
|
|
1601
|
+
const systemSecretSuggestedValues = Object.fromEntries(
|
|
1602
|
+
registry.entries.filter(
|
|
1603
|
+
(entry) => entry.id === "TREESEED_PLATFORM_RUNNER_SECRET" && typeof suggestedValues[entry.id] === "string" && suggestedValues[entry.id].length > 0
|
|
1604
|
+
).map((entry) => [entry.id, suggestedValues[entry.id]])
|
|
1605
|
+
);
|
|
1606
|
+
const scopedValues = scope === "local" ? { ...nonSecretSuggestedValues, ...systemSecretSuggestedValues, ...baseValues, ...machineValues } : { ...nonSecretSuggestedValues, ...systemSecretSuggestedValues, ...machineValues, ...baseValues };
|
|
1602
1607
|
return {
|
|
1603
1608
|
...scopedValues,
|
|
1604
1609
|
...overrides
|
|
@@ -20,7 +20,7 @@ export declare function createBranchPreviewDeployTarget(branchName: any): {
|
|
|
20
20
|
};
|
|
21
21
|
export declare function scopeFromTarget(target: any): any;
|
|
22
22
|
export declare function deployTargetLabel(scopeOrTarget?: string): any;
|
|
23
|
-
export declare function buildPublicVars(deployConfig: any): {
|
|
23
|
+
export declare function buildPublicVars(deployConfig: any, options?: {}): {
|
|
24
24
|
TREESEED_HOSTING_KIND: any;
|
|
25
25
|
TREESEED_HOSTING_REGISTRATION: any;
|
|
26
26
|
TREESEED_HUB_MODE: any;
|
|
@@ -874,6 +874,79 @@ export declare function validateDestroyPrerequisites(tenantRoot: any, { requireR
|
|
|
874
874
|
enabled: boolean;
|
|
875
875
|
};
|
|
876
876
|
};
|
|
877
|
+
export declare function shouldDeleteRailwayProjectAfterEnvironmentDestroy(project: any, scope: any, deleteData: any, deletedEnvironmentId?: null): boolean;
|
|
878
|
+
export declare function destroyTreeseedEnvironmentResources(tenantRoot: any, options?: {}): Promise<{
|
|
879
|
+
target: {
|
|
880
|
+
kind: string;
|
|
881
|
+
scope: string;
|
|
882
|
+
} | {
|
|
883
|
+
kind: string;
|
|
884
|
+
branchName: string;
|
|
885
|
+
};
|
|
886
|
+
deleteData: boolean;
|
|
887
|
+
summary: {
|
|
888
|
+
target: any;
|
|
889
|
+
identity: any;
|
|
890
|
+
workerName: any;
|
|
891
|
+
siteUrl: any;
|
|
892
|
+
accountId: any;
|
|
893
|
+
pages: any;
|
|
894
|
+
formGuardKv: any;
|
|
895
|
+
sessionKv: any;
|
|
896
|
+
siteDataDb: any;
|
|
897
|
+
queue: any;
|
|
898
|
+
content: any;
|
|
899
|
+
resources: {
|
|
900
|
+
pagesProject: any;
|
|
901
|
+
contentBucket: any;
|
|
902
|
+
queue: any;
|
|
903
|
+
dlq: any;
|
|
904
|
+
database: any;
|
|
905
|
+
formGuardKv: any;
|
|
906
|
+
railwayProject: any;
|
|
907
|
+
webDomain: any;
|
|
908
|
+
apiDomain: any;
|
|
909
|
+
railwayServices: {
|
|
910
|
+
[k: string]: any;
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
webCache: {
|
|
914
|
+
webHost: any;
|
|
915
|
+
contentHost: any;
|
|
916
|
+
rulesManaged: boolean;
|
|
917
|
+
lastSyncedAt: any;
|
|
918
|
+
lastError: any;
|
|
919
|
+
policy: {
|
|
920
|
+
sourcePages: {
|
|
921
|
+
paths: string[];
|
|
922
|
+
browserTtlSeconds: number;
|
|
923
|
+
edgeTtlSeconds: number;
|
|
924
|
+
staleWhileRevalidateSeconds: number;
|
|
925
|
+
staleIfErrorSeconds: number;
|
|
926
|
+
};
|
|
927
|
+
contentPages: Required<import("../../platform/contracts.ts").TreeseedWebCachePolicyConfig>;
|
|
928
|
+
r2PublishedObjects: Required<import("../../platform/contracts.ts").TreeseedWebCachePolicyConfig>;
|
|
929
|
+
};
|
|
930
|
+
deployPurge: any;
|
|
931
|
+
contentPurge: any;
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
operations: {
|
|
935
|
+
cloudflare: any[];
|
|
936
|
+
railway: {
|
|
937
|
+
provider: any;
|
|
938
|
+
type: any;
|
|
939
|
+
name: any;
|
|
940
|
+
status: any;
|
|
941
|
+
}[];
|
|
942
|
+
local: {
|
|
943
|
+
provider: any;
|
|
944
|
+
type: any;
|
|
945
|
+
name: any;
|
|
946
|
+
status: any;
|
|
947
|
+
}[];
|
|
948
|
+
};
|
|
949
|
+
}>;
|
|
877
950
|
export declare function destroyCloudflareResources(tenantRoot: any, options?: {}): {
|
|
878
951
|
target: {
|
|
879
952
|
kind: string;
|
|
@@ -882,6 +955,7 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
|
|
|
882
955
|
kind: string;
|
|
883
956
|
branchName: string;
|
|
884
957
|
};
|
|
958
|
+
deleteData: boolean;
|
|
885
959
|
summary: {
|
|
886
960
|
target: any;
|
|
887
961
|
identity: any;
|
|
@@ -943,36 +1017,42 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
|
|
|
943
1017
|
id: any;
|
|
944
1018
|
preview: boolean;
|
|
945
1019
|
};
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
status:
|
|
957
|
-
id: any;
|
|
958
|
-
preview?: undefined;
|
|
959
|
-
} | {
|
|
960
|
-
status: string;
|
|
961
|
-
id: any;
|
|
962
|
-
preview: boolean;
|
|
963
|
-
} | null;
|
|
964
|
-
sessionPreview: {
|
|
965
|
-
status: string;
|
|
966
|
-
id: any;
|
|
967
|
-
preview?: undefined;
|
|
1020
|
+
database: {
|
|
1021
|
+
provider: any;
|
|
1022
|
+
type: any;
|
|
1023
|
+
name: any;
|
|
1024
|
+
status: any;
|
|
1025
|
+
};
|
|
1026
|
+
queue: {
|
|
1027
|
+
provider: any;
|
|
1028
|
+
type: any;
|
|
1029
|
+
name: any;
|
|
1030
|
+
status: any;
|
|
968
1031
|
} | {
|
|
969
|
-
status: string;
|
|
970
1032
|
id: any;
|
|
971
|
-
|
|
1033
|
+
provider: any;
|
|
1034
|
+
type: any;
|
|
1035
|
+
name: any;
|
|
1036
|
+
status: any;
|
|
1037
|
+
};
|
|
1038
|
+
dlq: {
|
|
1039
|
+
provider: any;
|
|
1040
|
+
type: any;
|
|
1041
|
+
name: any;
|
|
1042
|
+
status: any;
|
|
972
1043
|
} | null;
|
|
973
|
-
|
|
974
|
-
|
|
1044
|
+
legacyQueues: any;
|
|
1045
|
+
r2Bucket: {
|
|
1046
|
+
provider: any;
|
|
1047
|
+
type: any;
|
|
1048
|
+
name: any;
|
|
1049
|
+
status: any;
|
|
1050
|
+
};
|
|
1051
|
+
pages: {
|
|
1052
|
+
provider: any;
|
|
1053
|
+
type: any;
|
|
975
1054
|
name: any;
|
|
1055
|
+
status: any;
|
|
976
1056
|
};
|
|
977
1057
|
};
|
|
978
1058
|
};
|