@alienplatform/core 1.10.7 → 1.11.1

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 (106) hide show
  1. package/.turbo/turbo-build.log +17 -17
  2. package/dist/index.d.ts +2024 -237
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +109 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/stack.js +422 -38
  7. package/dist/stack.js.map +1 -1
  8. package/dist/tests/index.d.ts +2 -2
  9. package/dist/tests/index.d.ts.map +1 -1
  10. package/dist/tests/index.js +1 -1
  11. package/package.json +1 -1
  12. package/src/__tests__/stack.test.ts +25 -0
  13. package/src/container.ts +10 -0
  14. package/src/daemon.ts +10 -0
  15. package/src/generated/index.ts +42 -0
  16. package/src/generated/schemas/alienEvent.json +1 -1
  17. package/src/generated/schemas/auroraPostgresHeartbeatData.json +1 -0
  18. package/src/generated/schemas/awsComputeClusterHeartbeatData.json +1 -1
  19. package/src/generated/schemas/awsDaemonHeartbeatData.json +1 -1
  20. package/src/generated/schemas/awsPostgresImportData.json +1 -0
  21. package/src/generated/schemas/azureComputeClusterHeartbeatData.json +1 -1
  22. package/src/generated/schemas/azureDaemonHeartbeatData.json +1 -1
  23. package/src/generated/schemas/azureFlexibleServerPostgresHeartbeatData.json +1 -0
  24. package/src/generated/schemas/azureFlexibleServerPostgresImportData.json +1 -0
  25. package/src/generated/schemas/azureVnetNetworkHeartbeatData.json +1 -1
  26. package/src/generated/schemas/computeCapacityGroupStatus.json +1 -1
  27. package/src/generated/schemas/computeClusterHeartbeatData.json +1 -1
  28. package/src/generated/schemas/computeDrainBlocker.json +1 -0
  29. package/src/generated/schemas/computeDrainProgress.json +1 -0
  30. package/src/generated/schemas/computeDrainProgressStatus.json +1 -0
  31. package/src/generated/schemas/container.json +1 -1
  32. package/src/generated/schemas/daemon.json +1 -1
  33. package/src/generated/schemas/daemonHeartbeatData.json +1 -1
  34. package/src/generated/schemas/deploymentStatus.json +1 -1
  35. package/src/generated/schemas/domainSettings.json +1 -1
  36. package/src/generated/schemas/eventChange.json +1 -1
  37. package/src/generated/schemas/gcpCloudSqlPostgresHeartbeatData.json +1 -0
  38. package/src/generated/schemas/gcpComputeClusterHeartbeatData.json +1 -1
  39. package/src/generated/schemas/gcpDaemonHeartbeatData.json +1 -1
  40. package/src/generated/schemas/gcpPostgresImportData.json +1 -0
  41. package/src/generated/schemas/localDaemonHeartbeatData.json +1 -1
  42. package/src/generated/schemas/localPostgresHeartbeatData.json +1 -0
  43. package/src/generated/schemas/machinesComputeClusterHeartbeatData.json +1 -0
  44. package/src/generated/schemas/machinesComputeMachineStatus.json +1 -0
  45. package/src/generated/schemas/machinesDaemonHeartbeatData.json +1 -0
  46. package/src/generated/schemas/networkHeartbeatData.json +1 -1
  47. package/src/generated/schemas/networkSettings.json +1 -1
  48. package/src/generated/schemas/observedInventoryBatch.json +1 -0
  49. package/src/generated/schemas/observedResourceSample.json +1 -0
  50. package/src/generated/schemas/platform.json +1 -1
  51. package/src/generated/schemas/postgres.json +1 -0
  52. package/src/generated/schemas/postgresBackend.json +1 -0
  53. package/src/generated/schemas/postgresHeartbeatData.json +1 -0
  54. package/src/generated/schemas/postgresHeartbeatStatus.json +1 -0
  55. package/src/generated/schemas/postgresOutputs.json +1 -0
  56. package/src/generated/schemas/publicEndpointTargetSettings.json +1 -0
  57. package/src/generated/schemas/resourceHeartbeat.json +1 -1
  58. package/src/generated/schemas/resourceHeartbeatData.json +1 -1
  59. package/src/generated/schemas/stack.json +1 -1
  60. package/src/generated/schemas/stackImportRequest.json +1 -1
  61. package/src/generated/schemas/stackImportResponse.json +1 -1
  62. package/src/generated/schemas/stackInputDefinition.json +1 -1
  63. package/src/generated/schemas/stackResourceState.json +1 -1
  64. package/src/generated/schemas/stackSettings.json +1 -1
  65. package/src/generated/schemas/stackState.json +1 -1
  66. package/src/generated/zod/agent-status-schema.ts +1 -1
  67. package/src/generated/zod/aurora-postgres-heartbeat-data-schema.ts +20 -0
  68. package/src/generated/zod/aws-daemon-heartbeat-data-schema.ts +1 -1
  69. package/src/generated/zod/aws-postgres-import-data-schema.ts +23 -0
  70. package/src/generated/zod/azure-daemon-heartbeat-data-schema.ts +1 -1
  71. package/src/generated/zod/azure-flexible-server-postgres-heartbeat-data-schema.ts +18 -0
  72. package/src/generated/zod/azure-flexible-server-postgres-import-data-schema.ts +25 -0
  73. package/src/generated/zod/azure-vnet-network-heartbeat-data-schema.ts +1 -0
  74. package/src/generated/zod/compute-capacity-group-status-schema.ts +4 -0
  75. package/src/generated/zod/compute-cluster-heartbeat-data-schema.ts +3 -0
  76. package/src/generated/zod/compute-drain-blocker-schema.ts +16 -0
  77. package/src/generated/zod/compute-drain-progress-schema.ts +26 -0
  78. package/src/generated/zod/compute-drain-progress-status-schema.ts +10 -0
  79. package/src/generated/zod/container-schema.ts +2 -1
  80. package/src/generated/zod/daemon-heartbeat-data-schema.ts +3 -0
  81. package/src/generated/zod/daemon-schema.ts +2 -1
  82. package/src/generated/zod/deployment-status-schema.ts +2 -2
  83. package/src/generated/zod/domain-settings-schema.ts +5 -1
  84. package/src/generated/zod/gcp-cloud-sql-postgres-heartbeat-data-schema.ts +18 -0
  85. package/src/generated/zod/gcp-daemon-heartbeat-data-schema.ts +1 -1
  86. package/src/generated/zod/gcp-postgres-import-data-schema.ts +23 -0
  87. package/src/generated/zod/index.ts +42 -0
  88. package/src/generated/zod/local-daemon-heartbeat-data-schema.ts +1 -1
  89. package/src/generated/zod/local-postgres-heartbeat-data-schema.ts +19 -0
  90. package/src/generated/zod/machines-compute-cluster-heartbeat-data-schema.ts +36 -0
  91. package/src/generated/zod/machines-compute-machine-status-schema.ts +30 -0
  92. package/src/generated/zod/machines-daemon-heartbeat-data-schema.ts +35 -0
  93. package/src/generated/zod/network-settings-schema.ts +1 -0
  94. package/src/generated/zod/observed-inventory-batch-schema.ts +27 -0
  95. package/src/generated/zod/observed-resource-sample-schema.ts +54 -0
  96. package/src/generated/zod/platform-schema.ts +1 -1
  97. package/src/generated/zod/postgres-backend-schema.ts +15 -0
  98. package/src/generated/zod/postgres-heartbeat-data-schema.ts +22 -0
  99. package/src/generated/zod/postgres-heartbeat-status-schema.ts +26 -0
  100. package/src/generated/zod/postgres-outputs-schema.ts +17 -0
  101. package/src/generated/zod/postgres-schema.ts +24 -0
  102. package/src/generated/zod/public-endpoint-target-settings-schema.ts +18 -0
  103. package/src/generated/zod/resource-heartbeat-data-schema.ts +6 -0
  104. package/src/generated/zod/resource-heartbeat-schema.ts +1 -1
  105. package/src/index.ts +5 -0
  106. package/src/postgres.ts +107 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { ComputeDrainBlockerSchema } from "./compute-drain-blocker-schema.js";
8
+
9
+ export const MachinesComputeMachineStatusSchema = z.object({
10
+ "capacityGroup": z.string(),
11
+ "cpuCores": z.number().nullish(),
12
+ get "drainBlockers"(){
13
+ return z.array(ComputeDrainBlockerSchema).optional()
14
+ },
15
+ "drainDeadlineAt": z.string().nullish(),
16
+ "drainForce": z.boolean(),
17
+ "drainRequestedAt": z.string().nullish(),
18
+ "drainedAt": z.string().nullish(),
19
+ "horizondVersion": z.string().nullish(),
20
+ "lastHeartbeat": z.string(),
21
+ "machineId": z.string(),
22
+ "memoryBytes": z.int().nullish(),
23
+ "overlayIp": z.string().nullish(),
24
+ "publicIp": z.string().nullish(),
25
+ "replicaCount": z.int(),
26
+ "status": z.string(),
27
+ "zone": z.string()
28
+ })
29
+
30
+ export type MachinesComputeMachineStatus = z.infer<typeof MachinesComputeMachineStatusSchema>
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { ManagedRuntimeEventSnapshotSchema } from "./managed-runtime-event-snapshot-schema.js";
8
+ import { ManagedRuntimeUnitStatusSchema } from "./managed-runtime-unit-status-schema.js";
9
+ import { WorkloadHeartbeatStatusSchema } from "./workload-heartbeat-status-schema.js";
10
+
11
+ export const MachinesDaemonHeartbeatDataSchema = z.object({
12
+ "assignedMachines": z.int().min(0),
13
+ "capacityGroup": z.string(),
14
+ "commandSupported": z.boolean(),
15
+ get "daemonInstances"(){
16
+ return z.array(ManagedRuntimeUnitStatusSchema)
17
+ },
18
+ "daemonName": z.optional(z.string()),
19
+ "desiredMachines": z.int().min(0),
20
+ get "events"(){
21
+ return z.array(ManagedRuntimeEventSnapshotSchema)
22
+ },
23
+ "healthyInstances": z.int().min(0),
24
+ "horizonClusterId": z.string(),
25
+ "horizonStatus": z.string(),
26
+ "horizonStatusMessage": z.string().nullish(),
27
+ "horizonStatusReason": z.string().nullish(),
28
+ "latestUpdateTimestamp": z.string(),
29
+ get "status"(){
30
+ return WorkloadHeartbeatStatusSchema
31
+ },
32
+ "unavailableInstances": z.int().min(0)
33
+ })
34
+
35
+ export type MachinesDaemonHeartbeatData = z.infer<typeof MachinesDaemonHeartbeatDataSchema>
@@ -27,6 +27,7 @@ export const NetworkSettingsSchema = z.union([z.object({
27
27
  "type": z.enum(["byo-vpc-gcp"])
28
28
  }), z.object({
29
29
  "application_gateway_subnet_name": z.string().describe("Name of the dedicated classic Application Gateway subnet within the VNet.").nullish(),
30
+ "private_endpoint_subnet_name": z.string().describe("Name of the dedicated subnet that hosts Private Endpoints (e.g. for a\nPostgres Flexible Server). A Private Endpoint must not share the private\nsubnet, which is already claimed by the Container Apps environment's\n`infrastructure_subnet_id`. Required only when the stack contains a\nPostgres resource; otherwise unused.").nullish(),
30
31
  "private_subnet_name": z.string().describe("Name of the private subnet within the VNet"),
31
32
  "public_subnet_name": z.string().describe("Name of the public subnet within the VNet"),
32
33
  "type": z.enum(["byo-vnet-azure"]),
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { HeartbeatBackendSchema } from "./heartbeat-backend-schema.js";
8
+ import { ObservedResourceSampleSchema } from "./observed-resource-sample-schema.js";
9
+ import { PlatformSchema } from "./platform-schema.js";
10
+
11
+ export const ObservedInventoryBatchSchema = z.object({
12
+ get "backend"(){
13
+ return HeartbeatBackendSchema.describe("Backend whose observer produced this snapshot.")
14
+ },
15
+ "complete": z.boolean().describe("Whether this batch is a complete replacement for the scope. Complete\nbatches tombstone previously observed rows in the same scope when they\nare absent from `resources`."),
16
+ get "controllerPlatform"(){
17
+ return PlatformSchema.describe("Represents the target cloud platform.")
18
+ },
19
+ "inventoryScope": z.string().describe("Stable scope for the provider list operation that produced this batch."),
20
+ "observedAt": z.iso.datetime().describe("Time the inventory scope was observed."),
21
+ get "resources"(){
22
+ return z.array(ObservedResourceSampleSchema)
23
+ },
24
+ "sourceKind": z.string().describe("Writer/source for this inventory pass, such as `operator` or\n`manager-observer`.")
25
+ })
26
+
27
+ export type ObservedInventoryBatch = z.infer<typeof ObservedInventoryBatchSchema>
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { HeartbeatCollectionIssueSchema } from "./heartbeat-collection-issue-schema.js";
8
+ import { ObservedCountsSchema } from "./observed-counts-schema.js";
9
+ import { ObservedHealthSchema } from "./observed-health-schema.js";
10
+ import { ProviderLifecycleStateSchema } from "./provider-lifecycle-state-schema.js";
11
+ import { RawHeartbeatSnippetSchema } from "./raw-heartbeat-snippet-schema.js";
12
+ import { ResourceTypeSchema } from "./resource-type-schema.js";
13
+ import { ValueSchema } from "./value-schema.js";
14
+
15
+ export const ObservedResourceSampleSchema = z.object({
16
+ "alienResourceId": z.string().nullish(),
17
+ "attributes": z.optional(z.object({
18
+
19
+ }).catchall(z.lazy(() => ValueSchema))),
20
+ get "collectionIssues"(){
21
+ return z.array(HeartbeatCollectionIssueSchema).optional()
22
+ },
23
+ get "counts"(){
24
+ return z.union([ObservedCountsSchema, z.null()]).optional()
25
+ },
26
+ "deploymentId": z.string().nullish(),
27
+ "displayName": z.string(),
28
+ get "health"(){
29
+ return ObservedHealthSchema
30
+ },
31
+ "labels": z.optional(z.object({
32
+
33
+ }).catchall(z.string())),
34
+ get "lifecycle"(){
35
+ return ProviderLifecycleStateSchema
36
+ },
37
+ "message": z.string().nullish(),
38
+ "namespace": z.string().nullish(),
39
+ "partial": z.boolean(),
40
+ "providerKind": z.string().describe("Provider-native kind, such as `apps/v1/Deployment`,\n`AWS::S3::Bucket`, `storage.googleapis.com/Bucket`, or an Azure\nresource type."),
41
+ "providerStale": z.boolean(),
42
+ get "raw"(){
43
+ return z.array(RawHeartbeatSnippetSchema).optional()
44
+ },
45
+ "rawIdentity": z.string().describe("Provider-native stable identity: Kubernetes object identity, cloud ARN,\nGCP full resource name, Azure resource id, etc."),
46
+ "region": z.string().nullish(),
47
+ get "resourceTypeHint"(){
48
+ return z.union([ResourceTypeSchema, z.null()]).optional()
49
+ },
50
+ "scope": z.string().nullish(),
51
+ "version": z.string().describe("Release/version identity observed from the provider resource, when available.").nullish()
52
+ })
53
+
54
+ export type ObservedResourceSample = z.infer<typeof ObservedResourceSampleSchema>
@@ -8,6 +8,6 @@ import * as z from "zod";
8
8
  /**
9
9
  * @description Represents the target cloud platform.
10
10
  */
11
- export const PlatformSchema = z.enum(["aws", "gcp", "azure", "kubernetes", "local", "test"]).describe("Represents the target cloud platform.")
11
+ export const PlatformSchema = z.enum(["aws", "gcp", "azure", "kubernetes", "machines", "local", "test"]).describe("Represents the target cloud platform.")
12
12
 
13
13
  export type Platform = z.infer<typeof PlatformSchema>
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+
8
+ /**
9
+ * @description Cloud backend for a Postgres resource. Only Aurora Serverless v2 ships in v1;\nthe enum reserves the slot so provisioned RDS is an additive variant later.
10
+ */
11
+ export const PostgresBackendSchema = z.object({
12
+ "type": z.enum(["auroraServerlessV2"])
13
+ }).describe("Cloud backend for a Postgres resource. Only Aurora Serverless v2 ships in v1;\nthe enum reserves the slot so provisioned RDS is an additive variant later.")
14
+
15
+ export type PostgresBackend = z.infer<typeof PostgresBackendSchema>
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { AuroraPostgresHeartbeatDataSchema } from "./aurora-postgres-heartbeat-data-schema.js";
8
+ import { AzureFlexibleServerPostgresHeartbeatDataSchema } from "./azure-flexible-server-postgres-heartbeat-data-schema.js";
9
+ import { GcpCloudSqlPostgresHeartbeatDataSchema } from "./gcp-cloud-sql-postgres-heartbeat-data-schema.js";
10
+ import { LocalPostgresHeartbeatDataSchema } from "./local-postgres-heartbeat-data-schema.js";
11
+
12
+ export const PostgresHeartbeatDataSchema = z.union([z.lazy(() => AuroraPostgresHeartbeatDataSchema).and(z.object({
13
+ "backend": z.enum(["aurora"])
14
+ })), z.lazy(() => GcpCloudSqlPostgresHeartbeatDataSchema).and(z.object({
15
+ "backend": z.enum(["cloudSql"])
16
+ })), z.lazy(() => AzureFlexibleServerPostgresHeartbeatDataSchema).and(z.object({
17
+ "backend": z.enum(["flexibleServer"])
18
+ })), z.lazy(() => LocalPostgresHeartbeatDataSchema).and(z.object({
19
+ "backend": z.enum(["local"])
20
+ }))])
21
+
22
+ export type PostgresHeartbeatData = z.infer<typeof PostgresHeartbeatDataSchema>
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { HeartbeatCollectionIssueSchema } from "./heartbeat-collection-issue-schema.js";
8
+ import { ObservedHealthSchema } from "./observed-health-schema.js";
9
+ import { ProviderLifecycleStateSchema } from "./provider-lifecycle-state-schema.js";
10
+
11
+ export const PostgresHeartbeatStatusSchema = z.object({
12
+ get "collectionIssues"(){
13
+ return z.array(HeartbeatCollectionIssueSchema)
14
+ },
15
+ get "health"(){
16
+ return ObservedHealthSchema
17
+ },
18
+ get "lifecycle"(){
19
+ return ProviderLifecycleStateSchema
20
+ },
21
+ "message": z.string().nullish(),
22
+ "partial": z.boolean(),
23
+ "stale": z.boolean()
24
+ })
25
+
26
+ export type PostgresHeartbeatStatus = z.infer<typeof PostgresHeartbeatStatusSchema>
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+
8
+ /**
9
+ * @description Outputs generated by a successfully provisioned Postgres database.
10
+ */
11
+ export const PostgresOutputsSchema = z.object({
12
+ "database": z.string().describe("The default database created for this resource. On cloud backends this is the fixed\nlabel `POSTGRES_DATABASE_NAME` (`alien`); on Local it is the resource id."),
13
+ "endpoint": z.string().describe("Host (or host:port) the database listens on; never publicly reachable."),
14
+ "port": z.int().min(0).describe("Listening port, when known.").nullish()
15
+ }).describe("Outputs generated by a successfully provisioned Postgres database.")
16
+
17
+ export type PostgresOutputs = z.infer<typeof PostgresOutputsSchema>
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+ import { PostgresBackendSchema } from "./postgres-backend-schema.js";
8
+
9
+ /**
10
+ * @description A managed PostgreSQL database. The target platform decides the backend\n(AWS Aurora Serverless v2, GCP Cloud SQL, Azure Flexible Server, or an\nembedded native process on Local); the database is never publicly reachable.
11
+ */
12
+ export const PostgresSchema = z.object({
13
+ get "backend"(){
14
+ return z.union([PostgresBackendSchema, z.null()]).optional()
15
+ },
16
+ "cpu": z.string().describe("Requested vCPUs (e.g. \"0.5\", \"2\"). None = smallest available tier.").nullish(),
17
+ "highAvailability": z.optional(z.boolean().describe("Multi-AZ / regional / zone-redundant high availability. Default false.")),
18
+ "id": z.string(),
19
+ "memory": z.string().describe("Requested memory (e.g. \"1Gi\", \"8Gi\"). None = smallest available tier.").nullish(),
20
+ "storage": z.optional(z.string().default("20Gi").describe("Allocated storage (e.g. \"20Gi\"). Default \"20Gi\". Grow-only.")),
21
+ "version": z.optional(z.string().default("17").describe("Major engine version: \"15\" | \"16\" | \"17\". Default \"17\"."))
22
+ }).describe("A managed PostgreSQL database. The target platform decides the backend\n(AWS Aurora Serverless v2, GCP Cloud SQL, Azure Flexible Server, or an\nembedded native process on Local); the database is never publicly reachable.")
23
+
24
+ export type Postgres = z.infer<typeof PostgresSchema>
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+
6
+ import * as z from "zod";
7
+
8
+ /**
9
+ * @description DNS target mode for public endpoints.
10
+ */
11
+ export const PublicEndpointTargetSettingsSchema = z.union([z.object({
12
+ "mode": z.enum(["machineAddresses"])
13
+ }), z.object({
14
+ "cnameTarget": z.string().describe("DNS name or URL for the external load balancer."),
15
+ "mode": z.enum(["loadBalancer"])
16
+ })]).describe("DNS target mode for public endpoints.")
17
+
18
+ export type PublicEndpointTargetSettings = z.infer<typeof PublicEndpointTargetSettingsSchema>
@@ -16,6 +16,7 @@ import { DaemonHeartbeatDataSchema } from "./daemon-heartbeat-data-schema.js";
16
16
  import { KubernetesClusterHeartbeatDataSchema } from "./kubernetes-cluster-heartbeat-data-schema.js";
17
17
  import { KvHeartbeatDataSchema } from "./kv-heartbeat-data-schema.js";
18
18
  import { NetworkHeartbeatDataSchema } from "./network-heartbeat-data-schema.js";
19
+ import { PostgresHeartbeatDataSchema } from "./postgres-heartbeat-data-schema.js";
19
20
  import { QueueHeartbeatDataSchema } from "./queue-heartbeat-data-schema.js";
20
21
  import { RemoteStackManagementHeartbeatDataSchema } from "./remote-stack-management-heartbeat-data-schema.js";
21
22
  import { ServiceAccountHeartbeatDataSchema } from "./service-account-heartbeat-data-schema.js";
@@ -64,6 +65,11 @@ export const ResourceHeartbeatDataSchema = z.union([z.object({
64
65
  return KvHeartbeatDataSchema
65
66
  },
66
67
  "resourceType": z.enum(["kv"])
68
+ }), z.object({
69
+ get "data"(){
70
+ return PostgresHeartbeatDataSchema
71
+ },
72
+ "resourceType": z.enum(["postgres"])
67
73
  }), z.object({
68
74
  get "data"(){
69
75
  return VaultHeartbeatDataSchema
@@ -25,7 +25,7 @@ get "data"(){
25
25
  get "raw"(){
26
26
  return z.array(RawHeartbeatSnippetSchema)
27
27
  },
28
- "resourceId": z.string(),
28
+ "resourceId": z.string().describe("Alien resource id, such as the `alien.Container` or `alien.Storage`\nresource id from the stack."),
29
29
  get "resourceType"(){
30
30
  return ResourceTypeSchema.describe("Resource type identifier that determines the specific kind of resource. This field is used for polymorphic deserialization and resource-specific behavior.")
31
31
  }
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export * from "./build.js"
8
8
  export * from "./artifact-registry.js"
9
9
  export * from "./vault.js"
10
10
  export * from "./kv.js"
11
+ export * from "./postgres.js"
11
12
  export * from "./queue.js"
12
13
  export * from "./service-account.js"
13
14
  export * from "./stack.js"
@@ -29,6 +30,8 @@ export {
29
30
  HeartbeatsModeSchema,
30
31
  ResourceHeartbeatSchema,
31
32
  ResourceHeartbeatDataSchema,
33
+ ObservedInventoryBatchSchema,
34
+ ObservedResourceSampleSchema,
32
35
  HeartbeatBackendSchema,
33
36
  HeartbeatIssueSeveritySchema,
34
37
  KubernetesEventSnapshotSchema,
@@ -240,6 +243,8 @@ export type {
240
243
  HeartbeatsMode,
241
244
  ResourceHeartbeat,
242
245
  ResourceHeartbeatData,
246
+ ObservedInventoryBatch,
247
+ ObservedResourceSample,
243
248
  HeartbeatBackend,
244
249
  HeartbeatIssueSeverity,
245
250
  KubernetesEventSnapshot,
@@ -0,0 +1,107 @@
1
+ import {
2
+ type Postgres as PostgresConfig,
3
+ PostgresSchema,
4
+ type ResourceType,
5
+ } from "./generated/index.js"
6
+ import { Resource } from "./resource.js"
7
+
8
+ export type { Postgres as PostgresConfig, PostgresOutputs } from "./generated/index.js"
9
+ export { PostgresSchema as PostgresConfigSchema } from "./generated/index.js"
10
+
11
+ /**
12
+ * Represents a managed PostgreSQL database. The target platform decides the backend;
13
+ * the database is private and reachable only by same-stack workloads.
14
+ */
15
+ export class Postgres {
16
+ private _config: Partial<PostgresConfig> = {
17
+ version: "17",
18
+ storage: "20Gi",
19
+ highAvailability: false,
20
+ }
21
+
22
+ /**
23
+ * Creates a new Postgres builder.
24
+ * @param id ID of the database. A database of this name is created on the server.
25
+ */
26
+ constructor(id: string) {
27
+ this._config.id = id
28
+ }
29
+
30
+ /**
31
+ * Returns a ResourceType representing any postgres resource.
32
+ * Used for creating permission targets that apply to all postgres resources.
33
+ * @returns The "postgres" resource type.
34
+ */
35
+ public static any(): ResourceType {
36
+ return "postgres"
37
+ }
38
+
39
+ /**
40
+ * Sets the major engine version ("15" | "16" | "17"). Default `"17"`.
41
+ * The union narrows the generated schema's free-form string for authoring ergonomics;
42
+ * keep it in sync with the supported majors if the Rust `Postgres` resource adds one.
43
+ * @param value The major version.
44
+ * @returns The Postgres builder instance.
45
+ */
46
+ public version(value: "15" | "16" | "17"): this {
47
+ this._config.version = value
48
+ return this
49
+ }
50
+
51
+ /**
52
+ * Requests vCPUs (e.g. "0.5", "2"). On GCP and Azure, `cpu` and `memory` together pick the
53
+ * smallest tier that satisfies both. On AWS (Aurora Serverless v2) sizing comes from `memory`, so
54
+ * `cpu` is ignored.
55
+ * @param value The requested vCPUs.
56
+ * @returns The Postgres builder instance.
57
+ */
58
+ public cpu(value: string): this {
59
+ this._config.cpu = value
60
+ return this
61
+ }
62
+
63
+ /**
64
+ * Requests memory (e.g. "1Gi", "8Gi"). Drives the size on AWS (the ACU ceiling) and, together
65
+ * with `cpu`, the tier on GCP and Azure.
66
+ * @param value The requested memory.
67
+ * @returns The Postgres builder instance.
68
+ */
69
+ public memory(value: string): this {
70
+ this._config.memory = value
71
+ return this
72
+ }
73
+
74
+ /**
75
+ * Sets allocated storage (e.g. "100Gi"). Default `"20Gi"`. Grow-only.
76
+ * @param value The storage size.
77
+ * @returns The Postgres builder instance.
78
+ */
79
+ public storage(value: string): this {
80
+ this._config.storage = value
81
+ return this
82
+ }
83
+
84
+ /**
85
+ * Enables multi-AZ / regional / zone-redundant high availability. Default `false`.
86
+ * @param value Whether to enable HA.
87
+ * @returns The Postgres builder instance.
88
+ */
89
+ public highAvailability(value = true): this {
90
+ this._config.highAvailability = value
91
+ return this
92
+ }
93
+
94
+ /**
95
+ * Builds and validates the postgres configuration.
96
+ * @returns An immutable Resource representing the configured database.
97
+ * @throws Error if the configuration is invalid.
98
+ */
99
+ public build(): Resource {
100
+ const config = PostgresSchema.parse(this._config)
101
+
102
+ return new Resource({
103
+ type: "postgres",
104
+ ...config,
105
+ })
106
+ }
107
+ }