@treeseed/sdk 0.5.3 → 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.
Files changed (66) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +46 -0
  3. package/dist/operations/providers/default.js +1 -1
  4. package/dist/operations/services/config-runtime.d.ts +49 -42
  5. package/dist/operations/services/config-runtime.js +449 -136
  6. package/dist/operations/services/deploy.d.ts +298 -0
  7. package/dist/operations/services/deploy.js +381 -137
  8. package/dist/operations/services/git-workflow.d.ts +9 -0
  9. package/dist/operations/services/git-workflow.js +32 -0
  10. package/dist/operations/services/github-api.d.ts +115 -0
  11. package/dist/operations/services/github-api.js +455 -0
  12. package/dist/operations/services/github-automation.d.ts +19 -33
  13. package/dist/operations/services/github-automation.js +44 -131
  14. package/dist/operations/services/key-agent.d.ts +20 -1
  15. package/dist/operations/services/key-agent.js +267 -102
  16. package/dist/operations/services/knowledge-coop-launch.d.ts +2 -3
  17. package/dist/operations/services/knowledge-coop-launch.js +26 -12
  18. package/dist/operations/services/project-platform.d.ts +157 -150
  19. package/dist/operations/services/project-platform.js +129 -26
  20. package/dist/operations/services/railway-api.d.ts +244 -0
  21. package/dist/operations/services/railway-api.js +882 -0
  22. package/dist/operations/services/railway-deploy.d.ts +171 -27
  23. package/dist/operations/services/railway-deploy.js +672 -172
  24. package/dist/operations/services/runtime-tools.d.ts +18 -0
  25. package/dist/operations/services/runtime-tools.js +19 -6
  26. package/dist/operations/services/workspace-preflight.js +2 -2
  27. package/dist/platform/contracts.d.ts +7 -0
  28. package/dist/platform/deploy-config.js +23 -0
  29. package/dist/platform/deploy-runtime.d.ts +1 -0
  30. package/dist/platform/deploy-runtime.js +7 -9
  31. package/dist/platform/env.yaml +10 -9
  32. package/dist/platform/environment.js +4 -0
  33. package/dist/platform/plugin.d.ts +6 -0
  34. package/dist/platform/plugins/constants.d.ts +1 -0
  35. package/dist/platform/plugins/constants.js +1 -0
  36. package/dist/platform/plugins/runtime.d.ts +4 -0
  37. package/dist/platform/plugins/runtime.js +8 -1
  38. package/dist/platform/published-content.js +27 -4
  39. package/dist/platform/tenant/runtime-config.js +33 -24
  40. package/dist/plugin-default.d.ts +1 -0
  41. package/dist/plugin-default.js +1 -0
  42. package/dist/reconcile/builtin-adapters.d.ts +3 -0
  43. package/dist/reconcile/builtin-adapters.js +2093 -0
  44. package/dist/reconcile/contracts.d.ts +155 -0
  45. package/dist/reconcile/contracts.js +0 -0
  46. package/dist/reconcile/desired-state.d.ts +179 -0
  47. package/dist/reconcile/desired-state.js +319 -0
  48. package/dist/reconcile/engine.d.ts +405 -0
  49. package/dist/reconcile/engine.js +356 -0
  50. package/dist/reconcile/errors.d.ts +5 -0
  51. package/dist/reconcile/errors.js +13 -0
  52. package/dist/reconcile/index.d.ts +7 -0
  53. package/dist/reconcile/index.js +7 -0
  54. package/dist/reconcile/registry.d.ts +7 -0
  55. package/dist/reconcile/registry.js +64 -0
  56. package/dist/reconcile/state.d.ts +7 -0
  57. package/dist/reconcile/state.js +303 -0
  58. package/dist/reconcile/units.d.ts +6 -0
  59. package/dist/reconcile/units.js +68 -0
  60. package/dist/scripts/config-treeseed.js +27 -19
  61. package/dist/scripts/tenant-deploy.js +35 -14
  62. package/dist/workflow/operations.js +127 -22
  63. package/dist/workflow-support.d.ts +3 -1
  64. package/dist/workflow-support.js +50 -0
  65. package/dist/workflow.d.ts +2 -0
  66. package/package.json +7 -1
@@ -1,3 +1,14 @@
1
+ export declare function resolveTreeseedResourceIdentity(deployConfig: any, target: any): {
2
+ teamId: string;
3
+ projectId: string;
4
+ slug: any;
5
+ environment: any;
6
+ deploymentKey: string;
7
+ environmentKey: string;
8
+ };
9
+ export declare function deriveTreeseedStagingSurfaceDomain(deployConfig: any, identity: any, surface: any): string | null;
10
+ export declare function resolveConfiguredSurfaceDomain(deployConfig: any, target: any, surface: any): any;
11
+ export declare function resolveConfiguredSurfaceBaseUrl(deployConfig: any, target: any, surface: any): any;
1
12
  export declare function normalizePersistentScope(scope?: string): string;
2
13
  export declare function createPersistentDeployTarget(scope?: string): {
3
14
  kind: string;
@@ -9,6 +20,64 @@ export declare function createBranchPreviewDeployTarget(branchName: any): {
9
20
  };
10
21
  export declare function scopeFromTarget(target: any): any;
11
22
  export declare function deployTargetLabel(scopeOrTarget?: string): any;
23
+ export declare function buildPublicVars(deployConfig: any): {
24
+ TREESEED_HOSTING_KIND: any;
25
+ TREESEED_HOSTING_REGISTRATION: any;
26
+ TREESEED_HUB_MODE: any;
27
+ TREESEED_RUNTIME_MODE: any;
28
+ TREESEED_RUNTIME_REGISTRATION: any;
29
+ TREESEED_MARKET_API_BASE_URL: any;
30
+ TREESEED_HOSTING_TEAM_ID: string;
31
+ TREESEED_PROJECT_ID: string;
32
+ TREESEED_AGENT_EXECUTION_PROVIDER: any;
33
+ TREESEED_AGENT_REPOSITORY_PROVIDER: any;
34
+ TREESEED_AGENT_VERIFICATION_PROVIDER: any;
35
+ TREESEED_CONTENT_RUNTIME_PROVIDER: any;
36
+ TREESEED_CONTENT_PUBLISH_PROVIDER: any;
37
+ TREESEED_CONTENT_SERVING_MODE: any;
38
+ TREESEED_CONTENT_DEFAULT_TEAM_ID: string;
39
+ TREESEED_CONTENT_MANIFEST_KEY: any;
40
+ TREESEED_CONTENT_MANIFEST_KEY_TEMPLATE: any;
41
+ TREESEED_CONTENT_PREVIEW_ROOT_TEMPLATE: any;
42
+ TREESEED_EDITORIAL_PREVIEW_ROOT: any;
43
+ TREESEED_EDITORIAL_PREVIEW_TTL_HOURS: string;
44
+ TREESEED_CONTENT_BUCKET_NAME: any;
45
+ TREESEED_CONTENT_PUBLIC_BASE_URL: any;
46
+ TREESEED_WORKER_POOL_SCALER: string;
47
+ TREESEED_WORKDAY_TIMEZONE: string;
48
+ TREESEED_WORKDAY_WINDOWS_JSON: string;
49
+ TREESEED_WORKDAY_TASK_CREDIT_BUDGET: string;
50
+ TREESEED_MANAGER_MAX_QUEUED_TASKS: string;
51
+ TREESEED_MANAGER_MAX_QUEUED_CREDITS: string;
52
+ TREESEED_MANAGER_PRIORITY_MODELS: string;
53
+ TREESEED_TASK_CREDIT_WEIGHTS_JSON: string;
54
+ TREESEED_AGENT_POOL_MIN_WORKERS: string;
55
+ TREESEED_AGENT_POOL_MAX_WORKERS: string;
56
+ TREESEED_AGENT_POOL_TARGET_QUEUE_DEPTH: string;
57
+ TREESEED_AGENT_POOL_COOLDOWN_SECONDS: string;
58
+ TREESEED_RAILWAY_PROJECT_ID: any;
59
+ TREESEED_RAILWAY_ENVIRONMENT_ID: string;
60
+ TREESEED_RAILWAY_WORKER_SERVICE_ID: any;
61
+ TREESEED_PUBLIC_TURNSTILE_SITE_KEY: string;
62
+ TREESEED_WEB_CACHE_SOURCE_BROWSER_TTL_SECONDS: string;
63
+ TREESEED_WEB_CACHE_SOURCE_EDGE_TTL_SECONDS: string;
64
+ TREESEED_WEB_CACHE_SOURCE_STALE_WHILE_REVALIDATE_SECONDS: string;
65
+ TREESEED_WEB_CACHE_SOURCE_STALE_IF_ERROR_SECONDS: string;
66
+ TREESEED_WEB_CACHE_CONTENT_BROWSER_TTL_SECONDS: string;
67
+ TREESEED_WEB_CACHE_CONTENT_EDGE_TTL_SECONDS: string;
68
+ TREESEED_WEB_CACHE_CONTENT_STALE_WHILE_REVALIDATE_SECONDS: string;
69
+ TREESEED_WEB_CACHE_CONTENT_STALE_IF_ERROR_SECONDS: string;
70
+ TREESEED_WEB_CACHE_R2_BROWSER_TTL_SECONDS: string;
71
+ TREESEED_WEB_CACHE_R2_EDGE_TTL_SECONDS: string;
72
+ TREESEED_WEB_CACHE_R2_STALE_WHILE_REVALIDATE_SECONDS: string;
73
+ TREESEED_WEB_CACHE_R2_STALE_IF_ERROR_SECONDS: string;
74
+ };
75
+ export declare function buildSecretMap(deployConfig: any, state: any): {
76
+ TREESEED_FORM_TOKEN_SECRET: any;
77
+ TREESEED_EDITORIAL_PREVIEW_SECRET: any;
78
+ TREESEED_TURNSTILE_SECRET_KEY: string | null;
79
+ TREESEED_SMTP_PASSWORD: string | null;
80
+ };
12
81
  export declare function loadDeployState(tenantRoot: any, deployConfig: any, options?: {}): any;
13
82
  export declare function writeDeployState(tenantRoot: any, state: any, options?: {}): void;
14
83
  export declare function resolveGeneratedWranglerPath(tenantRoot: any, options?: {}): string;
@@ -80,6 +149,7 @@ export declare function ensureGeneratedWranglerConfig(tenantRoot: any, options?:
80
149
  research: string;
81
150
  };
82
151
  deploy: string;
152
+ dns: string;
83
153
  content: {
84
154
  runtime: string;
85
155
  publish: string;
@@ -95,6 +165,23 @@ export declare function ensureGeneratedWranglerConfig(tenantRoot: any, options?:
95
165
  rootDir: string | undefined;
96
166
  publicBaseUrl: string | undefined;
97
167
  localBaseUrl: string | undefined;
168
+ environments: {
169
+ local: {
170
+ baseUrl: string | undefined;
171
+ domain: string | undefined;
172
+ railwayEnvironment: string | undefined;
173
+ };
174
+ staging: {
175
+ baseUrl: string | undefined;
176
+ domain: string | undefined;
177
+ railwayEnvironment: string | undefined;
178
+ };
179
+ prod: {
180
+ baseUrl: string | undefined;
181
+ domain: string | undefined;
182
+ railwayEnvironment: string | undefined;
183
+ };
184
+ } | undefined;
98
185
  cache: {
99
186
  sourcePages: {
100
187
  browserTtlSeconds: number | undefined;
@@ -178,6 +265,148 @@ export declare function ensureGeneratedWranglerConfig(tenantRoot: any, options?:
178
265
  branchName: string;
179
266
  };
180
267
  };
268
+ export declare function runWrangler(args: any, { cwd, allowFailure, json, capture, env, input }?: {
269
+ allowFailure?: boolean | undefined;
270
+ json?: boolean | undefined;
271
+ capture?: boolean | undefined;
272
+ env?: {} | undefined;
273
+ }): import("child_process").SpawnSyncReturns<string>;
274
+ export declare function isWranglerAlreadyExistsError(error: any, matchers: RegExp[]): boolean;
275
+ export declare function listKvNamespaces(tenantRoot: any, env: any): any;
276
+ export declare function listD1Databases(tenantRoot: any, env: any): any;
277
+ export declare function listQueues(tenantRoot: any, env: any): any;
278
+ export declare function listR2Buckets(tenantRoot: any, env: any): any;
279
+ export declare function listPagesProjects(tenantRoot: any, env: any): any;
280
+ export declare function buildProvisioningSummary(deployConfig: any, state: any, target: any): {
281
+ target: any;
282
+ identity: any;
283
+ workerName: any;
284
+ siteUrl: any;
285
+ accountId: any;
286
+ pages: any;
287
+ formGuardKv: any;
288
+ sessionKv: any;
289
+ siteDataDb: any;
290
+ queue: any;
291
+ content: any;
292
+ resources: {
293
+ pagesProject: any;
294
+ contentBucket: any;
295
+ queue: any;
296
+ dlq: any;
297
+ database: any;
298
+ formGuardKv: any;
299
+ sessionKv: any;
300
+ railwayProject: any;
301
+ webDomain: any;
302
+ apiDomain: any;
303
+ railwayServices: {
304
+ [k: string]: any;
305
+ };
306
+ };
307
+ webCache: {
308
+ webHost: any;
309
+ contentHost: any;
310
+ rulesManaged: boolean;
311
+ lastSyncedAt: any;
312
+ lastError: any;
313
+ policy: {
314
+ sourcePages: {
315
+ paths: string[];
316
+ browserTtlSeconds: number;
317
+ edgeTtlSeconds: number;
318
+ staleWhileRevalidateSeconds: number;
319
+ staleIfErrorSeconds: number;
320
+ };
321
+ contentPages: Required<import("../../platform/contracts.ts").TreeseedWebCachePolicyConfig>;
322
+ r2PublishedObjects: Required<import("../../platform/contracts.ts").TreeseedWebCachePolicyConfig>;
323
+ };
324
+ deployPurge: any;
325
+ contentPurge: any;
326
+ };
327
+ };
328
+ export declare function cloudflareApiRequest(path: any, { method, body, env, allowFailure }?: {
329
+ method?: string | undefined;
330
+ allowFailure?: boolean | undefined;
331
+ }): any;
332
+ export declare function resolveCloudflareZoneIdForHost(deployConfig: any, host: any, env: any): any;
333
+ export declare function reconcileCloudflareWebCacheRules(tenantRoot: any, deployConfig: any, state: any, target: any, { dryRun, env: providedEnv }?: {
334
+ dryRun?: boolean | undefined;
335
+ }): {
336
+ managed: boolean;
337
+ skipped: boolean;
338
+ reason: string;
339
+ results?: undefined;
340
+ error?: undefined;
341
+ } | {
342
+ managed: boolean;
343
+ results: ({
344
+ managed: boolean;
345
+ skipped: boolean;
346
+ reason: string;
347
+ dryRun?: undefined;
348
+ zoneId?: undefined;
349
+ host?: undefined;
350
+ rules?: undefined;
351
+ rulesetId?: undefined;
352
+ } | {
353
+ managed: boolean;
354
+ dryRun: boolean;
355
+ zoneId: any;
356
+ host: any;
357
+ rules: ({
358
+ description: string;
359
+ expression: string;
360
+ action: string;
361
+ action_parameters: {
362
+ cache: boolean;
363
+ edge_ttl?: undefined;
364
+ browser_ttl?: undefined;
365
+ };
366
+ enabled: boolean;
367
+ } | {
368
+ description: string;
369
+ expression: string;
370
+ action: string;
371
+ action_parameters: {
372
+ cache: boolean;
373
+ edge_ttl: {
374
+ mode: string;
375
+ default: number;
376
+ };
377
+ browser_ttl: {
378
+ mode: string;
379
+ default: number;
380
+ };
381
+ };
382
+ enabled: boolean;
383
+ })[];
384
+ skipped?: undefined;
385
+ reason?: undefined;
386
+ rulesetId?: undefined;
387
+ } | {
388
+ managed: boolean;
389
+ zoneId: any;
390
+ host: any;
391
+ rulesetId: any;
392
+ skipped?: undefined;
393
+ reason?: undefined;
394
+ dryRun?: undefined;
395
+ rules?: undefined;
396
+ })[];
397
+ skipped?: undefined;
398
+ reason?: undefined;
399
+ error?: undefined;
400
+ } | {
401
+ managed: boolean;
402
+ skipped: boolean;
403
+ reason: string;
404
+ error: string;
405
+ results?: undefined;
406
+ };
407
+ export declare function queueName(entry: any): any;
408
+ export declare function queueId(entry: any): any;
409
+ export declare function hasProvisionedCloudflareResources(state: any): boolean;
181
410
  export declare function purgeSourcePageCaches(tenantRoot: any, options?: {}): {
182
411
  skipped: any;
183
412
  urls: (string | null)[];
@@ -204,6 +433,7 @@ export declare function purgePublishedContentCaches(tenantRoot: any, urls: any,
204
433
  }[];
205
434
  skipped?: undefined;
206
435
  };
436
+ export declare function resolveConfiguredCloudflareAccountId(deployConfig: any): any;
207
437
  export declare function collectMissingDeployInputs(tenantRoot: any): {
208
438
  key: string;
209
439
  label: string;
@@ -280,6 +510,7 @@ export declare function validateDeployPrerequisites(tenantRoot: any, { requireRe
280
510
  research: string;
281
511
  };
282
512
  deploy: string;
513
+ dns: string;
283
514
  content: {
284
515
  runtime: string;
285
516
  publish: string;
@@ -295,6 +526,23 @@ export declare function validateDeployPrerequisites(tenantRoot: any, { requireRe
295
526
  rootDir: string | undefined;
296
527
  publicBaseUrl: string | undefined;
297
528
  localBaseUrl: string | undefined;
529
+ environments: {
530
+ local: {
531
+ baseUrl: string | undefined;
532
+ domain: string | undefined;
533
+ railwayEnvironment: string | undefined;
534
+ };
535
+ staging: {
536
+ baseUrl: string | undefined;
537
+ domain: string | undefined;
538
+ railwayEnvironment: string | undefined;
539
+ };
540
+ prod: {
541
+ baseUrl: string | undefined;
542
+ domain: string | undefined;
543
+ railwayEnvironment: string | undefined;
544
+ };
545
+ } | undefined;
298
546
  cache: {
299
547
  sourcePages: {
300
548
  browserTtlSeconds: number | undefined;
@@ -435,6 +683,7 @@ export declare function validateDestroyPrerequisites(tenantRoot: any, { requireR
435
683
  research: string;
436
684
  };
437
685
  deploy: string;
686
+ dns: string;
438
687
  content: {
439
688
  runtime: string;
440
689
  publish: string;
@@ -450,6 +699,23 @@ export declare function validateDestroyPrerequisites(tenantRoot: any, { requireR
450
699
  rootDir: string | undefined;
451
700
  publicBaseUrl: string | undefined;
452
701
  localBaseUrl: string | undefined;
702
+ environments: {
703
+ local: {
704
+ baseUrl: string | undefined;
705
+ domain: string | undefined;
706
+ railwayEnvironment: string | undefined;
707
+ };
708
+ staging: {
709
+ baseUrl: string | undefined;
710
+ domain: string | undefined;
711
+ railwayEnvironment: string | undefined;
712
+ };
713
+ prod: {
714
+ baseUrl: string | undefined;
715
+ domain: string | undefined;
716
+ railwayEnvironment: string | undefined;
717
+ };
718
+ } | undefined;
453
719
  cache: {
454
720
  sourcePages: {
455
721
  browserTtlSeconds: number | undefined;
@@ -533,6 +799,7 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
533
799
  };
534
800
  summary: {
535
801
  target: any;
802
+ identity: any;
536
803
  workerName: any;
537
804
  siteUrl: any;
538
805
  accountId: any;
@@ -542,6 +809,21 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
542
809
  siteDataDb: any;
543
810
  queue: any;
544
811
  content: any;
812
+ resources: {
813
+ pagesProject: any;
814
+ contentBucket: any;
815
+ queue: any;
816
+ dlq: any;
817
+ database: any;
818
+ formGuardKv: any;
819
+ sessionKv: any;
820
+ railwayProject: any;
821
+ webDomain: any;
822
+ apiDomain: any;
823
+ railwayServices: {
824
+ [k: string]: any;
825
+ };
826
+ };
545
827
  webCache: {
546
828
  webHost: any;
547
829
  contentHost: any;
@@ -613,6 +895,7 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
613
895
  export declare function cleanupDestroyedState(tenantRoot: any, options?: {}): void;
614
896
  export declare function provisionCloudflareResources(tenantRoot: any, options?: {}): {
615
897
  target: any;
898
+ identity: any;
616
899
  workerName: any;
617
900
  siteUrl: any;
618
901
  accountId: any;
@@ -622,6 +905,21 @@ export declare function provisionCloudflareResources(tenantRoot: any, options?:
622
905
  siteDataDb: any;
623
906
  queue: any;
624
907
  content: any;
908
+ resources: {
909
+ pagesProject: any;
910
+ contentBucket: any;
911
+ queue: any;
912
+ dlq: any;
913
+ database: any;
914
+ formGuardKv: any;
915
+ sessionKv: any;
916
+ railwayProject: any;
917
+ webDomain: any;
918
+ apiDomain: any;
919
+ railwayServices: {
920
+ [k: string]: any;
921
+ };
922
+ };
625
923
  webCache: {
626
924
  webHost: any;
627
925
  contentHost: any;