@ankhorage/infra 7.1.107 → 7.2.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/capabilities/index.d.ts +83 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +68 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/cli/commands/destroy.js +1 -2
- package/dist/cli/commands/destroy.js.map +1 -1
- package/dist/cli/commands/down.d.ts.map +1 -1
- package/dist/cli/commands/down.js +1 -2
- package/dist/cli/commands/down.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +1 -2
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/outputs.d.ts.map +1 -1
- package/dist/cli/commands/outputs.js +1 -2
- package/dist/cli/commands/outputs.js.map +1 -1
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js +1 -2
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +1 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/up.d.ts.map +1 -1
- package/dist/cli/commands/up.js +1 -2
- package/dist/cli/commands/up.js.map +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +1 -2
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -1
- package/dist/cli/createInfraRuntimeProvider.js +3 -2
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -1
- package/dist/constants.d.ts +81 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -11
- package/dist/constants.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/types/infraCli.d.ts +2 -2
- package/dist/types/infraCli.d.ts.map +1 -1
- package/dist/types/infraCli.js.map +1 -1
- package/package.json +131 -14
- package/src/capabilities/index.test.ts +17 -0
- package/src/capabilities/index.ts +71 -0
- package/src/cli/commands/destroy.ts +2 -2
- package/src/cli/commands/down.ts +3 -2
- package/src/cli/commands/generate.ts +3 -2
- package/src/cli/commands/outputs.ts +3 -2
- package/src/cli/commands/plan.ts +3 -2
- package/src/cli/commands/status.ts +3 -2
- package/src/cli/commands/up.ts +3 -2
- package/src/cli/commands/validate.ts +3 -2
- package/src/cli/createInfraRuntimeProvider.ts +3 -7
- package/src/cli/index.test.ts +3 -11
- package/src/commands.test.ts +4 -0
- package/src/constants.ts +3 -17
- package/src/metadata/index.ts +0 -1
- package/src/package.test.ts +21 -23
- package/src/types/infraCli.ts +2 -2
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
INFRA_COMMAND_CATEGORY,
|
|
6
|
-
INFRA_PACKAGE_NAME,
|
|
7
|
-
INFRA_PACKAGE_VERSION,
|
|
8
|
-
} from '../constants.js';
|
|
3
|
+
import { CAPABILITIES } from '../capabilities/index.js';
|
|
4
|
+
import { INFRA_COMMAND_CATEGORY, INFRA_PACKAGE_NAME, INFRA_PACKAGE_VERSION } from '../constants.js';
|
|
9
5
|
import type { CreateInfraRuntimeProviderOptions } from '../types/infraCli.js';
|
|
10
6
|
import { INFRA_COMMANDS } from './constants.js';
|
|
11
7
|
import { createProviderCommandDescriptors } from './createProviderCommandDescriptors.js';
|
|
@@ -20,7 +16,7 @@ export function createInfraRuntimeProvider(
|
|
|
20
16
|
id: INFRA_PACKAGE_NAME,
|
|
21
17
|
category: INFRA_COMMAND_CATEGORY,
|
|
22
18
|
version: INFRA_PACKAGE_VERSION,
|
|
23
|
-
capabilities:
|
|
19
|
+
capabilities: CAPABILITIES,
|
|
24
20
|
commands: createProviderCommandDescriptors(),
|
|
25
21
|
handlers: INFRA_COMMANDS.map((command) => ({
|
|
26
22
|
path: command.path,
|
package/src/cli/index.test.ts
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';
|
|
2
2
|
import { describe, expect, test } from 'bun:test';
|
|
3
3
|
|
|
4
|
+
import { CAPABILITIES } from '../capabilities/index.js';
|
|
4
5
|
import { createProviderCommandDescriptors } from './createProviderCommandDescriptors.js';
|
|
5
6
|
import provider, { createInfraRuntimeProvider } from './index.js';
|
|
6
7
|
|
|
7
8
|
describe('Infra Ankh provider', () => {
|
|
8
|
-
test('publishes
|
|
9
|
+
test('publishes the canonical capability descriptors and handlers', () => {
|
|
9
10
|
const expected = createInfraRuntimeProvider() satisfies AnkhRuntimeCommandProvider;
|
|
10
|
-
expect(expected.capabilities).toEqual(
|
|
11
|
-
'infra.validate',
|
|
12
|
-
'infra.plan',
|
|
13
|
-
'infra.generate',
|
|
14
|
-
'infra.up',
|
|
15
|
-
'infra.status',
|
|
16
|
-
'infra.outputs',
|
|
17
|
-
'infra.down',
|
|
18
|
-
'infra.destroy',
|
|
19
|
-
]);
|
|
11
|
+
expect(expected.capabilities).toEqual(CAPABILITIES);
|
|
20
12
|
expect(expected.commands).toEqual(createProviderCommandDescriptors());
|
|
21
13
|
expect(expected.handlers).toHaveLength(8);
|
|
22
14
|
expect(provider.handlers).toHaveLength(8);
|
package/src/commands.test.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AppManifest } from '@ankhorage/contracts';
|
|
|
3
3
|
import type { InfraEnvironmentSpec, InfraLedger, InfraResult } from '@ankhorage/contracts/infra';
|
|
4
4
|
import { describe, expect, test } from 'bun:test';
|
|
5
5
|
|
|
6
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
6
7
|
import { INFRA_COMMANDS } from './cli/constants.js';
|
|
7
8
|
import { createInfraRuntimeProvider } from './cli/createInfraRuntimeProvider.js';
|
|
8
9
|
import { createProviderCommandDescriptors } from './cli/createProviderCommandDescriptors.js';
|
|
@@ -17,6 +18,9 @@ describe('canonical Infra commands', () => {
|
|
|
17
18
|
test('exposes the same locked eight-command surface everywhere', () => {
|
|
18
19
|
const names = ['validate', 'plan', 'generate', 'up', 'status', 'outputs', 'down', 'destroy'];
|
|
19
20
|
expect(INFRA_COMMANDS.map(({ standaloneName }) => standaloneName)).toEqual(names);
|
|
21
|
+
expect(INFRA_COMMANDS.map(({ capability }) => capability)).toEqual(
|
|
22
|
+
CAPABILITIES.map(({ id }) => id),
|
|
23
|
+
);
|
|
20
24
|
expect(createProviderCommandDescriptors().map(({ path }) => path.join(' '))).toEqual(names);
|
|
21
25
|
const help = renderProviderHelp({
|
|
22
26
|
commandPrefix: ['ankhorage-infra'],
|
package/src/constants.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AnkhCapabilityId,
|
|
3
|
-
AnkhCommandCategory,
|
|
4
|
-
AnkhPackageMetadata,
|
|
5
|
-
} from '@ankhorage/contracts/cli';
|
|
1
|
+
import type { AnkhCommandCategory, AnkhPackageMetadata } from '@ankhorage/contracts/cli';
|
|
6
2
|
|
|
7
3
|
import packageJson from '../package.json';
|
|
4
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
8
5
|
|
|
9
6
|
export const INFRA_PACKAGE_NAME = packageJson.name;
|
|
10
7
|
export const INFRA_PACKAGE_VERSION = packageJson.version;
|
|
11
8
|
export const INFRA_PACKAGE_DESCRIPTION = packageJson.description;
|
|
12
9
|
export const INFRA_COMMAND_CATEGORY = 'infra' as const satisfies AnkhCommandCategory;
|
|
13
|
-
export const INFRA_CAPABILITIES = [
|
|
14
|
-
'infra.validate',
|
|
15
|
-
'infra.plan',
|
|
16
|
-
'infra.generate',
|
|
17
|
-
'infra.up',
|
|
18
|
-
'infra.status',
|
|
19
|
-
'infra.outputs',
|
|
20
|
-
'infra.down',
|
|
21
|
-
'infra.destroy',
|
|
22
|
-
] as const satisfies readonly AnkhCapabilityId[];
|
|
23
|
-
|
|
24
10
|
export const INFRA_PACKAGE_METADATA = {
|
|
25
11
|
category: INFRA_COMMAND_CATEGORY,
|
|
26
12
|
provider: './dist/cli/index.js',
|
|
27
|
-
capabilities:
|
|
13
|
+
capabilities: CAPABILITIES,
|
|
28
14
|
} as const satisfies AnkhPackageMetadata;
|
package/src/metadata/index.ts
CHANGED
package/src/package.test.ts
CHANGED
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { areCapabilitiesEqual, isCapability } from '@ankhorage/contracts/capabilities';
|
|
2
2
|
import { describe, expect, test } from 'bun:test';
|
|
3
3
|
|
|
4
4
|
import packageJson from '../package.json';
|
|
5
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
5
6
|
|
|
6
7
|
describe('package metadata', () => {
|
|
7
|
-
test('publishes the
|
|
8
|
-
const expectedAnkhMetadata = {
|
|
9
|
-
category: 'infra',
|
|
10
|
-
provider: './dist/cli/index.js',
|
|
11
|
-
capabilities: [
|
|
12
|
-
'infra.validate',
|
|
13
|
-
'infra.plan',
|
|
14
|
-
'infra.generate',
|
|
15
|
-
'infra.up',
|
|
16
|
-
'infra.status',
|
|
17
|
-
'infra.outputs',
|
|
18
|
-
'infra.down',
|
|
19
|
-
'infra.destroy',
|
|
20
|
-
],
|
|
21
|
-
} as const satisfies AnkhPackageMetadata;
|
|
22
|
-
|
|
8
|
+
test('publishes the canonical capability catalog and bin entry', () => {
|
|
23
9
|
expect(packageJson.name).toBe('@ankhorage/infra');
|
|
24
10
|
expect(packageJson.type).toBe('module');
|
|
25
11
|
expect(packageJson.bin).toEqual({
|
|
26
12
|
'ankhorage-infra': './dist/cli/bin.js',
|
|
27
13
|
});
|
|
28
|
-
expect(packageJson.ankh).
|
|
14
|
+
expect(packageJson.ankh.category).toBe('infra');
|
|
15
|
+
expect(packageJson.ankh.provider).toBe('./dist/cli/index.js');
|
|
16
|
+
expect(packageJson.ankh.capabilities).toHaveLength(CAPABILITIES.length);
|
|
17
|
+
expect(packageJson.ankh.capabilities.every(isCapability)).toBeTrue();
|
|
18
|
+
expect(packageJson.ankh.capabilities).toEqual(CAPABILITIES);
|
|
29
19
|
expect(packageJson.exports['./project']).toEqual({
|
|
30
20
|
types: './dist/project/index.d.ts',
|
|
31
21
|
import: './dist/project/index.js',
|
|
32
22
|
default: './dist/project/index.js',
|
|
33
23
|
});
|
|
34
|
-
expect(
|
|
24
|
+
expect(packageJson.exports['./capabilities']).toEqual({
|
|
25
|
+
types: './dist/capabilities/index.d.ts',
|
|
26
|
+
import: './dist/capabilities/index.js',
|
|
27
|
+
default: './dist/capabilities/index.js',
|
|
28
|
+
});
|
|
29
|
+
});
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
test('rejects string-only and conflicting capability metadata publication', () => {
|
|
32
|
+
for (const [index, capability] of CAPABILITIES.entries()) {
|
|
33
|
+
const published = packageJson.ankh.capabilities.at(index);
|
|
34
|
+
if (published === undefined) throw new Error('Published capability metadata is incomplete.');
|
|
35
|
+
expect(typeof published).toBe('object');
|
|
36
|
+
expect(areCapabilitiesEqual(published, capability)).toBeTrue();
|
|
37
|
+
}
|
|
40
38
|
});
|
|
41
39
|
});
|
package/src/types/infraCli.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
2
|
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
3
3
|
import type {
|
|
4
4
|
InfraEnvironmentSpec,
|
|
@@ -57,7 +57,7 @@ type InfraCommandImplementation = (
|
|
|
57
57
|
) => Promise<InfraCommandRunResult>;
|
|
58
58
|
|
|
59
59
|
export interface InfraCommandDefinition {
|
|
60
|
-
readonly capability:
|
|
60
|
+
readonly capability: Capability['id'];
|
|
61
61
|
readonly path: readonly [InfraCommandName];
|
|
62
62
|
readonly standaloneName: InfraCommandName;
|
|
63
63
|
readonly summary: string;
|