@corpdk/create-ds 2026.10.0-alpha.3 → 2026.10.0-alpha.5
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/canonical/.env.example +5 -0
- package/canonical/Dockerfile +1 -1
- package/canonical/docker/otel-collector-config.yaml +15 -0
- package/canonical/docker-compose.yml +12 -0
- package/canonical/docker-entrypoint.sh +1 -1
- package/canonical/package.json +16 -5
- package/canonical/src/db/index.ts +17 -1
- package/canonical/src/health.ts +78 -0
- package/canonical/src/index.ts +14 -1
- package/canonical/src/observability/otel-config.ts +11 -0
- package/canonical/src/observability/otel-smoke-extensions.ts +20 -0
- package/canonical/src/observability/preload-otel.ts +37 -0
- package/canonical/src/observability/yoga-tracing-plugin.ts +179 -0
- package/canonical/src/schema.ts +17 -2
- package/canonical/src/validation/parse-input.ts +13 -0
- package/dist/args.d.ts +8 -0
- package/dist/chunk-QT2CKMO4.js +71 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -79
- package/dist/init.d.ts +7 -0
- package/dist/package-merge.d.ts +19 -0
- package/dist/template.d.ts +16 -0
- package/dist/types-entry.d.ts +2 -0
- package/dist/types-entry.js +9 -0
- package/dist/upgrade.d.ts +5 -0
- package/dist/utils.d.ts +11 -0
- package/package.json +13 -3
package/canonical/.env.example
CHANGED
|
@@ -7,3 +7,8 @@ DATABASE_URL=postgresql://user:pass@localhost:5433/corpdk_ds
|
|
|
7
7
|
# Optional HMAC-SHA256 signing for pagination cursors (§13). When unset, cursors are unsigned (local dev).
|
|
8
8
|
# DAL_CURSOR_SECRET=
|
|
9
9
|
# REDIS_URL=redis://localhost:6379 # uncomment to switch pubsub to Redis/Valkey
|
|
10
|
+
# OpenTelemetry (optional — omit for local dev without tracing)
|
|
11
|
+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 # OTLP HTTP base URL; exporter appends /v1/traces
|
|
12
|
+
# DS_OTEL_ENABLED=true
|
|
13
|
+
# DS_OTEL_ENABLED=false # force tracing off even if OTEL_EXPORTER_OTLP_ENDPOINT is set
|
|
14
|
+
# OTEL_SERVICE_NAME=@corpdk/ds
|
package/canonical/Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Build from the monorepo root: docker build -f templates/ds/Dockerfile .
|
|
3
3
|
|
|
4
4
|
# ── Base ──────────────────────────────────────────────────────────────────────
|
|
5
|
-
FROM node:
|
|
5
|
+
FROM node:24-alpine AS base
|
|
6
6
|
ENV PNPM_HOME="/pnpm"
|
|
7
7
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
8
8
|
RUN corepack enable
|
|
@@ -32,6 +32,18 @@ services:
|
|
|
32
32
|
environment:
|
|
33
33
|
DS_PORT: "4000"
|
|
34
34
|
DATABASE_URL: postgresql://user:pass@postgres:5432/corpdk_ds
|
|
35
|
+
DS_OTEL_ENABLED: ${DS_OTEL_ENABLED:-}
|
|
36
|
+
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
|
|
37
|
+
DS_OTEL_SMOKE_TEST: ${DS_OTEL_SMOKE_TEST:-}
|
|
38
|
+
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-corpdk-ds-docker}
|
|
39
|
+
|
|
40
|
+
otel-collector:
|
|
41
|
+
profiles: ["otel"]
|
|
42
|
+
image: otel/opentelemetry-collector-contrib:0.120.0
|
|
43
|
+
container_name: corpdk-ds-otel-collector
|
|
44
|
+
command: ["--config=/etc/otelcol/config.yaml"]
|
|
45
|
+
volumes:
|
|
46
|
+
- ./docker/otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
|
|
35
47
|
|
|
36
48
|
volumes:
|
|
37
49
|
corpdk_ds_pgdata:
|
package/canonical/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"registry": "https://artifactory.corp.example.com/api/npm/npm-private/"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "node --env-file .env --import tsx/esm --watch src/index.ts",
|
|
10
|
+
"dev": "node --env-file .env --import tsx/esm --import ./src/observability/preload-otel.ts --watch src/index.ts",
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"codegen": "graphql-codegen",
|
|
13
13
|
"dal:codegen:schema": "node ./node_modules/@corpdk/dal-codegen/dist/cli.js --mode=schema",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dal:codegen:bootstrap": "node ./node_modules/@corpdk/dal-codegen/dist/cli.js --mode=bootstrap",
|
|
16
16
|
"dal:codegen": "pnpm run dal:codegen:schema && pnpm run codegen && pnpm run dal:codegen:impl",
|
|
17
17
|
"entity:lint": "node ./node_modules/@corpdk/dal-codegen/dist/lint-cli.js",
|
|
18
|
-
"start": "node dist/src/index.js",
|
|
18
|
+
"start": "node --import ./dist/src/observability/preload-otel.js dist/src/index.js",
|
|
19
19
|
"lint": "eslint src/",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"db:up": "docker compose up postgres -d",
|
|
@@ -36,7 +36,15 @@
|
|
|
36
36
|
"graphql": "^16.13.2",
|
|
37
37
|
"graphql-yoga": "^5.18.1",
|
|
38
38
|
"ioredis": "^5.10.1",
|
|
39
|
-
"pg": "^8.20.0"
|
|
39
|
+
"pg": "^8.20.0",
|
|
40
|
+
"zod": "^4.3.6",
|
|
41
|
+
"@opentelemetry/api": "^1.9.0",
|
|
42
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.211.0",
|
|
43
|
+
"@opentelemetry/instrumentation-http": "^0.211.0",
|
|
44
|
+
"@opentelemetry/instrumentation-pg": "^0.61.0",
|
|
45
|
+
"@opentelemetry/resources": "^2.5.0",
|
|
46
|
+
"@opentelemetry/sdk-node": "^0.211.0",
|
|
47
|
+
"@opentelemetry/semantic-conventions": "^1.39.0"
|
|
40
48
|
},
|
|
41
49
|
"devDependencies": {
|
|
42
50
|
"@corpdk/codegen-cli": "workspace:*",
|
|
@@ -45,11 +53,14 @@
|
|
|
45
53
|
"@graphql-codegen/client-preset": "^5.2.4",
|
|
46
54
|
"@graphql-codegen/typescript": "^5.0.9",
|
|
47
55
|
"@graphql-codegen/typescript-resolvers": "^5.1.7",
|
|
48
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^24.0.0",
|
|
49
57
|
"@types/pg": "^8.11.14",
|
|
50
58
|
"drizzle-kit": "^0.31.10",
|
|
51
59
|
"tsx": "^4.21.0",
|
|
52
60
|
"typescript": "^6.0.2"
|
|
53
61
|
},
|
|
54
|
-
"license": "MIT"
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=24.0.0"
|
|
65
|
+
}
|
|
55
66
|
}
|
|
@@ -10,6 +10,22 @@ import * as schema from "./schema/index.js";
|
|
|
10
10
|
* CockroachDB), it updates drizzle.config.ts, src/db/schema/, and
|
|
11
11
|
* swaps the driver package in package.json — update this file accordingly.
|
|
12
12
|
*/
|
|
13
|
-
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
13
|
+
export const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
14
14
|
|
|
15
15
|
export const db = drizzle(pool, { schema });
|
|
16
|
+
|
|
17
|
+
export interface DbPingResult {
|
|
18
|
+
connected: boolean;
|
|
19
|
+
latencyMs: number | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Lightweight connectivity check for /health and orchestrator probes. */
|
|
23
|
+
export async function pingDatabase(): Promise<DbPingResult> {
|
|
24
|
+
const start = performance.now();
|
|
25
|
+
try {
|
|
26
|
+
await pool.query("SELECT 1");
|
|
27
|
+
return { connected: true, latencyMs: Math.round(performance.now() - start) };
|
|
28
|
+
} catch {
|
|
29
|
+
return { connected: false, latencyMs: null };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
5
|
+
import { trace, SpanStatusCode } from "@opentelemetry/api";
|
|
6
|
+
import { pingDatabase } from "./db/index.js";
|
|
7
|
+
|
|
8
|
+
function readPackageVersion(): string {
|
|
9
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
for (const rel of ["../package.json", "../../package.json"]) {
|
|
11
|
+
try {
|
|
12
|
+
const path = join(here, rel);
|
|
13
|
+
return (JSON.parse(readFileSync(path, "utf-8")) as { version: string }).version;
|
|
14
|
+
} catch {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return "unknown";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const packageVersion = readPackageVersion();
|
|
22
|
+
|
|
23
|
+
export interface HealthPayload {
|
|
24
|
+
status: "ok" | "degraded";
|
|
25
|
+
uptime: number;
|
|
26
|
+
version: string;
|
|
27
|
+
db: {
|
|
28
|
+
connected: boolean;
|
|
29
|
+
latencyMs: number | null;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function collectHealth(uptimeSeconds: number): Promise<HealthPayload> {
|
|
34
|
+
const tracer = trace.getTracer("@corpdk/ds/health");
|
|
35
|
+
const db = await tracer.startActiveSpan("db.health_ping", async (span) => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await pingDatabase();
|
|
38
|
+
span.setAttribute("db.connected", result.connected);
|
|
39
|
+
if (result.latencyMs != null) {
|
|
40
|
+
span.setAttribute("db.latency_ms", result.latencyMs);
|
|
41
|
+
}
|
|
42
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
43
|
+
return result;
|
|
44
|
+
} catch (err) {
|
|
45
|
+
span.recordException(err instanceof Error ? err : new Error(String(err)));
|
|
46
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
47
|
+
return { connected: false, latencyMs: null };
|
|
48
|
+
} finally {
|
|
49
|
+
span.end();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const connected = db.connected;
|
|
54
|
+
return {
|
|
55
|
+
status: connected ? "ok" : "degraded",
|
|
56
|
+
uptime: uptimeSeconds,
|
|
57
|
+
version: packageVersion,
|
|
58
|
+
db,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export async function handleHealthRequest(
|
|
63
|
+
req: IncomingMessage,
|
|
64
|
+
res: ServerResponse,
|
|
65
|
+
serverStartedAt: number,
|
|
66
|
+
): Promise<void> {
|
|
67
|
+
if (req.method !== "GET") {
|
|
68
|
+
res.writeHead(405, { "Content-Type": "application/json" });
|
|
69
|
+
res.end(JSON.stringify({ error: "Method Not Allowed" }));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const uptimeSeconds = Math.floor((Date.now() - serverStartedAt) / 1000);
|
|
74
|
+
const body = await collectHealth(uptimeSeconds);
|
|
75
|
+
const statusCode = body.status === "ok" ? 200 : 503;
|
|
76
|
+
res.writeHead(statusCode, { "Content-Type": "application/json" });
|
|
77
|
+
res.end(JSON.stringify(body));
|
|
78
|
+
}
|
package/canonical/src/index.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { createYoga } from "graphql-yoga";
|
|
3
3
|
import { schema, createRequestContext } from "./schema.js";
|
|
4
|
+
import { handleHealthRequest } from "./health.js";
|
|
5
|
+
import { yogaTracingPlugin } from "./observability/yoga-tracing-plugin.js";
|
|
4
6
|
|
|
5
7
|
const PORT = Number(process.env.DS_PORT);
|
|
6
8
|
if (!PORT) throw new Error("DS_PORT env var is required");
|
|
7
9
|
|
|
10
|
+
const serverStartedAt = Date.now();
|
|
11
|
+
|
|
8
12
|
const yoga = createYoga({
|
|
9
13
|
schema,
|
|
10
14
|
context: () => {
|
|
@@ -14,13 +18,22 @@ const yoga = createYoga({
|
|
|
14
18
|
},
|
|
15
19
|
graphiql: process.env.NODE_ENV !== "production",
|
|
16
20
|
logging: true,
|
|
21
|
+
plugins: [yogaTracingPlugin()],
|
|
17
22
|
});
|
|
18
23
|
|
|
19
|
-
const server = createServer(
|
|
24
|
+
const server = createServer((req, res) => {
|
|
25
|
+
const url = req.url?.split("?")[0];
|
|
26
|
+
if (url === "/health") {
|
|
27
|
+
void handleHealthRequest(req, res, serverStartedAt);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
yoga(req, res);
|
|
31
|
+
});
|
|
20
32
|
|
|
21
33
|
server.listen(PORT, () => {
|
|
22
34
|
const base = `http://localhost:${PORT}/graphql`;
|
|
23
35
|
console.log(`@corpdk/ds HTTP ${base}`);
|
|
36
|
+
console.log(`@corpdk/ds health http://localhost:${PORT}/health`);
|
|
24
37
|
console.log(
|
|
25
38
|
`@corpdk/ds SSE ${base} (subscriptions: Accept: text/event-stream)`,
|
|
26
39
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** True when OTLP export or explicit DS flag enables tracing. */
|
|
2
|
+
export function isOtelEnabled(): boolean {
|
|
3
|
+
const flag = process.env.DS_OTEL_ENABLED;
|
|
4
|
+
if (flag === "true") return true;
|
|
5
|
+
if (flag === "false") return false;
|
|
6
|
+
return Boolean(process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim());
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function otelServiceName(): string {
|
|
10
|
+
return process.env.OTEL_SERVICE_NAME?.trim() || "@corpdk/ds";
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Dev-only GraphQL fields for OTel integration smoke tests (literal redaction, execute rejection). */
|
|
2
|
+
export const otelSmokeTestEnabled =
|
|
3
|
+
process.env.DS_OTEL_SMOKE_TEST === "true";
|
|
4
|
+
|
|
5
|
+
export const otelSmokeTypeDefs = /* GraphQL */ `
|
|
6
|
+
extend type Query {
|
|
7
|
+
"""Returns ok when OTel smoke test mode is enabled; password arg exercises literal redaction."""
|
|
8
|
+
otelSmoke(password: String!): String!
|
|
9
|
+
"""Resolver returns a rejected Promise to verify graphql span ERROR status."""
|
|
10
|
+
otelSmokeFault: String!
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const otelSmokeResolvers = {
|
|
15
|
+
Query: {
|
|
16
|
+
otelSmoke: () => "ok",
|
|
17
|
+
otelSmokeFault: () =>
|
|
18
|
+
Promise.reject(new Error("DS OTel smoke fault injection")),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isOtelEnabled, otelServiceName } from "./otel-config.js";
|
|
2
|
+
|
|
3
|
+
if (isOtelEnabled()) {
|
|
4
|
+
const { NodeSDK } = await import("@opentelemetry/sdk-node");
|
|
5
|
+
const { OTLPTraceExporter } = await import(
|
|
6
|
+
"@opentelemetry/exporter-trace-otlp-http"
|
|
7
|
+
);
|
|
8
|
+
const { resourceFromAttributes } = await import("@opentelemetry/resources");
|
|
9
|
+
const { ATTR_SERVICE_NAME } = await import(
|
|
10
|
+
"@opentelemetry/semantic-conventions"
|
|
11
|
+
);
|
|
12
|
+
const { HttpInstrumentation } = await import(
|
|
13
|
+
"@opentelemetry/instrumentation-http"
|
|
14
|
+
);
|
|
15
|
+
const { PgInstrumentation } = await import(
|
|
16
|
+
"@opentelemetry/instrumentation-pg"
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const sdk = new NodeSDK({
|
|
20
|
+
resource: resourceFromAttributes({
|
|
21
|
+
[ATTR_SERVICE_NAME]: otelServiceName(),
|
|
22
|
+
}),
|
|
23
|
+
traceExporter: new OTLPTraceExporter(),
|
|
24
|
+
instrumentations: [
|
|
25
|
+
new HttpInstrumentation(),
|
|
26
|
+
new PgInstrumentation({ enhancedDatabaseReporting: true }),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
sdk.start();
|
|
31
|
+
|
|
32
|
+
const shutdown = () => {
|
|
33
|
+
void sdk.shutdown();
|
|
34
|
+
};
|
|
35
|
+
process.once("SIGTERM", shutdown);
|
|
36
|
+
process.once("SIGINT", shutdown);
|
|
37
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { trace, SpanStatusCode, type Span } from "@opentelemetry/api";
|
|
2
|
+
import type { Plugin } from "graphql-yoga";
|
|
3
|
+
import {
|
|
4
|
+
Kind,
|
|
5
|
+
visit,
|
|
6
|
+
type DocumentNode,
|
|
7
|
+
type OperationDefinitionNode,
|
|
8
|
+
type GraphQLError,
|
|
9
|
+
} from "graphql";
|
|
10
|
+
import { isOtelEnabled } from "./otel-config.js";
|
|
11
|
+
|
|
12
|
+
const tracer = trace.getTracer("@corpdk/ds/graphql");
|
|
13
|
+
|
|
14
|
+
function operationDefinition(
|
|
15
|
+
document: DocumentNode,
|
|
16
|
+
operationName?: string | null,
|
|
17
|
+
): OperationDefinitionNode | undefined {
|
|
18
|
+
const ops: OperationDefinitionNode[] = [];
|
|
19
|
+
for (const def of document.definitions) {
|
|
20
|
+
if (def.kind === Kind.OPERATION_DEFINITION) ops.push(def);
|
|
21
|
+
}
|
|
22
|
+
if (ops.length === 0) return undefined;
|
|
23
|
+
if (ops.length === 1) return ops[0];
|
|
24
|
+
if (!operationName) return undefined;
|
|
25
|
+
return ops.find((op) => op.name?.value === operationName);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const SENSITIVE_VARIABLE_KEY =
|
|
29
|
+
/password|secret|token|authorization|api[_-]?key|credential|cookie|session/i;
|
|
30
|
+
|
|
31
|
+
function redactVariableValue(key: string, value: unknown): unknown {
|
|
32
|
+
if (SENSITIVE_VARIABLE_KEY.test(key)) return "[REDACTED]";
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
return value.map((entry) =>
|
|
35
|
+
entry !== null && typeof entry === "object"
|
|
36
|
+
? redactVariables(entry as Record<string, unknown>)
|
|
37
|
+
: entry,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (value !== null && typeof value === "object") {
|
|
41
|
+
return redactVariables(value as Record<string, unknown>);
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function redactVariables(
|
|
47
|
+
variables: Record<string, unknown>,
|
|
48
|
+
): Record<string, unknown> {
|
|
49
|
+
const out: Record<string, unknown> = {};
|
|
50
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
51
|
+
out[key] = redactVariableValue(key, value);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function sanitizedVariables(
|
|
57
|
+
variables: Record<string, unknown> | null | undefined,
|
|
58
|
+
): string {
|
|
59
|
+
if (!variables || Object.keys(variables).length === 0) return "{}";
|
|
60
|
+
try {
|
|
61
|
+
return JSON.stringify(redactVariables(variables));
|
|
62
|
+
} catch {
|
|
63
|
+
return "[unserializable]";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function redactSensitiveLiteralRanges(document: DocumentNode): { start: number; end: number }[] {
|
|
68
|
+
const ranges: { start: number; end: number }[] = [];
|
|
69
|
+
const pushValueLoc = (fieldName: string, loc: { start: number; end: number } | undefined) => {
|
|
70
|
+
if (SENSITIVE_VARIABLE_KEY.test(fieldName) && loc) {
|
|
71
|
+
ranges.push({ start: loc.start, end: loc.end });
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
visit(document, {
|
|
76
|
+
Argument(node) {
|
|
77
|
+
pushValueLoc(node.name.value, node.value.loc);
|
|
78
|
+
},
|
|
79
|
+
ObjectField(node) {
|
|
80
|
+
pushValueLoc(node.name.value, node.value.loc);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return ranges;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function sanitizedDocument(document: DocumentNode): string {
|
|
88
|
+
const source = document.loc?.source.body;
|
|
89
|
+
if (!source) return "";
|
|
90
|
+
|
|
91
|
+
const ranges = redactSensitiveLiteralRanges(document);
|
|
92
|
+
if (ranges.length === 0) return source;
|
|
93
|
+
|
|
94
|
+
ranges.sort((a, b) => b.start - a.start);
|
|
95
|
+
let out = source;
|
|
96
|
+
for (const { start, end } of ranges) {
|
|
97
|
+
out = `${out.slice(0, start)}[REDACTED]${out.slice(end)}`;
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function endSpan(
|
|
103
|
+
span: Span,
|
|
104
|
+
errors?: readonly GraphQLError[],
|
|
105
|
+
unhandled?: Error,
|
|
106
|
+
): void {
|
|
107
|
+
if (unhandled) {
|
|
108
|
+
span.setStatus({
|
|
109
|
+
code: SpanStatusCode.ERROR,
|
|
110
|
+
message: unhandled.message,
|
|
111
|
+
});
|
|
112
|
+
} else if (errors?.length) {
|
|
113
|
+
span.setStatus({
|
|
114
|
+
code: SpanStatusCode.ERROR,
|
|
115
|
+
message: errors.map((e) => e.message).join("; "),
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
119
|
+
}
|
|
120
|
+
span.end();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function finishFromResult(
|
|
124
|
+
span: Span,
|
|
125
|
+
result: { errors?: readonly GraphQLError[] } | AsyncIterable<unknown>,
|
|
126
|
+
): void {
|
|
127
|
+
if (typeof (result as AsyncIterable<unknown>)[Symbol.asyncIterator] === "function") {
|
|
128
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
129
|
+
span.end();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
endSpan(span, (result as { errors?: readonly GraphQLError[] }).errors);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** GraphQL execute spans (when OpenTelemetry is enabled). */
|
|
136
|
+
export function yogaTracingPlugin(): Plugin {
|
|
137
|
+
if (!isOtelEnabled()) {
|
|
138
|
+
return {};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
onExecute({ args }) {
|
|
143
|
+
const op = operationDefinition(args.document, args.operationName);
|
|
144
|
+
const operationType = op?.operation ?? "unknown";
|
|
145
|
+
const operationName =
|
|
146
|
+
args.operationName ?? op?.name?.value ?? "anonymous";
|
|
147
|
+
|
|
148
|
+
const span = tracer.startSpan(`graphql ${operationType}`, {
|
|
149
|
+
attributes: {
|
|
150
|
+
"graphql.operation.name": operationName,
|
|
151
|
+
"graphql.operation.type": operationType,
|
|
152
|
+
"graphql.document": sanitizedDocument(args.document),
|
|
153
|
+
"graphql.variables": sanitizedVariables(
|
|
154
|
+
args.variableValues as Record<string, unknown> | null | undefined,
|
|
155
|
+
),
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
onExecuteDone(payload) {
|
|
161
|
+
const { result } = payload;
|
|
162
|
+
if (result instanceof Promise) {
|
|
163
|
+
void result.then(
|
|
164
|
+
(resolved) => finishFromResult(span, resolved),
|
|
165
|
+
(err: unknown) => {
|
|
166
|
+
const error =
|
|
167
|
+
err instanceof Error ? err : new Error(String(err));
|
|
168
|
+
span.recordException(error);
|
|
169
|
+
endSpan(span, undefined, error);
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
finishFromResult(span, result);
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
package/canonical/src/schema.ts
CHANGED
|
@@ -5,10 +5,25 @@ import {
|
|
|
5
5
|
createDalContext,
|
|
6
6
|
pubsub,
|
|
7
7
|
} from "./generated/dal/index.js";
|
|
8
|
+
import {
|
|
9
|
+
otelSmokeResolvers,
|
|
10
|
+
otelSmokeTestEnabled,
|
|
11
|
+
otelSmokeTypeDefs,
|
|
12
|
+
} from "./observability/otel-smoke-extensions.js";
|
|
13
|
+
|
|
14
|
+
const resolvers = otelSmokeTestEnabled
|
|
15
|
+
? {
|
|
16
|
+
...generatedResolvers,
|
|
17
|
+
Query: {
|
|
18
|
+
...generatedResolvers.Query,
|
|
19
|
+
...otelSmokeResolvers.Query,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
: generatedResolvers;
|
|
8
23
|
|
|
9
24
|
export const schema = createSchema({
|
|
10
|
-
typeDefs,
|
|
11
|
-
resolvers
|
|
25
|
+
typeDefs: otelSmokeTestEnabled ? [typeDefs, otelSmokeTypeDefs] : typeDefs,
|
|
26
|
+
resolvers,
|
|
12
27
|
});
|
|
13
28
|
|
|
14
29
|
export interface RequestContextOptions {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
inputZodSchemas,
|
|
3
|
+
parseGraphqlInput,
|
|
4
|
+
parseGraphqlInputList,
|
|
5
|
+
parseOptionalGraphqlInput,
|
|
6
|
+
safeParseGraphqlInput,
|
|
7
|
+
safeParseGraphqlInputList,
|
|
8
|
+
safeParseOptionalGraphqlInput,
|
|
9
|
+
safeParseOptionalGraphqlInputList,
|
|
10
|
+
unwrapGraphqlInputParseResult,
|
|
11
|
+
type GraphqlInputParseResult,
|
|
12
|
+
type InputZodSchemaName,
|
|
13
|
+
} from "../generated/dal/input-zod.js";
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/args.ts
|
|
4
|
+
function printHelp() {
|
|
5
|
+
console.log(`@corpdk/create-ds \u2014 scaffold and upgrade DAL-automated DS packages
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
create-ds init [directory] [options]
|
|
9
|
+
create-ds upgrade [directory] [options]
|
|
10
|
+
|
|
11
|
+
Commands:
|
|
12
|
+
init Scaffold a minimal DS package (Drizzle schema + dal.config + scripts)
|
|
13
|
+
upgrade Merge canonical template deltas; never overwrites src/db/schema/**
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
--name <pkg> npm package name (default: @corpdk/ds)
|
|
17
|
+
--demo-schema Copy full demo commerce schema + seed from templates/ds
|
|
18
|
+
-h, --help Show this help
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
create-ds init ./packages/my-ds --name @myorg/my-ds
|
|
22
|
+
create-ds upgrade ./packages/my-ds
|
|
23
|
+
create-ds upgrade # upgrades current working directory
|
|
24
|
+
`);
|
|
25
|
+
}
|
|
26
|
+
function parseArgs(argv) {
|
|
27
|
+
const args = argv.slice(2);
|
|
28
|
+
const result = {
|
|
29
|
+
command: null,
|
|
30
|
+
targetDir: process.cwd(),
|
|
31
|
+
packageName: "@corpdk/ds",
|
|
32
|
+
withDemoSchema: false
|
|
33
|
+
};
|
|
34
|
+
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
35
|
+
result.command = "help";
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
const cmd = args[0];
|
|
39
|
+
if (cmd === "init" || cmd === "upgrade") {
|
|
40
|
+
result.command = cmd;
|
|
41
|
+
} else {
|
|
42
|
+
result.command = "help";
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
let i = 1;
|
|
46
|
+
while (i < args.length) {
|
|
47
|
+
const arg = args[i];
|
|
48
|
+
if (arg === "--name" && args[i + 1]) {
|
|
49
|
+
result.packageName = args[++i];
|
|
50
|
+
i++;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (arg === "--demo-schema") {
|
|
54
|
+
result.withDemoSchema = true;
|
|
55
|
+
i++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!arg.startsWith("-")) {
|
|
59
|
+
result.targetDir = arg;
|
|
60
|
+
i++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
i++;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
printHelp,
|
|
70
|
+
parseArgs
|
|
71
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
parseArgs,
|
|
4
|
+
printHelp
|
|
5
|
+
} from "./chunk-QT2CKMO4.js";
|
|
2
6
|
import {
|
|
3
7
|
copyDir,
|
|
4
8
|
execAsync,
|
|
@@ -10,77 +14,13 @@ import {
|
|
|
10
14
|
// src/index.ts
|
|
11
15
|
import { outro } from "@clack/prompts";
|
|
12
16
|
|
|
13
|
-
// src/args.ts
|
|
14
|
-
function printHelp() {
|
|
15
|
-
console.log(`@corpdk/create-ds \u2014 scaffold and upgrade DAL-automated DS packages
|
|
16
|
-
|
|
17
|
-
Usage:
|
|
18
|
-
create-ds init [directory] [options]
|
|
19
|
-
create-ds upgrade [directory] [options]
|
|
20
|
-
|
|
21
|
-
Commands:
|
|
22
|
-
init Scaffold a minimal DS package (Drizzle schema + dal.config + scripts)
|
|
23
|
-
upgrade Merge canonical template deltas; never overwrites src/db/schema/**
|
|
24
|
-
|
|
25
|
-
Options:
|
|
26
|
-
--name <pkg> npm package name (default: @corpdk/ds)
|
|
27
|
-
--demo-schema Copy full demo commerce schema + seed from templates/ds
|
|
28
|
-
-h, --help Show this help
|
|
29
|
-
|
|
30
|
-
Examples:
|
|
31
|
-
create-ds init ./packages/my-ds --name @myorg/my-ds
|
|
32
|
-
create-ds upgrade ./packages/my-ds
|
|
33
|
-
create-ds upgrade # upgrades current working directory
|
|
34
|
-
`);
|
|
35
|
-
}
|
|
36
|
-
function parseArgs(argv) {
|
|
37
|
-
const args = argv.slice(2);
|
|
38
|
-
const result = {
|
|
39
|
-
command: null,
|
|
40
|
-
targetDir: process.cwd(),
|
|
41
|
-
packageName: "@corpdk/ds",
|
|
42
|
-
withDemoSchema: false
|
|
43
|
-
};
|
|
44
|
-
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
45
|
-
result.command = "help";
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
const cmd = args[0];
|
|
49
|
-
if (cmd === "init" || cmd === "upgrade") {
|
|
50
|
-
result.command = cmd;
|
|
51
|
-
} else {
|
|
52
|
-
result.command = "help";
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
let i = 1;
|
|
56
|
-
while (i < args.length) {
|
|
57
|
-
const arg = args[i];
|
|
58
|
-
if (arg === "--name" && args[i + 1]) {
|
|
59
|
-
result.packageName = args[++i];
|
|
60
|
-
i++;
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (arg === "--demo-schema") {
|
|
64
|
-
result.withDemoSchema = true;
|
|
65
|
-
i++;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (!arg.startsWith("-")) {
|
|
69
|
-
result.targetDir = arg;
|
|
70
|
-
i++;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
i++;
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
17
|
// src/init.ts
|
|
79
|
-
import
|
|
18
|
+
import fs2 from "fs/promises";
|
|
80
19
|
import path2 from "path";
|
|
81
20
|
import { spinner } from "@clack/prompts";
|
|
82
21
|
|
|
83
22
|
// src/template.ts
|
|
23
|
+
import fs from "fs/promises";
|
|
84
24
|
import path from "path";
|
|
85
25
|
import { fileURLToPath } from "url";
|
|
86
26
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -123,6 +63,24 @@ function initialScaffoldCalVer(asOf = /* @__PURE__ */ new Date()) {
|
|
|
123
63
|
const month = asOf.getUTCMonth() + 1;
|
|
124
64
|
return `${year}.${month}.0`;
|
|
125
65
|
}
|
|
66
|
+
var BOOTSTRAP_STATIC_SRC_RELATIVE = [
|
|
67
|
+
"src/health.ts",
|
|
68
|
+
"src/validation/parse-input.ts",
|
|
69
|
+
"src/observability/otel-config.ts",
|
|
70
|
+
"src/observability/otel-smoke-extensions.ts",
|
|
71
|
+
"src/observability/preload-otel.ts",
|
|
72
|
+
"src/observability/yoga-tracing-plugin.ts"
|
|
73
|
+
];
|
|
74
|
+
async function copyBootstrapStaticSrc(templateDir, packageDir) {
|
|
75
|
+
const { pathExists: pathExists2 } = await import("./utils-RZJNRUXW.js");
|
|
76
|
+
for (const rel of BOOTSTRAP_STATIC_SRC_RELATIVE) {
|
|
77
|
+
const templatePath = path.join(templateDir, rel);
|
|
78
|
+
if (!await pathExists2(templatePath)) continue;
|
|
79
|
+
const destPath = path.join(packageDir, rel);
|
|
80
|
+
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
81
|
+
await fs.copyFile(templatePath, destPath);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
126
84
|
var UPGRADE_RELATIVE_FILES = [
|
|
127
85
|
"LICENSE",
|
|
128
86
|
"package.json",
|
|
@@ -132,12 +90,14 @@ var UPGRADE_RELATIVE_FILES = [
|
|
|
132
90
|
"tsconfig.json",
|
|
133
91
|
"Dockerfile",
|
|
134
92
|
"docker-compose.yml",
|
|
93
|
+
"docker/otel-collector-config.yaml",
|
|
135
94
|
"docker-entrypoint.sh",
|
|
136
95
|
".gitignore",
|
|
137
96
|
".env.example",
|
|
138
97
|
"src/schema.ts",
|
|
139
98
|
"src/index.ts",
|
|
140
|
-
"src/db/index.ts"
|
|
99
|
+
"src/db/index.ts",
|
|
100
|
+
...BOOTSTRAP_STATIC_SRC_RELATIVE
|
|
141
101
|
];
|
|
142
102
|
|
|
143
103
|
// src/package-merge.ts
|
|
@@ -239,13 +199,13 @@ async function runInit(options) {
|
|
|
239
199
|
throw new Error(`Canonical DS template not found: ${templateDir}`);
|
|
240
200
|
}
|
|
241
201
|
if (await pathExists(targetDir)) {
|
|
242
|
-
const entries = await
|
|
202
|
+
const entries = await fs2.readdir(targetDir);
|
|
243
203
|
if (entries.length > 0) {
|
|
244
204
|
throw new Error(`Target directory is not empty: ${targetDir}`);
|
|
245
205
|
}
|
|
246
206
|
}
|
|
247
207
|
s.start("Scaffolding DS package layout");
|
|
248
|
-
await
|
|
208
|
+
await fs2.mkdir(targetDir, { recursive: true });
|
|
249
209
|
await copyDir(templateDir, targetDir, {
|
|
250
210
|
extraExclude: ["src", "drizzle"]
|
|
251
211
|
});
|
|
@@ -254,12 +214,12 @@ async function runInit(options) {
|
|
|
254
214
|
if (options.withDemoSchema) {
|
|
255
215
|
const seedSrc = path2.join(templateDir, "src", "db", "seed.ts");
|
|
256
216
|
if (await pathExists(seedSrc)) {
|
|
257
|
-
await
|
|
217
|
+
await fs2.copyFile(seedSrc, path2.join(targetDir, "src", "db", "seed.ts"));
|
|
258
218
|
}
|
|
259
219
|
}
|
|
260
220
|
const starterDal = path2.join(engineStarterDir(), "dal", "dal.config.yaml");
|
|
261
221
|
if (!options.withDemoSchema && await pathExists(starterDal)) {
|
|
262
|
-
await
|
|
222
|
+
await fs2.copyFile(
|
|
263
223
|
starterDal,
|
|
264
224
|
path2.join(targetDir, "dal", "dal.config.yaml")
|
|
265
225
|
);
|
|
@@ -284,14 +244,15 @@ async function runInit(options) {
|
|
|
284
244
|
});
|
|
285
245
|
} else {
|
|
286
246
|
for (const rel of ["src/schema.ts", "src/index.ts", "src/db/index.ts"]) {
|
|
287
|
-
await
|
|
247
|
+
await fs2.copyFile(path2.join(templateDir, rel), path2.join(targetDir, rel));
|
|
288
248
|
}
|
|
289
249
|
}
|
|
250
|
+
await copyBootstrapStaticSrc(templateDir, targetDir);
|
|
290
251
|
s.stop("DS package scaffolded");
|
|
291
252
|
}
|
|
292
253
|
|
|
293
254
|
// src/upgrade.ts
|
|
294
|
-
import
|
|
255
|
+
import fs3 from "fs/promises";
|
|
295
256
|
import path3 from "path";
|
|
296
257
|
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
297
258
|
import { spinner as spinner2 } from "@clack/prompts";
|
|
@@ -306,10 +267,10 @@ async function mergeUpgradePackageJson(templatePath, destPath, mergeOptions) {
|
|
|
306
267
|
await writeJson(destPath, mergePackageJson(consumer, template, mergeOptions));
|
|
307
268
|
}
|
|
308
269
|
async function mergeUpgradeDalConfig(templatePath, destPath) {
|
|
309
|
-
const templateRaw = await
|
|
310
|
-
const consumerRaw = await pathExists(destPath) ? await
|
|
311
|
-
await
|
|
312
|
-
await
|
|
270
|
+
const templateRaw = await fs3.readFile(templatePath, "utf8");
|
|
271
|
+
const consumerRaw = await pathExists(destPath) ? await fs3.readFile(destPath, "utf8") : null;
|
|
272
|
+
await fs3.mkdir(path3.dirname(destPath), { recursive: true });
|
|
273
|
+
await fs3.writeFile(
|
|
313
274
|
destPath,
|
|
314
275
|
mergeDalConfig(templateRaw, consumerRaw),
|
|
315
276
|
"utf8"
|
|
@@ -327,8 +288,8 @@ async function copyUpgradeRelativeFile(rel, templateDir, packageDir, mergeOption
|
|
|
327
288
|
await mergeUpgradeDalConfig(templatePath, destPath);
|
|
328
289
|
return;
|
|
329
290
|
}
|
|
330
|
-
await
|
|
331
|
-
await
|
|
291
|
+
await fs3.mkdir(path3.dirname(destPath), { recursive: true });
|
|
292
|
+
await fs3.copyFile(templatePath, destPath);
|
|
332
293
|
}
|
|
333
294
|
async function runEntityLintIfAvailable(repoRoot, packageDir) {
|
|
334
295
|
const dalCodegenLint = path3.join(
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type PkgJson = {
|
|
2
|
+
name?: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
publishConfig?: Record<string, string>;
|
|
6
|
+
scripts?: Record<string, string>;
|
|
7
|
+
dependencies?: Record<string, string>;
|
|
8
|
+
devDependencies?: Record<string, string>;
|
|
9
|
+
type?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
/** Invoke dal-codegen via installed package (works before pnpm .bin links exist). */
|
|
13
|
+
export declare function normalizeDalScripts(scripts: Record<string, string>): Record<string, string>;
|
|
14
|
+
export type MergePackageJsonOptions = {
|
|
15
|
+
/** When set, `workspace:*` @corpdk/* deps use `^${publishedCorpdkVersions}` (published CLI init). */
|
|
16
|
+
publishedCorpdkVersions?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function mergePackageJson(consumer: PkgJson, template: PkgJson, options?: MergePackageJsonOptions): PkgJson;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Monorepo root (engines/create-ds/dist → engines/create-ds → engines → root). */
|
|
2
|
+
export declare function repoRootFromEngine(): string;
|
|
3
|
+
export declare function resolveCanonicalDsTemplateDir(repoRoot: string): Promise<string>;
|
|
4
|
+
export declare function engineStarterDir(): string;
|
|
5
|
+
export declare function isBundledCanonicalTemplate(templateDir: string): boolean;
|
|
6
|
+
export declare function readCreateDsReleaseVersion(): Promise<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Initial CalVer for a newly scaffolded deployable DS package (`YYYY.MM.MICRO`, UTC).
|
|
9
|
+
* Uses MICRO `0` for the first version in the scaffold month (Limitless CalVer policy).
|
|
10
|
+
*/
|
|
11
|
+
export declare function initialScaffoldCalVer(asOf?: Date): string;
|
|
12
|
+
/** Health, observability, and validation modules referenced by bootstrap entry files. */
|
|
13
|
+
export declare const BOOTSTRAP_STATIC_SRC_RELATIVE: readonly ["src/health.ts", "src/validation/parse-input.ts", "src/observability/otel-config.ts", "src/observability/otel-smoke-extensions.ts", "src/observability/preload-otel.ts", "src/observability/yoga-tracing-plugin.ts"];
|
|
14
|
+
export declare function copyBootstrapStaticSrc(templateDir: string, packageDir: string): Promise<void>;
|
|
15
|
+
/** Relative paths under templates/ds merged on upgrade (never touches src/db/schema/**). */
|
|
16
|
+
export declare const UPGRADE_RELATIVE_FILES: readonly ["LICENSE", "package.json", "dal/dal.config.yaml", "codegen.ts", "drizzle.config.ts", "tsconfig.json", "Dockerfile", "docker-compose.yml", "docker/otel-collector-config.yaml", "docker-entrypoint.sh", ".gitignore", ".env.example", "src/schema.ts", "src/index.ts", "src/db/index.ts", "src/health.ts", "src/validation/parse-input.ts", "src/observability/otel-config.ts", "src/observability/otel-smoke-extensions.ts", "src/observability/preload-otel.ts", "src/observability/yoga-tracing-plugin.ts"];
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
declare const execAsync: typeof exec.__promisify__;
|
|
3
|
+
export { execAsync };
|
|
4
|
+
export declare function pathExists(p: string): Promise<boolean>;
|
|
5
|
+
export declare function readJson<T>(filePath: string): Promise<T>;
|
|
6
|
+
export declare function writeJson(filePath: string, data: unknown): Promise<void>;
|
|
7
|
+
export declare function copyDir(src: string, dest: string, options?: {
|
|
8
|
+
extraExclude?: string[];
|
|
9
|
+
transform?: (content: string, relPath: string) => string;
|
|
10
|
+
skipIfExists?: boolean;
|
|
11
|
+
}): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corpdk/create-ds",
|
|
3
|
-
"version": "2026.10.0-alpha.
|
|
3
|
+
"version": "2026.10.0-alpha.5",
|
|
4
4
|
"description": "Scaffold and upgrade DAL-automated GraphQL data services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
"canonical",
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
|
+
"types": "./dist/types-entry.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/types-entry.d.ts",
|
|
25
|
+
"import": "./dist/types-entry.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
21
28
|
"bin": {
|
|
22
29
|
"create-ds": "./dist/index.js"
|
|
23
30
|
},
|
|
@@ -26,13 +33,16 @@
|
|
|
26
33
|
"yaml": "^2.8.3"
|
|
27
34
|
},
|
|
28
35
|
"devDependencies": {
|
|
29
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^24.0.0",
|
|
30
37
|
"tsup": "^8.5.1",
|
|
31
38
|
"typescript": "^6.0.2"
|
|
32
39
|
},
|
|
33
40
|
"license": "MIT",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=24.0.0"
|
|
43
|
+
},
|
|
34
44
|
"scripts": {
|
|
35
|
-
"build": "tsup",
|
|
45
|
+
"build": "tsup && pnpm exec tsc -p tsconfig.json --emitDeclarationOnly",
|
|
36
46
|
"dev": "tsup --watch",
|
|
37
47
|
"clean": "rm -rf dist node_modules .turbo"
|
|
38
48
|
}
|