@ancplua/qyl-api-schema 11.0.1 → 11.2.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/common/types.tsp +2 -13
- package/generated/json-schema/qyl-api-schema.json +12 -24
- package/generated/openapi/qyl.openapi.json +15 -27
- package/generated/runtime/index.d.ts +1 -0
- package/generated/runtime/index.js +1 -0
- package/generated/runtime/time.d.ts +12 -0
- package/generated/runtime/time.js +29 -0
- package/generated/ts-runtime/api.d.ts +6 -0
- package/generated/ts-runtime/api.js +28 -1
- package/generated/ts-runtime/schemas.d.ts +662 -0
- package/generated/ts-runtime/schemas.js +658 -0
- package/generated/zod-runtime/index.d.ts +12 -0
- package/generated/zod-runtime/index.js +12 -0
- package/models/session.tsp +0 -1
- package/package.json +9 -8
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ContractDefinitionName, ContractDefinitions } from "../../generated/ts-runtime/schemas.js";
|
|
2
|
+
export type { ContractDefinitionName, ContractDefinitions };
|
|
3
|
+
export { contractDefinitionKeys } from "../../generated/ts-runtime/schemas.js";
|
|
1
4
|
import { z } from "zod";
|
|
2
5
|
/**
|
|
3
6
|
* A published contract type as it looks *before* validation: branded identity
|
|
@@ -38,6 +41,15 @@ export type ContractInput<TContract> = TContract extends {
|
|
|
38
41
|
* const span = SpanSchema.parse(await response.json());
|
|
39
42
|
* ```
|
|
40
43
|
*/
|
|
44
|
+
/**
|
|
45
|
+
* A validator for a published definition with its TypeScript type bound by the emitter:
|
|
46
|
+
* the name is checked at compile time and the result type cannot be paired wrongly.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* const span = contractSchema("OTel.Traces.Span").parse(await response.json());
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function contractSchema<TName extends ContractDefinitionName>(definitionName: TName): z.ZodType<ContractDefinitions[TName]>;
|
|
41
53
|
export declare function publishedContractSchema<TContract>(definitionName: string): z.ZodType<TContract>;
|
|
42
54
|
/**
|
|
43
55
|
* Every definition name {@link publishedContractSchema} accepts, sorted.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// map, so this file resolves the same artifact from source, from
|
|
11
11
|
// generated/zod-runtime, and from inside an installed node_modules copy.
|
|
12
12
|
import contractJsonSchema from "@ancplua/qyl-api-schema/json-schema" with { type: "json" };
|
|
13
|
+
export { contractDefinitionKeys } from "../../generated/ts-runtime/schemas.js";
|
|
13
14
|
import { z } from "zod";
|
|
14
15
|
/**
|
|
15
16
|
* Rewrite the published JSON Schema into the subset `z.fromJSONSchema` accepts,
|
|
@@ -231,6 +232,17 @@ const publishedContractSchemas = new Map();
|
|
|
231
232
|
* const span = SpanSchema.parse(await response.json());
|
|
232
233
|
* ```
|
|
233
234
|
*/
|
|
235
|
+
/**
|
|
236
|
+
* A validator for a published definition with its TypeScript type bound by the emitter:
|
|
237
|
+
* the name is checked at compile time and the result type cannot be paired wrongly.
|
|
238
|
+
*
|
|
239
|
+
* ```ts
|
|
240
|
+
* const span = contractSchema("OTel.Traces.Span").parse(await response.json());
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export function contractSchema(definitionName) {
|
|
244
|
+
return publishedContractSchema(definitionName);
|
|
245
|
+
}
|
|
234
246
|
export function publishedContractSchema(definitionName) {
|
|
235
247
|
const cached = publishedContractSchemas.get(definitionName);
|
|
236
248
|
if (cached)
|
package/models/session.tsp
CHANGED
|
@@ -63,7 +63,6 @@ enum SessionEventName {
|
|
|
63
63
|
// =============================================================================
|
|
64
64
|
|
|
65
65
|
@doc("Complete session entity with aggregated data")
|
|
66
|
-
@TypeSpec.OpenAPI.extension("x-csharp-type", "SessionEntity")
|
|
67
66
|
model SessionEntity {
|
|
68
67
|
@doc("Session ID")
|
|
69
68
|
@key
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancplua/qyl-api-schema",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "TypeSpec source of truth for qyl API contracts. Emits OpenAPI, JSON Schema, Qyl.Api.Contracts DTOs, and TypeScript contract types; not an OpenTelemetry package, storage schema, or server implementation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"packageManager": "bun@1.4.2",
|
|
7
6
|
"workspaces": [
|
|
8
7
|
"emitters/csharp",
|
|
9
8
|
"emitters/ts-types",
|
|
@@ -83,6 +82,8 @@
|
|
|
83
82
|
"generated/ts-runtime/api.js",
|
|
84
83
|
"generated/ts-runtime/runtime.d.ts",
|
|
85
84
|
"generated/ts-runtime/runtime.js",
|
|
85
|
+
"generated/ts-runtime/schemas.js",
|
|
86
|
+
"generated/ts-runtime/schemas.d.ts",
|
|
86
87
|
"generated/openapi/qyl.openapi.json",
|
|
87
88
|
"generated/json-schema/qyl-api-schema.json",
|
|
88
89
|
"generated/zod-runtime/index.d.ts",
|
|
@@ -117,12 +118,12 @@
|
|
|
117
118
|
"build:runtime": "tsc -p tsconfig.runtime.json"
|
|
118
119
|
},
|
|
119
120
|
"peerDependencies": {
|
|
120
|
-
"@typespec/compiler": "^1.
|
|
121
|
-
"@typespec/events": "^0.
|
|
122
|
-
"@typespec/http": "^1.
|
|
123
|
-
"@typespec/openapi": "^1.
|
|
124
|
-
"@typespec/openapi3": "^1.
|
|
125
|
-
"@typespec/sse": "
|
|
121
|
+
"@typespec/compiler": "^1.16.0",
|
|
122
|
+
"@typespec/events": "^0.86.0",
|
|
123
|
+
"@typespec/http": "^1.16.0",
|
|
124
|
+
"@typespec/openapi": "^1.16.0",
|
|
125
|
+
"@typespec/openapi3": "^1.16.0",
|
|
126
|
+
"@typespec/sse": "^0.86.0",
|
|
126
127
|
"zod": ">=4.5.0 <5"
|
|
127
128
|
},
|
|
128
129
|
"peerDependenciesMeta": {
|