@ankhorage/infra 3.2.0 → 4.0.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.
- package/CHANGELOG.md +12 -0
- package/README.md +14 -16
- package/dist/adapters/minikube/auth/index.d.ts +2 -1
- package/dist/adapters/minikube/auth/index.d.ts.map +1 -1
- package/dist/adapters/minikube/auth/index.js +6 -3
- package/dist/adapters/minikube/auth/index.js.map +1 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +7 -0
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +1 -0
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +104 -0
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +1 -0
- package/dist/adapters/minikube/index.d.ts.map +1 -1
- package/dist/adapters/minikube/index.js +7 -17
- package/dist/adapters/minikube/index.js.map +1 -1
- package/dist/authTargetRedirects.d.ts +12 -0
- package/dist/authTargetRedirects.d.ts.map +1 -0
- package/dist/authTargetRedirects.js +32 -0
- package/dist/authTargetRedirects.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/infraValidation.d.ts +1 -0
- package/dist/infraValidation.d.ts.map +1 -1
- package/dist/infraValidation.js +6 -1
- package/dist/infraValidation.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +7 -7
- package/src/adapters/minikube/auth/index.ts +8 -4
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +83 -0
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +136 -0
- package/src/adapters/minikube/index.ts +7 -22
- package/src/apiInfrastructure.test.ts +69 -0
- package/src/authTargetRedirects.test.ts +62 -0
- package/src/authTargetRedirects.ts +46 -0
- package/src/generatedApiLedgerCleanup.test.ts +72 -0
- package/src/index.ts +0 -6
- package/src/infraApiValidation.test.ts +42 -0
- package/src/infraValidation.ts +10 -1
- package/src/types.ts +1 -1
- package/dist/generatedApiDatabase.d.ts +0 -20
- package/dist/generatedApiDatabase.d.ts.map +0 -1
- package/dist/generatedApiDatabase.js +0 -343
- package/dist/generatedApiDatabase.js.map +0 -1
- package/src/generatedApiDatabase.test.ts +0 -355
- package/src/generatedApiDatabase.ts +0 -558
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/infra
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 82e969e: Align infrastructure generation with canonical `infra.apis[]`, remove generated-API database projection and public generator exports, treat external APIs as infrastructure no-ops, and report internal API provisioning as unsupported in Phase 1.
|
|
8
|
+
|
|
9
|
+
## 3.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 716f678: Derive Supabase OAuth redirect allowlists from canonical app deployment targets, using enabled Web state and stable Android/iOS schemes instead of a separate native redirect environment variable.
|
|
14
|
+
|
|
3
15
|
## 3.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
|
|
4
4
|
# INFRA
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Executable infra provider and standalone CLI for Ankhorage project workflows.
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
11
11
|
|
|
12
|
-
### Provider and
|
|
12
|
+
### Provider, CLI, and project API surface
|
|
13
13
|
|
|
14
|
-
`@ankhorage/infra` owns
|
|
14
|
+
`@ankhorage/infra` owns infrastructure generation, project reconciliation,
|
|
15
|
+
and generated lifecycle execution.
|
|
15
16
|
|
|
16
|
-
The same
|
|
17
|
+
The same owner implementation backs CLI consumers and the public
|
|
18
|
+
`@ankhorage/infra/project` application-service boundary. Trusted hosts such
|
|
19
|
+
as Studio should call that subpath instead of reproducing ledger, generated
|
|
20
|
+
file, lifecycle-script, or port-forward configuration semantics.
|
|
21
|
+
|
|
22
|
+
CLI entrypoints:
|
|
17
23
|
|
|
18
24
|
- `ankh infra ...`
|
|
19
25
|
- `bunx @ankhorage/infra ...`
|
|
@@ -26,12 +32,10 @@ Current command surface:
|
|
|
26
32
|
- `up`
|
|
27
33
|
- `down`
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- pass `[project]`, or
|
|
34
|
-
- omit it when cwd is already inside `apps/<project>`
|
|
35
|
+
Project resolution for the CLI is workspace-aware: pass `[project]`, or
|
|
36
|
+
omit it when cwd is already inside `apps/<project>`. Programmatic project
|
|
37
|
+
operations accept an explicit project path and do not require Studio or a
|
|
38
|
+
particular workspace layout.
|
|
35
39
|
|
|
36
40
|
Source: `src/readme-usage.ts`
|
|
37
41
|
|
|
@@ -41,12 +45,6 @@ import { runCli } from './cli/bin.js';
|
|
|
41
45
|
await runCli(['--help']);
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
## Installation
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
bunx @ankhorage/infra
|
|
48
|
-
```
|
|
49
|
-
|
|
50
48
|
## Generated documentation
|
|
51
49
|
|
|
52
50
|
- [Interactive documentation app](././paradox/index.html)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { InfraManifestInput } from '../../../types';
|
|
1
|
+
import type { InfraManifestInput, InfrastructureGenerationOptions } from '../../../types';
|
|
2
2
|
import { type MinikubeAdapterArtifacts } from '../contracts';
|
|
3
3
|
export declare function generateAuthProviderArtifacts(args: {
|
|
4
|
+
appManifest: InfrastructureGenerationOptions['appManifest'];
|
|
4
5
|
manifest: InfraManifestInput;
|
|
5
6
|
namespace: string;
|
|
6
7
|
}): MinikubeAdapterArtifacts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAA0B,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAIrF,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,WAAW,EAAE,+BAA+B,CAAC,aAAa,CAAC,CAAC;IAC5D,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,wBAAwB,CA8B3B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { emptyMinikubeArtifacts } from '../contracts';
|
|
2
|
-
import { generateSupabaseOAuthRuntimeArtifacts } from './oauthRuntime';
|
|
3
2
|
import { generateSupabaseAuthArtifacts } from './supabase';
|
|
3
|
+
import { generateTargetAwareSupabaseOAuthRuntimeArtifacts } from './targetAwareOAuthRuntime';
|
|
4
4
|
export function generateAuthProviderArtifacts(args) {
|
|
5
|
-
const { manifest, namespace } = args;
|
|
5
|
+
const { appManifest, manifest, namespace } = args;
|
|
6
6
|
const { auth } = manifest;
|
|
7
7
|
if (!auth) {
|
|
8
8
|
return emptyMinikubeArtifacts();
|
|
@@ -11,7 +11,10 @@ export function generateAuthProviderArtifacts(args) {
|
|
|
11
11
|
throw new Error(`Unsupported auth provider for minikube adapter: "${auth.provider}". Only "supabase" is currently supported.`);
|
|
12
12
|
}
|
|
13
13
|
const providerArtifacts = generateSupabaseAuthArtifacts({ manifest, namespace });
|
|
14
|
-
const oauthArtifacts =
|
|
14
|
+
const oauthArtifacts = generateTargetAwareSupabaseOAuthRuntimeArtifacts({
|
|
15
|
+
appManifest,
|
|
16
|
+
manifest,
|
|
17
|
+
});
|
|
15
18
|
return {
|
|
16
19
|
files: [...providerArtifacts.files, ...oauthArtifacts.files],
|
|
17
20
|
resources: [...providerArtifacts.resources, ...oauthArtifacts.resources],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAiC,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAiC,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,gDAAgD,EAAE,MAAM,2BAA2B,CAAC;AAE7F,MAAM,UAAU,6BAA6B,CAAC,IAI7C;IACC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAClD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAE1B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,sBAAsB,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,oDAAoD,IAAI,CAAC,QAAQ,4CAA4C,CAC9G,CAAC;IACJ,CAAC;IAED,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IACjF,MAAM,cAAc,GAAG,gDAAgD,CAAC;QACtE,WAAW;QACX,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC;QAC5D,SAAS,EAAE,CAAC,GAAG,iBAAiB,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC,SAAS,CAAC;QACxE,iBAAiB,EAAE;YACjB,GAAG,iBAAiB,CAAC,iBAAiB;YACtC,GAAG,cAAc,CAAC,iBAAiB;SACpC;QACD,UAAU,EAAE,CAAC,GAAG,iBAAiB,CAAC,UAAU,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC;QAC3E,QAAQ,EAAE,CAAC,GAAG,iBAAiB,CAAC,QAAQ,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC;KACtE,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraManifestInput, InfrastructureGenerationOptions } from '../../../types';\nimport { emptyMinikubeArtifacts, type MinikubeAdapterArtifacts } from '../contracts';\nimport { generateSupabaseAuthArtifacts } from './supabase';\nimport { generateTargetAwareSupabaseOAuthRuntimeArtifacts } from './targetAwareOAuthRuntime';\n\nexport function generateAuthProviderArtifacts(args: {\n appManifest: InfrastructureGenerationOptions['appManifest'];\n manifest: InfraManifestInput;\n namespace: string;\n}): MinikubeAdapterArtifacts {\n const { appManifest, manifest, namespace } = args;\n const { auth } = manifest;\n\n if (!auth) {\n return emptyMinikubeArtifacts();\n }\n\n if (auth.provider !== 'supabase') {\n throw new Error(\n `Unsupported auth provider for minikube adapter: \"${auth.provider}\". Only \"supabase\" is currently supported.`,\n );\n }\n\n const providerArtifacts = generateSupabaseAuthArtifacts({ manifest, namespace });\n const oauthArtifacts = generateTargetAwareSupabaseOAuthRuntimeArtifacts({\n appManifest,\n manifest,\n });\n\n return {\n files: [...providerArtifacts.files, ...oauthArtifacts.files],\n resources: [...providerArtifacts.resources, ...oauthArtifacts.resources],\n providerLifecycle: [\n ...providerArtifacts.providerLifecycle,\n ...oauthArtifacts.providerLifecycle,\n ],\n envEntries: [...providerArtifacts.envEntries, ...oauthArtifacts.envEntries],\n warnings: [...providerArtifacts.warnings, ...oauthArtifacts.warnings],\n };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InfraManifestInput, InfrastructureGenerationOptions } from '../../../types';
|
|
2
|
+
import type { MinikubeAdapterArtifacts } from '../contracts';
|
|
3
|
+
export declare function generateTargetAwareSupabaseOAuthRuntimeArtifacts(args: {
|
|
4
|
+
readonly appManifest: InfrastructureGenerationOptions['appManifest'];
|
|
5
|
+
readonly manifest: InfraManifestInput;
|
|
6
|
+
}): MinikubeAdapterArtifacts;
|
|
7
|
+
//# sourceMappingURL=targetAwareOAuthRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targetAwareOAuthRuntime.d.ts","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/targetAwareOAuthRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,KAAK,EAAE,wBAAwB,EAA6B,MAAM,cAAc,CAAC;AAUxF,wBAAgB,gDAAgD,CAAC,IAAI,EAAE;IACrE,QAAQ,CAAC,WAAW,EAAE,+BAA+B,CAAC,aAAa,CAAC,CAAC;IACrE,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;CACvC,GAAG,wBAAwB,CA8B3B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { getLocalAuthRedirectPatterns, normalizeAuthCallbackRoute } from '../../../authRedirects';
|
|
2
|
+
import { resolveAuthTargetRedirectModel } from '../../../authTargetRedirects';
|
|
3
|
+
import { generateSupabaseOAuthRuntimeArtifacts } from './oauthRuntime';
|
|
4
|
+
export function generateTargetAwareSupabaseOAuthRuntimeArtifacts(args) {
|
|
5
|
+
const baseArtifacts = generateSupabaseOAuthRuntimeArtifacts(args.manifest);
|
|
6
|
+
if (!baseArtifacts.providerLifecycle.some((lifecycle) => lifecycle.id === 'supabase-auth')) {
|
|
7
|
+
return baseArtifacts;
|
|
8
|
+
}
|
|
9
|
+
const callbackRoute = normalizeAuthCallbackRoute(args.manifest.auth?.oauth?.callbackRoute ?? '');
|
|
10
|
+
const targets = resolveAuthTargetRedirectModel({
|
|
11
|
+
callbackRoute,
|
|
12
|
+
targets: args.appManifest?.deploy?.targets,
|
|
13
|
+
});
|
|
14
|
+
const policy = {
|
|
15
|
+
callbackRoute,
|
|
16
|
+
localPatterns: targets.webEnabled ? getLocalAuthRedirectPatterns(callbackRoute) : [],
|
|
17
|
+
nativeRedirectUris: targets.nativeRedirectUris,
|
|
18
|
+
webEnabled: targets.webEnabled,
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
...baseArtifacts,
|
|
22
|
+
files: baseArtifacts.files.map((file) => file.path === 'infra/minikube/auth/oauth-runtime.md'
|
|
23
|
+
? { ...file, content: getTargetAwareGuide(policy) }
|
|
24
|
+
: file),
|
|
25
|
+
providerLifecycle: baseArtifacts.providerLifecycle.map((lifecycle) => lifecycle.id === 'supabase-auth' ? applyRedirectPolicy(lifecycle, policy) : lifecycle),
|
|
26
|
+
warnings: [...baseArtifacts.warnings, ...targets.warnings],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function applyRedirectPolicy(lifecycle, policy) {
|
|
30
|
+
return {
|
|
31
|
+
...lifecycle,
|
|
32
|
+
reconciliationCommands: lifecycle.reconciliationCommands.map((entry) => ({
|
|
33
|
+
...entry,
|
|
34
|
+
command: rewriteReconciliationCommand(entry.command, policy),
|
|
35
|
+
})),
|
|
36
|
+
statusChecks: lifecycle.statusChecks.map((entry) => ({
|
|
37
|
+
...entry,
|
|
38
|
+
command: getTargetAwareStatusCommand(policy),
|
|
39
|
+
})),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function rewriteReconciliationCommand(command, policy) {
|
|
43
|
+
const legacyPatterns = getLocalAuthRedirectPatterns(policy.callbackRoute).join(',');
|
|
44
|
+
const legacyPolicy = `oauth_redirect_allow_list="\${oauth_site_url},\${oauth_site_url}/\${oauth_callback_path},${legacyPatterns}"
|
|
45
|
+
if [[ -n "\${OAUTH_NATIVE_REDIRECT_URLS:-}" ]]; then
|
|
46
|
+
oauth_redirect_allow_list="\${oauth_redirect_allow_list},\${OAUTH_NATIVE_REDIRECT_URLS}"
|
|
47
|
+
fi`;
|
|
48
|
+
const staticRedirects = [...policy.localPatterns, ...policy.nativeRedirectUris].join(',');
|
|
49
|
+
const suffix = staticRedirects ? `,${staticRedirects}` : '';
|
|
50
|
+
const canonicalPolicy = policy.webEnabled
|
|
51
|
+
? `oauth_redirect_allow_list="\${oauth_site_url},\${oauth_site_url}/\${oauth_callback_path}${suffix}"`
|
|
52
|
+
: `oauth_redirect_allow_list='${staticRedirects}'`;
|
|
53
|
+
let rewritten = replaceOnce(command, legacyPolicy, canonicalPolicy);
|
|
54
|
+
if (!policy.webEnabled) {
|
|
55
|
+
rewritten = replaceOnce(rewritten, 'oauth_site_url="${SITE_URL%/}"\n', '');
|
|
56
|
+
}
|
|
57
|
+
return rewritten;
|
|
58
|
+
}
|
|
59
|
+
function getTargetAwareStatusCommand(policy) {
|
|
60
|
+
const appCallback = policy.webEnabled
|
|
61
|
+
? `if [[ -n "\${SITE_URL:-}" ]]; then
|
|
62
|
+
echo "- provider supabase-auth/app-callback: \${SITE_URL%/}/\${oauth_callback_path}"
|
|
63
|
+
else
|
|
64
|
+
echo "- provider supabase-auth/app-callback: unavailable"
|
|
65
|
+
fi`
|
|
66
|
+
: 'echo "- provider supabase-auth/app-callback: disabled (web target)"';
|
|
67
|
+
const localPatterns = policy.localPatterns.join(',') || 'none';
|
|
68
|
+
const nativeRedirects = policy.nativeRedirectUris.join(',') || 'none';
|
|
69
|
+
return `oauth_callback_route='${policy.callbackRoute}'
|
|
70
|
+
oauth_callback_path="\${oauth_callback_route#/}"
|
|
71
|
+
if [[ -n "\${API_EXTERNAL_URL:-}" ]]; then
|
|
72
|
+
echo "- provider supabase-auth/provider-callback: \${API_EXTERNAL_URL%/}/callback"
|
|
73
|
+
else
|
|
74
|
+
echo "- provider supabase-auth/provider-callback: unavailable"
|
|
75
|
+
fi
|
|
76
|
+
${appCallback}
|
|
77
|
+
echo "- provider supabase-auth/local-callback-patterns: ${localPatterns}"
|
|
78
|
+
echo "- provider supabase-auth/native-callbacks: ${nativeRedirects}"`;
|
|
79
|
+
}
|
|
80
|
+
function getTargetAwareGuide(policy) {
|
|
81
|
+
const nativeRedirects = policy.nativeRedirectUris.length
|
|
82
|
+
? policy.nativeRedirectUris.map((uri) => `- \`${uri}\``).join('\n')
|
|
83
|
+
: '- none';
|
|
84
|
+
return `# Supabase OAuth Runtime Reconciliation
|
|
85
|
+
|
|
86
|
+
The provider callback remains project-owned. GoTrue-to-app redirects use the configured callback
|
|
87
|
+
route \`${policy.callbackRoute}\` and are derived from \`AppManifest.deploy.targets\`.
|
|
88
|
+
|
|
89
|
+
- Web target: ${policy.webEnabled ? 'enabled' : 'disabled'}
|
|
90
|
+
- Native callbacks:
|
|
91
|
+
${nativeRedirects}
|
|
92
|
+
|
|
93
|
+
Local loopback patterns are emitted only for an enabled Web target. Native callbacks come only
|
|
94
|
+
from enabled Android/iOS target schemes; no environment variable or slug-derived identity can add
|
|
95
|
+
a native callback. Provider credential values remain sourced from trusted secret resolution.
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
function replaceOnce(value, search, replacement) {
|
|
99
|
+
if (!value.includes(search)) {
|
|
100
|
+
throw new Error('Supabase OAuth redirect reconciliation template drifted from its canonical form.');
|
|
101
|
+
}
|
|
102
|
+
return value.replace(search, replacement);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=targetAwareOAuthRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targetAwareOAuthRuntime.js","sourceRoot":"","sources":["../../../../src/adapters/minikube/auth/targetAwareOAuthRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BA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,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { getLocalAuthRedirectPatterns, normalizeAuthCallbackRoute } from '../../../authRedirects';\nimport { resolveAuthTargetRedirectModel } from '../../../authTargetRedirects';\nimport type { InfraManifestInput, InfrastructureGenerationOptions } from '../../../types';\nimport type { MinikubeAdapterArtifacts, MinikubeProviderLifecycle } from '../contracts';\nimport { generateSupabaseOAuthRuntimeArtifacts } from './oauthRuntime';\n\ninterface RedirectPolicy {\n readonly callbackRoute: string;\n readonly localPatterns: readonly string[];\n readonly nativeRedirectUris: readonly string[];\n readonly webEnabled: boolean;\n}\n\nexport function generateTargetAwareSupabaseOAuthRuntimeArtifacts(args: {\n readonly appManifest: InfrastructureGenerationOptions['appManifest'];\n readonly manifest: InfraManifestInput;\n}): MinikubeAdapterArtifacts {\n const baseArtifacts = generateSupabaseOAuthRuntimeArtifacts(args.manifest);\n if (!baseArtifacts.providerLifecycle.some((lifecycle) => lifecycle.id === 'supabase-auth')) {\n return baseArtifacts;\n }\n\n const callbackRoute = normalizeAuthCallbackRoute(args.manifest.auth?.oauth?.callbackRoute ?? '');\n const targets = resolveAuthTargetRedirectModel({\n callbackRoute,\n targets: args.appManifest?.deploy?.targets,\n });\n const policy: RedirectPolicy = {\n callbackRoute,\n localPatterns: targets.webEnabled ? getLocalAuthRedirectPatterns(callbackRoute) : [],\n nativeRedirectUris: targets.nativeRedirectUris,\n webEnabled: targets.webEnabled,\n };\n\n return {\n ...baseArtifacts,\n files: baseArtifacts.files.map((file) =>\n file.path === 'infra/minikube/auth/oauth-runtime.md'\n ? { ...file, content: getTargetAwareGuide(policy) }\n : file,\n ),\n providerLifecycle: baseArtifacts.providerLifecycle.map((lifecycle) =>\n lifecycle.id === 'supabase-auth' ? applyRedirectPolicy(lifecycle, policy) : lifecycle,\n ),\n warnings: [...baseArtifacts.warnings, ...targets.warnings],\n };\n}\n\nfunction applyRedirectPolicy(\n lifecycle: MinikubeProviderLifecycle,\n policy: RedirectPolicy,\n): MinikubeProviderLifecycle {\n return {\n ...lifecycle,\n reconciliationCommands: lifecycle.reconciliationCommands.map((entry) => ({\n ...entry,\n command: rewriteReconciliationCommand(entry.command, policy),\n })),\n statusChecks: lifecycle.statusChecks.map((entry) => ({\n ...entry,\n command: getTargetAwareStatusCommand(policy),\n })),\n };\n}\n\nfunction rewriteReconciliationCommand(command: string, policy: RedirectPolicy): string {\n const legacyPatterns = getLocalAuthRedirectPatterns(policy.callbackRoute).join(',');\n const legacyPolicy = `oauth_redirect_allow_list=\"\\${oauth_site_url},\\${oauth_site_url}/\\${oauth_callback_path},${legacyPatterns}\"\nif [[ -n \"\\${OAUTH_NATIVE_REDIRECT_URLS:-}\" ]]; then\n oauth_redirect_allow_list=\"\\${oauth_redirect_allow_list},\\${OAUTH_NATIVE_REDIRECT_URLS}\"\nfi`;\n const staticRedirects = [...policy.localPatterns, ...policy.nativeRedirectUris].join(',');\n const suffix = staticRedirects ? `,${staticRedirects}` : '';\n const canonicalPolicy = policy.webEnabled\n ? `oauth_redirect_allow_list=\"\\${oauth_site_url},\\${oauth_site_url}/\\${oauth_callback_path}${suffix}\"`\n : `oauth_redirect_allow_list='${staticRedirects}'`;\n let rewritten = replaceOnce(command, legacyPolicy, canonicalPolicy);\n\n if (!policy.webEnabled) {\n rewritten = replaceOnce(rewritten, 'oauth_site_url=\"${SITE_URL%/}\"\\n', '');\n }\n\n return rewritten;\n}\n\nfunction getTargetAwareStatusCommand(policy: RedirectPolicy): string {\n const appCallback = policy.webEnabled\n ? `if [[ -n \"\\${SITE_URL:-}\" ]]; then\n echo \"- provider supabase-auth/app-callback: \\${SITE_URL%/}/\\${oauth_callback_path}\"\nelse\n echo \"- provider supabase-auth/app-callback: unavailable\"\nfi`\n : 'echo \"- provider supabase-auth/app-callback: disabled (web target)\"';\n const localPatterns = policy.localPatterns.join(',') || 'none';\n const nativeRedirects = policy.nativeRedirectUris.join(',') || 'none';\n\n return `oauth_callback_route='${policy.callbackRoute}'\noauth_callback_path=\"\\${oauth_callback_route#/}\"\nif [[ -n \"\\${API_EXTERNAL_URL:-}\" ]]; then\n echo \"- provider supabase-auth/provider-callback: \\${API_EXTERNAL_URL%/}/callback\"\nelse\n echo \"- provider supabase-auth/provider-callback: unavailable\"\nfi\n${appCallback}\necho \"- provider supabase-auth/local-callback-patterns: ${localPatterns}\"\necho \"- provider supabase-auth/native-callbacks: ${nativeRedirects}\"`;\n}\n\nfunction getTargetAwareGuide(policy: RedirectPolicy): string {\n const nativeRedirects = policy.nativeRedirectUris.length\n ? policy.nativeRedirectUris.map((uri) => `- \\`${uri}\\``).join('\\n')\n : '- none';\n\n return `# Supabase OAuth Runtime Reconciliation\n\nThe provider callback remains project-owned. GoTrue-to-app redirects use the configured callback\nroute \\`${policy.callbackRoute}\\` and are derived from \\`AppManifest.deploy.targets\\`.\n\n- Web target: ${policy.webEnabled ? 'enabled' : 'disabled'}\n- Native callbacks:\n${nativeRedirects}\n\nLocal loopback patterns are emitted only for an enabled Web target. Native callbacks come only\nfrom enabled Android/iOS target schemes; no environment variable or slug-derived identity can add\na native callback. Provider credential values remain sourced from trusted secret resolution.\n`;\n}\n\nfunction replaceOnce(value: string, search: string, replacement: string): string {\n if (!value.includes(search)) {\n throw new Error(\n 'Supabase OAuth redirect reconciliation template drifted from its canonical form.',\n );\n }\n return value.replace(search, replacement);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAUrB,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAUrB,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,CAmFhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateInfraApiSupport } from '../../infraValidation';
|
|
2
2
|
import { generateAuthProviderArtifacts } from './auth';
|
|
3
3
|
import { generateAuthorizationArtifacts } from './authz';
|
|
4
4
|
import { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';
|
|
@@ -15,7 +15,11 @@ export function generateMinikubeInfra(manifest, options = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);
|
|
17
17
|
const namespace = APP_NAMESPACE;
|
|
18
|
-
const authArtifacts = generateAuthProviderArtifacts({
|
|
18
|
+
const authArtifacts = generateAuthProviderArtifacts({
|
|
19
|
+
appManifest: options.appManifest,
|
|
20
|
+
manifest,
|
|
21
|
+
namespace,
|
|
22
|
+
});
|
|
19
23
|
const authzArtifacts = generateAuthorizationArtifacts({
|
|
20
24
|
manifest,
|
|
21
25
|
namespace,
|
|
@@ -23,16 +27,6 @@ export function generateMinikubeInfra(manifest, options = {}) {
|
|
|
23
27
|
});
|
|
24
28
|
const storageArtifacts = generateStorageArtifacts({ manifest, namespace });
|
|
25
29
|
const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });
|
|
26
|
-
const generatedApiDatabaseArtifacts = generateGeneratedApiDatabaseArtifacts({
|
|
27
|
-
generatedApis: options.appManifest?.generatedApis,
|
|
28
|
-
databaseProvider: manifest.database?.provider,
|
|
29
|
-
});
|
|
30
|
-
const generatedApiErrors = generatedApiDatabaseArtifacts.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
|
|
31
|
-
if (generatedApiErrors.length > 0) {
|
|
32
|
-
throw new Error(`Generated API database definition is invalid:\n${generatedApiErrors
|
|
33
|
-
.map((diagnostic) => `- ${diagnostic.path ?? diagnostic.apiId}: ${diagnostic.message}`)
|
|
34
|
-
.join('\n')}`);
|
|
35
|
-
}
|
|
36
30
|
const extraResources = unique([
|
|
37
31
|
...authArtifacts.resources,
|
|
38
32
|
...authzArtifacts.resources,
|
|
@@ -68,9 +62,6 @@ export function generateMinikubeInfra(manifest, options = {}) {
|
|
|
68
62
|
...authzArtifacts.warnings,
|
|
69
63
|
...storageArtifacts.warnings,
|
|
70
64
|
...secretStoreArtifacts.warnings,
|
|
71
|
-
...generatedApiDatabaseArtifacts.diagnostics
|
|
72
|
-
.filter((diagnostic) => diagnostic.severity === 'warning')
|
|
73
|
-
.map((diagnostic) => diagnostic.message),
|
|
74
65
|
]);
|
|
75
66
|
return {
|
|
76
67
|
files: [
|
|
@@ -79,7 +70,6 @@ export function generateMinikubeInfra(manifest, options = {}) {
|
|
|
79
70
|
...authzArtifacts.files,
|
|
80
71
|
...storageArtifacts.files,
|
|
81
72
|
...secretStoreArtifacts.files,
|
|
82
|
-
...generatedApiDatabaseArtifacts.files,
|
|
83
73
|
],
|
|
84
74
|
warnings,
|
|
85
75
|
meta: {
|
|
@@ -119,7 +109,7 @@ function collectDependencies(manifest) {
|
|
|
119
109
|
];
|
|
120
110
|
}
|
|
121
111
|
function collectWarnings(manifest) {
|
|
122
|
-
const warnings = [];
|
|
112
|
+
const warnings = [...validateInfraApiSupport(manifest)];
|
|
123
113
|
if (manifest.deployment?.monitoring) {
|
|
124
114
|
warnings.push('Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.');
|
|
125
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAOnF,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QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;QACpC,QAAQ,CAAC,IAAI,CACX,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAwB;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,kMAAkM,CACnM,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { generateGeneratedApiDatabaseArtifacts } from '../../generatedApiDatabase';\nimport type {\n GeneratedPackageDependency,\n InfraManifestInput,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n} from '../../types';\nimport { generateAuthProviderArtifacts } from './auth';\nimport { generateAuthorizationArtifacts } from './authz';\nimport { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';\nimport { generateSecretStoreArtifacts } from './secrets';\nimport { generateStorageArtifacts } from './storage';\n\nconst CANONICAL_PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;\nconst BUILT_IN_NAMESPACES = new Set([APP_NAMESPACE, 'supabase']);\n\nexport function generateMinikubeInfra(\n manifest: InfraManifestInput,\n options: InfrastructureGenerationOptions = {},\n): InfrastructureGenerationResult {\n if (manifest.deployment?.target !== 'minikube') {\n throw new Error(\n `Minikube adapter only supports deployment target \"minikube\" (received \"${manifest.deployment?.target ?? 'undefined'}\").`,\n );\n }\n\n if (manifest.database?.provider && manifest.database.provider !== 'supabase') {\n throw new Error(\n `Unsupported database provider for minikube adapter: \"${manifest.database.provider}\". Only \"supabase\" is implemented.`,\n );\n }\n\n const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);\n const namespace = APP_NAMESPACE;\n\n const authArtifacts = generateAuthProviderArtifacts({ manifest, namespace });\n const authzArtifacts = generateAuthorizationArtifacts({\n manifest,\n namespace,\n appManifest: options.appManifest,\n });\n const storageArtifacts = generateStorageArtifacts({ manifest, namespace });\n const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });\n const generatedApiDatabaseArtifacts = generateGeneratedApiDatabaseArtifacts({\n generatedApis: options.appManifest?.generatedApis,\n databaseProvider: manifest.database?.provider,\n });\n const generatedApiErrors = generatedApiDatabaseArtifacts.diagnostics.filter(\n (diagnostic) => diagnostic.severity === 'error',\n );\n\n if (generatedApiErrors.length > 0) {\n throw new Error(\n `Generated API database definition is invalid:\\n${generatedApiErrors\n .map((diagnostic) => `- ${diagnostic.path ?? diagnostic.apiId}: ${diagnostic.message}`)\n .join('\\n')}`,\n );\n }\n\n const extraResources = unique([\n ...authArtifacts.resources,\n ...authzArtifacts.resources,\n ...storageArtifacts.resources,\n ...secretStoreArtifacts.resources,\n ]);\n const providerLifecycle = [\n ...authArtifacts.providerLifecycle,\n ...authzArtifacts.providerLifecycle,\n ...storageArtifacts.providerLifecycle,\n ...secretStoreArtifacts.providerLifecycle,\n ];\n const providerNamespaces = unique([\n ...providerLifecycle.map((contribution) => contribution.namespace),\n ]).filter((providerNamespace) => !BUILT_IN_NAMESPACES.has(providerNamespace));\n const extraEnvEntries = unique([\n ...authArtifacts.envEntries,\n ...authzArtifacts.envEntries,\n ...storageArtifacts.envEntries,\n ...secretStoreArtifacts.envEntries,\n ]);\n\n const baseFiles = generateMinikubeBaseArtifacts({\n manifest,\n appSlug,\n extraResources,\n providerNamespaces,\n providerLifecycle,\n extraEnvEntries,\n });\n\n const warnings = unique([\n ...collectWarnings(manifest),\n ...authArtifacts.warnings,\n ...authzArtifacts.warnings,\n ...storageArtifacts.warnings,\n ...secretStoreArtifacts.warnings,\n ...generatedApiDatabaseArtifacts.diagnostics\n .filter((diagnostic) => diagnostic.severity === 'warning')\n .map((diagnostic) => diagnostic.message),\n ]);\n\n return {\n files: [\n ...baseFiles,\n ...authArtifacts.files,\n ...authzArtifacts.files,\n ...storageArtifacts.files,\n ...secretStoreArtifacts.files,\n ...generatedApiDatabaseArtifacts.files,\n ],\n warnings,\n meta: {\n target: 'minikube',\n providers: collectProviders(manifest),\n },\n dependencies: collectDependencies(manifest),\n };\n}\n\nfunction collectProviders(manifest: InfraManifestInput): string[] {\n const providers = new Set<string>();\n\n if (manifest.auth?.provider) providers.add(manifest.auth.provider);\n if (manifest.auth?.authorization?.engine) {\n providers.add(manifest.auth.authorization.engine);\n }\n if (manifest.database?.provider) providers.add(manifest.database.provider);\n if (manifest.storage?.provider) providers.add(manifest.storage.provider);\n if (manifest.secretStore?.provider) providers.add(manifest.secretStore.provider);\n if (manifest.state?.provider) providers.add(manifest.state.provider);\n\n return [...providers].sort();\n}\n\nfunction collectDependencies(manifest: InfraManifestInput): readonly GeneratedPackageDependency[] {\n if (manifest.state?.provider !== 'legend') {\n return [];\n }\n\n return [\n {\n name: '@ankhorage/state-legend',\n version: '^0.1.0',\n reason: 'Selected by infra.state.provider=legend.',\n },\n ];\n}\n\nfunction collectWarnings(manifest: InfraManifestInput): string[] {\n const warnings: string[] = [];\n\n if (manifest.deployment?.monitoring) {\n warnings.push(\n 'Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.',\n );\n }\n\n if (manifest.networking?.cdn) {\n warnings.push('CDN is enabled in manifest, but CDN resources are not generated for minikube.');\n }\n\n return warnings;\n}\n\nfunction validateCanonicalAppSlug(slug: string | undefined): string {\n if (!slug) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug is required.',\n );\n }\n\n if (slug.trim() !== slug || !CANONICAL_PROJECT_SLUG_RE.test(slug)) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug must be a canonical lowercase slug up to 40 characters using only a-z, 0-9, and hyphens, without leading or trailing hyphens.',\n );\n }\n\n return slug;\n}\n\nfunction unique(values: string[]): string[] {\n return [...new Set(values)];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,yBAAyB,GAAG,wCAAwC,CAAC;AAC3E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjE,MAAM,UAAU,qBAAqB,CACnC,QAA4B,EAC5B,UAA2C,EAAE;IAE7C,IAAI,QAAQ,CAAC,UAAU,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,0EAA0E,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,WAAW,KAAK,CAC1H,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,wDAAwD,QAAQ,CAAC,QAAQ,CA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,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,kMAAkM,CACnM,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { validateInfraApiSupport } from '../../infraValidation';\nimport type {\n GeneratedPackageDependency,\n InfraManifestInput,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n} from '../../types';\nimport { generateAuthProviderArtifacts } from './auth';\nimport { generateAuthorizationArtifacts } from './authz';\nimport { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';\nimport { generateSecretStoreArtifacts } from './secrets';\nimport { generateStorageArtifacts } from './storage';\n\nconst CANONICAL_PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;\nconst BUILT_IN_NAMESPACES = new Set([APP_NAMESPACE, 'supabase']);\n\nexport function generateMinikubeInfra(\n manifest: InfraManifestInput,\n options: InfrastructureGenerationOptions = {},\n): InfrastructureGenerationResult {\n if (manifest.deployment?.target !== 'minikube') {\n throw new Error(\n `Minikube adapter only supports deployment target \"minikube\" (received \"${manifest.deployment?.target ?? 'undefined'}\").`,\n );\n }\n\n if (manifest.database?.provider && manifest.database.provider !== 'supabase') {\n throw new Error(\n `Unsupported database provider for minikube adapter: \"${manifest.database.provider}\". Only \"supabase\" is implemented.`,\n );\n }\n\n const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);\n const namespace = APP_NAMESPACE;\n\n const authArtifacts = generateAuthProviderArtifacts({\n appManifest: options.appManifest,\n manifest,\n namespace,\n });\n const authzArtifacts = generateAuthorizationArtifacts({\n manifest,\n namespace,\n appManifest: options.appManifest,\n });\n const storageArtifacts = generateStorageArtifacts({ manifest, namespace });\n const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });\n\n const extraResources = unique([\n ...authArtifacts.resources,\n ...authzArtifacts.resources,\n ...storageArtifacts.resources,\n ...secretStoreArtifacts.resources,\n ]);\n const providerLifecycle = [\n ...authArtifacts.providerLifecycle,\n ...authzArtifacts.providerLifecycle,\n ...storageArtifacts.providerLifecycle,\n ...secretStoreArtifacts.providerLifecycle,\n ];\n const providerNamespaces = unique([\n ...providerLifecycle.map((contribution) => contribution.namespace),\n ]).filter((providerNamespace) => !BUILT_IN_NAMESPACES.has(providerNamespace));\n const extraEnvEntries = unique([\n ...authArtifacts.envEntries,\n ...authzArtifacts.envEntries,\n ...storageArtifacts.envEntries,\n ...secretStoreArtifacts.envEntries,\n ]);\n\n const baseFiles = generateMinikubeBaseArtifacts({\n manifest,\n appSlug,\n extraResources,\n providerNamespaces,\n providerLifecycle,\n extraEnvEntries,\n });\n\n const warnings = unique([\n ...collectWarnings(manifest),\n ...authArtifacts.warnings,\n ...authzArtifacts.warnings,\n ...storageArtifacts.warnings,\n ...secretStoreArtifacts.warnings,\n ]);\n\n return {\n files: [\n ...baseFiles,\n ...authArtifacts.files,\n ...authzArtifacts.files,\n ...storageArtifacts.files,\n ...secretStoreArtifacts.files,\n ],\n warnings,\n meta: {\n target: 'minikube',\n providers: collectProviders(manifest),\n },\n dependencies: collectDependencies(manifest),\n };\n}\n\nfunction collectProviders(manifest: InfraManifestInput): string[] {\n const providers = new Set<string>();\n\n if (manifest.auth?.provider) providers.add(manifest.auth.provider);\n if (manifest.auth?.authorization?.engine) {\n providers.add(manifest.auth.authorization.engine);\n }\n if (manifest.database?.provider) providers.add(manifest.database.provider);\n if (manifest.storage?.provider) providers.add(manifest.storage.provider);\n if (manifest.secretStore?.provider) providers.add(manifest.secretStore.provider);\n if (manifest.state?.provider) providers.add(manifest.state.provider);\n\n return [...providers].sort();\n}\n\nfunction collectDependencies(manifest: InfraManifestInput): readonly GeneratedPackageDependency[] {\n if (manifest.state?.provider !== 'legend') {\n return [];\n }\n\n return [\n {\n name: '@ankhorage/state-legend',\n version: '^0.1.0',\n reason: 'Selected by infra.state.provider=legend.',\n },\n ];\n}\n\nfunction collectWarnings(manifest: InfraManifestInput): string[] {\n const warnings = [...validateInfraApiSupport(manifest)];\n\n if (manifest.deployment?.monitoring) {\n warnings.push(\n 'Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.',\n );\n }\n\n if (manifest.networking?.cdn) {\n warnings.push('CDN is enabled in manifest, but CDN resources are not generated for minikube.');\n }\n\n return warnings;\n}\n\nfunction validateCanonicalAppSlug(slug: string | undefined): string {\n if (!slug) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug is required.',\n );\n }\n\n if (slug.trim() !== slug || !CANONICAL_PROJECT_SLUG_RE.test(slug)) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug must be a canonical lowercase slug up to 40 characters using only a-z, 0-9, and hyphens, without leading or trailing hyphens.',\n );\n }\n\n return slug;\n}\n\nfunction unique(values: string[]): string[] {\n return [...new Set(values)];\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AppDeployTargets } from '@ankhorage/contracts/deploy';
|
|
2
|
+
interface AuthTargetRedirectModel {
|
|
3
|
+
readonly nativeRedirectUris: readonly string[];
|
|
4
|
+
readonly warnings: readonly string[];
|
|
5
|
+
readonly webEnabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveAuthTargetRedirectModel(args: {
|
|
8
|
+
readonly callbackRoute: string;
|
|
9
|
+
readonly targets: AppDeployTargets | undefined;
|
|
10
|
+
}): AuthTargetRedirectModel;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=authTargetRedirects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authTargetRedirects.d.ts","sourceRoot":"","sources":["../src/authTargetRedirects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAChD,GAAG,uBAAuB,CAkC1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function resolveAuthTargetRedirectModel(args) {
|
|
2
|
+
if (args.targets === undefined) {
|
|
3
|
+
return {
|
|
4
|
+
nativeRedirectUris: [],
|
|
5
|
+
warnings: [
|
|
6
|
+
'OAuth deploy.targets is missing; Infra keeps Web-local redirects only until canonical targets are persisted.',
|
|
7
|
+
],
|
|
8
|
+
webEnabled: true,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const callbackPath = args.callbackRoute.replace(/^\/+/u, '');
|
|
12
|
+
const nativeRedirectUris = [];
|
|
13
|
+
const warnings = [];
|
|
14
|
+
for (const [targetId, target] of [
|
|
15
|
+
['android', args.targets.android],
|
|
16
|
+
['ios', args.targets.ios],
|
|
17
|
+
]) {
|
|
18
|
+
if (target?.enabled !== true)
|
|
19
|
+
continue;
|
|
20
|
+
if (target.scheme === undefined) {
|
|
21
|
+
warnings.push(`OAuth ${targetId} target is enabled but deploy.targets.${targetId}.scheme is missing; native callback omitted.`);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
nativeRedirectUris.push(`${target.scheme}://${callbackPath}`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
nativeRedirectUris: [...new Set(nativeRedirectUris)],
|
|
28
|
+
warnings,
|
|
29
|
+
webEnabled: args.targets.web?.enabled === true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=authTargetRedirects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authTargetRedirects.js","sourceRoot":"","sources":["../src/authTargetRedirects.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,8BAA8B,CAAC,IAG9C;IACC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO;YACL,kBAAkB,EAAE,EAAE;YACtB,QAAQ,EAAE;gBACR,8GAA8G;aAC/G;YACD,UAAU,EAAE,IAAI;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,kBAAkB,GAAa,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI;QAC/B,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,EAAE,CAAC;QACX,IAAI,MAAM,EAAE,OAAO,KAAK,IAAI;YAAE,SAAS;QACvC,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,QAAQ,CAAC,IAAI,CACX,SAAS,QAAQ,yCAAyC,QAAQ,8CAA8C,CACjH,CAAC;YACF,SAAS;QACX,CAAC;QACD,kBAAkB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,MAAM,YAAY,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACpD,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["import type { AppDeployTargets } from '@ankhorage/contracts/deploy';\n\ninterface AuthTargetRedirectModel {\n readonly nativeRedirectUris: readonly string[];\n readonly warnings: readonly string[];\n readonly webEnabled: boolean;\n}\n\nexport function resolveAuthTargetRedirectModel(args: {\n readonly callbackRoute: string;\n readonly targets: AppDeployTargets | undefined;\n}): AuthTargetRedirectModel {\n if (args.targets === undefined) {\n return {\n nativeRedirectUris: [],\n warnings: [\n 'OAuth deploy.targets is missing; Infra keeps Web-local redirects only until canonical targets are persisted.',\n ],\n webEnabled: true,\n };\n }\n\n const callbackPath = args.callbackRoute.replace(/^\\/+/u, '');\n const nativeRedirectUris: string[] = [];\n const warnings: string[] = [];\n\n for (const [targetId, target] of [\n ['android', args.targets.android],\n ['ios', args.targets.ios],\n ] as const) {\n if (target?.enabled !== true) continue;\n if (target.scheme === undefined) {\n warnings.push(\n `OAuth ${targetId} target is enabled but deploy.targets.${targetId}.scheme is missing; native callback omitted.`,\n );\n continue;\n }\n nativeRedirectUris.push(`${target.scheme}://${callbackPath}`);\n }\n\n return {\n nativeRedirectUris: [...new Set(nativeRedirectUris)],\n warnings,\n webEnabled: args.targets.web?.enabled === true,\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { InfraGenerationInput, InfraManifestInput, InfrastructureGenerationOptions, InfrastructureGenerationResult } from './types';
|
|
2
2
|
export { type AuthRedirectConfiguration, type AuthRedirectEnvironment, getLocalAuthRedirectPatterns, normalizeAuthCallbackRoute, resolveAuthRedirectConfiguration, type ResolveAuthRedirectConfigurationInput, } from './authRedirects';
|
|
3
|
-
export { type GeneratedApiDatabaseArtifacts, type GeneratedApiDatabaseDiagnostic, type GeneratedApiDatabaseDiagnosticCode, generateGeneratedApiDatabaseArtifacts, } from './generatedApiDatabase';
|
|
4
3
|
export { createInfraSecretStoreAdapter, type CreateInfraSecretStoreAdapterInput, type InfraSecretStoreProviders, } from './secretStore';
|
|
5
4
|
export type { GeneratedFile, GeneratedInfrastructureFile, GeneratedPackageDependency, InfraDiagnostic, InfraGenerationInput, InfraGenerationOptions, InfraGenerationResult, InfraManifestInput, InfrastructureGenerationMeta, InfrastructureGenerationOptions, InfrastructureGenerationResult, PackageDependency, } from './types';
|
|
6
5
|
export declare function generateInfra(input: InfraGenerationInput): InfrastructureGenerationResult;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,KAAK,qCAAqC,GAC3C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,KAAK,qCAAqC,GAC3C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,6BAA6B,EAC7B,KAAK,kCAAkC,EACvC,KAAK,yBAAyB,GAC/B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,aAAa,EACb,2BAA2B,EAC3B,0BAA0B,EAC1B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,8BAA8B,CAEzF;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,CAUhC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { generateMinikubeInfra } from './adapters/minikube';
|
|
2
2
|
export { getLocalAuthRedirectPatterns, normalizeAuthCallbackRoute, resolveAuthRedirectConfiguration, } from './authRedirects';
|
|
3
|
-
export { generateGeneratedApiDatabaseArtifacts, } from './generatedApiDatabase';
|
|
4
3
|
export { createInfraSecretStoreAdapter, } from './secretStore';
|
|
5
4
|
export function generateInfra(input) {
|
|
6
5
|
return generateInfrastructure(input.manifest, input.options ?? {});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAQ5D,OAAO,EAGL,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,GAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAQ5D,OAAO,EAGL,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,GAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,6BAA6B,GAG9B,MAAM,eAAe,CAAC;AAgBvB,MAAM,UAAU,aAAa,CAAC,KAA2B;IACvD,OAAO,sBAAsB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAA4B,EAC5B,UAA2C,EAAE;IAE7C,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import { generateMinikubeInfra } from './adapters/minikube';\nimport type {\n InfraGenerationInput,\n InfraManifestInput,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n} from './types';\n\nexport {\n type AuthRedirectConfiguration,\n type AuthRedirectEnvironment,\n getLocalAuthRedirectPatterns,\n normalizeAuthCallbackRoute,\n resolveAuthRedirectConfiguration,\n type ResolveAuthRedirectConfigurationInput,\n} from './authRedirects';\nexport {\n createInfraSecretStoreAdapter,\n type CreateInfraSecretStoreAdapterInput,\n type InfraSecretStoreProviders,\n} from './secretStore';\nexport type {\n GeneratedFile,\n GeneratedInfrastructureFile,\n GeneratedPackageDependency,\n InfraDiagnostic,\n InfraGenerationInput,\n InfraGenerationOptions,\n InfraGenerationResult,\n InfraManifestInput,\n InfrastructureGenerationMeta,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n PackageDependency,\n} from './types';\n\nexport function generateInfra(input: InfraGenerationInput): InfrastructureGenerationResult {\n return generateInfrastructure(input.manifest, input.options ?? {});\n}\n\nexport function generateInfrastructure(\n manifest: InfraManifestInput,\n options: InfrastructureGenerationOptions = {},\n): InfrastructureGenerationResult {\n if (!manifest.deployment) {\n throw new Error('Deployment configuration is missing.');\n }\n\n if (manifest.deployment.target !== 'minikube') {\n throw new Error(`Unsupported deployment target: ${manifest.deployment.target}`);\n }\n\n return generateMinikubeInfra(manifest, options);\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { InfraManifestInput } from './types.js';
|
|
2
2
|
export declare function validateInfraSupport(manifest: InfraManifestInput): readonly string[];
|
|
3
|
+
export declare function validateInfraApiSupport(manifest: InfraManifestInput): readonly string[];
|
|
3
4
|
//# sourceMappingURL=infraValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraValidation.d.ts","sourceRoot":"","sources":["../src/infraValidation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,MAAM,EAAE,CA2DpF"}
|
|
1
|
+
{"version":3,"file":"infraValidation.d.ts","sourceRoot":"","sources":["../src/infraValidation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,MAAM,EAAE,CA2DpF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,MAAM,EAAE,CAOvF"}
|
package/dist/infraValidation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AUTH_PROVIDERS, AUTH_SCOPES, AUTHZ_ENGINES, DATABASE_PROVIDERS, DEPLOYMENT_TARGETS, } from '@ankhorage/contracts';
|
|
2
2
|
export function validateInfraSupport(manifest) {
|
|
3
|
-
const warnings = [];
|
|
3
|
+
const warnings = [...validateInfraApiSupport(manifest)];
|
|
4
4
|
const deploymentTarget = manifest.deployment?.target;
|
|
5
5
|
if (deploymentTarget !== undefined && !isSupported(deploymentTarget, DEPLOYMENT_TARGETS)) {
|
|
6
6
|
warnings.push(warningForUnsupportedValue({
|
|
@@ -43,6 +43,11 @@ export function validateInfraSupport(manifest) {
|
|
|
43
43
|
}
|
|
44
44
|
return warnings;
|
|
45
45
|
}
|
|
46
|
+
export function validateInfraApiSupport(manifest) {
|
|
47
|
+
return (manifest.apis ?? [])
|
|
48
|
+
.filter((api) => api.origin === 'internal')
|
|
49
|
+
.map((api) => `infra.apis.${api.id} has origin "internal", but internal API provisioning is not supported in Phase 1; no API infrastructure will be generated.`);
|
|
50
|
+
}
|
|
46
51
|
function warningForUnsupportedValue(args) {
|
|
47
52
|
return `${args.path} "${args.value}" is not currently supported by implemented generators. Supported values: ${formatSupportedValues(args.supported)}.`;
|
|
48
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraValidation.js","sourceRoot":"","sources":["../src/infraValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,UAAU,oBAAoB,CAAC,QAA4B;IAC/D,MAAM,QAAQ,GAAa,
|
|
1
|
+
{"version":3,"file":"infraValidation.js","sourceRoot":"","sources":["../src/infraValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,UAAU,oBAAoB,CAAC,QAA4B;IAC/D,MAAM,QAAQ,GAAa,CAAC,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAElE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IACrD,IAAI,gBAAgB,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,CAAC;QACzF,QAAQ,CAAC,IAAI,CACX,0BAA0B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QAAQ,CAAC,IAAI,CACX,0BAA0B,CAAC;YACzB,IAAI,EAAE,iCAAiC;YACvC,KAAK,EAAE,WAAW;YAClB,SAAS,EAAE,aAAa;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAA4B;IAClE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;SACzB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC;SAC1C,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,cAAc,GAAG,CAAC,EAAE,6HAA6H,CACpJ,CAAC;AACN,CAAC;AAED,SAAS,0BAA0B,CAAC,IAInC;IACC,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,6EAA6E,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;AAC1J,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAyB;IACtD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,SAA4B;IAC9D,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import {\n AUTH_PROVIDERS,\n AUTH_SCOPES,\n AUTHZ_ENGINES,\n DATABASE_PROVIDERS,\n DEPLOYMENT_TARGETS,\n} from '@ankhorage/contracts';\n\nimport type { InfraManifestInput } from './types.js';\n\nexport function validateInfraSupport(manifest: InfraManifestInput): readonly string[] {\n const warnings: string[] = [...validateInfraApiSupport(manifest)];\n\n const deploymentTarget = manifest.deployment?.target;\n if (deploymentTarget !== undefined && !isSupported(deploymentTarget, DEPLOYMENT_TARGETS)) {\n warnings.push(\n warningForUnsupportedValue({\n path: 'infra.deployment.target',\n value: deploymentTarget,\n supported: DEPLOYMENT_TARGETS,\n }),\n );\n }\n\n const databaseProvider = manifest.database?.provider;\n if (databaseProvider !== undefined && !isSupported(databaseProvider, DATABASE_PROVIDERS)) {\n warnings.push(\n warningForUnsupportedValue({\n path: 'infra.database.provider',\n value: databaseProvider,\n supported: DATABASE_PROVIDERS,\n }),\n );\n }\n\n const authProvider = manifest.auth?.provider;\n if (authProvider !== undefined && !isSupported(authProvider, AUTH_PROVIDERS)) {\n warnings.push(\n warningForUnsupportedValue({\n path: 'infra.auth.provider',\n value: authProvider,\n supported: AUTH_PROVIDERS,\n }),\n );\n }\n\n const authScope = manifest.auth?.scope;\n if (authScope !== undefined && !isSupported(authScope, AUTH_SCOPES)) {\n warnings.push(\n warningForUnsupportedValue({\n path: 'infra.auth.scope',\n value: authScope,\n supported: AUTH_SCOPES,\n }),\n );\n }\n\n const authzEngine = manifest.auth?.authorization?.engine;\n if (authzEngine !== undefined && !isSupported(authzEngine, AUTHZ_ENGINES)) {\n warnings.push(\n warningForUnsupportedValue({\n path: 'infra.auth.authorization.engine',\n value: authzEngine,\n supported: AUTHZ_ENGINES,\n }),\n );\n }\n\n return warnings;\n}\n\nexport function validateInfraApiSupport(manifest: InfraManifestInput): readonly string[] {\n return (manifest.apis ?? [])\n .filter((api) => api.origin === 'internal')\n .map(\n (api) =>\n `infra.apis.${api.id} has origin \"internal\", but internal API provisioning is not supported in Phase 1; no API infrastructure will be generated.`,\n );\n}\n\nfunction warningForUnsupportedValue(args: {\n readonly path: string;\n readonly value: string;\n readonly supported: readonly string[];\n}): string {\n return `${args.path} \"${args.value}\" is not currently supported by implemented generators. Supported values: ${formatSupportedValues(args.supported)}.`;\n}\n\nfunction formatSupportedValues(values: readonly string[]): string {\n if (values.length === 0) {\n return '(none)';\n }\n\n return values.join(', ');\n}\n\nfunction isSupported(value: string, supported: readonly string[]): boolean {\n return supported.includes(value);\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface InfrastructureGenerationOptions {
|
|
|
30
30
|
/**
|
|
31
31
|
* Optional app-level context used by provider/engine-specific generators.
|
|
32
32
|
*/
|
|
33
|
-
readonly appManifest?: Pick<AppManifest, '
|
|
33
|
+
readonly appManifest?: Pick<AppManifest, 'deploy' | 'infra' | 'metadata' | 'navigator' | 'screens' | 'settings'>;
|
|
34
34
|
}
|
|
35
35
|
export interface InfraGenerationInput {
|
|
36
36
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpE,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,4BAA4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AAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CACzB,WAAW,EACX,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CACvE,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,+BAA+B,CAAC;CACpD;AAED,MAAM,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,2BAA2B,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,KAAK,oBAAoB,GAAG,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AAE3F,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAC1C,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppManifest, InfraManifest } from '@ankhorage/contracts';\n\nexport interface GeneratedInfrastructureFile {\n /**\n * Path relative to the target app root.\n */\n readonly path: string;\n readonly content: string;\n readonly executable?: boolean;\n}\n\nexport interface GeneratedPackageDependency {\n readonly name: string;\n readonly version: string;\n readonly reason: string;\n}\n\nexport interface InfrastructureGenerationMeta {\n readonly target: NonNullable<InfraManifest['deployment']>['target'];\n readonly providers: readonly string[];\n}\n\nexport interface InfrastructureGenerationResult {\n readonly files: readonly GeneratedInfrastructureFile[];\n readonly warnings: readonly string[];\n readonly meta: InfrastructureGenerationMeta;\n readonly dependencies: readonly GeneratedPackageDependency[];\n}\n\nexport interface InfrastructureGenerationOptions {\n /**\n * Optional namespace hint from caller context, such as app slug or project id.\n */\n readonly namespaceHint?: string;\n /**\n * Optional app-level context used by provider/engine-specific generators.\n */\n readonly appManifest?: Pick<\n AppManifest,\n '
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppManifest, InfraManifest } from '@ankhorage/contracts';\n\nexport interface GeneratedInfrastructureFile {\n /**\n * Path relative to the target app root.\n */\n readonly path: string;\n readonly content: string;\n readonly executable?: boolean;\n}\n\nexport interface GeneratedPackageDependency {\n readonly name: string;\n readonly version: string;\n readonly reason: string;\n}\n\nexport interface InfrastructureGenerationMeta {\n readonly target: NonNullable<InfraManifest['deployment']>['target'];\n readonly providers: readonly string[];\n}\n\nexport interface InfrastructureGenerationResult {\n readonly files: readonly GeneratedInfrastructureFile[];\n readonly warnings: readonly string[];\n readonly meta: InfrastructureGenerationMeta;\n readonly dependencies: readonly GeneratedPackageDependency[];\n}\n\nexport interface InfrastructureGenerationOptions {\n /**\n * Optional namespace hint from caller context, such as app slug or project id.\n */\n readonly namespaceHint?: string;\n /**\n * Optional app-level context used by provider/engine-specific generators.\n */\n readonly appManifest?: Pick<\n AppManifest,\n 'deploy' | 'infra' | 'metadata' | 'navigator' | 'screens' | 'settings'\n >;\n}\n\nexport interface InfraGenerationInput {\n /**\n * Infra manifest section from an app manifest.\n */\n readonly manifest: InfraManifestInput;\n /**\n * Optional root used by callers that want to keep output intent alongside generation.\n * The generator itself still returns relative file paths and does not write to disk.\n */\n readonly outputRoot?: string;\n readonly options?: InfrastructureGenerationOptions;\n}\n\nexport type InfraGenerationOptions = InfrastructureGenerationOptions;\nexport type InfraGenerationResult = InfrastructureGenerationResult;\nexport type GeneratedFile = GeneratedInfrastructureFile;\nexport type PackageDependency = GeneratedPackageDependency;\n\nexport interface InfraDiagnostic {\n readonly severity: 'warning';\n readonly message: string;\n}\n\ntype InfraStorageProvider = NonNullable<InfraManifest['storage']>['provider'] | 'supabase';\n\ninterface InfraStorageSpecInput {\n readonly provider: InfraStorageProvider;\n readonly buckets: readonly string[];\n}\n\n/**\n * Infra-local manifest input type.\n *\n * This is intentionally broader than `@ankhorage/contracts` to allow adapters to support\n * additional providers before the shared contracts package officially includes them.\n */\nexport type InfraManifestInput = Omit<InfraManifest, 'storage'> & {\n readonly storage?: InfraStorageSpecInput;\n};\n"]}
|