@pulse-compute/wasm-schema-json 1.0.0-beta.3 → 1.0.0-beta.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/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
> **Stability:** Internal schema compiler interface synchronized with this release set.<br>
|
|
9
9
|
> **npm:** [`@pulse-compute/wasm-schema-json`](https://www.npmjs.com/package/@pulse-compute/wasm-schema-json)<br>
|
|
10
10
|
> **Canonical replacement:** `schemas in .pulse/config.ts through the Pulse project workflow`<br>
|
|
11
|
-
> **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.
|
|
11
|
+
> **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.5/packages/implementation-packages/)
|
|
12
12
|
>
|
|
13
|
-
> This release-status block is generated from the synchronized `Pulse 1.0.0-beta.
|
|
13
|
+
> This release-status block is generated from the synchronized `Pulse 1.0.0-beta.5` package policy.
|
|
14
14
|
<!-- pulse-package-status:end -->
|
|
15
15
|
|
|
16
16
|
JSON schema compiler, canonical codec, registry, sidecar, and body-policy implementation for Pulse.
|
|
@@ -35,4 +35,4 @@ Application projects declare schemas in `pulse.config.*`; they do not install or
|
|
|
35
35
|
|
|
36
36
|
The exported compiler modules are synchronized implementation interfaces without an application-author compatibility promise.
|
|
37
37
|
|
|
38
|
-
See [Explicit JSON schemas](https://pulsecompute.io/v1.0.0-beta.
|
|
38
|
+
See [Explicit JSON schemas](https://pulsecompute.io/v1.0.0-beta.5/guides/json-schemas/), [Project configuration](https://pulsecompute.io/v1.0.0-beta.5/reference/project-config/#json-schema-policy), and [Implementation packages](https://pulsecompute.io/v1.0.0-beta.5/packages/implementation-packages/).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-compute/wasm-schema-json",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^22.14.0 || ^24.0.0"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"./compiler/schema-registry": "./src/compiler/schema-registry.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pulse-compute/wasm-build-support": "1.0.0-beta.
|
|
23
|
-
"@pulse-compute/wasm-contracts": "1.0.0-beta.
|
|
22
|
+
"@pulse-compute/wasm-build-support": "1.0.0-beta.5",
|
|
23
|
+
"@pulse-compute/wasm-contracts": "1.0.0-beta.5",
|
|
24
24
|
"typescript": "5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "git+https://github.com/pulse-compute/pulse.git",
|
|
38
38
|
"directory": "wasm/packages/schema-json"
|
|
39
39
|
},
|
|
40
|
-
"homepage": "https://pulsecompute.io/v1.0.0-beta.
|
|
40
|
+
"homepage": "https://pulsecompute.io/v1.0.0-beta.5/packages/implementation-packages/",
|
|
41
41
|
"bugs": {
|
|
42
42
|
"url": "https://github.com/pulse-compute/pulse/issues"
|
|
43
43
|
}
|
|
@@ -13,8 +13,8 @@ const {
|
|
|
13
13
|
const CANONICAL_SCHEMA_BUNDLE_VERSION = 'pulse.canonical-schema-bundle.v2';
|
|
14
14
|
const CANONICAL_SCHEMA_REGISTRY_VERSION = 'pulse.canonical-schema-registry.v2';
|
|
15
15
|
const CANONICAL_SCHEMA_CODECS_VERSION = 'pulse.canonical-schema-codecs.v2';
|
|
16
|
-
const JAVASCRIPT_SCHEMA_CODEC_VERSION = 'pulse.javascript-schema-codec.
|
|
17
|
-
const NATIVE_SCHEMA_CODEC_VERSION = 'pulse.native-json-as-schema-codec.
|
|
16
|
+
const JAVASCRIPT_SCHEMA_CODEC_VERSION = 'pulse.javascript-schema-codec.v2';
|
|
17
|
+
const NATIVE_SCHEMA_CODEC_VERSION = 'pulse.native-json-as-schema-codec.v2';
|
|
18
18
|
|
|
19
19
|
function stableObject(value) {
|
|
20
20
|
if (Array.isArray(value)) return value.map(stableObject);
|
|
@@ -225,6 +225,7 @@ function renderCanonicalSchemaCodecDeclaration(registryInput, options = {}) {
|
|
|
225
225
|
lines.push(" if (!value || typeof value !== 'object' || Array.isArray(value)) throw __pulse_schema_failure(mode, undefined, schemaId, path, 'object', __pulse_schema_kind(value), source);");
|
|
226
226
|
lines.push(' const output = {};');
|
|
227
227
|
lines.push(' for (const field of node.fields) {');
|
|
228
|
+
lines.push(" if (!field.required && !Object.prototype.hasOwnProperty.call(value, field.name)) continue;");
|
|
228
229
|
lines.push(' const fieldPath = __pulse_schema_pointer(path, field.name);');
|
|
229
230
|
lines.push(' const fieldValue = __pulse_schema_data_value(value, field.name, mode, schemaId, fieldPath, source);');
|
|
230
231
|
lines.push(' Object.defineProperty(output, field.name, { enumerable: true, configurable: false, writable: false, value: __pulse_schema_apply_node(field.value, fieldValue, mode, schemaId, fieldPath, source) });');
|
|
@@ -330,7 +330,7 @@ function classifyType(graph, record, typeNode, state) {
|
|
|
330
330
|
if (typeNode.kind === ts.SyntaxKind.BooleanKeyword) return Object.freeze({ kind: 'boolean' });
|
|
331
331
|
if (typeNode.kind === ts.SyntaxKind.NumberKeyword) return Object.freeze({ kind: 'f64' });
|
|
332
332
|
if (typeNode.kind === ts.SyntaxKind.UndefinedKeyword || typeNode.kind === ts.SyntaxKind.VoidKeyword) {
|
|
333
|
-
fail('PULSE_SCHEMA_OPTIONAL_FIELD_RESERVED', 'undefined
|
|
333
|
+
fail('PULSE_SCHEMA_OPTIONAL_FIELD_RESERVED', 'Explicit undefined schema types are reserved; use a question-mark property for absence.', typeNode, record);
|
|
334
334
|
}
|
|
335
335
|
if (ts.isArrayTypeNode(typeNode)) {
|
|
336
336
|
return Object.freeze({ kind: 'array', element: classifyType(graph, record, typeNode.elementType, state) });
|
|
@@ -420,15 +420,7 @@ function classifyMembers(graph, record, members, state) {
|
|
|
420
420
|
if (!ts.isPropertySignature(member)) {
|
|
421
421
|
fail(
|
|
422
422
|
'PULSE_SCHEMA_OBJECT_MEMBER_UNSUPPORTED',
|
|
423
|
-
'Schema object types allow
|
|
424
|
-
member,
|
|
425
|
-
record
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
if (member.questionToken) {
|
|
429
|
-
fail(
|
|
430
|
-
'PULSE_SCHEMA_OPTIONAL_FIELD_RESERVED',
|
|
431
|
-
'Optional schema fields are reserved until absence-preserving encode semantics are defined.',
|
|
423
|
+
'Schema object types allow property signatures only.',
|
|
432
424
|
member,
|
|
433
425
|
record
|
|
434
426
|
);
|
|
@@ -444,7 +436,7 @@ function classifyMembers(graph, record, members, state) {
|
|
|
444
436
|
names.add(name);
|
|
445
437
|
fields.push(Object.freeze({
|
|
446
438
|
name,
|
|
447
|
-
required:
|
|
439
|
+
required: !member.questionToken,
|
|
448
440
|
value: classifyType(graph, record, member.type, { ...state, node: member }),
|
|
449
441
|
source: sourceLocation(record, member.name)
|
|
450
442
|
}));
|
|
@@ -621,7 +613,7 @@ function schemaRegistryLegacyBridge(registry) {
|
|
|
621
613
|
const deferred = [];
|
|
622
614
|
for (const schema of registry.schemas) {
|
|
623
615
|
const fieldPairs = schema.root.fields.map((field) => [field.name, legacyFieldType(field.value)]);
|
|
624
|
-
if (schema.typeName.startsWith('Inline_') || fieldPairs.some(([, type]) => type === null)) {
|
|
616
|
+
if (schema.typeName.startsWith('Inline_') || schema.root.fields.some(field => !field.required) || fieldPairs.some(([, type]) => type === null)) {
|
|
625
617
|
deferred.push(schema.id);
|
|
626
618
|
continue;
|
|
627
619
|
}
|