@supacloud/compiler 0.15.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ export interface SourceMigrationIssue {
2
+ code: string;
3
+ message: string;
4
+ file: string;
5
+ line?: number;
6
+ }
7
+ export interface SourceMigrationResult {
8
+ changed: boolean;
9
+ content: string;
10
+ replacements: number;
11
+ issues: SourceMigrationIssue[];
12
+ }
13
+ export interface SupaCloudMigration {
14
+ id: string;
15
+ from: string;
16
+ to: string;
17
+ description: string;
18
+ apply(source: string, fileName: string): SourceMigrationResult;
19
+ }
20
+ export interface MigrateProjectOptions {
21
+ rootDir: string;
22
+ include?: string[];
23
+ write?: boolean;
24
+ }
25
+ export interface MigrateFileResult {
26
+ file: string;
27
+ changed: boolean;
28
+ replacements: number;
29
+ issues: SourceMigrationIssue[];
30
+ }
31
+ export interface MigrateProjectResult {
32
+ write: boolean;
33
+ migrations: Array<Pick<SupaCloudMigration, "id" | "from" | "to" | "description">>;
34
+ files: MigrateFileResult[];
35
+ changedFiles: string[];
36
+ issues: SourceMigrationIssue[];
37
+ }
38
+ declare function migrateRouteResponse(source: string, fileName: string): SourceMigrationResult;
39
+ export declare const SUPACLOUD_MIGRATIONS: SupaCloudMigration[];
40
+ export declare function migrateProject(options: MigrateProjectOptions): Promise<MigrateProjectResult>;
41
+ export { migrateRouteResponse };
@@ -0,0 +1,41 @@
1
+ export type OpenApiObject = {
2
+ [key: string]: unknown;
3
+ };
4
+ export interface OpenApiDocument {
5
+ openapi: string;
6
+ info: OpenApiObject;
7
+ paths: OpenApiObject;
8
+ [key: string]: unknown;
9
+ }
10
+ export declare class OpenApiDocumentError extends Error {
11
+ readonly code: "OPENAPI_DOCUMENT_INVALID";
12
+ constructor();
13
+ }
14
+ export interface OpenApiJsonWriteResult {
15
+ path: string;
16
+ written: boolean;
17
+ }
18
+ export interface OpenApiExportOptions {
19
+ modulePath: string;
20
+ outputPath: string;
21
+ space?: number;
22
+ }
23
+ export interface OpenApiDiffChange {
24
+ kind: "breaking" | "non-breaking";
25
+ code: string;
26
+ path: string;
27
+ message: string;
28
+ }
29
+ export interface OpenApiDiffResult {
30
+ ok: boolean;
31
+ breaking: OpenApiDiffChange[];
32
+ changes: OpenApiDiffChange[];
33
+ }
34
+ export declare function parseOpenApiDocument(value: unknown): OpenApiDocument;
35
+ export declare function serializeOpenApiJson(document: unknown, space?: number): string;
36
+ export declare function readOpenApiJson(path: string): Promise<OpenApiDocument>;
37
+ export declare function writeOpenApiJson(document: unknown, outputPath: string, space?: number): Promise<OpenApiJsonWriteResult>;
38
+ export declare function loadGeneratedOpenApiDocument(modulePath: string): Promise<OpenApiDocument>;
39
+ export declare function exportGeneratedOpenApiJson(options: OpenApiExportOptions): Promise<OpenApiJsonWriteResult>;
40
+ export declare function diffOpenApiDocuments(baseValue: unknown, currentValue: unknown): OpenApiDiffResult;
41
+ export declare function formatOpenApiDiff(result: OpenApiDiffResult): string;
@@ -7,11 +7,11 @@ export declare function inspectRouteContracts(graph: ApplicationGraph): {
7
7
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
8
8
  path: string;
9
9
  file: string;
10
- missing: ("query" | "body" | "params" | "response")[];
10
+ missing: ("query" | "body" | "headers" | "cookie" | "params" | "response")[];
11
11
  validation: {
12
12
  body: string;
13
13
  response: string;
14
- schemas: Partial<Record<"query" | "body" | "params" | "response", "opaque" | "declared">>;
14
+ schemas: Partial<Record<"query" | "body" | "headers" | "cookie" | "params" | "response", "opaque" | "declared">>;
15
15
  evidence: string | null;
16
16
  verified: false;
17
17
  obligations: string[];
@@ -1,4 +1,30 @@
1
1
  import type { Diagnostic, TypeSafetyOptions } from "./types";
2
+ export declare const TYPE_SAFETY_DIAGNOSTIC_CODES: {
3
+ readonly "generated-any": {
4
+ readonly errorCode: "SC6001";
5
+ readonly docsUrl: "https://supacloud.dev/errors/SC6001";
6
+ };
7
+ readonly "source-any": {
8
+ readonly errorCode: "SC6002";
9
+ readonly docsUrl: "https://supacloud.dev/errors/SC6002";
10
+ };
11
+ readonly "source-type-assertion": {
12
+ readonly errorCode: "SC6003";
13
+ readonly docsUrl: "https://supacloud.dev/errors/SC6003";
14
+ };
15
+ readonly "source-non-null-assertion": {
16
+ readonly errorCode: "SC6004";
17
+ readonly docsUrl: "https://supacloud.dev/errors/SC6004";
18
+ };
19
+ readonly "source-implicit-widening": {
20
+ readonly errorCode: "SC6005";
21
+ readonly docsUrl: "https://supacloud.dev/errors/SC6005";
22
+ };
23
+ readonly "source-type-suppression": {
24
+ readonly errorCode: "SC6006";
25
+ readonly docsUrl: "https://supacloud.dev/errors/SC6006";
26
+ };
27
+ };
2
28
  export interface TypeSafetyScanOptions extends TypeSafetyOptions {
3
29
  rootDir: string;
4
30
  include?: string[];
package/dist/types.d.ts CHANGED
@@ -4,6 +4,9 @@
4
4
  */
5
5
  import type { IncrementalProgramSession } from "./program";
6
6
  export type Scope = "application" | "request" | "job";
7
+ export type JobMode = "task" | "workflow";
8
+ export type JobIdempotency = "required" | "none";
9
+ export type JobSchemaKind = "opaque" | "declared";
7
10
  export type ProviderKind = "class" | "value" | "factory" | "existing";
8
11
  export type TokenKind = "injection-token" | "class";
9
12
  export interface FunctionalInjectNode {
@@ -140,7 +143,7 @@ export interface ProviderNode {
140
143
  }
141
144
  export interface HandlerParamNode {
142
145
  name: string;
143
- kind: "param" | "query" | "body" | "headers" | "context" | "unknown";
146
+ kind: "param" | "query" | "body" | "headers" | "cookie" | "context" | "unknown";
144
147
  bindingName?: string;
145
148
  transform?: "number" | "boolean" | "string";
146
149
  default?: unknown;
@@ -151,7 +154,7 @@ export interface RouteNode {
151
154
  response?: "framework" | "native-json" | "binary" | "stream";
152
155
  evidence?: string;
153
156
  };
154
- schemaKinds?: Partial<Record<"body" | "params" | "query" | "response", "opaque" | "declared">>;
157
+ schemaKinds?: Partial<Record<"body" | "params" | "query" | "headers" | "cookie" | "response", "opaque" | "declared">>;
155
158
  nativeResponse?: boolean;
156
159
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
157
160
  path: string;
@@ -159,7 +162,10 @@ export interface RouteNode {
159
162
  body?: string;
160
163
  params?: string;
161
164
  query?: string;
165
+ headers?: string;
166
+ cookie?: string;
162
167
  response?: string;
168
+ responses?: Record<string, string>;
163
169
  /** @Command-decorated class explicitly bound by the route. */
164
170
  command?: string;
165
171
  /** Route guards executed before handler (Angular CanActivateFn style). */
@@ -241,6 +247,21 @@ export interface JobNode {
241
247
  /** Generated services key; follows a custom useClass provider token when present. */
242
248
  serviceKey: string;
243
249
  scope: Scope;
250
+ /** Input schema symbol imported into the generated application, when declared. */
251
+ input?: string;
252
+ /** Output schema symbol imported into the generated application, when declared. */
253
+ output?: string;
254
+ schemaKinds?: Partial<Record<"input" | "output", JobSchemaKind>>;
255
+ /** Job schema symbol name -> relative module path for import generation. */
256
+ schemaImports?: Record<string, string>;
257
+ /** Existing execution adapter selected by the job declaration. */
258
+ mode?: JobMode;
259
+ /** Adapter-owned execution deadline in seconds. */
260
+ timeoutSec?: number;
261
+ /** Adapter-owned maximum execution attempts. */
262
+ maxAttempts?: number;
263
+ /** Adapter-owned idempotency requirement. */
264
+ idempotency?: JobIdempotency;
244
265
  aspects?: AspectRefNode[];
245
266
  }
246
267
  export interface QueryNode {
@@ -338,6 +359,10 @@ export interface CompileOptions {
338
359
  writeOnError?: boolean;
339
360
  /** Generate typed API client in client.ts (default: false). */
340
361
  generateClient?: boolean;
362
+ /** Generate the OpenAPI 3.1 document module in openapi.ts (default: false). */
363
+ generateOpenApi?: boolean;
364
+ /** OpenAPI document metadata and explicitly configured security schemes. */
365
+ openApi?: OpenApiOptions;
341
366
  /** Generate typed permissions registry in permissions.ts (default: false). */
342
367
  generatePermissions?: boolean;
343
368
  /** Prune unused root providers from compiled output (Angular Ivy AOT tree-shaking). */
@@ -366,6 +391,36 @@ export interface GraphqlOptions {
366
391
  output: string;
367
392
  }>;
368
393
  }
394
+ export interface OpenApiServer {
395
+ url: string;
396
+ description?: string;
397
+ }
398
+ export type OpenApiSecurityScheme = {
399
+ type: "apiKey";
400
+ name: string;
401
+ in: "header" | "query" | "cookie";
402
+ description?: string;
403
+ } | {
404
+ type: "http";
405
+ scheme: string;
406
+ bearerFormat?: string;
407
+ description?: string;
408
+ } | {
409
+ type: "oauth2";
410
+ flows: Record<string, unknown>;
411
+ description?: string;
412
+ } | {
413
+ type: "openIdConnect";
414
+ openIdConnectUrl: string;
415
+ description?: string;
416
+ };
417
+ export interface OpenApiOptions {
418
+ title?: string;
419
+ version?: string;
420
+ description?: string;
421
+ servers?: OpenApiServer[];
422
+ securitySchemes?: Record<string, OpenApiSecurityScheme>;
423
+ }
369
424
  export interface GraphqlContractSummary {
370
425
  schema: string;
371
426
  schemaHash?: string;
@@ -414,11 +469,14 @@ export interface ValidateOptions {
414
469
  }
415
470
  /** Runtime capabilities declared by the Command executor. */
416
471
  export interface CommandExecutionCapabilities {
472
+ /** Require named persistent adapters and explicit audit/idempotency declarations. */
473
+ requirePersistentAdapters?: boolean;
417
474
  /** Explicit named adapters; declarations must also be tested against the database. */
418
475
  rpc?: Record<string, {
419
476
  audit?: boolean;
420
477
  idempotency?: boolean;
421
478
  transaction?: boolean;
479
+ boundary?: "database" | "external";
422
480
  }>;
423
481
  /** Whether runtime permission checks are supported. */
424
482
  permission?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/compiler",
3
- "version": "0.15.0",
3
+ "version": "0.19.1",
4
4
  "description": "Static compiler for @supacloud/app metadata: builds the application graph from AST, validates it, and generates reflection-free factory code",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,7 +18,8 @@
18
18
  },
19
19
  "files": [
20
20
  "dist",
21
- "README.md"
21
+ "README.md",
22
+ "DELIVERY.md"
22
23
  ],
23
24
  "scripts": {
24
25
  "build": "bun run clean && bun run build:js && bun run build:types",
@@ -46,6 +47,7 @@
46
47
  "directory": "packages/compiler"
47
48
  },
48
49
  "dependencies": {
50
+ "@sinclair/typebox": "^0.34.52",
49
51
  "@graphql-codegen/core": "^6.2.0",
50
52
  "@graphql-codegen/typed-document-node": "^7.1.0",
51
53
  "@graphql-codegen/typescript-operations": "^6.1.6",
@@ -54,7 +56,7 @@
54
56
  "graphql": "^16"
55
57
  },
56
58
  "devDependencies": {
57
- "@types/bun": "^1.4.0",
59
+ "@types/bun": "^1.4.2",
58
60
  "typescript": "^7.0.2"
59
61
  }
60
62
  }