@ankhorage/contracts 22.0.3 → 22.1.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/dist/auth.d.ts +2 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/bindings.d.ts +6 -5
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js.map +1 -1
- package/dist/collections.d.ts +4 -0
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js.map +1 -1
- package/dist/data/apis.d.ts +2 -1
- package/dist/data/apis.d.ts.map +1 -1
- package/dist/data/apis.js.map +1 -1
- package/dist/data/endpoints.d.ts +5 -4
- package/dist/data/endpoints.d.ts.map +1 -1
- package/dist/data/endpoints.js.map +1 -1
- package/dist/data/operations.d.ts +2 -1
- package/dist/data/operations.d.ts.map +1 -1
- package/dist/data/operations.js.map +1 -1
- package/dist/data/schemas.d.ts +3 -2
- package/dist/data/schemas.d.ts.map +1 -1
- package/dist/data/schemas.js.map +1 -1
- package/dist/data/sources.d.ts +2 -1
- package/dist/data/sources.d.ts.map +1 -1
- package/dist/data/sources.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +2 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js.map +1 -1
- package/dist/navigator.d.ts +2 -1
- package/dist/navigator.d.ts.map +1 -1
- package/dist/navigator.js.map +1 -1
- package/dist/structure/index.d.ts +4 -0
- package/dist/structure/index.d.ts.map +1 -0
- package/dist/structure/index.js +3 -0
- package/dist/structure/index.js.map +1 -0
- package/dist/structure/isStructureDescriptor.d.ts +4 -0
- package/dist/structure/isStructureDescriptor.d.ts.map +1 -0
- package/dist/structure/isStructureDescriptor.js +132 -0
- package/dist/structure/isStructureDescriptor.js.map +1 -0
- package/dist/structure/isStructureDescriptorDocument.d.ts +4 -0
- package/dist/structure/isStructureDescriptorDocument.d.ts.map +1 -0
- package/dist/structure/isStructureDescriptorDocument.js +114 -0
- package/dist/structure/isStructureDescriptorDocument.js.map +1 -0
- package/dist/structure/types.d.ts +63 -0
- package/dist/structure/types.d.ts.map +1 -0
- package/dist/structure/types.js +2 -0
- package/dist/structure/types.js.map +1 -0
- package/dist/theme.d.ts +7 -6
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/types/infraManifest.d.ts +3 -3
- package/dist/types/infraManifest.d.ts.map +1 -1
- package/dist/types/infraManifest.js.map +1 -1
- package/dist/types/infraWorkload.d.ts +6 -6
- package/dist/types/infraWorkload.d.ts.map +1 -1
- package/dist/types/infraWorkload.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -2
- package/src/auth.ts +2 -1
- package/src/bindings.ts +9 -6
- package/src/collections.ts +10 -0
- package/src/data/apis.ts +2 -1
- package/src/data/endpoints.ts +5 -4
- package/src/data/operations.ts +2 -1
- package/src/data/schemas.ts +3 -2
- package/src/data/sources.ts +2 -1
- package/src/index.ts +1 -0
- package/src/media.ts +3 -1
- package/src/navigator.ts +2 -1
- package/src/structure/index.ts +21 -0
- package/src/structure/isStructureDescriptor.ts +163 -0
- package/src/structure/isStructureDescriptorDocument.ts +164 -0
- package/src/structure/types.ts +92 -0
- package/src/structure.test.ts +255 -0
- package/src/theme.ts +8 -6
- package/src/types/infraManifest.ts +3 -3
- package/src/types/infraWorkload.ts +6 -6
- package/src/types.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraManifest.js","sourceRoot":"","sources":["../../src/types/infraManifest.ts"],"names":[],"mappings":"","sourcesContent":["import type { AuthFlowConfig, AuthOAuthConfig } from '../auth';\nimport type { SerializableSet } from '../collections';\nimport type { ApiDefinitionRegistry, DataContractValue } from '../data';\nimport type { AppEnvironmentId } from '../environments';\nimport type { INFRA_ADAPTER_CATALOG, INFRA_RUNTIME_COMPATIBILITY } from '../infra/constants';\nimport type { AuthProfileSpec, AuthScope, AuthSignInSpec, AuthSignUpSpec } from '../types';\nimport type { InfraControlPlaneCredentialRef } from './infraSecrets';\nimport type { InfraWorkloadRegistry } from './infraWorkload';\n\nexport type InfraAdapterId = keyof typeof INFRA_ADAPTER_CATALOG;\nexport type InfraCapability =\n (typeof INFRA_ADAPTER_CATALOG)[InfraAdapterId]['capabilities'][number];\nexport type InfraProviderFor<C extends InfraCapability> = {\n [P in InfraAdapterId]: C extends (typeof INFRA_ADAPTER_CATALOG)[P]['capabilities'][number]\n ? P\n : never;\n}[InfraAdapterId];\nexport type InfraComputeProviderId = InfraProviderFor<'compute'>;\nexport type InfraRuntimeProviderId = keyof typeof INFRA_RUNTIME_COMPATIBILITY;\n\n/** Non-secret provider configuration; credentials are resolved only at the execution boundary. */\nexport interface InfraComputeConfigMap {\n readonly local: { readonly workingDirectory?: string };\n readonly hetzner: {\n readonly location: string;\n readonly serverType?: string;\n readonly image?: string;\n readonly credentials?: InfraControlPlaneCredentialRef;\n readonly ssh?: {\n readonly user?: string;\n readonly port?: number;\n readonly credentials?: InfraControlPlaneCredentialRef;\n };\n };\n}\n\nexport interface InfraRuntimeConfigMap {\n readonly minikube: {\n readonly profile?: string;\n readonly driver?: 'docker' | 'podman';\n readonly cpus?: number;\n readonly memoryMiB?: number;\n };\n readonly k3s: {\n readonly version?: string;\n readonly topology?: { readonly servers: number; readonly agents: number };\n };\n readonly 'docker-compose': { readonly projectName?: string };\n}\n\nexport type InfraComputeSelection<P extends InfraComputeProviderId = InfraComputeProviderId> = {\n [K in P]: { readonly provider: K } & InfraComputeConfigMap[K];\n}[P];\nexport type InfraRuntimeSelection<P extends InfraRuntimeProviderId = InfraRuntimeProviderId> = {\n [K in P]: { readonly provider: K } & InfraRuntimeConfigMap[K];\n}[P];\n\n/** A discriminated union derived from the runtime catalog, never a Cartesian product. */\nexport type InfraDeploymentSpec = {\n [R in InfraRuntimeProviderId]: {\n readonly compute: InfraComputeSelection<(typeof INFRA_RUNTIME_COMPATIBILITY)[R][number]>;\n readonly runtime: InfraRuntimeSelection<R>;\n };\n}[InfraRuntimeProviderId];\n\n/** Portable S3-compatible persistence target; privileged values stay behind one credential ref. */\nexport interface InfraS3PersistenceTarget {\n readonly endpoint: string;\n readonly region: string;\n readonly bucket: string;\n readonly credentials: InfraControlPlaneCredentialRef;\n readonly forcePathStyle?: boolean;\n}\n\n/** Scheduled database protection intent; the selected database provider owns its concrete engine. */\nexport interface InfraScheduledDatabaseBackupSpec {\n readonly mode: 'scheduled';\n readonly target: InfraS3PersistenceTarget;\n readonly intervalHours?: number;\n}\n\nexport interface InfraDatabaseConfigMap {\n readonly supabase: {\n readonly tier?: 'dev' | 'prod';\n readonly backup?: InfraScheduledDatabaseBackupSpec;\n };\n}\nexport interface InfraObjectStorageConfigMap {\n readonly supabase: {\n readonly buckets?: SerializableSet;\n readonly backend?: InfraS3PersistenceTarget;\n };\n readonly r2: {\n readonly buckets?: SerializableSet;\n readonly accountId?: string;\n readonly credentials?: InfraControlPlaneCredentialRef;\n };\n}\nexport interface InfraAuthConfigMap {\n readonly supabase: {\n readonly scope?: AuthScope;\n readonly flow?: AuthFlowConfig;\n readonly signIn?: AuthSignInSpec;\n readonly signUp?: AuthSignUpSpec;\n readonly oauth?: AuthOAuthConfig;\n readonly profile?: AuthProfileSpec;\n };\n}\nexport interface InfraAuthzConfigMap {\n readonly cerbos: {\n readonly kind: 'RBAC' | 'ABAC';\n readonly policies?:
|
|
1
|
+
{"version":3,"file":"infraManifest.js","sourceRoot":"","sources":["../../src/types/infraManifest.ts"],"names":[],"mappings":"","sourcesContent":["import type { AuthFlowConfig, AuthOAuthConfig } from '../auth';\nimport type { EntityRegistry, SerializableSet, ValueMap } from '../collections';\nimport type { ApiDefinitionRegistry, DataContractValue } from '../data';\nimport type { AppEnvironmentId } from '../environments';\nimport type { INFRA_ADAPTER_CATALOG, INFRA_RUNTIME_COMPATIBILITY } from '../infra/constants';\nimport type { AuthProfileSpec, AuthScope, AuthSignInSpec, AuthSignUpSpec } from '../types';\nimport type { InfraControlPlaneCredentialRef } from './infraSecrets';\nimport type { InfraWorkloadRegistry } from './infraWorkload';\n\nexport type InfraAdapterId = keyof typeof INFRA_ADAPTER_CATALOG;\nexport type InfraCapability =\n (typeof INFRA_ADAPTER_CATALOG)[InfraAdapterId]['capabilities'][number];\nexport type InfraProviderFor<C extends InfraCapability> = {\n [P in InfraAdapterId]: C extends (typeof INFRA_ADAPTER_CATALOG)[P]['capabilities'][number]\n ? P\n : never;\n}[InfraAdapterId];\nexport type InfraComputeProviderId = InfraProviderFor<'compute'>;\nexport type InfraRuntimeProviderId = keyof typeof INFRA_RUNTIME_COMPATIBILITY;\n\n/** Non-secret provider configuration; credentials are resolved only at the execution boundary. */\nexport interface InfraComputeConfigMap {\n readonly local: { readonly workingDirectory?: string };\n readonly hetzner: {\n readonly location: string;\n readonly serverType?: string;\n readonly image?: string;\n readonly credentials?: InfraControlPlaneCredentialRef;\n readonly ssh?: {\n readonly user?: string;\n readonly port?: number;\n readonly credentials?: InfraControlPlaneCredentialRef;\n };\n };\n}\n\nexport interface InfraRuntimeConfigMap {\n readonly minikube: {\n readonly profile?: string;\n readonly driver?: 'docker' | 'podman';\n readonly cpus?: number;\n readonly memoryMiB?: number;\n };\n readonly k3s: {\n readonly version?: string;\n readonly topology?: { readonly servers: number; readonly agents: number };\n };\n readonly 'docker-compose': { readonly projectName?: string };\n}\n\nexport type InfraComputeSelection<P extends InfraComputeProviderId = InfraComputeProviderId> = {\n [K in P]: { readonly provider: K } & InfraComputeConfigMap[K];\n}[P];\nexport type InfraRuntimeSelection<P extends InfraRuntimeProviderId = InfraRuntimeProviderId> = {\n [K in P]: { readonly provider: K } & InfraRuntimeConfigMap[K];\n}[P];\n\n/** A discriminated union derived from the runtime catalog, never a Cartesian product. */\nexport type InfraDeploymentSpec = {\n [R in InfraRuntimeProviderId]: {\n readonly compute: InfraComputeSelection<(typeof INFRA_RUNTIME_COMPATIBILITY)[R][number]>;\n readonly runtime: InfraRuntimeSelection<R>;\n };\n}[InfraRuntimeProviderId];\n\n/** Portable S3-compatible persistence target; privileged values stay behind one credential ref. */\nexport interface InfraS3PersistenceTarget {\n readonly endpoint: string;\n readonly region: string;\n readonly bucket: string;\n readonly credentials: InfraControlPlaneCredentialRef;\n readonly forcePathStyle?: boolean;\n}\n\n/** Scheduled database protection intent; the selected database provider owns its concrete engine. */\nexport interface InfraScheduledDatabaseBackupSpec {\n readonly mode: 'scheduled';\n readonly target: InfraS3PersistenceTarget;\n readonly intervalHours?: number;\n}\n\nexport interface InfraDatabaseConfigMap {\n readonly supabase: {\n readonly tier?: 'dev' | 'prod';\n readonly backup?: InfraScheduledDatabaseBackupSpec;\n };\n}\nexport interface InfraObjectStorageConfigMap {\n readonly supabase: {\n readonly buckets?: SerializableSet;\n readonly backend?: InfraS3PersistenceTarget;\n };\n readonly r2: {\n readonly buckets?: SerializableSet;\n readonly accountId?: string;\n readonly credentials?: InfraControlPlaneCredentialRef;\n };\n}\nexport interface InfraAuthConfigMap {\n readonly supabase: {\n readonly scope?: AuthScope;\n readonly flow?: AuthFlowConfig;\n readonly signIn?: AuthSignInSpec;\n readonly signUp?: AuthSignUpSpec;\n readonly oauth?: AuthOAuthConfig;\n readonly profile?: AuthProfileSpec;\n };\n}\nexport interface InfraAuthzConfigMap {\n readonly cerbos: {\n readonly kind: 'RBAC' | 'ABAC';\n readonly policies?: ValueMap<string, string>;\n };\n}\nexport interface InfraSecretStoreConfigMap {\n readonly 'supabase-vault': { readonly schema?: string };\n}\n\nexport type InfraDatabaseSpec = {\n [P in InfraProviderFor<'database'>]: { readonly provider: P } & InfraDatabaseConfigMap[P];\n}[InfraProviderFor<'database'>];\nexport type InfraObjectStorageSpec = {\n [P in InfraProviderFor<'objectStorage'>]: {\n readonly provider: P;\n } & InfraObjectStorageConfigMap[P];\n}[InfraProviderFor<'objectStorage'>];\nexport type InfraAuthSpec = {\n [P in InfraProviderFor<'auth'>]: { readonly provider: P } & InfraAuthConfigMap[P];\n}[InfraProviderFor<'auth'>];\nexport type InfraAuthzSpec = {\n [P in InfraProviderFor<'authz'>]: { readonly provider: P } & InfraAuthzConfigMap[P];\n}[InfraProviderFor<'authz'>];\nexport type InfraSecretStoreSpec = {\n [P in InfraProviderFor<'secretStore'>]: { readonly provider: P } & InfraSecretStoreConfigMap[P];\n}[InfraProviderFor<'secretStore'>];\n\nexport interface InfraNetworkingTlsSpec {\n /** First production slice: runtime-managed ACME using the HTTP-01 challenge. */\n readonly mode: 'acme-http-01';\n /** ACME registration and expiry-notification contact. */\n readonly contactEmail: string;\n}\n\nexport interface InfraNetworkingSpec {\n /** Public DNS name intent, not automatic DNS/CDN vendor provisioning. */\n readonly domain?: string;\n /** Absolute HTTP(S) origin used by workloads that must know their external URL at startup. */\n readonly publicBaseUrl?: string;\n /** Runtime-neutral automatic TLS intent; the selected runtime owns concrete ingress configuration. */\n readonly tls?: InfraNetworkingTlsSpec;\n}\n\nexport interface InfraEnvironmentSpec {\n readonly deployment: InfraDeploymentSpec;\n readonly database?: InfraDatabaseSpec;\n readonly objectStorage?: InfraObjectStorageSpec;\n readonly auth?: InfraAuthSpec;\n readonly authz?: InfraAuthzSpec;\n readonly secretStore?: InfraSecretStoreSpec;\n readonly networking?: InfraNetworkingSpec;\n readonly workloads?: InfraWorkloadRegistry;\n}\n\nexport type InfraModuleId = string;\n\nexport interface InfraModuleSpec {\n readonly config?: DataContractValue;\n}\n\nexport type InfraModuleRegistry = EntityRegistry<InfraModuleId, InfraModuleSpec>;\n\nexport interface InfraManifest {\n readonly environments: Readonly<\n Record<'local', InfraEnvironmentSpec> &\n Partial<Record<Exclude<AppEnvironmentId, 'local'>, InfraEnvironmentSpec>>\n >;\n readonly apis?: ApiDefinitionRegistry;\n readonly modules: InfraModuleRegistry;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SerializableSet } from '../collections';
|
|
1
|
+
import type { EntityRegistry, SerializableSet, ValueMap } from '../collections';
|
|
2
2
|
import type { InfraControlPlaneCredentialRef, InfraSecretReference } from './infraSecrets';
|
|
3
3
|
export interface InfraWorkloadArtifact {
|
|
4
4
|
readonly kind: 'image';
|
|
@@ -60,16 +60,16 @@ export interface InfraWorkloadVolumeSpec {
|
|
|
60
60
|
readonly retention: 'retain' | 'delete-on-destroy';
|
|
61
61
|
}
|
|
62
62
|
export type InfraWorkloadId = string;
|
|
63
|
-
export type InfraWorkloadPortRegistry =
|
|
64
|
-
export type InfraWorkloadFileMap =
|
|
65
|
-
export type InfraWorkloadVolumeRegistry =
|
|
63
|
+
export type InfraWorkloadPortRegistry = EntityRegistry<string, InfraWorkloadPort>;
|
|
64
|
+
export type InfraWorkloadFileMap = ValueMap<string, InfraWorkloadValue>;
|
|
65
|
+
export type InfraWorkloadVolumeRegistry = EntityRegistry<string, InfraWorkloadVolumeSpec, 'id'>;
|
|
66
66
|
export interface InfraWorkloadSpec {
|
|
67
67
|
readonly id: InfraWorkloadId;
|
|
68
68
|
readonly artifact: InfraWorkloadArtifact;
|
|
69
69
|
readonly command?: readonly string[];
|
|
70
70
|
readonly args?: readonly string[];
|
|
71
71
|
readonly ports?: InfraWorkloadPortRegistry;
|
|
72
|
-
readonly environment?:
|
|
72
|
+
readonly environment?: ValueMap<string, InfraWorkloadValue>;
|
|
73
73
|
readonly files?: InfraWorkloadFileMap;
|
|
74
74
|
readonly health?: InfraWorkloadHealthSpec;
|
|
75
75
|
readonly resources?: InfraWorkloadResourceSpec;
|
|
@@ -79,5 +79,5 @@ export interface InfraWorkloadSpec {
|
|
|
79
79
|
/** IDs in the composed desired-state graph; the orchestrator validates missing/cyclic edges. */
|
|
80
80
|
readonly dependsOn?: SerializableSet;
|
|
81
81
|
}
|
|
82
|
-
export type InfraWorkloadRegistry =
|
|
82
|
+
export type InfraWorkloadRegistry = EntityRegistry<InfraWorkloadId, InfraWorkloadSpec, 'id'>;
|
|
83
83
|
//# sourceMappingURL=infraWorkload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraWorkload.d.ts","sourceRoot":"","sources":["../../src/types/infraWorkload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"infraWorkload.d.ts","sourceRoot":"","sources":["../../src/types/infraWorkload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAA;CAAE,GACrE;IACE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,kBAAkB,GAC1B,wBAAwB,GACxB;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,wFAAwF;IACx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js","sourceRoot":"","sources":["../../src/types/infraWorkload.ts"],"names":[],"mappings":"","sourcesContent":["import type { SerializableSet } from '../collections';\nimport type { InfraControlPlaneCredentialRef, InfraSecretReference } from './infraSecrets';\n\nexport interface InfraWorkloadArtifact {\n readonly kind: 'image';\n /** Prebuilt image, optionally pinned by digest. No registry/build provider requirement. */\n readonly image: string;\n}\n\nexport type InfraWorkloadScalarValue =\n | { readonly kind: 'literal'; readonly value: string }\n | { readonly kind: 'secret'; readonly reference: InfraSecretReference }\n | {\n readonly kind: 'credential';\n readonly reference: InfraControlPlaneCredentialRef;\n readonly key: string;\n }\n | { readonly kind: 'output'; readonly resourceId: string; readonly output: string };\n\nexport type InfraWorkloadValue =\n | InfraWorkloadScalarValue\n | {\n readonly kind: 'template';\n /** Ordered scalar segments materialized into one value only at the runtime boundary. */\n readonly segments: readonly InfraWorkloadScalarValue[];\n };\n\nexport interface InfraWorkloadPort {\n readonly port: number;\n readonly protocol?: 'tcp' | 'udp';\n /** Exact external listener port requested for a public single-replica workload. */\n readonly publishedPort?: number;\n}\n\nexport type InfraWorkloadHealthSpec = {\n readonly intervalSeconds?: number;\n readonly timeoutSeconds?: number;\n readonly failureThreshold?: number;\n} & (\n | { readonly kind: 'http'; readonly port: number; readonly path: string }\n | { readonly kind: 'tcp'; readonly port: number }\n | { readonly kind: 'command'; readonly command: readonly string[] }\n);\n\nexport interface InfraWorkloadResourceSpec {\n readonly cpuMillis?: number;\n readonly memoryMiB?: number;\n}\n\nexport interface InfraWorkloadVolumeSpec {\n readonly id: string;\n readonly mountPath: string;\n readonly sizeGiB: number;\n /** Seed a newly created empty volume from the image contents at mountPath before workload start. */\n readonly seed?: 'image';\n /** Persistence survives down and is retained by default on destroy. */\n readonly retention: 'retain' | 'delete-on-destroy';\n}\n\nexport type InfraWorkloadId = string;\nexport type InfraWorkloadPortRegistry =
|
|
1
|
+
{"version":3,"file":"infraWorkload.js","sourceRoot":"","sources":["../../src/types/infraWorkload.ts"],"names":[],"mappings":"","sourcesContent":["import type { EntityRegistry, SerializableSet, ValueMap } from '../collections';\nimport type { InfraControlPlaneCredentialRef, InfraSecretReference } from './infraSecrets';\n\nexport interface InfraWorkloadArtifact {\n readonly kind: 'image';\n /** Prebuilt image, optionally pinned by digest. No registry/build provider requirement. */\n readonly image: string;\n}\n\nexport type InfraWorkloadScalarValue =\n | { readonly kind: 'literal'; readonly value: string }\n | { readonly kind: 'secret'; readonly reference: InfraSecretReference }\n | {\n readonly kind: 'credential';\n readonly reference: InfraControlPlaneCredentialRef;\n readonly key: string;\n }\n | { readonly kind: 'output'; readonly resourceId: string; readonly output: string };\n\nexport type InfraWorkloadValue =\n | InfraWorkloadScalarValue\n | {\n readonly kind: 'template';\n /** Ordered scalar segments materialized into one value only at the runtime boundary. */\n readonly segments: readonly InfraWorkloadScalarValue[];\n };\n\nexport interface InfraWorkloadPort {\n readonly port: number;\n readonly protocol?: 'tcp' | 'udp';\n /** Exact external listener port requested for a public single-replica workload. */\n readonly publishedPort?: number;\n}\n\nexport type InfraWorkloadHealthSpec = {\n readonly intervalSeconds?: number;\n readonly timeoutSeconds?: number;\n readonly failureThreshold?: number;\n} & (\n | { readonly kind: 'http'; readonly port: number; readonly path: string }\n | { readonly kind: 'tcp'; readonly port: number }\n | { readonly kind: 'command'; readonly command: readonly string[] }\n);\n\nexport interface InfraWorkloadResourceSpec {\n readonly cpuMillis?: number;\n readonly memoryMiB?: number;\n}\n\nexport interface InfraWorkloadVolumeSpec {\n readonly id: string;\n readonly mountPath: string;\n readonly sizeGiB: number;\n /** Seed a newly created empty volume from the image contents at mountPath before workload start. */\n readonly seed?: 'image';\n /** Persistence survives down and is retained by default on destroy. */\n readonly retention: 'retain' | 'delete-on-destroy';\n}\n\nexport type InfraWorkloadId = string;\nexport type InfraWorkloadPortRegistry = EntityRegistry<string, InfraWorkloadPort>;\nexport type InfraWorkloadFileMap = ValueMap<string, InfraWorkloadValue>;\nexport type InfraWorkloadVolumeRegistry = EntityRegistry<string, InfraWorkloadVolumeSpec, 'id'>;\n\nexport interface InfraWorkloadSpec {\n readonly id: InfraWorkloadId;\n readonly artifact: InfraWorkloadArtifact;\n readonly command?: readonly string[];\n readonly args?: readonly string[];\n readonly ports?: InfraWorkloadPortRegistry;\n readonly environment?: ValueMap<string, InfraWorkloadValue>;\n readonly files?: InfraWorkloadFileMap;\n readonly health?: InfraWorkloadHealthSpec;\n readonly resources?: InfraWorkloadResourceSpec;\n readonly persistence?: InfraWorkloadVolumeRegistry;\n readonly exposure?: 'internal' | 'public';\n readonly replicas?: number;\n /** IDs in the composed desired-state graph; the orchestrator validates missing/cyclic edges. */\n readonly dependsOn?: SerializableSet;\n}\n\nexport type InfraWorkloadRegistry = EntityRegistry<InfraWorkloadId, InfraWorkloadSpec, 'id'>;\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
|
2
2
|
import type { SplashScreenSpec } from './appManifest/splashScreen';
|
|
3
3
|
import type { AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
4
4
|
import type { BindingValueSource, ComponentDataBindingRegistry, ScreenDataLoaderDefinition } from './bindings';
|
|
5
|
+
import type { EntityRegistry } from './collections';
|
|
5
6
|
import type { DataSourceRegistry } from './data';
|
|
6
7
|
import type { AppDeployManifest } from './deploy';
|
|
7
8
|
import type { InfraManifest } from './infra';
|
|
@@ -27,7 +28,7 @@ export interface ThemeConfig {
|
|
|
27
28
|
/** Component/pattern recipe override values; recipe schemas remain package-owned metadata. */
|
|
28
29
|
recipes?: ThemeRecipeOverrides;
|
|
29
30
|
}
|
|
30
|
-
export type ThemeRegistry =
|
|
31
|
+
export type ThemeRegistry = EntityRegistry<ThemeId, ThemeConfig, 'id'>;
|
|
31
32
|
export type ActionType = 'navigate' | 'alert' | 'console' | 'toggleDarkMode' | 'setLanguage' | 'search' | 'filter';
|
|
32
33
|
export interface NavigateAction {
|
|
33
34
|
type: 'navigate';
|
|
@@ -189,7 +190,7 @@ export interface AppManifest {
|
|
|
189
190
|
state?: AppStateSpec;
|
|
190
191
|
infra: InfraManifest;
|
|
191
192
|
navigator: AppNavigatorManifest;
|
|
192
|
-
screens:
|
|
193
|
+
screens: EntityRegistry<string, ScreenSpec, 'id'>;
|
|
193
194
|
dataSources?: DataSourceRegistry;
|
|
194
195
|
dataBindings?: ComponentDataBindingRegistry;
|
|
195
196
|
repository?: RepositoryManifest;
|
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,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,E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B,CAAC;IACF,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,uFAAuF;IACvF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yFAAyF;IACzF,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,6DAA6D;IAC7D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,WAAW,CAAC;CACvB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA6IA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;IACjB,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC;AAIX,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,YAAY,CAAU,CAAC;AAG3E,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAGjF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { SplashScreenSpec } from './appManifest/splashScreen';\nimport type { AuthIdentifierKind, AuthSignUpField } from './auth';\nimport type {\n BindingValueSource,\n ComponentDataBindingRegistry,\n ScreenDataLoaderDefinition,\n} from './bindings';\nimport type { EntityRegistry } from './collections';\nimport type { DataSourceRegistry } from './data';\nimport type { AppDeployManifest } from './deploy';\nimport type { InfraManifest } from './infra';\nimport type { MediaAssetReference, MediaManifest } from './media';\nimport type { AppNavigatorManifest } from './navigator';\nimport type { RepositoryManifest } from './repository';\nimport type { ScreenRequirements } from './requirements';\nimport type { SerializableValue } from './serializable';\nimport type { AppStateSpec } from './state';\nimport type { ThemeGlobalTokenOverrides, ThemeRecipeOverrides } from './theme';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport type ThemeId = string;\n\nexport interface ThemeConfig {\n id: ThemeId;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n /** Theme-global authored token overrides shared by light and dark mode. */\n tokens?: ThemeGlobalTokenOverrides;\n /** Component/pattern recipe override values; recipe schemas remain package-owned metadata. */\n recipes?: ThemeRecipeOverrides;\n}\n\nexport type ThemeRegistry = EntityRegistry<ThemeId, ThemeConfig, 'id'>;\n\nexport type ActionType =\n 'navigate' | 'alert' | 'console' | 'toggleDarkMode' | 'setLanguage' | 'search' | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue = SerializableValue;\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n ButtonPressEventDto['type'] | CollectionItemPressEventDto['type'] | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n ButtonPressEventDto | CollectionItemPressEventDto | FormSubmitEventDto;\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'] as const;\nexport type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'] as const;\nexport type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'] as const;\nexport type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];\n\ninterface IconPresentationSpec {\n size?: number | string;\n color?: string;\n}\n\nexport interface NamedIconSpec extends IconPresentationSpec {\n name: string;\n provider?: string;\n source?: never;\n}\n\nexport interface SvgIconSpec extends IconPresentationSpec {\n source: MediaAssetReference;\n name?: never;\n provider?: never;\n}\n\nexport type IconSpec = NamedIconSpec | SvgIconSpec;\n\nexport interface UiNodeRepeatSpec {\n source: BindingValueSource;\n itemAlias?: string;\n keyPath?: string;\n empty?: readonly UiNode[];\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n repeat?: UiNodeRepeatSpec;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n dataLoaders?: readonly ScreenDataLoaderDefinition[];\n requires?: ScreenRequirements;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n table?: string;\n primaryKey?: AuthProfilePrimaryKeyStrategy;\n createStrategy?: AuthProfileCreateStrategy;\n updateStrategy?: AuthProfileUpdateStrategy;\n}\n\nexport interface AppSettings {\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n category: AppCategory;\n themeId: ThemeId;\n created?: string;\n updated?: string;\n };\n themes: ThemeRegistry;\n activeThemeId: ThemeId;\n activeThemeMode?: 'dark' | 'light';\n splashScreen?: SplashScreenSpec;\n /** Studio-managed authoring media. Runtime/user uploads are intentionally separate. */\n media?: MediaManifest;\n /** App distribution desired state, separate from environment-specific infrastructure. */\n deploy?: AppDeployManifest;\n /** Application runtime state is not provisioned by Infra. */\n state?: AppStateSpec;\n infra: InfraManifest;\n navigator: AppNavigatorManifest;\n screens: EntityRegistry<string, ScreenSpec, 'id'>;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n repository?: RepositoryManifest;\n settings: AppSettings;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "22.0
|
|
3
|
+
"version": "22.1.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"ankh": {
|
|
6
6
|
"category": "contracts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@ankhorage/color-theory": "^0.3.1",
|
|
14
|
-
"@ankhorage/utility": "^1.
|
|
14
|
+
"@ankhorage/utility": "^1.4.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@ankhorage/devtools": "^1.12.0",
|
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
"./repository": {
|
|
93
93
|
"types": "./dist/repository.d.ts",
|
|
94
94
|
"default": "./dist/repository.js"
|
|
95
|
+
},
|
|
96
|
+
"./structure": {
|
|
97
|
+
"types": "./dist/structure/index.d.ts",
|
|
98
|
+
"default": "./dist/structure/index.js"
|
|
95
99
|
}
|
|
96
100
|
},
|
|
97
101
|
"description": "Serializable app, action, theme, auth, and secret-store contracts for Ankhorage.",
|
package/src/auth.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ValueMap } from './collections';
|
|
1
2
|
import type { AppDeployTargetId } from './deploy';
|
|
2
3
|
import type { AppEnvironmentId } from './environments';
|
|
3
4
|
import type { SecretRef } from './secrets';
|
|
@@ -301,7 +302,7 @@ export interface StartOAuthAuthorizationInput {
|
|
|
301
302
|
provider: AuthOAuthProviderId;
|
|
302
303
|
redirectUri: string;
|
|
303
304
|
scopes?: readonly string[];
|
|
304
|
-
queryParams?:
|
|
305
|
+
queryParams?: ValueMap<string, string>;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
export interface AuthOAuthAuthorizationRequest {
|
package/src/bindings.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityRegistry, ValueMap } from './collections';
|
|
1
2
|
import type { ApiId, EndpointId, OperationId } from './data';
|
|
2
3
|
import type { SerializableValue } from './serializable';
|
|
3
4
|
|
|
@@ -77,7 +78,7 @@ export type BindingInputValue =
|
|
|
77
78
|
}
|
|
78
79
|
| {
|
|
79
80
|
readonly kind: 'object';
|
|
80
|
-
readonly fields:
|
|
81
|
+
readonly fields: ValueMap<string, BindingInputValue>;
|
|
81
82
|
}
|
|
82
83
|
| {
|
|
83
84
|
readonly kind: 'source';
|
|
@@ -85,7 +86,7 @@ export type BindingInputValue =
|
|
|
85
86
|
readonly transforms?: readonly BindingValueTransform[];
|
|
86
87
|
};
|
|
87
88
|
|
|
88
|
-
export type BindingInputMap =
|
|
89
|
+
export type BindingInputMap = ValueMap<string, BindingInputValue>;
|
|
89
90
|
|
|
90
91
|
export interface OperationScreenDataLoaderDefinition {
|
|
91
92
|
readonly kind: 'operation';
|
|
@@ -123,10 +124,12 @@ export interface EventBinding {
|
|
|
123
124
|
export interface ComponentDataBinding {
|
|
124
125
|
readonly componentId: ComponentInstanceId;
|
|
125
126
|
readonly componentType?: ComponentTypeId;
|
|
126
|
-
readonly props?:
|
|
127
|
-
readonly events?:
|
|
127
|
+
readonly props?: ValueMap<string, PropBinding>;
|
|
128
|
+
readonly events?: ValueMap<string, readonly EventBinding[]>;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
export type ComponentDataBindingRegistry =
|
|
131
|
-
|
|
131
|
+
export type ComponentDataBindingRegistry = EntityRegistry<
|
|
132
|
+
ComponentInstanceId,
|
|
133
|
+
ComponentDataBinding,
|
|
134
|
+
'componentId'
|
|
132
135
|
>;
|
package/src/collections.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { isRecord } from '@ankhorage/utility/object';
|
|
2
2
|
|
|
3
|
+
/** Stable keyed entities whose collection identity is carried by the record key. */
|
|
4
|
+
export type EntityRegistry<
|
|
5
|
+
TKey extends string,
|
|
6
|
+
TValue,
|
|
7
|
+
TIdentityField extends Extract<keyof TValue, string> = never,
|
|
8
|
+
> = Readonly<Record<TKey, TValue>> & Readonly<Record<never, TIdentityField>>;
|
|
9
|
+
|
|
10
|
+
/** Keyed configuration/property values whose key is part of the value's meaning. */
|
|
11
|
+
export type ValueMap<TKey extends string, TValue> = Readonly<Record<TKey, TValue>>;
|
|
12
|
+
|
|
3
13
|
export type SerializableSet<T extends string = string> = Readonly<Partial<Record<T, true>>>;
|
|
4
14
|
|
|
5
15
|
/*** Validate the canonical JSON-safe representation for unordered string membership. */
|
package/src/data/apis.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityRegistry } from '../collections';
|
|
1
2
|
import type { DataEndpointRegistry } from './endpoints';
|
|
2
3
|
import type { ApiId } from './ids';
|
|
3
4
|
import type { CredentialRef } from './refs';
|
|
@@ -60,4 +61,4 @@ export interface InternalRestApiDefinition extends ApiBaseDefinition {
|
|
|
60
61
|
export type ApiDefinition =
|
|
61
62
|
ExternalGraphQlApiDefinition | ExternalRestApiDefinition | InternalRestApiDefinition;
|
|
62
63
|
|
|
63
|
-
export type ApiDefinitionRegistry =
|
|
64
|
+
export type ApiDefinitionRegistry = EntityRegistry<ApiId, ApiDefinition, 'id'>;
|
package/src/data/endpoints.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { EntityRegistry } from '../collections';
|
|
2
|
+
import type { EndpointId } from './ids';
|
|
3
|
+
import type { DataOperationRegistry } from './operations';
|
|
3
4
|
import type { CredentialRef } from './refs';
|
|
4
5
|
import type { DataContractValue } from './values';
|
|
5
6
|
|
|
@@ -13,8 +14,8 @@ export interface DataEndpointConfig {
|
|
|
13
14
|
readonly baseUrl?: string;
|
|
14
15
|
readonly path?: string;
|
|
15
16
|
readonly credential?: CredentialRef;
|
|
16
|
-
readonly operations:
|
|
17
|
+
readonly operations: DataOperationRegistry;
|
|
17
18
|
readonly metadata?: DataContractValue;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export type DataEndpointRegistry =
|
|
21
|
+
export type DataEndpointRegistry = EntityRegistry<EndpointId, DataEndpointConfig, 'id'>;
|
package/src/data/operations.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityRegistry } from '../collections';
|
|
1
2
|
import type { EndpointId, OperationId } from './ids';
|
|
2
3
|
import type { CredentialRef } from './refs';
|
|
3
4
|
import type { DataSchemaSlot } from './schemas';
|
|
@@ -56,4 +57,4 @@ export interface DataOperationConfig {
|
|
|
56
57
|
readonly metadata?: DataContractValue;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export type DataOperationRegistry =
|
|
60
|
+
export type DataOperationRegistry = EntityRegistry<OperationId, DataOperationConfig, 'id'>;
|
package/src/data/schemas.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ValueMap } from '../collections';
|
|
1
2
|
import type { SchemaId } from './ids';
|
|
2
3
|
import type { DataContractValue } from './values';
|
|
3
4
|
|
|
@@ -23,7 +24,7 @@ export interface DataSchema {
|
|
|
23
24
|
readonly format?: string;
|
|
24
25
|
readonly nullable?: boolean;
|
|
25
26
|
readonly required?: readonly string[];
|
|
26
|
-
readonly properties?:
|
|
27
|
+
readonly properties?: ValueMap<string, DataSchema>;
|
|
27
28
|
readonly additionalProperties?: boolean | DataSchema;
|
|
28
29
|
readonly items?: DataSchema;
|
|
29
30
|
readonly allOf?: readonly DataSchema[];
|
|
@@ -32,7 +33,7 @@ export interface DataSchema {
|
|
|
32
33
|
readonly ref?: DataSchemaRef;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export type DataSchemaRegistry =
|
|
36
|
+
export type DataSchemaRegistry = ValueMap<SchemaId, DataSchema>;
|
|
36
37
|
|
|
37
38
|
export interface DataSchemaSlot {
|
|
38
39
|
readonly schema?: DataSchema;
|
package/src/data/sources.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityRegistry } from '../collections';
|
|
1
2
|
import type { DataEndpointRegistry } from './endpoints';
|
|
2
3
|
import type { DataSourceId } from './ids';
|
|
3
4
|
import type { CredentialRef, DatabaseAdapterRef } from './refs';
|
|
@@ -19,4 +20,4 @@ export interface DatabaseDataSourceConfig {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export type DataSourceConfig = DatabaseDataSourceConfig;
|
|
22
|
-
export type DataSourceRegistry =
|
|
23
|
+
export type DataSourceRegistry = EntityRegistry<DataSourceId, DataSourceConfig, 'id'>;
|
package/src/index.ts
CHANGED
package/src/media.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isRecord } from '@ankhorage/utility/object';
|
|
2
2
|
import { isNonEmptyString } from '@ankhorage/utility/string';
|
|
3
3
|
|
|
4
|
+
import type { EntityRegistry } from './collections';
|
|
5
|
+
|
|
4
6
|
export const MEDIA_ASSET_KINDS = ['image', 'audio', 'video', 'font', 'file'] as const;
|
|
5
7
|
|
|
6
8
|
export type MediaAssetKind = (typeof MEDIA_ASSET_KINDS)[number];
|
|
@@ -46,7 +48,7 @@ export interface MediaAsset {
|
|
|
46
48
|
readonly metadata?: MediaAssetMetadata;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
export type MediaAssetRegistry =
|
|
51
|
+
export type MediaAssetRegistry = EntityRegistry<string, MediaAsset, 'id'>;
|
|
50
52
|
|
|
51
53
|
/*** App-authoring media pool. Runtime/user-generated uploads do not belong here. */
|
|
52
54
|
export interface MediaManifest {
|
package/src/navigator.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ValueMap } from './collections';
|
|
1
2
|
import type { IconSpec, ManifestValue } from './types';
|
|
2
3
|
|
|
3
4
|
export { isAppNavigatorManifest } from './appManifest/navigator';
|
|
@@ -214,7 +215,7 @@ export interface SplitViewNavigatorNode extends NavigatorNodeBase {
|
|
|
214
215
|
export interface CustomNavigatorNode extends NavigatorNodeBase {
|
|
215
216
|
type: 'custom';
|
|
216
217
|
navigatorId: string;
|
|
217
|
-
config?:
|
|
218
|
+
config?: ValueMap<string, ManifestValue>;
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
export type NavigatorNode =
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { isStructureDescriptor } from './isStructureDescriptor';
|
|
2
|
+
export { isStructureDescriptorDocument } from './isStructureDescriptorDocument';
|
|
3
|
+
export type {
|
|
4
|
+
StructureDescriptor,
|
|
5
|
+
StructureDescriptorDefinition,
|
|
6
|
+
StructureDescriptorDocument,
|
|
7
|
+
StructureDescriptorId,
|
|
8
|
+
StructureDescriptorRegistry,
|
|
9
|
+
StructureEntityRegistryDescriptor,
|
|
10
|
+
StructureEnumDescriptor,
|
|
11
|
+
StructureLiteralValue,
|
|
12
|
+
StructureObjectDescriptor,
|
|
13
|
+
StructureObjectField,
|
|
14
|
+
StructureOrderedListDescriptor,
|
|
15
|
+
StructureReferenceDescriptor,
|
|
16
|
+
StructureScalarDescriptor,
|
|
17
|
+
StructureScalarType,
|
|
18
|
+
StructureSetDescriptor,
|
|
19
|
+
StructureUnionDescriptor,
|
|
20
|
+
StructureValueMapDescriptor,
|
|
21
|
+
} from './types';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { hasOnlyKeys, isRecord } from '@ankhorage/utility/object';
|
|
2
|
+
import { isNonEmptyString } from '@ankhorage/utility/string';
|
|
3
|
+
|
|
4
|
+
import type { StructureDescriptor, StructureLiteralValue, StructureScalarType } from './types';
|
|
5
|
+
|
|
6
|
+
/*** Validate one standalone structural descriptor without resolving external/local references. */
|
|
7
|
+
export function isStructureDescriptor(value: unknown): value is StructureDescriptor {
|
|
8
|
+
return isDescriptor(value, new Set());
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/*** Validate one descriptor recursively while rejecting cyclic inline object graphs. */
|
|
12
|
+
function isDescriptor(value: unknown, ancestors: Set<object>): value is StructureDescriptor {
|
|
13
|
+
if (!isRecord(value) || typeof value.kind !== 'string' || ancestors.has(value)) return false;
|
|
14
|
+
ancestors.add(value);
|
|
15
|
+
const valid = validateDescriptorKind(value, ancestors);
|
|
16
|
+
ancestors.delete(value);
|
|
17
|
+
return valid;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*** Dispatch descriptor validation by its explicit structural kind. */
|
|
21
|
+
function validateDescriptorKind(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
22
|
+
switch (value.kind) {
|
|
23
|
+
case 'scalar':
|
|
24
|
+
return isScalarDescriptor(value);
|
|
25
|
+
case 'enum':
|
|
26
|
+
return isEnumDescriptor(value);
|
|
27
|
+
case 'object':
|
|
28
|
+
return isObjectDescriptor(value, ancestors);
|
|
29
|
+
case 'entity-registry':
|
|
30
|
+
return isEntityRegistryDescriptor(value, ancestors);
|
|
31
|
+
case 'value-map':
|
|
32
|
+
return isValueMapDescriptor(value, ancestors);
|
|
33
|
+
case 'set':
|
|
34
|
+
return isSetDescriptor(value, ancestors);
|
|
35
|
+
case 'ordered-list':
|
|
36
|
+
return isOrderedListDescriptor(value, ancestors);
|
|
37
|
+
case 'union':
|
|
38
|
+
return isUnionDescriptor(value, ancestors);
|
|
39
|
+
case 'ref':
|
|
40
|
+
return isReferenceDescriptor(value);
|
|
41
|
+
default:
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/*** Validate a scalar descriptor and its closed primitive vocabulary. */
|
|
47
|
+
function isScalarDescriptor(value: Record<string, unknown>): boolean {
|
|
48
|
+
return (
|
|
49
|
+
hasOnlyKeys(value, ['kind', 'type']) &&
|
|
50
|
+
typeof value.type === 'string' &&
|
|
51
|
+
SCALAR_TYPES.has(value.type as StructureScalarType)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*** Validate a non-empty finite scalar literal set without duplicate members. */
|
|
56
|
+
function isEnumDescriptor(value: Record<string, unknown>): boolean {
|
|
57
|
+
if (!hasOnlyKeys(value, ['kind', 'values']) || !Array.isArray(value.values)) return false;
|
|
58
|
+
if (value.values.length === 0 || !value.values.every(isStructureLiteralValue)) return false;
|
|
59
|
+
const identities = value.values.map(structureLiteralIdentity);
|
|
60
|
+
return new Set(identities).size === identities.length;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*** Validate a fixed-field object descriptor. */
|
|
64
|
+
function isObjectDescriptor(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
65
|
+
return (
|
|
66
|
+
hasOnlyKeys(value, ['kind', 'fields']) &&
|
|
67
|
+
isRecord(value.fields) &&
|
|
68
|
+
Object.values(value.fields).every((field) => isObjectField(field, ancestors))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/*** Validate one object field and its optionality marker. */
|
|
73
|
+
function isObjectField(value: unknown, ancestors: Set<object>): boolean {
|
|
74
|
+
return (
|
|
75
|
+
isRecord(value) &&
|
|
76
|
+
hasOnlyKeys(value, ['value', 'optional']) &&
|
|
77
|
+
(value.optional === undefined || typeof value.optional === 'boolean') &&
|
|
78
|
+
isDescriptor(value.value, ancestors)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*** Validate a stable keyed entity collection descriptor. */
|
|
83
|
+
function isEntityRegistryDescriptor(
|
|
84
|
+
value: Record<string, unknown>,
|
|
85
|
+
ancestors: Set<object>,
|
|
86
|
+
): boolean {
|
|
87
|
+
return (
|
|
88
|
+
hasOnlyKeys(value, ['kind', 'key', 'value', 'identityField']) &&
|
|
89
|
+
isStringKeyDescriptor(value.key, ancestors) &&
|
|
90
|
+
isDescriptor(value.value, ancestors) &&
|
|
91
|
+
(value.identityField === undefined || isNonEmptyString(value.identityField))
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/*** Validate a keyed property/configuration map descriptor. */
|
|
96
|
+
function isValueMapDescriptor(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
97
|
+
return (
|
|
98
|
+
hasOnlyKeys(value, ['kind', 'key', 'value']) &&
|
|
99
|
+
isStringKeyDescriptor(value.key, ancestors) &&
|
|
100
|
+
isDescriptor(value.value, ancestors)
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/*** Validate an unordered string-membership descriptor. */
|
|
105
|
+
function isSetDescriptor(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
106
|
+
return hasOnlyKeys(value, ['kind', 'member']) && isStringKeyDescriptor(value.member, ancestors);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*** Validate a semantically ordered list descriptor. */
|
|
110
|
+
function isOrderedListDescriptor(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
111
|
+
return hasOnlyKeys(value, ['kind', 'item']) && isDescriptor(value.item, ancestors);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/*** Validate a union descriptor with at least two valid variants. */
|
|
115
|
+
function isUnionDescriptor(value: Record<string, unknown>, ancestors: Set<object>): boolean {
|
|
116
|
+
return (
|
|
117
|
+
hasOnlyKeys(value, ['kind', 'variants', 'discriminator']) &&
|
|
118
|
+
Array.isArray(value.variants) &&
|
|
119
|
+
value.variants.length >= 2 &&
|
|
120
|
+
value.variants.every((variant) => isDescriptor(variant, ancestors)) &&
|
|
121
|
+
(value.discriminator === undefined || isNonEmptyString(value.discriminator))
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/*** Validate a local or package-qualified descriptor reference. */
|
|
126
|
+
function isReferenceDescriptor(value: Record<string, unknown>): boolean {
|
|
127
|
+
return (
|
|
128
|
+
hasOnlyKeys(value, ['kind', 'id', 'packageName']) &&
|
|
129
|
+
isNonEmptyString(value.id) &&
|
|
130
|
+
(value.packageName === undefined || isNonEmptyString(value.packageName))
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/*** Validate a descriptor that can represent a JSON object key or set member string. */
|
|
135
|
+
function isStringKeyDescriptor(value: unknown, ancestors: Set<object>): boolean {
|
|
136
|
+
if (!isDescriptor(value, ancestors)) return false;
|
|
137
|
+
if (value.kind === 'ref') return true;
|
|
138
|
+
if (value.kind === 'scalar') return value.type === 'string';
|
|
139
|
+
return value.kind === 'enum' && value.values.every((member) => typeof member === 'string');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*** Validate one serializable scalar literal used by finite enum descriptors. */
|
|
143
|
+
function isStructureLiteralValue(value: unknown): value is StructureLiteralValue {
|
|
144
|
+
return (
|
|
145
|
+
value === null ||
|
|
146
|
+
typeof value === 'boolean' ||
|
|
147
|
+
(typeof value === 'number' && Number.isFinite(value)) ||
|
|
148
|
+
typeof value === 'string'
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/*** Produce an unambiguous identity for one scalar enum member. */
|
|
153
|
+
function structureLiteralIdentity(value: StructureLiteralValue): string {
|
|
154
|
+
return value === null ? 'null' : `${typeof value}:${String(value)}`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const SCALAR_TYPES = new Set<StructureScalarType>([
|
|
158
|
+
'boolean',
|
|
159
|
+
'integer',
|
|
160
|
+
'null',
|
|
161
|
+
'number',
|
|
162
|
+
'string',
|
|
163
|
+
]);
|