@ankhorage/infra-hetzner 0.0.0-stage → 0.3.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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/constants/infra.d.ts +11 -0
  4. package/dist/constants/infra.d.ts.map +1 -0
  5. package/dist/constants/infra.js +4 -0
  6. package/dist/constants/infra.js.map +1 -0
  7. package/dist/features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi.d.ts +4 -0
  8. package/dist/features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi.d.ts.map +1 -0
  9. package/dist/features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi.js +193 -0
  10. package/dist/features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi.js.map +1 -0
  11. package/dist/features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe.d.ts +4 -0
  12. package/dist/features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe.d.ts.map +1 -0
  13. package/dist/features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe.js +63 -0
  14. package/dist/features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe.js.map +1 -0
  15. package/dist/features/cloud-compute/adapters/outbound/hetznerApiValues.d.ts +14 -0
  16. package/dist/features/cloud-compute/adapters/outbound/hetznerApiValues.d.ts.map +1 -0
  17. package/dist/features/cloud-compute/adapters/outbound/hetznerApiValues.js +162 -0
  18. package/dist/features/cloud-compute/adapters/outbound/hetznerApiValues.js.map +1 -0
  19. package/dist/features/cloud-compute/application/createHetznerComputeSnapshotAsync.d.ts +5 -0
  20. package/dist/features/cloud-compute/application/createHetznerComputeSnapshotAsync.d.ts.map +1 -0
  21. package/dist/features/cloud-compute/application/createHetznerComputeSnapshotAsync.js +38 -0
  22. package/dist/features/cloud-compute/application/createHetznerComputeSnapshotAsync.js.map +1 -0
  23. package/dist/features/cloud-compute/application/destroyHetznerComputeAsync.d.ts +5 -0
  24. package/dist/features/cloud-compute/application/destroyHetznerComputeAsync.d.ts.map +1 -0
  25. package/dist/features/cloud-compute/application/destroyHetznerComputeAsync.js +46 -0
  26. package/dist/features/cloud-compute/application/destroyHetznerComputeAsync.js.map +1 -0
  27. package/dist/features/cloud-compute/application/ensureHetznerComputeAsync.d.ts +5 -0
  28. package/dist/features/cloud-compute/application/ensureHetznerComputeAsync.d.ts.map +1 -0
  29. package/dist/features/cloud-compute/application/ensureHetznerComputeAsync.js +28 -0
  30. package/dist/features/cloud-compute/application/ensureHetznerComputeAsync.js.map +1 -0
  31. package/dist/features/cloud-compute/application/getHetznerComputeStatusAsync.d.ts +5 -0
  32. package/dist/features/cloud-compute/application/getHetznerComputeStatusAsync.d.ts.map +1 -0
  33. package/dist/features/cloud-compute/application/getHetznerComputeStatusAsync.js +19 -0
  34. package/dist/features/cloud-compute/application/getHetznerComputeStatusAsync.js.map +1 -0
  35. package/dist/features/cloud-compute/application/hetznerResults.d.ts +6 -0
  36. package/dist/features/cloud-compute/application/hetznerResults.d.ts.map +1 -0
  37. package/dist/features/cloud-compute/application/hetznerResults.js +31 -0
  38. package/dist/features/cloud-compute/application/hetznerResults.js.map +1 -0
  39. package/dist/features/cloud-compute/application/inspectHetznerComputeAsync.d.ts +5 -0
  40. package/dist/features/cloud-compute/application/inspectHetznerComputeAsync.d.ts.map +1 -0
  41. package/dist/features/cloud-compute/application/inspectHetznerComputeAsync.js +15 -0
  42. package/dist/features/cloud-compute/application/inspectHetznerComputeAsync.js.map +1 -0
  43. package/dist/features/cloud-compute/application/planHetznerComputeAsync.d.ts +5 -0
  44. package/dist/features/cloud-compute/application/planHetznerComputeAsync.d.ts.map +1 -0
  45. package/dist/features/cloud-compute/application/planHetznerComputeAsync.js +35 -0
  46. package/dist/features/cloud-compute/application/planHetznerComputeAsync.js.map +1 -0
  47. package/dist/features/cloud-compute/application/projectHetznerCompute.d.ts +5 -0
  48. package/dist/features/cloud-compute/application/projectHetznerCompute.d.ts.map +1 -0
  49. package/dist/features/cloud-compute/application/projectHetznerCompute.js +36 -0
  50. package/dist/features/cloud-compute/application/projectHetznerCompute.js.map +1 -0
  51. package/dist/features/cloud-compute/application/resolveHetznerCredentialsAsync.d.ts +10 -0
  52. package/dist/features/cloud-compute/application/resolveHetznerCredentialsAsync.d.ts.map +1 -0
  53. package/dist/features/cloud-compute/application/resolveHetznerCredentialsAsync.js +39 -0
  54. package/dist/features/cloud-compute/application/resolveHetznerCredentialsAsync.js.map +1 -0
  55. package/dist/features/cloud-compute/application/validateHetznerComputeAsync.d.ts +6 -0
  56. package/dist/features/cloud-compute/application/validateHetznerComputeAsync.d.ts.map +1 -0
  57. package/dist/features/cloud-compute/application/validateHetznerComputeAsync.js +23 -0
  58. package/dist/features/cloud-compute/application/validateHetznerComputeAsync.js.map +1 -0
  59. package/dist/features/cloud-compute/composition/createInfraAdapter.d.ts +12 -0
  60. package/dist/features/cloud-compute/composition/createInfraAdapter.d.ts.map +1 -0
  61. package/dist/features/cloud-compute/composition/createInfraAdapter.js +31 -0
  62. package/dist/features/cloud-compute/composition/createInfraAdapter.js.map +1 -0
  63. package/dist/features/cloud-compute/utils/hetznerOwnership.d.ts +13 -0
  64. package/dist/features/cloud-compute/utils/hetznerOwnership.d.ts.map +1 -0
  65. package/dist/features/cloud-compute/utils/hetznerOwnership.js +41 -0
  66. package/dist/features/cloud-compute/utils/hetznerOwnership.js.map +1 -0
  67. package/dist/index.d.ts +7 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +6 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/types/hetznerCompute.d.ts +55 -0
  72. package/dist/types/hetznerCompute.d.ts.map +1 -0
  73. package/dist/types/hetznerCompute.js +2 -0
  74. package/dist/types/hetznerCompute.js.map +1 -0
  75. package/package.json +66 -4
@@ -0,0 +1,31 @@
1
+ import { infraAdapterDescriptor } from '../../../constants/infra';
2
+ import { createFetchHetznerCloudApi } from '../adapters/outbound/createFetchHetznerCloudApi';
3
+ import { createNodeHetznerHostKeyProbe } from '../adapters/outbound/createNodeHetznerHostKeyProbe';
4
+ import { destroyHetznerComputeAsync } from '../application/destroyHetznerComputeAsync';
5
+ import { ensureHetznerComputeAsync } from '../application/ensureHetznerComputeAsync';
6
+ import { getHetznerComputeStatusAsync } from '../application/getHetznerComputeStatusAsync';
7
+ import { inspectHetznerComputeAsync } from '../application/inspectHetznerComputeAsync';
8
+ import { planHetznerComputeAsync } from '../application/planHetznerComputeAsync';
9
+ import { validateHetznerComputeAsync } from '../application/validateHetznerComputeAsync';
10
+ /***
11
+ * Create the canonical Hetzner Cloud compute adapter.
12
+ *
13
+ * The default composition uses the authenticated Cloud REST API and a shell-free SSH host-key
14
+ * probe. Provider API and SSH credentials remain transient execution inputs.
15
+ *
16
+ * @readme
17
+ */
18
+ export function createInfraAdapter(options = {}) {
19
+ const api = options.api ?? createFetchHetznerCloudApi();
20
+ const hostKeyProbe = options.hostKeyProbe ?? createNodeHetznerHostKeyProbe();
21
+ return {
22
+ descriptor: infraAdapterDescriptor,
23
+ validateAsync: (context, selection) => validateHetznerComputeAsync(api, context, selection),
24
+ inspectAsync: (context, selection) => inspectHetznerComputeAsync(api, hostKeyProbe, context, selection),
25
+ planAsync: (context, selection) => planHetznerComputeAsync(api, context, selection),
26
+ ensureAsync: (context, selection) => ensureHetznerComputeAsync(api, hostKeyProbe, context, selection),
27
+ statusAsync: (context) => getHetznerComputeStatusAsync(api, context),
28
+ destroyAsync: (context, request) => destroyHetznerComputeAsync(api, context, request),
29
+ };
30
+ }
31
+ //# sourceMappingURL=createInfraAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createInfraAdapter.js","sourceRoot":"","sources":["../../../../src/features/cloud-compute/composition/createInfraAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,E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AG,EAAE,OAAO,EAAE,OAAO,CAAC;KACtF,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraComputeAdapter } from '@ankhorage/contracts/infra';\n\nimport { infraAdapterDescriptor } from '../../../constants/infra';\nimport type { HetznerAdapterOptions } from '../../../types/hetznerCompute';\nimport { createFetchHetznerCloudApi } from '../adapters/outbound/createFetchHetznerCloudApi';\nimport { createNodeHetznerHostKeyProbe } from '../adapters/outbound/createNodeHetznerHostKeyProbe';\nimport { destroyHetznerComputeAsync } from '../application/destroyHetznerComputeAsync';\nimport { ensureHetznerComputeAsync } from '../application/ensureHetznerComputeAsync';\nimport { getHetznerComputeStatusAsync } from '../application/getHetznerComputeStatusAsync';\nimport { inspectHetznerComputeAsync } from '../application/inspectHetznerComputeAsync';\nimport { planHetznerComputeAsync } from '../application/planHetznerComputeAsync';\nimport { validateHetznerComputeAsync } from '../application/validateHetznerComputeAsync';\n\n/***\n * Create the canonical Hetzner Cloud compute adapter.\n *\n * The default composition uses the authenticated Cloud REST API and a shell-free SSH host-key\n * probe. Provider API and SSH credentials remain transient execution inputs.\n *\n * @readme\n */\nexport function createInfraAdapter(\n options: HetznerAdapterOptions = {},\n): InfraComputeAdapter<'hetzner'> {\n const api = options.api ?? createFetchHetznerCloudApi();\n const hostKeyProbe = options.hostKeyProbe ?? createNodeHetznerHostKeyProbe();\n return {\n descriptor: infraAdapterDescriptor,\n validateAsync: (context, selection) => validateHetznerComputeAsync(api, context, selection),\n inspectAsync: (context, selection) =>\n inspectHetznerComputeAsync(api, hostKeyProbe, context, selection),\n planAsync: (context, selection) => planHetznerComputeAsync(api, context, selection),\n ensureAsync: (context, selection) =>\n ensureHetznerComputeAsync(api, hostKeyProbe, context, selection),\n statusAsync: (context) => getHetznerComputeStatusAsync(api, context),\n destroyAsync: (context, request) => destroyHetznerComputeAsync(api, context, request),\n };\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { InfraExecutionContext, InfraOwnedResource } from '@ankhorage/contracts/infra';
2
+ import type { HetznerProjectIdentity, HetznerResourceId } from '../../../types/hetznerCompute';
3
+ export declare const HETZNER_LABELS: {
4
+ readonly project: "ankhorage.com/project";
5
+ readonly environment: "ankhorage.com/environment";
6
+ readonly adapter: "ankhorage.com/adapter";
7
+ readonly resourceId: "ankhorage.com/resource-id";
8
+ readonly configurationHash: "ankhorage.com/configuration-hash";
9
+ };
10
+ export declare function createHetznerOwner(identity: HetznerProjectIdentity, resourceId: HetznerResourceId): InfraOwnedResource;
11
+ export declare function getHetznerLabels(identity: HetznerProjectIdentity, resourceId?: HetznerResourceId, configurationHash?: string): Readonly<Record<string, string>>;
12
+ export declare function getHetznerIdentity(context: InfraExecutionContext): HetznerProjectIdentity;
13
+ //# sourceMappingURL=hetznerOwnership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hetznerOwnership.d.ts","sourceRoot":"","sources":["../../../../src/features/cloud-compute/utils/hetznerOwnership.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAE/F,eAAO,MAAM,cAAc;;;;;;CAMjB,CAAC;AAEX,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,sBAAsB,EAChC,UAAU,EAAE,iBAAiB,GAC5B,kBAAkB,CAepB;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,sBAAsB,EAChC,UAAU,CAAC,EAAE,iBAAiB,EAC9B,iBAAiB,CAAC,EAAE,MAAM,GACzB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAalC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,GAAG,sBAAsB,CAEzF"}
@@ -0,0 +1,41 @@
1
+ import { createHash } from 'node:crypto';
2
+ export const HETZNER_LABELS = {
3
+ project: 'ankhorage.com/project',
4
+ environment: 'ankhorage.com/environment',
5
+ adapter: 'ankhorage.com/adapter',
6
+ resourceId: 'ankhorage.com/resource-id',
7
+ configurationHash: 'ankhorage.com/configuration-hash',
8
+ };
9
+ export function createHetznerOwner(identity, resourceId) {
10
+ const ownIdentity = { ...identity, adapter: 'hetzner', resourceId };
11
+ return {
12
+ identity: ownIdentity,
13
+ persistent: false,
14
+ retention: 'delete-on-destroy',
15
+ dependsOn: resourceId === 'server'
16
+ ? ['network', 'firewall', 'ssh-key'].map((dependency) => ({
17
+ ...identity,
18
+ adapter: 'hetzner',
19
+ resourceId: dependency,
20
+ }))
21
+ : [],
22
+ };
23
+ }
24
+ export function getHetznerLabels(identity, resourceId, configurationHash) {
25
+ return {
26
+ [HETZNER_LABELS.project]: createHash('sha256')
27
+ .update(identity.projectId)
28
+ .digest('hex')
29
+ .slice(0, 32),
30
+ [HETZNER_LABELS.environment]: identity.environment,
31
+ [HETZNER_LABELS.adapter]: 'hetzner',
32
+ ...(resourceId === undefined ? {} : { [HETZNER_LABELS.resourceId]: resourceId }),
33
+ ...(configurationHash === undefined
34
+ ? {}
35
+ : { [HETZNER_LABELS.configurationHash]: configurationHash }),
36
+ };
37
+ }
38
+ export function getHetznerIdentity(context) {
39
+ return { projectId: context.projectId, environment: context.environment };
40
+ }
41
+ //# sourceMappingURL=hetznerOwnership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hetznerOwnership.js","sourceRoot":"","sources":["../../../../src/features/cloud-compute/utils/hetznerOwnership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,uBAAuB;IAChC,WAAW,EAAE,2BAA2B;IACxC,OAAO,EAAE,uBAAuB;IAChC,UAAU,EAAE,2BAA2B;IACvC,iBAAiB,EAAE,kCAAkC;CAC7C,CAAC;AAEX,MAAM,UAAU,kBAAkB,CAChC,QAAgC,EAChC,UAA6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AC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport type { InfraExecutionContext, InfraOwnedResource } from '@ankhorage/contracts/infra';\n\nimport type { HetznerProjectIdentity, HetznerResourceId } from '../../../types/hetznerCompute';\n\nexport const HETZNER_LABELS = {\n project: 'ankhorage.com/project',\n environment: 'ankhorage.com/environment',\n adapter: 'ankhorage.com/adapter',\n resourceId: 'ankhorage.com/resource-id',\n configurationHash: 'ankhorage.com/configuration-hash',\n} as const;\n\nexport function createHetznerOwner(\n identity: HetznerProjectIdentity,\n resourceId: HetznerResourceId,\n): InfraOwnedResource {\n const ownIdentity = { ...identity, adapter: 'hetzner' as const, resourceId };\n return {\n identity: ownIdentity,\n persistent: false,\n retention: 'delete-on-destroy',\n dependsOn:\n resourceId === 'server'\n ? (['network', 'firewall', 'ssh-key'] as const).map((dependency) => ({\n ...identity,\n adapter: 'hetzner' as const,\n resourceId: dependency,\n }))\n : [],\n };\n}\n\nexport function getHetznerLabels(\n identity: HetznerProjectIdentity,\n resourceId?: HetznerResourceId,\n configurationHash?: string,\n): Readonly<Record<string, string>> {\n return {\n [HETZNER_LABELS.project]: createHash('sha256')\n .update(identity.projectId)\n .digest('hex')\n .slice(0, 32),\n [HETZNER_LABELS.environment]: identity.environment,\n [HETZNER_LABELS.adapter]: 'hetzner',\n ...(resourceId === undefined ? {} : { [HETZNER_LABELS.resourceId]: resourceId }),\n ...(configurationHash === undefined\n ? {}\n : { [HETZNER_LABELS.configurationHash]: configurationHash }),\n };\n}\n\nexport function getHetznerIdentity(context: InfraExecutionContext): HetznerProjectIdentity {\n return { projectId: context.projectId, environment: context.environment };\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /** Public Hetzner Cloud compute adapter package boundary. */
2
+ export { infraAdapterDescriptor } from './constants/infra';
3
+ export { createFetchHetznerCloudApi } from './features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi';
4
+ export { createNodeHetznerHostKeyProbe } from './features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe';
5
+ export { createInfraAdapter } from './features/cloud-compute/composition/createInfraAdapter';
6
+ export type { HetznerAdapterOptions, HetznerCloudApi, HetznerCloudObservation, HetznerDesiredCompute, HetznerFetchApiOptions, HetznerHostKeyProbe, HetznerProjectIdentity, HetznerResourceId, HetznerResourceObservation, } from './types/hetznerCompute';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACnH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0EAA0E,CAAC;AACzH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAC7F,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /** Public Hetzner Cloud compute adapter package boundary. */
2
+ export { infraAdapterDescriptor } from './constants/infra';
3
+ export { createFetchHetznerCloudApi } from './features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi';
4
+ export { createNodeHetznerHostKeyProbe } from './features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe';
5
+ export { createInfraAdapter } from './features/cloud-compute/composition/createInfraAdapter';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACnH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0EAA0E,CAAC;AACzH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC","sourcesContent":["/** Public Hetzner Cloud compute adapter package boundary. */\nexport { infraAdapterDescriptor } from './constants/infra';\nexport { createFetchHetznerCloudApi } from './features/cloud-compute/adapters/outbound/createFetchHetznerCloudApi';\nexport { createNodeHetznerHostKeyProbe } from './features/cloud-compute/adapters/outbound/createNodeHetznerHostKeyProbe';\nexport { createInfraAdapter } from './features/cloud-compute/composition/createInfraAdapter';\nexport type {\n HetznerAdapterOptions,\n HetznerCloudApi,\n HetznerCloudObservation,\n HetznerDesiredCompute,\n HetznerFetchApiOptions,\n HetznerHostKeyProbe,\n HetznerProjectIdentity,\n HetznerResourceId,\n HetznerResourceObservation,\n} from './types/hetznerCompute';\n"]}
@@ -0,0 +1,55 @@
1
+ import type { InfraComputeSelection, InfraExecutionContext, InfraOwnedResource, InfraResult } from '@ankhorage/contracts/infra';
2
+ export type HetznerResourceId = 'network' | 'firewall' | 'ssh-key' | 'server';
3
+ export interface HetznerProjectIdentity {
4
+ readonly projectId: string;
5
+ readonly environment: InfraExecutionContext['environment'];
6
+ }
7
+ interface HetznerDesiredResource {
8
+ readonly owner: InfraOwnedResource;
9
+ readonly name: string;
10
+ readonly configurationHash: string;
11
+ }
12
+ export interface HetznerDesiredCompute {
13
+ readonly identity: HetznerProjectIdentity;
14
+ readonly location: string;
15
+ readonly serverType: string;
16
+ readonly image: string;
17
+ readonly sshUser: string;
18
+ readonly sshPort: number;
19
+ readonly sshPublicKey: string;
20
+ readonly network: HetznerDesiredResource;
21
+ readonly firewall: HetznerDesiredResource;
22
+ readonly sshKey: HetznerDesiredResource;
23
+ readonly server: HetznerDesiredResource;
24
+ }
25
+ export interface HetznerResourceObservation {
26
+ readonly resourceId: HetznerResourceId;
27
+ readonly externalId: string;
28
+ readonly configurationHash?: string;
29
+ readonly state: 'pending' | 'ready' | 'stopped' | 'degraded' | 'failed' | 'unknown';
30
+ readonly publicIpv4?: string;
31
+ readonly architecture?: 'amd64' | 'arm64';
32
+ }
33
+ export interface HetznerCloudObservation {
34
+ readonly resources: readonly HetznerResourceObservation[];
35
+ }
36
+ export interface HetznerCloudApi {
37
+ validateAsync(token: string, selection: InfraComputeSelection<'hetzner'>, signal?: AbortSignal): Promise<InfraResult<null>>;
38
+ inspectAsync(token: string, identity: HetznerProjectIdentity, signal?: AbortSignal): Promise<InfraResult<HetznerCloudObservation>>;
39
+ reconcileAsync(token: string, desired: HetznerDesiredCompute, signal?: AbortSignal): Promise<InfraResult<HetznerCloudObservation>>;
40
+ destroyAsync(token: string, identity: HetznerProjectIdentity, resourceIds: readonly HetznerResourceId[], signal?: AbortSignal): Promise<InfraResult<HetznerCloudObservation>>;
41
+ }
42
+ export interface HetznerHostKeyProbe {
43
+ fingerprintAsync(host: string, port: number, signal?: AbortSignal): Promise<InfraResult<string>>;
44
+ }
45
+ export interface HetznerAdapterOptions {
46
+ readonly api?: HetznerCloudApi;
47
+ readonly hostKeyProbe?: HetznerHostKeyProbe;
48
+ }
49
+ export interface HetznerFetchApiOptions {
50
+ readonly endpoint?: string;
51
+ readonly fetch?: typeof fetch;
52
+ readonly pollIntervalMs?: number;
53
+ }
54
+ export {};
55
+ //# sourceMappingURL=hetznerCompute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hetznerCompute.d.ts","sourceRoot":"","sources":["../../src/types/hetznerCompute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CA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//# sourceMappingURL=hetznerCompute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hetznerCompute.js","sourceRoot":"","sources":["../../src/types/hetznerCompute.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n InfraComputeSelection,\n InfraExecutionContext,\n InfraOwnedResource,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nexport type HetznerResourceId = 'network' | 'firewall' | 'ssh-key' | 'server';\n\nexport interface HetznerProjectIdentity {\n readonly projectId: string;\n readonly environment: InfraExecutionContext['environment'];\n}\n\ninterface HetznerDesiredResource {\n readonly owner: InfraOwnedResource;\n readonly name: string;\n readonly configurationHash: string;\n}\n\nexport interface HetznerDesiredCompute {\n readonly identity: HetznerProjectIdentity;\n readonly location: string;\n readonly serverType: string;\n readonly image: string;\n readonly sshUser: string;\n readonly sshPort: number;\n readonly sshPublicKey: string;\n readonly network: HetznerDesiredResource;\n readonly firewall: HetznerDesiredResource;\n readonly sshKey: HetznerDesiredResource;\n readonly server: HetznerDesiredResource;\n}\n\nexport interface HetznerResourceObservation {\n readonly resourceId: HetznerResourceId;\n readonly externalId: string;\n readonly configurationHash?: string;\n readonly state: 'pending' | 'ready' | 'stopped' | 'degraded' | 'failed' | 'unknown';\n readonly publicIpv4?: string;\n readonly architecture?: 'amd64' | 'arm64';\n}\n\nexport interface HetznerCloudObservation {\n readonly resources: readonly HetznerResourceObservation[];\n}\n\nexport interface HetznerCloudApi {\n validateAsync(\n token: string,\n selection: InfraComputeSelection<'hetzner'>,\n signal?: AbortSignal,\n ): Promise<InfraResult<null>>;\n inspectAsync(\n token: string,\n identity: HetznerProjectIdentity,\n signal?: AbortSignal,\n ): Promise<InfraResult<HetznerCloudObservation>>;\n reconcileAsync(\n token: string,\n desired: HetznerDesiredCompute,\n signal?: AbortSignal,\n ): Promise<InfraResult<HetznerCloudObservation>>;\n destroyAsync(\n token: string,\n identity: HetznerProjectIdentity,\n resourceIds: readonly HetznerResourceId[],\n signal?: AbortSignal,\n ): Promise<InfraResult<HetznerCloudObservation>>;\n}\n\nexport interface HetznerHostKeyProbe {\n fingerprintAsync(host: string, port: number, signal?: AbortSignal): Promise<InfraResult<string>>;\n}\n\nexport interface HetznerAdapterOptions {\n readonly api?: HetznerCloudApi;\n readonly hostKeyProbe?: HetznerHostKeyProbe;\n}\n\nexport interface HetznerFetchApiOptions {\n readonly endpoint?: string;\n readonly fetch?: typeof fetch;\n readonly pollIntervalMs?: number;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@ankhorage/infra-hetzner",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.1",
4
+ "description": "Hetzner Cloud compute adapter for provider-neutral Ankhorage infrastructure.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/ankhorage/infra-hetzner.git"
13
+ },
14
+ "homepage": "https://github.com/ankhorage/infra-hetzner#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/ankhorage/infra-hetzner/issues"
17
+ },
18
+ "keywords": [
19
+ "ankhorage",
20
+ "infrastructure",
21
+ "hetzner",
22
+ "compute",
23
+ "adapter"
24
+ ],
25
+ "files": [
26
+ "dist",
27
+ "README.md",
28
+ "LICENSE",
29
+ "package.json"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "scripts": {
42
+ "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.build.json",
43
+ "typecheck": "bun x tsc --noEmit -p tsconfig.json",
44
+ "check-types": "bun run typecheck",
45
+ "test": "bun test src",
46
+ "docs": "paradox && ankhorage-prettier --write README.md paradox",
47
+ "prepack": "bun run build",
48
+ "lint": "ankhorage-eslint . --max-warnings=0",
49
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
50
+ "format": "ankhorage-prettier --write .",
51
+ "format:check": "ankhorage-prettier --check .",
52
+ "knip:check": "ankhorage-knip",
53
+ "changeset": "ankhorage-changeset",
54
+ "changeset:status": "ankhorage-changeset status --since=origin/main",
55
+ "version-packages": "ankhorage-changeset version"
56
+ },
57
+ "dependencies": {
58
+ "@ankhorage/contracts": "^19.5.0"
59
+ },
60
+ "devDependencies": {
61
+ "@ankhorage/devtools": "^2.3.26",
62
+ "@ankhorage/paradox": "^0.1.27",
63
+ "@types/bun": "^1.4.2",
64
+ "@types/node": "^26.6.5",
65
+ "typescript": "~6.0.3"
66
+ },
67
+ "packageManager": "bun@1.4.2"
68
+ }