@supacloud/compiler 0.27.4 → 0.28.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.
@@ -1,4 +1,5 @@
1
1
  import { type ExecutionContextPack } from "./execution-context";
2
+ import { type ApplicationDevelopmentContext } from "./application-development";
2
3
  export declare class DeliveryContextError extends Error {
3
4
  readonly code: "DELIVERY_CONTEXT_INVALID" | "DELIVERY_CONTEXT_IDENTITY_MISMATCH" | "DELIVERY_CONTEXT_INTEGRITY_FAILED";
4
5
  constructor(code: "DELIVERY_CONTEXT_INVALID" | "DELIVERY_CONTEXT_IDENTITY_MISMATCH" | "DELIVERY_CONTEXT_INTEGRITY_FAILED");
@@ -11,5 +12,20 @@ export interface DeliveryExecutionContextPack extends Omit<ExecutionContextPack,
11
12
  artifactVerified: true;
12
13
  };
13
14
  }
15
+ export interface DeliveredApplicationDevelopmentContext {
16
+ correlation: "verified-build-snapshot";
17
+ delivery: {
18
+ target: string;
19
+ objectId: string;
20
+ artifactVerified: true;
21
+ };
22
+ context: ApplicationDevelopmentContext;
23
+ }
24
+ /**
25
+ * Read the application development contract from an immutable delivered object.
26
+ * Local artifact integrity only: this does not attest deployment, runtime state
27
+ * or account identity. It never falls back to the current source checkout.
28
+ */
29
+ export declare function readApplicationDevelopmentContext(manifestPath: string, target: string): Promise<DeliveredApplicationDevelopmentContext>;
14
30
  /** Local artifact integrity only. Caller-supplied events do not attest execution or deployment. */
15
31
  export declare function createDeliveryExecutionContextPack(manifestPath: string, target: string, subject: string, observations: unknown, requestId: string): Promise<DeliveryExecutionContextPack>;
@@ -4,6 +4,7 @@ import { type GenerateOptions } from "./generate";
4
4
  /** Keep conservative service factories while restricting exposed route/job descriptors. */
5
5
  export declare function renderDeliveryTarget(graph: ApplicationGraph, target: DeliveryTarget, options: GenerateOptions): {
6
6
  executionSnapshot: string;
7
+ applicationDevelopment: string;
7
8
  applicationCode: string;
8
9
  manifestJson: string;
9
10
  contractsManifestJson: string;
@@ -0,0 +1,3 @@
1
+ import { type EnvironmentBindingsDocument } from "./environment-bindings";
2
+ /** Bound actual bytes before decoding/parsing, including files growing during a read. */
3
+ export declare function readEnvironmentBindingsFile(file: string): Promise<EnvironmentBindingsDocument>;
@@ -0,0 +1,78 @@
1
+ import type { ApplicationGraph, InfraResourceKind } from "./types";
2
+ /** Static binding references only; this never proves runtime availability or permissions. */
3
+ export declare const ENVIRONMENT_BINDINGS_SCHEMA = "supacloud.environments.v1";
4
+ export declare const ENVIRONMENT_BINDINGS_PROJECTION_SCHEMA = "supacloud.environment-bindings.v1";
5
+ export declare const ENVIRONMENT_BINDING_REFERENCE_PATTERN = "^(?:local|[a-z][a-z0-9-]{0,15}:[A-Za-z0-9][A-Za-z0-9_.-]{0,63})$";
6
+ export declare const ENVIRONMENT_BINDINGS_LIMITS: {
7
+ readonly environments: number;
8
+ readonly bindings: number;
9
+ readonly resources: number;
10
+ readonly outputBytes: number;
11
+ };
12
+ export type EnvironmentBindingErrorCode = "ENVIRONMENT_BINDINGS_INVALID" | "ENVIRONMENT_BINDINGS_TOO_LARGE" | "ENVIRONMENT_BINDINGS_UNKNOWN_ENVIRONMENT" | "ENVIRONMENT_BINDINGS_PRODUCTION_FORBIDDEN";
13
+ export declare class EnvironmentBindingError extends Error {
14
+ readonly code: EnvironmentBindingErrorCode;
15
+ constructor(code: EnvironmentBindingErrorCode);
16
+ }
17
+ export type EnvironmentBindingDiagnosticCode = "missing-environment-binding" | "unknown-environment-binding" | "invalid-environment-binding";
18
+ export interface EnvironmentBindingDiagnostic {
19
+ code: EnvironmentBindingDiagnosticCode;
20
+ severity: "error";
21
+ environment: string;
22
+ resource?: string;
23
+ message: string;
24
+ }
25
+ export interface EnvironmentBindingsDocument {
26
+ schema: typeof ENVIRONMENT_BINDINGS_SCHEMA;
27
+ environments: Record<string, {
28
+ bindings: Record<string, string>;
29
+ }>;
30
+ }
31
+ export interface EnvironmentBindingEntry {
32
+ resource: string;
33
+ kind: InfraResourceKind;
34
+ binding: string;
35
+ }
36
+ export interface EnvironmentBindingsProjection {
37
+ schema: typeof ENVIRONMENT_BINDINGS_PROJECTION_SCHEMA;
38
+ environment: string;
39
+ bindings: EnvironmentBindingEntry[];
40
+ omitted: {
41
+ resources: number;
42
+ };
43
+ limits: typeof ENVIRONMENT_BINDINGS_LIMITS;
44
+ }
45
+ export interface EnvironmentBindingsResult {
46
+ projection: EnvironmentBindingsProjection;
47
+ diagnostics: EnvironmentBindingDiagnostic[];
48
+ }
49
+ /** Parse a detached document, retaining invalid references for safe resolution diagnostics. */
50
+ export declare function parseEnvironmentBindings(value: unknown): EnvironmentBindingsDocument;
51
+ export declare function formatEnvironmentBindings(result: EnvironmentBindingsResult): string;
52
+ /** Resolve only own binding properties and reject invalid references without echoing them. */
53
+ export declare function resolveEnvironmentBindings(graph: ApplicationGraph, document: EnvironmentBindingsDocument, environment: string): EnvironmentBindingsResult;
54
+ /** Classification only. A name check is not proof of environment identity or isolation. */
55
+ export declare const RUNTIME_BINDINGS_SCHEMA = "supacloud.runtime-bindings.v1";
56
+ export type RuntimeBindingProfile = "fast" | "integration";
57
+ export type RuntimeBindingMode = "ephemeral" | "external";
58
+ export interface RuntimeBindingEntry extends EnvironmentBindingEntry {
59
+ mode: RuntimeBindingMode;
60
+ }
61
+ export interface RuntimeBindingsProjection {
62
+ schema: typeof RUNTIME_BINDINGS_SCHEMA;
63
+ profile: RuntimeBindingProfile;
64
+ environment: string;
65
+ credentials: "resolved-by-local-runner";
66
+ bindings: RuntimeBindingEntry[];
67
+ omitted: {
68
+ resources: number;
69
+ };
70
+ limits: typeof ENVIRONMENT_BINDINGS_LIMITS;
71
+ }
72
+ export interface RuntimeBindingsResult {
73
+ projection: RuntimeBindingsProjection;
74
+ diagnostics: EnvironmentBindingDiagnostic[];
75
+ }
76
+ export declare function formatRuntimeBindings(result: RuntimeBindingsResult): string;
77
+ /** Validate the full declaration set before applying any display limit. */
78
+ export declare function resolveRuntimeBindings(graph: ApplicationGraph, document: EnvironmentBindingsDocument, environment: string, profile: RuntimeBindingProfile): RuntimeBindingsResult;
@@ -10,6 +10,9 @@ export declare const EXECUTION_CONTEXT_LIMITS: {
10
10
  readonly files: number;
11
11
  readonly diagnostics: number;
12
12
  readonly plans: number;
13
+ readonly timeline: number;
14
+ readonly timelineAttempts: number;
15
+ readonly timelineStages: number;
13
16
  };
14
17
  interface ExecutionMetadata {
15
18
  kind: "route" | "command" | "job";
@@ -18,6 +21,39 @@ interface ExecutionMetadata {
18
21
  phase: "started" | "succeeded" | "failed";
19
22
  requestId?: string;
20
23
  durationMs?: number;
24
+ /** 1-based execution attempt; omitted means the first. Distinguishes retries without inventing a counter. */
25
+ attempt?: number;
26
+ /** Opaque correlation ID (for example a W3C trace ID) shared across a business operation and its tasks. */
27
+ traceId?: string;
28
+ }
29
+ export interface ExecutionTimelineStage {
30
+ stage: string;
31
+ phase: "started" | "succeeded" | "failed";
32
+ durationMs?: number;
33
+ index: number;
34
+ }
35
+ export interface ExecutionTimelineAttempt {
36
+ attempt: number;
37
+ stages: ExecutionTimelineStage[];
38
+ failed: boolean;
39
+ /** The last declared stage succeeded in the matched input, before display caps. Not business success. */
40
+ complete: boolean;
41
+ /** Declared stages with no observation in this attempt. Absence is not proof a stage was skipped. */
42
+ missingStages: string[];
43
+ /** Observed stages not present in the current static plan. */
44
+ unexpectedStages: string[];
45
+ traceIds: string[];
46
+ /** Matched stage observations excluded from this attempt's displayed details. */
47
+ omittedStages: number;
48
+ }
49
+ export interface ExecutionTimelineEntry {
50
+ kind: "route" | "command" | "job";
51
+ operation: string;
52
+ module: string;
53
+ declaredStages: string[];
54
+ attempts: ExecutionTimelineAttempt[];
55
+ /** Attempts excluded from this entry by the display cap. */
56
+ omittedAttempts: number;
21
57
  }
22
58
  export declare class ExecutionContextError extends Error {
23
59
  readonly code: "EXECUTION_METADATA_INVALID" | "EXECUTION_METADATA_UNREADABLE" | "EXECUTION_CONTEXT_NOT_FOUND" | "EXECUTION_CONTEXT_TOO_LARGE";
@@ -57,7 +93,10 @@ export interface ExecutionContextPack {
57
93
  diagnostics: number;
58
94
  plans: number;
59
95
  unmatchedEvents: number;
96
+ timeline: number;
60
97
  };
98
+ /** Per-operation timeline summarized from all matched observations, independently of display caps. */
99
+ timeline: ExecutionTimelineEntry[];
61
100
  limits: typeof EXECUTION_CONTEXT_LIMITS;
62
101
  }
63
102
  /** Read only a bounded regular file; parse failures never echo file contents or paths. */
@@ -3,5 +3,5 @@
3
3
  * AST analysis matches decorators by name only and generated code does not import it;
4
4
  * implementation exists only so fixture sources can be dynamically imported and executed by bun.
5
5
  */
6
- export declare const RUNTIME_SOURCE = "export class InjectionToken<T = unknown> {\n readonly name: string;\n readonly scope?: string;\n\n constructor(name: string, options: { scope?: string } = {}) {\n this.name = name;\n this.scope = options.scope;\n }\n}\n\nexport function Injectable(_options: { scope?: string; deps?: unknown[] } = {}) {\n return () => {};\n}\n\nexport function Inject(_token: unknown) {\n return () => {};\n}\n\nexport function Module(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function defineModule(_options: Record<string, unknown>) {\n return class DefinedModule {};\n}\n\nexport function Command(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Job(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Query(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Controller(_path: string) {\n return () => {};\n}\n\nfunction routeDecorator(_method: string) {\n return (_path: string, _options?: Record<string, unknown>) => () => {};\n}\n\nexport const Get = routeDecorator(\"GET\");\nexport const Post = routeDecorator(\"POST\");\nexport const Put = routeDecorator(\"PUT\");\nexport const Patch = routeDecorator(\"PATCH\");\nexport const Delete = routeDecorator(\"DELETE\");\nexport const Head = routeDecorator(\"HEAD\");\nexport const Options = routeDecorator(\"OPTIONS\");\n\nexport const REQUEST_CONTEXT = new InjectionToken(\"supacloud.request-context\", {\n scope: \"request\",\n});\nexport const JOB_CONTEXT = new InjectionToken(\"supacloud.job-context\", {\n scope: \"job\",\n});\n";
6
+ export declare const RUNTIME_SOURCE = "export class InjectionToken<T = unknown> {\n readonly name: string;\n readonly scope?: string;\n\n constructor(name: string, options: { scope?: string } = {}) {\n this.name = name;\n this.scope = options.scope;\n }\n}\n\nexport function Injectable(_options: { scope?: string; deps?: unknown[] } = {}) {\n return () => {};\n}\n\nexport function Inject(_token: unknown) {\n return () => {};\n}\n\nexport function Module(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function defineModule(_options: Record<string, unknown>) {\n return class DefinedModule {};\n}\n\nexport function Command(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Job(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Query(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function InfraResource(_options: { name: string; kind: string }) {\n return () => {};\n}\n\nexport function Controller(_path: string) {\n return () => {};\n}\n\nfunction routeDecorator(_method: string) {\n return (_path: string, _options?: Record<string, unknown>) => () => {};\n}\n\nexport const Get = routeDecorator(\"GET\");\nexport const Post = routeDecorator(\"POST\");\nexport const Put = routeDecorator(\"PUT\");\nexport const Patch = routeDecorator(\"PATCH\");\nexport const Delete = routeDecorator(\"DELETE\");\nexport const Head = routeDecorator(\"HEAD\");\nexport const Options = routeDecorator(\"OPTIONS\");\n\nexport const REQUEST_CONTEXT = new InjectionToken(\"supacloud.request-context\", {\n scope: \"request\",\n});\nexport const JOB_CONTEXT = new InjectionToken(\"supacloud.job-context\", {\n scope: \"job\",\n});\n";
7
7
  export declare const FIXTURE_TSCONFIG = "{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"experimentalDecorators\": true,\n \"strict\": true\n }\n}\n";
package/dist/index.d.ts CHANGED
@@ -10,7 +10,15 @@ export type { DeliveryOptions, DeliveryPlan, DeliveryPlanResult, DeliveryTarget,
10
10
  export { generateFeatureSource, validateFeatureSpec } from "./feature";
11
11
  export { applyDiagnosticFix } from "./fixes";
12
12
  export { createExecutionContextPack, readExecutionMetadata, EXECUTION_CONTEXT_LIMITS, ExecutionContextError } from "./execution-context";
13
- export type { ExecutionContextPack } from "./execution-context";
13
+ export type { ExecutionContextPack, ExecutionTimelineStage, ExecutionTimelineAttempt, ExecutionTimelineEntry } from "./execution-context";
14
+ export { readApplicationDevelopmentContext, DeliveryContextError } from "./delivery-context";
15
+ export type { DeliveredApplicationDevelopmentContext, DeliveryExecutionContextPack } from "./delivery-context";
16
+ export { createApplicationDevelopmentContext, parseApplicationDevelopmentContext, formatApplicationDevelopmentContext, APPLICATION_DEVELOPMENT_LIMITS, APPLICATION_DEVELOPMENT_ARCHIVE_MAX_BYTES, APPLICATION_DEVELOPMENT_SCHEMA, ApplicationDevelopmentError, } from "./application-development";
17
+ export type { ApplicationDevelopmentContext, ApplicationDevelopmentOptions, ApplicationDevelopmentModule, ApplicationDevelopmentRoute, ApplicationDevelopmentCommand, ApplicationDevelopmentJob, ApplicationDevelopmentResource, ApplicationDevelopmentResourceUse, ApplicationDevelopmentResourceUseEntry, ApplicationDevelopmentDiagnostic, DevelopmentSchemaKind, } from "./application-development";
18
+ export { parseEnvironmentBindings, resolveEnvironmentBindings, resolveRuntimeBindings, formatEnvironmentBindings, formatRuntimeBindings, EnvironmentBindingError, ENVIRONMENT_BINDINGS_SCHEMA, ENVIRONMENT_BINDINGS_PROJECTION_SCHEMA, ENVIRONMENT_BINDING_REFERENCE_PATTERN, ENVIRONMENT_BINDINGS_LIMITS, RUNTIME_BINDINGS_SCHEMA, } from "./environment-bindings";
19
+ export type { EnvironmentBindingsDocument, EnvironmentBindingsProjection, EnvironmentBindingsResult, EnvironmentBindingEntry, EnvironmentBindingDiagnostic, EnvironmentBindingDiagnosticCode, EnvironmentBindingErrorCode, RuntimeBindingProfile, RuntimeBindingMode, RuntimeBindingEntry, RuntimeBindingsProjection, RuntimeBindingsResult, } from "./environment-bindings";
20
+ export { createReleaseEvidence, formatReleaseEvidence, RELEASE_EVIDENCE_SCHEMA, ReleaseEvidenceError, } from "./release-evidence";
21
+ export type { ReleaseEvidence, ReleaseEvidenceErrorCode } from "./release-evidence";
14
22
  export type { AppliedDiagnosticFix, ApplyDiagnosticFixOptions } from "./fixes";
15
23
  export { createDiagnosticRepairPlan } from "./repair-plan";
16
24
  export type { DiagnosticRepair } from "./repair-plan";