@automovie/ingest 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +37 -2
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.d.ts +5 -0
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js +8 -0
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js.map +1 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.d.ts +5 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js +15 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js.map +1 -0
- package/lib/AutoMovieExternalModelIngestProfile.d.ts +11 -0
- package/lib/AutoMovieExternalModelIngestProfile.js +3 -0
- package/lib/AutoMovieExternalModelIngestProfile.js.map +1 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.d.ts +11 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.js +3 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.js.map +1 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.d.ts +9 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.js +3 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.js.map +1 -0
- package/lib/IAutoMovieExternalModelInspection.d.ts +48 -0
- package/lib/IAutoMovieExternalModelInspection.js +3 -0
- package/lib/IAutoMovieExternalModelInspection.js.map +1 -0
- package/lib/IAutoMovieExternalModelResource.d.ts +18 -0
- package/lib/IAutoMovieExternalModelResource.js +3 -0
- package/lib/IAutoMovieExternalModelResource.js.map +1 -0
- package/lib/IAutoMovieExternalMotionAdoption.d.ts +23 -0
- package/lib/IAutoMovieExternalMotionAdoption.js +3 -0
- package/lib/IAutoMovieExternalMotionAdoption.js.map +1 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.d.ts +15 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.js +3 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.js.map +1 -0
- package/lib/IAutoMovieExternalMotionInspection.d.ts +25 -0
- package/lib/IAutoMovieExternalMotionInspection.js +3 -0
- package/lib/IAutoMovieExternalMotionInspection.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.d.ts +20 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.js +3 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.d.ts +18 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.js +3 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.d.ts +21 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.js +3 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.js.map +1 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.d.ts +24 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.js +3 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.js.map +1 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.d.ts +22 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.js +3 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.js.map +1 -0
- package/lib/IAutoMovieExternalMotionSource.d.ts +18 -0
- package/lib/IAutoMovieExternalMotionSource.js +3 -0
- package/lib/IAutoMovieExternalMotionSource.js.map +1 -0
- package/lib/IAutoMovieIngestResult.d.ts +17 -0
- package/lib/IAutoMovieIngestResult.js +3 -0
- package/lib/IAutoMovieIngestResult.js.map +1 -0
- package/lib/adoptAutoMovieExternalMotion.d.ts +32 -0
- package/lib/adoptAutoMovieExternalMotion.js +215 -0
- package/lib/adoptAutoMovieExternalMotion.js.map +1 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.d.ts +28 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.js +3 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.js.map +1 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.d.ts +18 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.js +3 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.js.map +1 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.d.ts +39 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.js +3 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.js.map +1 -0
- package/lib/audio/decodeProductionAudioAsset.d.ts +33 -0
- package/lib/audio/decodeProductionAudioAsset.js +257 -0
- package/lib/audio/decodeProductionAudioAsset.js.map +1 -0
- package/lib/audio/index.d.ts +4 -0
- package/lib/audio/index.js +21 -0
- package/lib/audio/index.js.map +1 -0
- package/lib/decodeAutoMoviePpmImage.d.ts +30 -0
- package/lib/decodeAutoMoviePpmImage.js +84 -0
- package/lib/decodeAutoMoviePpmImage.js.map +1 -0
- package/lib/humanoidSkeleton.d.ts +24 -0
- package/lib/humanoidSkeleton.js +80 -0
- package/lib/humanoidSkeleton.js.map +1 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.js +40 -0
- package/lib/index.js.map +1 -0
- package/lib/ingestDocument.d.ts +23 -0
- package/lib/ingestDocument.js +173 -0
- package/lib/ingestDocument.js.map +1 -0
- package/lib/inspectAutoMovieExternalModelBytes.d.ts +32 -0
- package/lib/inspectAutoMovieExternalModelBytes.js +219 -0
- package/lib/inspectAutoMovieExternalModelBytes.js.map +1 -0
- package/lib/internal/COMPONENT_BYTES.d.ts +2 -0
- package/lib/internal/COMPONENT_BYTES.js +13 -0
- package/lib/internal/COMPONENT_BYTES.js.map +1 -0
- package/lib/internal/IAccessorSource.d.ts +16 -0
- package/lib/internal/IAccessorSource.js +3 -0
- package/lib/internal/IAccessorSource.js.map +1 -0
- package/lib/internal/IExternalModelAccessorReader.d.ts +9 -0
- package/lib/internal/IExternalModelAccessorReader.js +3 -0
- package/lib/internal/IExternalModelAccessorReader.js.map +1 -0
- package/lib/internal/IHumanoidSlot.d.ts +15 -0
- package/lib/internal/IHumanoidSlot.js +3 -0
- package/lib/internal/IHumanoidSlot.js.map +1 -0
- package/lib/internal/IParsedContainer.d.ts +16 -0
- package/lib/internal/IParsedContainer.js +3 -0
- package/lib/internal/IParsedContainer.js.map +1 -0
- package/lib/internal/SHAPE_COMPONENTS.d.ts +6 -0
- package/lib/internal/SHAPE_COMPONENTS.js +25 -0
- package/lib/internal/SHAPE_COMPONENTS.js.map +1 -0
- package/lib/internal/accessorElementByteLength.d.ts +12 -0
- package/lib/internal/accessorElementByteLength.js +28 -0
- package/lib/internal/accessorElementByteLength.js.map +1 -0
- package/lib/internal/accessorReader.d.ts +16 -0
- package/lib/internal/accessorReader.js +52 -0
- package/lib/internal/accessorReader.js.map +1 -0
- package/lib/internal/accessorValues.d.ts +18 -0
- package/lib/internal/accessorValues.js +38 -0
- package/lib/internal/accessorValues.js.map +1 -0
- package/lib/internal/collectExternalResources.d.ts +13 -0
- package/lib/internal/collectExternalResources.js +51 -0
- package/lib/internal/collectExternalResources.js.map +1 -0
- package/lib/internal/compareCodeUnits.d.ts +12 -0
- package/lib/internal/compareCodeUnits.js +17 -0
- package/lib/internal/compareCodeUnits.js.map +1 -0
- package/lib/internal/composeLocalTransform.d.ts +21 -0
- package/lib/internal/composeLocalTransform.js +53 -0
- package/lib/internal/composeLocalTransform.js.map +1 -0
- package/lib/internal/decodeDataUri.d.ts +14 -0
- package/lib/internal/decodeDataUri.js +61 -0
- package/lib/internal/decodeDataUri.js.map +1 -0
- package/lib/internal/decodeGlb.d.ts +13 -0
- package/lib/internal/decodeGlb.js +56 -0
- package/lib/internal/decodeGlb.js.map +1 -0
- package/lib/internal/decodeJson.d.ts +12 -0
- package/lib/internal/decodeJson.js +77 -0
- package/lib/internal/decodeJson.js.map +1 -0
- package/lib/internal/fileExtension.d.ts +12 -0
- package/lib/internal/fileExtension.js +21 -0
- package/lib/internal/fileExtension.js.map +1 -0
- package/lib/internal/finiteTuple.d.ts +14 -0
- package/lib/internal/finiteTuple.js +29 -0
- package/lib/internal/finiteTuple.js.map +1 -0
- package/lib/internal/gltfHumanoidBones.d.ts +15 -0
- package/lib/internal/gltfHumanoidBones.js +39 -0
- package/lib/internal/gltfHumanoidBones.js.map +1 -0
- package/lib/internal/humanoidBoneOfName.d.ts +18 -0
- package/lib/internal/humanoidBoneOfName.js +67 -0
- package/lib/internal/humanoidBoneOfName.js.map +1 -0
- package/lib/internal/inspectExternalModelHierarchy.d.ts +12 -0
- package/lib/internal/inspectExternalModelHierarchy.js +51 -0
- package/lib/internal/inspectExternalModelHierarchy.js.map +1 -0
- package/lib/internal/inspectExternalMotion.d.ts +23 -0
- package/lib/internal/inspectExternalMotion.js +152 -0
- package/lib/internal/inspectExternalMotion.js.map +1 -0
- package/lib/internal/inspectExternalMotionNodes.d.ts +15 -0
- package/lib/internal/inspectExternalMotionNodes.js +58 -0
- package/lib/internal/inspectExternalMotionNodes.js.map +1 -0
- package/lib/internal/integerIndex.d.ts +12 -0
- package/lib/internal/integerIndex.js +23 -0
- package/lib/internal/integerIndex.js.map +1 -0
- package/lib/internal/integerIndices.d.ts +12 -0
- package/lib/internal/integerIndices.js +23 -0
- package/lib/internal/integerIndices.js.map +1 -0
- package/lib/internal/nonNegativeInteger.d.ts +12 -0
- package/lib/internal/nonNegativeInteger.js +22 -0
- package/lib/internal/nonNegativeInteger.js.map +1 -0
- package/lib/internal/object.d.ts +12 -0
- package/lib/internal/object.js +21 -0
- package/lib/internal/object.js.map +1 -0
- package/lib/internal/optionalArray.d.ts +12 -0
- package/lib/internal/optionalArray.js +18 -0
- package/lib/internal/optionalArray.js.map +1 -0
- package/lib/internal/optionalObject.d.ts +12 -0
- package/lib/internal/optionalObject.js +18 -0
- package/lib/internal/optionalObject.js.map +1 -0
- package/lib/internal/optionalStringArray.d.ts +12 -0
- package/lib/internal/optionalStringArray.js +22 -0
- package/lib/internal/optionalStringArray.js.map +1 -0
- package/lib/internal/positiveInteger.d.ts +12 -0
- package/lib/internal/positiveInteger.js +22 -0
- package/lib/internal/positiveInteger.js.map +1 -0
- package/lib/internal/readMotionAccessor.d.ts +15 -0
- package/lib/internal/readMotionAccessor.js +41 -0
- package/lib/internal/readMotionAccessor.js.map +1 -0
- package/lib/internal/requiredArray.d.ts +12 -0
- package/lib/internal/requiredArray.js +21 -0
- package/lib/internal/requiredArray.js.map +1 -0
- package/lib/internal/uniqueStrings.d.ts +12 -0
- package/lib/internal/uniqueStrings.js +18 -0
- package/lib/internal/uniqueStrings.js.map +1 -0
- package/lib/internal/validNodeIndex.d.ts +12 -0
- package/lib/internal/validNodeIndex.js +20 -0
- package/lib/internal/validNodeIndex.js.map +1 -0
- package/lib/internal/validateAccessorRange.d.ts +14 -0
- package/lib/internal/validateAccessorRange.js +37 -0
- package/lib/internal/validateAccessorRange.js.map +1 -0
- package/lib/internal/validateHumanoidSkinning.d.ts +20 -0
- package/lib/internal/validateHumanoidSkinning.js +91 -0
- package/lib/internal/validateHumanoidSkinning.js.map +1 -0
- package/lib/internal/validatePayloadClosure.d.ts +21 -0
- package/lib/internal/validatePayloadClosure.js +74 -0
- package/lib/internal/validatePayloadClosure.js.map +1 -0
- package/lib/internal/validateSparseAccessor.d.ts +14 -0
- package/lib/internal/validateSparseAccessor.js +50 -0
- package/lib/internal/validateSparseAccessor.js.map +1 -0
- package/lib/internal/vrmHumanoidBones.d.ts +15 -0
- package/lib/internal/vrmHumanoidBones.js +132 -0
- package/lib/internal/vrmHumanoidBones.js.map +1 -0
- package/lib/isAutoMovieExternalModelIngestProfile.d.ts +18 -0
- package/lib/isAutoMovieExternalModelIngestProfile.js +24 -0
- package/lib/isAutoMovieExternalModelIngestProfile.js.map +1 -0
- package/package.json +45 -3
- package/src/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.ts +7 -0
- package/src/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.ts +21 -0
- package/src/AutoMovieExternalModelIngestProfile.ts +15 -0
- package/src/AutoMovieExternalMotionAdoptionDecision.ts +14 -0
- package/src/AutoMovieGltfMotionInterpretationProfile.ts +10 -0
- package/src/IAutoMovieExternalModelInspection.ts +62 -0
- package/src/IAutoMovieExternalModelResource.ts +20 -0
- package/src/IAutoMovieExternalMotionAdoption.ts +30 -0
- package/src/IAutoMovieExternalMotionBoneMapping.ts +17 -0
- package/src/IAutoMovieExternalMotionInspection.ts +32 -0
- package/src/IAutoMovieExternalMotionNativeDecision.ts +25 -0
- package/src/IAutoMovieExternalMotionNativeHandoff.ts +22 -0
- package/src/IAutoMovieExternalMotionNodeInspection.ts +26 -0
- package/src/IAutoMovieExternalMotionRetargetDecision.ts +31 -0
- package/src/IAutoMovieExternalMotionRetargetHandoff.ts +28 -0
- package/src/IAutoMovieExternalMotionSource.ts +20 -0
- package/src/IAutoMovieIngestResult.ts +19 -0
- package/src/adoptAutoMovieExternalMotion.ts +387 -0
- package/src/audio/IAutoMovieDecodedProductionAudioAsset.ts +35 -0
- package/src/audio/IAutoMovieProductionAudioProcessing.ts +21 -0
- package/src/audio/IAutoMovieProductionWaveSourceFormat.ts +50 -0
- package/src/audio/decodeProductionAudioAsset.ts +451 -0
- package/src/audio/index.ts +4 -0
- package/src/decodeAutoMoviePpmImage.ts +103 -0
- package/src/humanoidSkeleton.ts +105 -0
- package/src/index.ts +23 -0
- package/src/ingestDocument.ts +242 -0
- package/src/inspectAutoMovieExternalModelBytes.ts +346 -0
- package/src/internal/COMPONENT_BYTES.ts +12 -0
- package/src/internal/IAccessorSource.ts +18 -0
- package/src/internal/IExternalModelAccessorReader.ts +12 -0
- package/src/internal/IHumanoidSlot.ts +17 -0
- package/src/internal/IParsedContainer.ts +18 -0
- package/src/internal/SHAPE_COMPONENTS.ts +27 -0
- package/src/internal/accessorElementByteLength.ts +24 -0
- package/src/internal/accessorReader.ts +76 -0
- package/src/internal/accessorValues.ts +35 -0
- package/src/internal/collectExternalResources.ts +69 -0
- package/src/internal/compareCodeUnits.ts +15 -0
- package/src/internal/composeLocalTransform.ts +56 -0
- package/src/internal/decodeDataUri.ts +70 -0
- package/src/internal/decodeGlb.ts +70 -0
- package/src/internal/decodeJson.ts +76 -0
- package/src/internal/fileExtension.ts +18 -0
- package/src/internal/finiteTuple.ts +33 -0
- package/src/internal/gltfHumanoidBones.ts +48 -0
- package/src/internal/humanoidBoneOfName.ts +75 -0
- package/src/internal/inspectExternalModelHierarchy.ts +61 -0
- package/src/internal/inspectExternalMotion.ts +292 -0
- package/src/internal/inspectExternalMotionNodes.ts +81 -0
- package/src/internal/integerIndex.ts +28 -0
- package/src/internal/integerIndices.ts +24 -0
- package/src/internal/nonNegativeInteger.ts +22 -0
- package/src/internal/object.ts +22 -0
- package/src/internal/optionalArray.ts +17 -0
- package/src/internal/optionalObject.ts +20 -0
- package/src/internal/optionalStringArray.ts +22 -0
- package/src/internal/positiveInteger.ts +22 -0
- package/src/internal/readMotionAccessor.ts +60 -0
- package/src/internal/requiredArray.ts +19 -0
- package/src/internal/uniqueStrings.ts +16 -0
- package/src/internal/validNodeIndex.ts +19 -0
- package/src/internal/validateAccessorRange.ts +53 -0
- package/src/internal/validateHumanoidSkinning.ts +152 -0
- package/src/internal/validatePayloadClosure.ts +116 -0
- package/src/internal/validateSparseAccessor.ts +109 -0
- package/src/internal/vrmHumanoidBones.ts +176 -0
- package/src/isAutoMovieExternalModelIngestProfile.ts +28 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inspectExternalMotion = void 0;
|
|
4
|
+
const AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE_1 = require("../AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE");
|
|
5
|
+
const SHAPE_COMPONENTS_1 = require("./SHAPE_COMPONENTS");
|
|
6
|
+
const inspectExternalMotionNodes_1 = require("./inspectExternalMotionNodes");
|
|
7
|
+
const integerIndex_1 = require("./integerIndex");
|
|
8
|
+
const object_1 = require("./object");
|
|
9
|
+
const readMotionAccessor_1 = require("./readMotionAccessor");
|
|
10
|
+
const requiredArray_1 = require("./requiredArray");
|
|
11
|
+
/** Accessor shape each target path's output must use. */
|
|
12
|
+
const MOTION_OUTPUT_TYPES = {
|
|
13
|
+
translation: "VEC3",
|
|
14
|
+
rotation: "VEC4",
|
|
15
|
+
scale: "VEC3",
|
|
16
|
+
weights: "SCALAR",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Normalize glTF animation samplers into deterministic node tracks.
|
|
20
|
+
*
|
|
21
|
+
* Empty animation inventories return undefined. Otherwise source-order clips and channel-order tracks own independent FLOAT keyframe copies, even when samplers share accessors. Times must be nonnegative and strictly increasing; output arity follows path and interpolation, with only quaternion value groups checked within 1e-4 of unit magnitude. Cubic tangents remain unchanged and weight arity is not checked against the target mesh's morph count. Missing interpolation means LINEAR; unknown interpolation, duplicate node/path channels and malformed data throw with the field path.
|
|
22
|
+
*
|
|
23
|
+
* @evidence contracts/development/implementation.md#principled-implementation Validated FLOAT accessors, strictly increasing nonnegative times, supported interpolation and target-specific arity determine copied clips.
|
|
24
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Motion normalization owns sampler/channel relationships while hierarchy, node TRS and byte readers remain separate owners.
|
|
25
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Duplicate targets and non-finite values throw; quaternion value groups outside the 1e-4 magnitude tolerance are refused, while accepted keyframes are copied without normalization. Weight counts are checked only for a nonempty whole keyframe group, not against a target mesh's morph count.
|
|
26
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose describes clip/channel ordering, exact keyframe ownership, interpolation, arity and quaternion checks.
|
|
27
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Cost follows node/channel counts and decoded/copied keyframe values; shared accessors are decoded once but each track owns a copy.
|
|
28
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Accessor index plus expected shape keys per-call decoding; immutable source/payload dependencies justify reuse and track arrays remain independent.
|
|
29
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The decode cache lives only for one inspection; returned clips retain arrays proportional to keyframe counts without raw payload bytes.
|
|
30
|
+
*/
|
|
31
|
+
const inspectExternalMotion = (props) => {
|
|
32
|
+
if (props.animations.length === 0)
|
|
33
|
+
return undefined;
|
|
34
|
+
const nodes = (0, inspectExternalMotionNodes_1.inspectExternalMotionNodes)(props.nodes, props.parentByIndex);
|
|
35
|
+
const nodeIds = nodes.map((node) => node.id);
|
|
36
|
+
// Shared accessors reuse finite FLOAT decoding; each track owns a copy and
|
|
37
|
+
// still checks its times, interpolation-specific arity and quaternion values.
|
|
38
|
+
const decoded = new Map();
|
|
39
|
+
const readOnce = (accessorIndex, expectedType, path) => {
|
|
40
|
+
const key = `${accessorIndex}:${expectedType}`;
|
|
41
|
+
let values = decoded.get(key);
|
|
42
|
+
if (values === undefined) {
|
|
43
|
+
values = (0, readMotionAccessor_1.readMotionAccessor)(props.source, accessorIndex, expectedType, path);
|
|
44
|
+
decoded.set(key, values);
|
|
45
|
+
}
|
|
46
|
+
return values.slice();
|
|
47
|
+
};
|
|
48
|
+
const takes = props.animations.map((value, animationIndex) => {
|
|
49
|
+
const animation = (0, object_1.object)(value, `animations[${animationIndex}]`);
|
|
50
|
+
const samplers = (0, requiredArray_1.requiredArray)(animation.samplers, `animations[${animationIndex}].samplers`);
|
|
51
|
+
const channels = (0, requiredArray_1.requiredArray)(animation.channels, `animations[${animationIndex}].channels`);
|
|
52
|
+
if (samplers.length === 0 || channels.length === 0)
|
|
53
|
+
throw new Error(`animations[${animationIndex}] needs at least one sampler and channel.`);
|
|
54
|
+
const targets = new Set();
|
|
55
|
+
const tracks = channels.map((channelValue, channelIndex) => {
|
|
56
|
+
const channelPath = `animations[${animationIndex}].channels[${channelIndex}]`;
|
|
57
|
+
const channel = (0, object_1.object)(channelValue, channelPath);
|
|
58
|
+
(0, integerIndex_1.integerIndex)(channel.sampler, samplers.length, `${channelPath}.sampler`, true);
|
|
59
|
+
const target = (0, object_1.object)(channel.target, `${channelPath}.target`);
|
|
60
|
+
(0, integerIndex_1.integerIndex)(target.node, props.nodes.length, `${channelPath}.target.node`, true);
|
|
61
|
+
if (typeof target.path !== "string" ||
|
|
62
|
+
Object.hasOwn(MOTION_OUTPUT_TYPES, target.path) === false)
|
|
63
|
+
throw new Error(`${channelPath}.target.path must be translation, rotation, scale, or weights.`);
|
|
64
|
+
const targetPath = target.path;
|
|
65
|
+
const targetKey = `${String(target.node)}\u0000${targetPath}`;
|
|
66
|
+
if (targets.has(targetKey))
|
|
67
|
+
throw new Error(`${channelPath} duplicates the ${targetPath} channel for node ${String(target.node)}.`);
|
|
68
|
+
targets.add(targetKey);
|
|
69
|
+
const samplerPath = `animations[${animationIndex}].samplers[${String(channel.sampler)}]`;
|
|
70
|
+
const sampler = (0, object_1.object)(samplers[channel.sampler], samplerPath);
|
|
71
|
+
(0, integerIndex_1.integerIndex)(sampler.input, props.source.accessors.length, `${samplerPath}.input`, true);
|
|
72
|
+
(0, integerIndex_1.integerIndex)(sampler.output, props.source.accessors.length, `${samplerPath}.output`, true);
|
|
73
|
+
const interpolation = motionInterpolation(sampler.interpolation, `${samplerPath}.interpolation`);
|
|
74
|
+
const times = readOnce(sampler.input, "SCALAR", `${samplerPath}.input`);
|
|
75
|
+
const values = readOnce(sampler.output, MOTION_OUTPUT_TYPES[targetPath], `${samplerPath}.output`);
|
|
76
|
+
validateMotionTimes(times, `${samplerPath}.input`);
|
|
77
|
+
validateMotionOutput({
|
|
78
|
+
path: `${samplerPath}.output`,
|
|
79
|
+
targetPath,
|
|
80
|
+
interpolation,
|
|
81
|
+
keyframes: times.length,
|
|
82
|
+
values,
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
channel: {
|
|
86
|
+
kind: "node",
|
|
87
|
+
node: nodeIds[target.node],
|
|
88
|
+
path: targetPath,
|
|
89
|
+
},
|
|
90
|
+
times,
|
|
91
|
+
values,
|
|
92
|
+
interpolation,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const name = animation.name;
|
|
96
|
+
if (name !== undefined && typeof name !== "string")
|
|
97
|
+
throw new Error(`animations[${animationIndex}].name must be a string.`);
|
|
98
|
+
return {
|
|
99
|
+
id: `clip_${animationIndex}`,
|
|
100
|
+
name: name === undefined || name.length === 0 ? null : name,
|
|
101
|
+
duration: tracks.reduce((maximum, track) => Math.max(maximum, track.times[track.times.length - 1]), 0),
|
|
102
|
+
loop: false,
|
|
103
|
+
tracks,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
path: props.path,
|
|
108
|
+
byteLength: props.byteLength,
|
|
109
|
+
interpretation: AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE_1.AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE,
|
|
110
|
+
nodes,
|
|
111
|
+
nodeIds,
|
|
112
|
+
takes,
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.inspectExternalMotion = inspectExternalMotion;
|
|
116
|
+
const motionInterpolation = (value, path) => {
|
|
117
|
+
if (value === undefined || value === "LINEAR")
|
|
118
|
+
return "linear";
|
|
119
|
+
if (value === "STEP")
|
|
120
|
+
return "step";
|
|
121
|
+
if (value === "CUBICSPLINE")
|
|
122
|
+
return "cubicspline";
|
|
123
|
+
throw new Error(`${path} must be LINEAR, STEP, or CUBICSPLINE.`);
|
|
124
|
+
};
|
|
125
|
+
const validateMotionTimes = (times, path) => {
|
|
126
|
+
for (let index = 0; index < times.length; ++index)
|
|
127
|
+
if (times[index] < 0 || (index > 0 && times[index] <= times[index - 1]))
|
|
128
|
+
throw new Error(`${path} keyframe times must be non-negative and strictly increasing.`);
|
|
129
|
+
};
|
|
130
|
+
const validateMotionOutput = (props) => {
|
|
131
|
+
const factor = props.interpolation === "cubicspline" ? 3 : 1;
|
|
132
|
+
const width = props.targetPath === "weights"
|
|
133
|
+
? null
|
|
134
|
+
: SHAPE_COMPONENTS_1.SHAPE_COMPONENTS[MOTION_OUTPUT_TYPES[props.targetPath]];
|
|
135
|
+
const group = props.keyframes * factor;
|
|
136
|
+
if (group === 0 ||
|
|
137
|
+
(width === null
|
|
138
|
+
? props.values.length === 0 || props.values.length % group !== 0
|
|
139
|
+
: props.values.length !== group * width))
|
|
140
|
+
throw new Error(`${props.path} does not match the ${props.targetPath} keyframe arity.`);
|
|
141
|
+
if (props.targetPath !== "rotation")
|
|
142
|
+
return;
|
|
143
|
+
for (let frame = 0; frame < props.keyframes; ++frame) {
|
|
144
|
+
// A cubic-spline keyframe stores in-tangent, value, out-tangent; only the
|
|
145
|
+
// value must be a unit quaternion.
|
|
146
|
+
const at = (props.interpolation === "cubicspline" ? frame * 3 + 1 : frame) * 4;
|
|
147
|
+
const magnitude = Math.hypot(props.values[at], props.values[at + 1], props.values[at + 2], props.values[at + 3]);
|
|
148
|
+
if (Math.abs(magnitude - 1) > 1e-4)
|
|
149
|
+
throw new Error(`${props.path} contains a non-unit rotation keyframe.`);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=inspectExternalMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectExternalMotion.js","sourceRoot":"","sources":["../../src/internal/inspectExternalMotion.ts"],"names":[],"mappings":";;;AAEA,kHAA+G;AAI/G,yDAAsD;AACtD,6EAA0E;AAC1E,iDAA8C;AAC9C,qCAAkC;AAClC,6DAA0D;AAC1D,mDAAgD;AAQhD,yDAAyD;AACzD,MAAM,mBAAmB,GAErB;IACF,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,QAAQ;CAClB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACI,MAAM,qBAAqB,GAOqB,CAAC,KAOvD,EAAkD,EAAE;IAC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AAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC;QAC7D,0EAA0E;QAC1E,mCAAmC;QACnC,MAAM,EAAE,GACN,CAAC,KAAK,CAAC,aAAa,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtE,MAAM,SAAS,GAAW,IAAI,CAAC,KAAK,CAClC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAE,EACjB,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAE,EACrB,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAE,EACrB,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAE,CACtB,CAAC;QACF,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI;YAChC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,yCAAyC,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IAutoMovieExternalMotionNodeInspection } from "../IAutoMovieExternalMotionNodeInspection";
|
|
2
|
+
/**
|
|
3
|
+
* Read glTF motion nodes as finite canonical local TRS records.
|
|
4
|
+
*
|
|
5
|
+
* The caller supplies a validated acyclic parent table. Omitted translation, rotation and scale use glTF defaults; present tuples must be finite, scales positive and quaternion magnitude within 1e-4 of one before normalization. Matrix transforms throw instead of being decomposed. Records use source-index ids, null for absent/empty names or root parents, and fresh transform objects.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Three/four-component tuples use glTF defaults; positive scale and unit-quaternion tolerance precede rotation normalization.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Node interpretation owns stable index ids, parent ids and local transforms, separate from animation channel decoding.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Matrix transforms are refused rather than decomposed; rig names do not invent skeletal semantics.
|
|
10
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose states defaults, matrix refusal, positive scale, quaternion normalization and absent name/parent meaning.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms N nodes require O(N) time and output records, with fixed-size tuple work per node.
|
|
12
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work The admitted parent table is reused from structural hierarchy checks; each node transform is interpreted once per inspection.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned node records own new fixed-size transforms; source JSON arrays and tuple temporaries are not retained.
|
|
14
|
+
*/
|
|
15
|
+
export declare const inspectExternalMotionNodes: (values: unknown[], parentByIndex: readonly (number | undefined)[]) => IAutoMovieExternalMotionNodeInspection[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inspectExternalMotionNodes = void 0;
|
|
4
|
+
const finiteTuple_1 = require("./finiteTuple");
|
|
5
|
+
const object_1 = require("./object");
|
|
6
|
+
/**
|
|
7
|
+
* Read glTF motion nodes as finite canonical local TRS records.
|
|
8
|
+
*
|
|
9
|
+
* The caller supplies a validated acyclic parent table. Omitted translation, rotation and scale use glTF defaults; present tuples must be finite, scales positive and quaternion magnitude within 1e-4 of one before normalization. Matrix transforms throw instead of being decomposed. Records use source-index ids, null for absent/empty names or root parents, and fresh transform objects.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/development/implementation.md#principled-implementation Three/four-component tuples use glTF defaults; positive scale and unit-quaternion tolerance precede rotation normalization.
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Node interpretation owns stable index ids, parent ids and local transforms, separate from animation channel decoding.
|
|
13
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Matrix transforms are refused rather than decomposed; rig names do not invent skeletal semantics.
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose states defaults, matrix refusal, positive scale, quaternion normalization and absent name/parent meaning.
|
|
15
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms N nodes require O(N) time and output records, with fixed-size tuple work per node.
|
|
16
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work The admitted parent table is reused from structural hierarchy checks; each node transform is interpreted once per inspection.
|
|
17
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned node records own new fixed-size transforms; source JSON arrays and tuple temporaries are not retained.
|
|
18
|
+
*/
|
|
19
|
+
const inspectExternalMotionNodes = (values, parentByIndex) => values.map((value, index) => {
|
|
20
|
+
const node = (0, object_1.object)(value, `nodes[${index}]`);
|
|
21
|
+
if (node.matrix !== undefined)
|
|
22
|
+
throw new Error(`nodes[${index}].matrix is unsupported by the glTF motion interpretation profile; declare translation, rotation, and scale explicitly.`);
|
|
23
|
+
if (node.name !== undefined && typeof node.name !== "string")
|
|
24
|
+
throw new Error(`nodes[${index}].name must be a string.`);
|
|
25
|
+
const translation = (0, finiteTuple_1.finiteTuple)(node.translation, `nodes[${index}].translation`, [0, 0, 0]);
|
|
26
|
+
const rotation = (0, finiteTuple_1.finiteTuple)(node.rotation, `nodes[${index}].rotation`, [0, 0, 0, 1]);
|
|
27
|
+
const scale = (0, finiteTuple_1.finiteTuple)(node.scale, `nodes[${index}].scale`, [1, 1, 1]);
|
|
28
|
+
if (scale.some((component) => component <= 0))
|
|
29
|
+
throw new Error(`nodes[${index}].scale must contain only positive values.`);
|
|
30
|
+
const magnitude = Math.hypot(...rotation);
|
|
31
|
+
if (Math.abs(magnitude - 1) > 1e-4)
|
|
32
|
+
throw new Error(`nodes[${index}].rotation must be a unit quaternion.`);
|
|
33
|
+
const parent = parentByIndex[index];
|
|
34
|
+
return {
|
|
35
|
+
id: `node_${index}`,
|
|
36
|
+
index,
|
|
37
|
+
name: typeof node.name === "string" && node.name.length !== 0
|
|
38
|
+
? node.name
|
|
39
|
+
: null,
|
|
40
|
+
parent: parent === undefined ? null : `node_${parent}`,
|
|
41
|
+
transform: {
|
|
42
|
+
translation: {
|
|
43
|
+
x: translation[0],
|
|
44
|
+
y: translation[1],
|
|
45
|
+
z: translation[2],
|
|
46
|
+
},
|
|
47
|
+
rotation: {
|
|
48
|
+
x: rotation[0] / magnitude,
|
|
49
|
+
y: rotation[1] / magnitude,
|
|
50
|
+
z: rotation[2] / magnitude,
|
|
51
|
+
w: rotation[3] / magnitude,
|
|
52
|
+
},
|
|
53
|
+
scale: { x: scale[0], y: scale[1], z: scale[2] },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
exports.inspectExternalMotionNodes = inspectExternalMotionNodes;
|
|
58
|
+
//# sourceMappingURL=inspectExternalMotionNodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectExternalMotionNodes.js","sourceRoot":"","sources":["../../src/internal/inspectExternalMotionNodes.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAC5C,qCAAkC;AAElC;;;;;;;;;;;;GAYG;AACI,MAAM,0BAA0B,GAGS,CAC9C,MAAiB,EACjB,aAA8C,EACJ,EAAE,CAC5C,MAAM,CAAC,GAAG,CACR,CAAC,KAAc,EAAE,KAAa,EAA0C,EAAE;IACxE,MAAM,IAAI,GAA4B,IAAA,eAAM,EAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,CAAC;IACvE,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAC3B,MAAM,IAAI,KAAK,CACb,SAAS,KAAK,yHAAyH,CACxI,CAAC;IACJ,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;QAC1D,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,0BAA0B,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAa,IAAA,yBAAW,EACvC,IAAI,CAAC,WAAW,EAChB,SAAS,KAAK,eAAe,EAC7B,CAAC,CAA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C,CAAE;aACnB;YACD,QAAQ,EAAE;gBACR,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAE,GAAG,SAAS;gBAC3B,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAE,GAAG,SAAS;gBAC3B,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAE,GAAG,SAAS;gBAC3B,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAE,GAAG,SAAS;aAC5B;YACD,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE;SACpD;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AA/DS,QAAA,0BAA0B,GAA1B,0BAA0B,CA+DnC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admit an optional or required index into an already declared inventory.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Safe integer identity and the half-open zero-to-length range establish resolvable references; omission is accepted only when optional.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One gate owns reference existence semantics while callers supply the appropriate inventory and field path.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Undefined required values, negatives, fractions and out-of-range indices throw instead of selecting a nearby element.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose defines required omission, zero-based range, safe precision and path-named failure.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms The helper performs constant-time predicates independent of the inventory population.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work All reference-array validation delegates this same gate without a separate range implementation.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources No inventory is copied or retained, and no resource is acquired by index admission.
|
|
11
|
+
*/
|
|
12
|
+
export declare const integerIndex: (value: unknown, length: number, path: string, required?: boolean) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integerIndex = void 0;
|
|
4
|
+
const validNodeIndex_1 = require("./validNodeIndex");
|
|
5
|
+
/**
|
|
6
|
+
* Admit an optional or required index into an already declared inventory.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Safe integer identity and the half-open zero-to-length range establish resolvable references; omission is accepted only when optional.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One gate owns reference existence semantics while callers supply the appropriate inventory and field path.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Undefined required values, negatives, fractions and out-of-range indices throw instead of selecting a nearby element.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose defines required omission, zero-based range, safe precision and path-named failure.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms The helper performs constant-time predicates independent of the inventory population.
|
|
13
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work All reference-array validation delegates this same gate without a separate range implementation.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources No inventory is copied or retained, and no resource is acquired by index admission.
|
|
15
|
+
*/
|
|
16
|
+
const integerIndex = (value, length, path, required = false) => {
|
|
17
|
+
if (value === undefined && required === false)
|
|
18
|
+
return;
|
|
19
|
+
if ((0, validNodeIndex_1.validNodeIndex)(value, length) === false)
|
|
20
|
+
throw new Error(`${path} does not resolve inside its declared inventory.`);
|
|
21
|
+
};
|
|
22
|
+
exports.integerIndex = integerIndex;
|
|
23
|
+
//# sourceMappingURL=integerIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integerIndex.js","sourceRoot":"","sources":["../../src/internal/integerIndex.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD;;;;;;;;;;GAUG;AACI,MAAM,YAAY,GAKb,CACV,KAAc,EACd,MAAc,EACd,IAAY,EACZ,QAAQ,GAAY,KAAK,EACnB,EAAE;IACR,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO;IACtD,IAAI,IAAA,+BAAc,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,KAAK;QACzC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,kDAAkD,CAAC,CAAC;AAC/E,CAAC,CAAC;AAdW,QAAA,YAAY,GAAZ,YAAY,CAcvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate every index in an optional glTF reference array.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined allows omitted references; a supplied array delegates each element's safe in-range admission with an indexed path.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Array shape belongs to requiredArray and each index predicate to integerIndex, leaving this owner only enumeration.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Malformed references are neither skipped nor coerced, so the first failing index remains observable.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Comments describe optional-array meaning, indexed failures and the predeclared inventory length.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms An N-reference array costs O(N) with no new result array and constant work per index.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each reference is checked once using the shared single-index admission rule.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The enumeration borrows its array for the call and retains no graph or payload resource.
|
|
11
|
+
*/
|
|
12
|
+
export declare const integerIndices: (value: unknown, length: number, path: string) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integerIndices = void 0;
|
|
4
|
+
const integerIndex_1 = require("./integerIndex");
|
|
5
|
+
const requiredArray_1 = require("./requiredArray");
|
|
6
|
+
/**
|
|
7
|
+
* Validate every index in an optional glTF reference array.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined allows omitted references; a supplied array delegates each element's safe in-range admission with an indexed path.
|
|
10
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Array shape belongs to requiredArray and each index predicate to integerIndex, leaving this owner only enumeration.
|
|
11
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Malformed references are neither skipped nor coerced, so the first failing index remains observable.
|
|
12
|
+
* @evidence contracts/development/common.md#meaningful-documentation Comments describe optional-array meaning, indexed failures and the predeclared inventory length.
|
|
13
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms An N-reference array costs O(N) with no new result array and constant work per index.
|
|
14
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each reference is checked once using the shared single-index admission rule.
|
|
15
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The enumeration borrows its array for the call and retains no graph or payload resource.
|
|
16
|
+
*/
|
|
17
|
+
const integerIndices = (value, length, path) => {
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return;
|
|
20
|
+
(0, requiredArray_1.requiredArray)(value, path).forEach((entry, index) => (0, integerIndex_1.integerIndex)(entry, length, `${path}[${index}]`, true));
|
|
21
|
+
};
|
|
22
|
+
exports.integerIndices = integerIndices;
|
|
23
|
+
//# sourceMappingURL=integerIndices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integerIndices.js","sourceRoot":"","sources":["../../src/internal/integerIndices.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAC9C,mDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,MAAM,cAAc,GAIf,CAAC,KAAc,EAAE,MAAc,EAAE,IAAY,EAAQ,EAAE;IACjE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAA,6BAAa,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,KAAc,EAAE,KAAa,EAAQ,EAAE,CACzE,IAAA,2BAAY,EAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,IAAI,CAAC,CACvD,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,cAAc,GAAd,cAAc,CASzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Require a safe nonnegative glTF byte offset.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Number type, safe-integer identity and nonnegative sign protect subsequent declared-range arithmetic.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One shared scalar rule serves buffer/accessor offsets without embedding range ownership.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Fractions, negative offsets and unsafe integers throw rather than being truncated or clamped.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose states zero allowance, integer precision requirement, path diagnostic and unchanged input.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Three scalar checks require constant time without payload allocation or byte traversal.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work All offset owners reuse this gate; final offset-plus-length bounds remain with their range validators.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources No input record or offset cache survives this pure admission call.
|
|
11
|
+
*/
|
|
12
|
+
export declare const nonNegativeInteger: (value: unknown, path: string) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nonNegativeInteger = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Require a safe nonnegative glTF byte offset.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Number type, safe-integer identity and nonnegative sign protect subsequent declared-range arithmetic.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One shared scalar rule serves buffer/accessor offsets without embedding range ownership.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Fractions, negative offsets and unsafe integers throw rather than being truncated or clamped.
|
|
10
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose states zero allowance, integer precision requirement, path diagnostic and unchanged input.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Three scalar checks require constant time without payload allocation or byte traversal.
|
|
12
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work All offset owners reuse this gate; final offset-plus-length bounds remain with their range validators.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources No input record or offset cache survives this pure admission call.
|
|
14
|
+
*/
|
|
15
|
+
const nonNegativeInteger = (value, path) => {
|
|
16
|
+
if (typeof value !== "number" ||
|
|
17
|
+
Number.isSafeInteger(value) === false ||
|
|
18
|
+
value < 0)
|
|
19
|
+
throw new Error(`${path} must be a non-negative safe integer.`);
|
|
20
|
+
};
|
|
21
|
+
exports.nonNegativeInteger = nonNegativeInteger;
|
|
22
|
+
//# sourceMappingURL=nonNegativeInteger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonNegativeInteger.js","sourceRoot":"","sources":["../../src/internal/nonNegativeInteger.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACI,MAAM,kBAAkB,GAA2C,CACxE,KAAc,EACd,IAAY,EACN,EAAE;IACR,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,KAAK;QACrC,KAAK,GAAG,CAAC;QAET,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAVW,QAAA,kBAAkB,GAAlB,kBAAkB,CAU7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Require a non-null non-array JSON record at its owning path.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Runtime type and null/array exclusions establish an object shape before fields are read.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One shared JSON record gate keeps identical error semantics across structural, payload and profile consumers.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No value is cast into a usable record until the object predicate succeeds, and malformed inputs are not repaired.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies accepted shape, path-named failure and returned borrowed identity.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Object shape admission uses constant-time predicates rather than copying or traversing properties.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Every optional-object path delegates this same gate for present values.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The helper returns the existing object and retains no metadata, payload or resource state.
|
|
11
|
+
*/
|
|
12
|
+
export declare const object: (value: unknown, path: string) => Record<string, unknown>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.object = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Require a non-null non-array JSON record at its owning path.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Runtime type and null/array exclusions establish an object shape before fields are read.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One shared JSON record gate keeps identical error semantics across structural, payload and profile consumers.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No value is cast into a usable record until the object predicate succeeds, and malformed inputs are not repaired.
|
|
10
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies accepted shape, path-named failure and returned borrowed identity.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Object shape admission uses constant-time predicates rather than copying or traversing properties.
|
|
12
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Every optional-object path delegates this same gate for present values.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The helper returns the existing object and retains no metadata, payload or resource state.
|
|
14
|
+
*/
|
|
15
|
+
const object = (value, path) => {
|
|
16
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
17
|
+
throw new Error(`${path} must be an object.`);
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
exports.object = object;
|
|
21
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/internal/object.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACI,MAAM,MAAM,GAGY,CAC7B,KAAc,EACd,IAAY,EACa,EAAE;IAC3B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAC;IAChD,OAAO,KAAgC,CAAC;AAC1C,CAAC,CAAC;AAVW,QAAA,MAAM,GAAN,MAAM,CAUjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an absent optional JSON array as an empty inventory.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined alone produces an empty array; supplied values must pass the common Array.isArray gate.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The wrapper owns omission while requiredArray owns shape admission and named-path diagnostics.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Null, strings and array-like objects are refused rather than being treated as missing inventories.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose identifies the undefined case, unchanged supplied arrays and malformed-value refusal.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One omission check and constant-time array identity test run without scanning elements.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work The same required-array operation is reused for every present optional inventory.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only omitted input creates a new empty array; valid supplied arrays remain borrowed and unretained.
|
|
11
|
+
*/
|
|
12
|
+
export declare const optionalArray: (value: unknown, path: string) => unknown[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalArray = void 0;
|
|
4
|
+
const requiredArray_1 = require("./requiredArray");
|
|
5
|
+
/**
|
|
6
|
+
* Read an absent optional JSON array as an empty inventory.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined alone produces an empty array; supplied values must pass the common Array.isArray gate.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The wrapper owns omission while requiredArray owns shape admission and named-path diagnostics.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Null, strings and array-like objects are refused rather than being treated as missing inventories.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation Prose identifies the undefined case, unchanged supplied arrays and malformed-value refusal.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One omission check and constant-time array identity test run without scanning elements.
|
|
13
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work The same required-array operation is reused for every present optional inventory.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only omitted input creates a new empty array; valid supplied arrays remain borrowed and unretained.
|
|
15
|
+
*/
|
|
16
|
+
const optionalArray = (value, path) => (value === undefined ? [] : (0, requiredArray_1.requiredArray)(value, path));
|
|
17
|
+
exports.optionalArray = optionalArray;
|
|
18
|
+
//# sourceMappingURL=optionalArray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionalArray.js","sourceRoot":"","sources":["../../src/internal/optionalArray.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,MAAM,aAAa,GAAgD,CACxE,KAAc,EACd,IAAY,EACD,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,6BAAa,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAH3D,QAAA,aAAa,GAAb,aAAa,CAG8C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an absent optional JSON object as an empty record.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined alone means omitted; a supplied value must pass the shared non-null non-array object gate.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure This wrapper owns omission semantics while object identity and path diagnostics stay in the required-object helper.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Null or arrays do not silently become empty optional objects, preserving malformed input distinctions.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Comments state undefined-only omission and borrowed identity for supplied valid records.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One omission test and at most one object gate require constant time without property scans.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Required and optional records share the same object admission predicate instead of separate coercion logic.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Omission allocates one empty record; supplied records are borrowed with no retained handle or cache.
|
|
11
|
+
*/
|
|
12
|
+
export declare const optionalObject: (value: unknown, path: string) => Record<string, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalObject = void 0;
|
|
4
|
+
const object_1 = require("./object");
|
|
5
|
+
/**
|
|
6
|
+
* Read an absent optional JSON object as an empty record.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Undefined alone means omitted; a supplied value must pass the shared non-null non-array object gate.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure This wrapper owns omission semantics while object identity and path diagnostics stay in the required-object helper.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Null or arrays do not silently become empty optional objects, preserving malformed input distinctions.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation Comments state undefined-only omission and borrowed identity for supplied valid records.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One omission test and at most one object gate require constant time without property scans.
|
|
13
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Required and optional records share the same object admission predicate instead of separate coercion logic.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Omission allocates one empty record; supplied records are borrowed with no retained handle or cache.
|
|
15
|
+
*/
|
|
16
|
+
const optionalObject = (value, path) => (value === undefined ? {} : (0, object_1.object)(value, path));
|
|
17
|
+
exports.optionalObject = optionalObject;
|
|
18
|
+
//# sourceMappingURL=optionalObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionalObject.js","sourceRoot":"","sources":["../../src/internal/optionalObject.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAElC;;;;;;;;;;GAUG;AACI,MAAM,cAAc,GAGI,CAC7B,KAAc,EACd,IAAY,EACa,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,eAAM,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AANlE,QAAA,cAAc,GAAd,cAAc,CAMoD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an omitted or nonblank-string glTF extension inventory.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Omission produces an empty array; supplied arrays must contain only nonblank strings with path/index diagnostics.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Optional-array identity is delegated and this owner adds extension-name element admission.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Names are not trimmed or case-folded, preserving exact identifiers after nonblank validation.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation The description explains omission, exact spelling preservation and indexed error paths.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Cost is linear in element count plus trim scans of string lengths, with one returned array.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each name is checked once for this inventory; exact duplicate removal belongs to the downstream canonical inventory.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only the returned string array survives; original arrays and validation metadata are not retained.
|
|
11
|
+
*/
|
|
12
|
+
export declare const optionalStringArray: (value: unknown, path: string) => string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalStringArray = void 0;
|
|
4
|
+
const optionalArray_1 = require("./optionalArray");
|
|
5
|
+
/**
|
|
6
|
+
* Read an omitted or nonblank-string glTF extension inventory.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Omission produces an empty array; supplied arrays must contain only nonblank strings with path/index diagnostics.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Optional-array identity is delegated and this owner adds extension-name element admission.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Names are not trimmed or case-folded, preserving exact identifiers after nonblank validation.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation The description explains omission, exact spelling preservation and indexed error paths.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Cost is linear in element count plus trim scans of string lengths, with one returned array.
|
|
13
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each name is checked once for this inventory; exact duplicate removal belongs to the downstream canonical inventory.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only the returned string array survives; original arrays and validation metadata are not retained.
|
|
15
|
+
*/
|
|
16
|
+
const optionalStringArray = (value, path) => (0, optionalArray_1.optionalArray)(value, path).map((entry, index) => {
|
|
17
|
+
if (typeof entry !== "string" || entry.trim().length === 0)
|
|
18
|
+
throw new Error(`${path}[${index}] must be a non-blank string.`);
|
|
19
|
+
return entry;
|
|
20
|
+
});
|
|
21
|
+
exports.optionalStringArray = optionalStringArray;
|
|
22
|
+
//# sourceMappingURL=optionalStringArray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionalStringArray.js","sourceRoot":"","sources":["../../src/internal/optionalStringArray.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,MAAM,mBAAmB,GAA+C,CAC7E,KAAc,EACd,IAAY,EACF,EAAE,CACZ,IAAA,6BAAa,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAc,EAAE,KAAa,EAAU,EAAE;IACvE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,KAAK,+BAA+B,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,CAAC;AARQ,QAAA,mBAAmB,GAAnB,mBAAmB,CAQ3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Require a positive safe-integer glTF count or declared byte length.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/implementation.md#principled-implementation Type, safe-integer and strict-positive checks reject nonnumeric, fractional, zero and unsafe values before range arithmetic.
|
|
5
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The scalar gate is shared by buffer lengths, view lengths and accessor counts.
|
|
6
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A count is not rounded, clamped or silently replaced with a default value.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies safe-integer positivity, named-path errors and unchanged caller input.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Three scalar predicates require constant time without metadata traversal or allocation.
|
|
9
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Repeated schema owners use the same positive-count predicate; no value admission cache is retained.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The predicate retains no metadata and allocates only an error when refusing a value.
|
|
11
|
+
*/
|
|
12
|
+
export declare const positiveInteger: (value: unknown, path: string) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.positiveInteger = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Require a positive safe-integer glTF count or declared byte length.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Type, safe-integer and strict-positive checks reject nonnumeric, fractional, zero and unsafe values before range arithmetic.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The scalar gate is shared by buffer lengths, view lengths and accessor counts.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A count is not rounded, clamped or silently replaced with a default value.
|
|
10
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies safe-integer positivity, named-path errors and unchanged caller input.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Three scalar predicates require constant time without metadata traversal or allocation.
|
|
12
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Repeated schema owners use the same positive-count predicate; no value admission cache is retained.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The predicate retains no metadata and allocates only an error when refusing a value.
|
|
14
|
+
*/
|
|
15
|
+
const positiveInteger = (value, path) => {
|
|
16
|
+
if (typeof value !== "number" ||
|
|
17
|
+
Number.isSafeInteger(value) === false ||
|
|
18
|
+
value <= 0)
|
|
19
|
+
throw new Error(`${path} must be a positive safe integer.`);
|
|
20
|
+
};
|
|
21
|
+
exports.positiveInteger = positiveInteger;
|
|
22
|
+
//# sourceMappingURL=positiveInteger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positiveInteger.js","sourceRoot":"","sources":["../../src/internal/positiveInteger.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACI,MAAM,eAAe,GAA2C,CACrE,KAAc,EACd,IAAY,EACN,EAAE;IACR,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,KAAK;QACrC,KAAK,IAAI,CAAC;QAEV,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mCAAmC,CAAC,CAAC;AAChE,CAAC,CAAC;AAVW,QAAA,eAAe,GAAf,eAAe,CAU1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IAccessorSource } from "./IAccessorSource";
|
|
2
|
+
/**
|
|
3
|
+
* Read a finite non-sparse FLOAT accessor into caller-owned motion values.
|
|
4
|
+
*
|
|
5
|
+
* The source inventories and byte ranges are already admitted. The requested SCALAR, VEC3 or VEC4 shape must match an accessor with a buffer view, FLOAT components and no sparse overrides. Every component is copied in element order and checked finite; a mismatch or non-finite value throws with the supplied path.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Shape and FLOAT storage are checked before stride-aware component reads; every copied numeric value must be finite.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Motion-specific shape admission stays here while shared reader code owns buffer view, stride and little-endian decoding.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Sparse or normalized integer motion data is not coerced into the profile's exact FLOAT interpretation.
|
|
10
|
+
* @evidence contracts/development/common.md#meaningful-documentation Comments state source admission premises, permitted shapes, finite-value refusal and flat element/component order.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Count times shape width drives time and output space; one reader and DataView serve the entire accessor copy.
|
|
12
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work The inspector caches this complete decoded accessor by index and expected shape within one immutable input revision.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The output array belongs to its caller; the reader's borrowed payload reference ends when decoding completes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const readMotionAccessor: (source: IAccessorSource, accessorIndex: number, expectedType: "SCALAR" | "VEC3" | "VEC4", path: string) => number[];
|