@treeseed/sdk 0.12.4 → 0.12.5

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.
@@ -156,6 +156,7 @@ function nodeTypeScriptAdapter(pkg) {
156
156
  type: stringValue(manifest?.type) ?? null,
157
157
  githubEnvironments: stringArray(manifest?.githubEnvironments),
158
158
  requiredSecrets: stringArray(manifest?.requiredSecrets),
159
+ requiredVariables: stringArray(manifest?.requiredVariables),
159
160
  workflowTemplateVersion: stringValue(manifest?.workflowTemplateVersion) ?? null,
160
161
  localDev: stringRecord(manifest?.localDev),
161
162
  capacityProvider: stringRecord(manifest?.capacityProvider),
@@ -269,6 +270,7 @@ function beamPackageAdapter(root, dir) {
269
270
  type: stringValue(manifest?.type) ?? null,
270
271
  githubEnvironments: stringArray(manifest?.githubEnvironments),
271
272
  requiredSecrets: stringArray(manifest?.requiredSecrets),
273
+ requiredVariables: stringArray(manifest?.requiredVariables),
272
274
  workflowTemplateVersion: stringValue(manifest?.workflowTemplateVersion) ?? null,
273
275
  ...projectArchitecture ? {
274
276
  projectArchitecture,
@@ -11,6 +11,9 @@ export type TreeseedPackageUnit = {
11
11
  manifestPath: string | null;
12
12
  repository: string | null;
13
13
  releaseCapability: 'npm' | 'image' | 'deploy-only' | 'none';
14
+ requiredSecrets: string[];
15
+ requiredVariables: string[];
16
+ githubEnvironments: string[];
14
17
  };
15
18
  export type TreeseedTemplateUnit = {
16
19
  id: string;
@@ -23,7 +26,7 @@ export type TreeseedTemplateUnit = {
23
26
  releaseTag: string | null;
24
27
  recordPath: string;
25
28
  };
26
- export type TreeseedDesiredResourceKind = 'package-manifest' | 'template-manifest' | 'package-workflow' | 'package-image' | 'github-environment' | 'github-secret-binding' | 'docker-image-build' | 'cloudflare-resource' | 'railway-project' | 'railway-environment' | 'railway-service' | 'railway-volume' | 'railway-domain' | 'local-process' | 'local-docker-compose' | 'local-treedx' | 'local-content-materialization' | 'capacity-provider' | 'branch-preview' | 'branch-preview-cleanup' | 'workflow-gate' | 'save-gate' | 'release-gate';
29
+ export type TreeseedDesiredResourceKind = 'package-manifest' | 'template-manifest' | 'package-workflow' | 'package-image' | 'github-environment' | 'github-secret-binding' | 'github-variable-binding' | 'docker-image-build' | 'cloudflare-resource' | 'railway-project' | 'railway-environment' | 'railway-service' | 'railway-volume' | 'railway-domain' | 'local-process' | 'local-docker-compose' | 'local-treedx' | 'local-content-materialization' | 'capacity-provider' | 'branch-preview' | 'branch-preview-cleanup' | 'workflow-gate' | 'save-gate' | 'release-gate';
27
30
  export type TreeseedDesiredResource = {
28
31
  id: string;
29
32
  kind: TreeseedDesiredResourceKind;
@@ -77,7 +77,10 @@ function packageUnitFromAdapter(adapter) {
77
77
  publishTarget: adapter.publishTarget,
78
78
  manifestPath: adapter.manifestPath,
79
79
  repository: typeof adapter.metadata.repository === "string" ? adapter.metadata.repository : null,
80
- releaseCapability: packageReleaseCapability(adapter)
80
+ releaseCapability: packageReleaseCapability(adapter),
81
+ requiredSecrets: Array.isArray(adapter.metadata.requiredSecrets) ? adapter.metadata.requiredSecrets : [],
82
+ requiredVariables: Array.isArray(adapter.metadata.requiredVariables) ? adapter.metadata.requiredVariables : [],
83
+ githubEnvironments: Array.isArray(adapter.metadata.githubEnvironments) ? adapter.metadata.githubEnvironments : []
81
84
  };
82
85
  }
83
86
  function templateReleaseTag(manifest) {
@@ -251,6 +254,7 @@ function packageResources(adapter, environment) {
251
254
  type: adapter.metadata.type ?? null,
252
255
  releaseCapability: packageReleaseCapability(adapter),
253
256
  requiredSecrets: adapter.metadata.requiredSecrets ?? [],
257
+ requiredVariables: adapter.metadata.requiredVariables ?? [],
254
258
  githubEnvironments: adapter.metadata.githubEnvironments ?? []
255
259
  },
256
260
  source: { type: "package-adapter", id: packageId }
@@ -317,6 +321,28 @@ function packageResources(adapter, environment) {
317
321
  source: { type: "package-adapter", id: packageId }
318
322
  });
319
323
  }
324
+ for (const variableName of Array.isArray(adapter.metadata.requiredVariables) ? adapter.metadata.requiredVariables : []) {
325
+ if (typeof variableName !== "string" || !variableName.trim()) continue;
326
+ resources.push({
327
+ id: `github-variable-binding:${packageId}:${environmentName}:${variableName}`,
328
+ kind: "github-variable-binding",
329
+ provider: "github",
330
+ environment,
331
+ packageId,
332
+ serviceId: null,
333
+ logicalName: `${packageId} ${environmentName} ${variableName}`,
334
+ dependencies: [`github-environment:${packageId}:${environmentName}`],
335
+ spec: {
336
+ packageId,
337
+ packageRoot: adapter.dir,
338
+ repository,
339
+ environment: environmentName,
340
+ variableName,
341
+ envName: variableName
342
+ },
343
+ source: { type: "package-adapter", id: packageId }
344
+ });
345
+ }
320
346
  }
321
347
  }
322
348
  for (const artifact of adapter.artifacts) {
@@ -704,6 +730,11 @@ function releaseGateResources(packages, templates, environment) {
704
730
  source: { type: "package-adapter", id: pkg.id }
705
731
  };
706
732
  const publishGateKind = pkg.releaseCapability === "npm" ? "release-gate:npm-publish" : pkg.releaseCapability === "image" ? "release-gate:image-publish" : null;
733
+ const imageCredentialDependencies = publishGateKind === "release-gate:image-publish" && pkg.githubEnvironments.includes(hostedEnvironment) ? [
734
+ ...pkg.requiredSecrets.map((secretName) => `github-secret-binding:${pkg.id}:${hostedEnvironment}:${secretName}`),
735
+ ...pkg.requiredVariables.map((variableName) => `github-variable-binding:${pkg.id}:${hostedEnvironment}:${variableName}`)
736
+ ] : [];
737
+ const publishDependencies = publishGateKind === "release-gate:image-publish" ? [verifyGate.id, ...imageCredentialDependencies] : [verifyGate.id];
707
738
  return [
708
739
  verifyGate,
709
740
  ...publishGateKind ? [{
@@ -714,7 +745,7 @@ function releaseGateResources(packages, templates, environment) {
714
745
  packageId: pkg.id,
715
746
  serviceId: null,
716
747
  logicalName: `${pkg.id} publish gate`,
717
- dependencies: [verifyGate.id],
748
+ dependencies: publishDependencies,
718
749
  spec: {
719
750
  gateKind: publishGateKind,
720
751
  phase,
@@ -4943,7 +4943,7 @@ async function runReleaseGateReconcileFacade(operation, helpers, root, target, i
4943
4943
  provider: ["treeseed"]
4944
4944
  };
4945
4945
  const desiredGraph = compileTreeseedDesiredResourceGraph({ tenantRoot: root, target });
4946
- const rawUnits = compileTreeseedDesiredUnitsFromGraph(desiredGraph).filter((unit) => unit.provider === "treeseed" && (unit.unitType === "package-manifest" || unit.unitType.startsWith("release-gate:")));
4946
+ const rawUnits = compileTreeseedDesiredUnitsFromGraph(desiredGraph).filter((unit) => unit.provider === "treeseed" && (unit.unitType === "package-manifest" || unit.unitType.startsWith("release-gate:")) || unit.provider === "github" && (unit.unitType === "github-environment" || unit.unitType === "github-secret-binding" || unit.unitType === "github-variable-binding"));
4947
4947
  const rawUnitIds = new Set(rawUnits.map((unit) => unit.unitId));
4948
4948
  const units = rawUnits.map((unit) => ({
4949
4949
  ...unit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {