@supacloud/compiler 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/cli.js +21 -9
- package/dist/graphql-schema-hashes.d.ts +5 -0
- package/dist/graphql-schema.d.ts +1 -0
- package/dist/index.js +23 -11
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -143,6 +143,15 @@ export again and compile. Offline compilation cannot attest a snapshot's origin;
|
|
|
143
143
|
The starter's synthetic SDL is solely an offline test fixture, not a deployed
|
|
144
144
|
schema. Replace it with a database export before integration.
|
|
145
145
|
|
|
146
|
+
Schema export results and compiled GraphQL manifests retain `schemaHash` as the
|
|
147
|
+
SHA-256 of the original UTF-8 text. The additional `schemaNormalizedHash` hashes
|
|
148
|
+
the same text with physical CRLF/CR line endings converted to LF, helping identify
|
|
149
|
+
checkout line-ending drift. It does not normalize escaped `\r` sequences, field
|
|
150
|
+
order, descriptions or other content, and is not a semantic-equivalence or
|
|
151
|
+
integrity check. `graphql-schema --check` remains byte-strict and read-only;
|
|
152
|
+
an explicit export restores the generated file. Re-export and regenerate the
|
|
153
|
+
manifest rather than bypassing drift checks based on the normalized hash.
|
|
154
|
+
|
|
146
155
|
New `supacloud app init` projects preconfigure GraphQL query contracts and include
|
|
147
156
|
an offline example. Existing REST, Command-only and background-task projects
|
|
148
157
|
remain unchanged: general App/CLI configuration and `compileProject(options)`
|
package/dist/cli.js
CHANGED
|
@@ -2466,7 +2466,7 @@ function renderClient(graph, options) {
|
|
|
2466
2466
|
"",
|
|
2467
2467
|
"export interface ApiClientConfig {",
|
|
2468
2468
|
" baseUrl?: string;",
|
|
2469
|
-
" fetch?:
|
|
2469
|
+
" fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;",
|
|
2470
2470
|
" headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);",
|
|
2471
2471
|
" interceptors?: HttpInterceptorFn[];",
|
|
2472
2472
|
" /** Normalize response objects like Elysia's default schema validator. */",
|
|
@@ -3999,12 +3999,23 @@ export function parseGraphqlResult<Name extends keyof GraphqlQueryResults>(
|
|
|
3999
3999
|
}
|
|
4000
4000
|
var init_graphql_runtime = () => {};
|
|
4001
4001
|
|
|
4002
|
+
// src/graphql-schema-hashes.ts
|
|
4003
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
4004
|
+
function graphqlSchemaHashes(content) {
|
|
4005
|
+
const hash = (text) => createHash5("sha256").update(text).digest("hex");
|
|
4006
|
+
return {
|
|
4007
|
+
schemaHash: hash(content),
|
|
4008
|
+
schemaNormalizedHash: hash(content.replace(/\r\n?/g, `
|
|
4009
|
+
`))
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
var init_graphql_schema_hashes = () => {};
|
|
4013
|
+
|
|
4002
4014
|
// src/graphql.ts
|
|
4003
4015
|
var exports_graphql = {};
|
|
4004
4016
|
__export(exports_graphql, {
|
|
4005
4017
|
renderGraphql: () => renderGraphql
|
|
4006
4018
|
});
|
|
4007
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
4008
4019
|
import { readFile } from "node:fs/promises";
|
|
4009
4020
|
import { relative as relative4, sep as sep4 } from "node:path";
|
|
4010
4021
|
import {
|
|
@@ -4063,7 +4074,7 @@ async function renderGraphql(options) {
|
|
|
4063
4074
|
let schemaContent;
|
|
4064
4075
|
try {
|
|
4065
4076
|
schemaContent = await readFile(schemaPath, "utf8");
|
|
4066
|
-
contract
|
|
4077
|
+
Object.assign(contract, graphqlSchemaHashes(schemaContent));
|
|
4067
4078
|
if (schemaPath.endsWith(".json")) {
|
|
4068
4079
|
const json = JSON.parse(schemaContent);
|
|
4069
4080
|
schema = buildClientSchema(json.data ?? json);
|
|
@@ -4195,6 +4206,7 @@ var init_graphql = __esm(() => {
|
|
|
4195
4206
|
init_graphql_inputs();
|
|
4196
4207
|
init_graphql_options();
|
|
4197
4208
|
init_graphql_runtime();
|
|
4209
|
+
init_graphql_schema_hashes();
|
|
4198
4210
|
});
|
|
4199
4211
|
|
|
4200
4212
|
// src/inspect.ts
|
|
@@ -16587,7 +16599,6 @@ var init_database_contracts = __esm(() => {
|
|
|
16587
16599
|
|
|
16588
16600
|
// src/graphql-schema.ts
|
|
16589
16601
|
import { mkdir as mkdir6, readFile as readFile13 } from "node:fs/promises";
|
|
16590
|
-
import { createHash as createHash12 } from "node:crypto";
|
|
16591
16602
|
import { dirname as dirname12, resolve as resolve22 } from "node:path";
|
|
16592
16603
|
async function pullGraphqlSchema(options) {
|
|
16593
16604
|
assertGraphqlOptions({ schema: options.output });
|
|
@@ -16642,16 +16653,17 @@ async function pullGraphqlSchema(options) {
|
|
|
16642
16653
|
throw error;
|
|
16643
16654
|
}
|
|
16644
16655
|
const upToDate = previous === content;
|
|
16645
|
-
const
|
|
16656
|
+
const hashes = graphqlSchemaHashes(content);
|
|
16646
16657
|
if (options.check)
|
|
16647
|
-
return { path,
|
|
16658
|
+
return { path, ...hashes, upToDate, written: false };
|
|
16648
16659
|
await mkdir6(dirname12(path), { recursive: true });
|
|
16649
16660
|
await writeFileIfChanged(path, content);
|
|
16650
|
-
return { path,
|
|
16661
|
+
return { path, ...hashes, upToDate: true, written: true };
|
|
16651
16662
|
}
|
|
16652
16663
|
var init_graphql_schema = __esm(() => {
|
|
16653
16664
|
init_generate();
|
|
16654
16665
|
init_graphql_options();
|
|
16666
|
+
init_graphql_schema_hashes();
|
|
16655
16667
|
});
|
|
16656
16668
|
|
|
16657
16669
|
// src/cli.ts
|
|
@@ -22330,9 +22342,9 @@ function compilerVersion() {
|
|
|
22330
22342
|
}
|
|
22331
22343
|
function migrationDependencies() {
|
|
22332
22344
|
return {
|
|
22333
|
-
"@supacloud/app": "0.21.
|
|
22345
|
+
"@supacloud/app": "0.21.1",
|
|
22334
22346
|
"@supacloud/compiler": compilerVersion(),
|
|
22335
|
-
"@supacloud/elysia": "0.23.
|
|
22347
|
+
"@supacloud/elysia": "0.23.1",
|
|
22336
22348
|
elysia: "2.0.0-beta.19",
|
|
22337
22349
|
typescript: "7.0.2"
|
|
22338
22350
|
};
|
package/dist/graphql-schema.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2465,7 +2465,7 @@ function renderClient(graph, options) {
|
|
|
2465
2465
|
"",
|
|
2466
2466
|
"export interface ApiClientConfig {",
|
|
2467
2467
|
" baseUrl?: string;",
|
|
2468
|
-
" fetch?:
|
|
2468
|
+
" fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;",
|
|
2469
2469
|
" headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);",
|
|
2470
2470
|
" interceptors?: HttpInterceptorFn[];",
|
|
2471
2471
|
" /** Normalize response objects like Elysia's default schema validator. */",
|
|
@@ -3998,12 +3998,23 @@ export function parseGraphqlResult<Name extends keyof GraphqlQueryResults>(
|
|
|
3998
3998
|
}
|
|
3999
3999
|
var init_graphql_runtime = () => {};
|
|
4000
4000
|
|
|
4001
|
+
// src/graphql-schema-hashes.ts
|
|
4002
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
4003
|
+
function graphqlSchemaHashes(content) {
|
|
4004
|
+
const hash = (text) => createHash5("sha256").update(text).digest("hex");
|
|
4005
|
+
return {
|
|
4006
|
+
schemaHash: hash(content),
|
|
4007
|
+
schemaNormalizedHash: hash(content.replace(/\r\n?/g, `
|
|
4008
|
+
`))
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
var init_graphql_schema_hashes = () => {};
|
|
4012
|
+
|
|
4001
4013
|
// src/graphql.ts
|
|
4002
4014
|
var exports_graphql = {};
|
|
4003
4015
|
__export(exports_graphql, {
|
|
4004
4016
|
renderGraphql: () => renderGraphql
|
|
4005
4017
|
});
|
|
4006
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
4007
4018
|
import { readFile } from "node:fs/promises";
|
|
4008
4019
|
import { relative as relative4, sep as sep4 } from "node:path";
|
|
4009
4020
|
import {
|
|
@@ -4062,7 +4073,7 @@ async function renderGraphql(options) {
|
|
|
4062
4073
|
let schemaContent;
|
|
4063
4074
|
try {
|
|
4064
4075
|
schemaContent = await readFile(schemaPath, "utf8");
|
|
4065
|
-
contract
|
|
4076
|
+
Object.assign(contract, graphqlSchemaHashes(schemaContent));
|
|
4066
4077
|
if (schemaPath.endsWith(".json")) {
|
|
4067
4078
|
const json = JSON.parse(schemaContent);
|
|
4068
4079
|
schema = buildClientSchema(json.data ?? json);
|
|
@@ -4194,6 +4205,7 @@ var init_graphql = __esm(() => {
|
|
|
4194
4205
|
init_graphql_inputs();
|
|
4195
4206
|
init_graphql_options();
|
|
4196
4207
|
init_graphql_runtime();
|
|
4208
|
+
init_graphql_schema_hashes();
|
|
4197
4209
|
});
|
|
4198
4210
|
|
|
4199
4211
|
// node_modules/typebox/build/system/memory/metrics.mjs
|
|
@@ -16405,7 +16417,6 @@ var init_release_evidence = __esm(() => {
|
|
|
16405
16417
|
|
|
16406
16418
|
// src/graphql-schema.ts
|
|
16407
16419
|
import { mkdir as mkdir5, readFile as readFile12 } from "node:fs/promises";
|
|
16408
|
-
import { createHash as createHash11 } from "node:crypto";
|
|
16409
16420
|
import { dirname as dirname11, resolve as resolve20 } from "node:path";
|
|
16410
16421
|
async function pullGraphqlSchema(options) {
|
|
16411
16422
|
assertGraphqlOptions({ schema: options.output });
|
|
@@ -16460,25 +16471,26 @@ async function pullGraphqlSchema(options) {
|
|
|
16460
16471
|
throw error;
|
|
16461
16472
|
}
|
|
16462
16473
|
const upToDate = previous === content;
|
|
16463
|
-
const
|
|
16474
|
+
const hashes = graphqlSchemaHashes(content);
|
|
16464
16475
|
if (options.check)
|
|
16465
|
-
return { path,
|
|
16476
|
+
return { path, ...hashes, upToDate, written: false };
|
|
16466
16477
|
await mkdir5(dirname11(path), { recursive: true });
|
|
16467
16478
|
await writeFileIfChanged(path, content);
|
|
16468
|
-
return { path,
|
|
16479
|
+
return { path, ...hashes, upToDate: true, written: true };
|
|
16469
16480
|
}
|
|
16470
16481
|
var init_graphql_schema = __esm(() => {
|
|
16471
16482
|
init_generate();
|
|
16472
16483
|
init_graphql_options();
|
|
16484
|
+
init_graphql_schema_hashes();
|
|
16473
16485
|
});
|
|
16474
16486
|
|
|
16475
16487
|
// src/database-contracts.ts
|
|
16476
|
-
import { createHash as
|
|
16488
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
16477
16489
|
import { mkdir as mkdir6, readFile as readFile13 } from "node:fs/promises";
|
|
16478
16490
|
import { dirname as dirname12, relative as relative12, resolve as resolve21 } from "node:path";
|
|
16479
16491
|
import * as ts17 from "@typescript/typescript6";
|
|
16480
16492
|
function hash3(value) {
|
|
16481
|
-
return
|
|
16493
|
+
return createHash11("sha256").update(value).digest("hex");
|
|
16482
16494
|
}
|
|
16483
16495
|
function importPath(out, path) {
|
|
16484
16496
|
const value = relative12(out, path).replaceAll("\\", "/").replace(/\.(?:d\.)?[cm]?ts$/, "");
|
|
@@ -22063,9 +22075,9 @@ function compilerVersion() {
|
|
|
22063
22075
|
}
|
|
22064
22076
|
function migrationDependencies() {
|
|
22065
22077
|
return {
|
|
22066
|
-
"@supacloud/app": "0.21.
|
|
22078
|
+
"@supacloud/app": "0.21.1",
|
|
22067
22079
|
"@supacloud/compiler": compilerVersion(),
|
|
22068
|
-
"@supacloud/elysia": "0.23.
|
|
22080
|
+
"@supacloud/elysia": "0.23.1",
|
|
22069
22081
|
elysia: "2.0.0-beta.19",
|
|
22070
22082
|
typescript: "7.0.2"
|
|
22071
22083
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -477,6 +477,8 @@ export interface OpenApiOptions {
|
|
|
477
477
|
export interface GraphqlContractSummary {
|
|
478
478
|
schema: string;
|
|
479
479
|
schemaHash?: string;
|
|
480
|
+
/** SHA-256 with physical CRLF/CR normalized to LF; not an integrity or semantic digest. */
|
|
481
|
+
schemaNormalizedHash?: string;
|
|
480
482
|
documents: string[];
|
|
481
483
|
operations: Array<{
|
|
482
484
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.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",
|