@nodaro/shared 3.1.0 → 3.4.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/dist/index.cjs +60 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +54 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/scene3d-base-visibility.test.ts +36 -0
- package/src/__tests__/scene3d-input-assets.test.ts +31 -0
- package/src/__tests__/sequence-execution.test.ts +20 -0
- package/src/index.ts +2 -0
- package/src/pro-3d-render.ts +7 -1
- package/src/scene3d-input-assets.ts +27 -0
- package/src/scene3d-v2.ts +3 -0
- package/src/sequence-execution.ts +24 -0
package/dist/index.cjs
CHANGED
|
@@ -15379,6 +15379,7 @@ var scene3DEntityV2Schema = zod.z.object({
|
|
|
15379
15379
|
position: vec3Schema.optional(),
|
|
15380
15380
|
rotation: rotationVec3Schema.optional(),
|
|
15381
15381
|
scale: scaleVec3Schema.optional(),
|
|
15382
|
+
visible: zod.z.boolean().optional(),
|
|
15382
15383
|
identityColor: scene3DColorSchema.optional(),
|
|
15383
15384
|
anchors: zod.z.array(scene3DAnchorSchema).max(SCENE3D_V2_LIMITS.maxAnchorsPerEntity).optional(),
|
|
15384
15385
|
capabilities: zod.z.array(scene3DEntityCapabilitySchema).max(SCENE3D_ENTITY_CAPABILITIES.length).optional(),
|
|
@@ -16273,8 +16274,8 @@ function scene3DCameraTrackIssues(track) {
|
|
|
16273
16274
|
}
|
|
16274
16275
|
const quaternionTolerance = SCENE3D_CAMERA_TRACK_LIMITS.quaternionTolerance;
|
|
16275
16276
|
track.samples.forEach((sample, index) => {
|
|
16276
|
-
const [x, y,
|
|
16277
|
-
const norm = Math.sqrt(x * x + y * y +
|
|
16277
|
+
const [x, y, z24, w] = sample.quaternion;
|
|
16278
|
+
const norm = Math.sqrt(x * x + y * y + z24 * z24 + w * w);
|
|
16278
16279
|
if (Math.abs(norm - 1) > quaternionTolerance) {
|
|
16279
16280
|
issues.push({
|
|
16280
16281
|
path: ["samples", index, "quaternion"],
|
|
@@ -16365,6 +16366,26 @@ function parseScene3DCameraTrackJson(text) {
|
|
|
16365
16366
|
}
|
|
16366
16367
|
return { ok: true, value: parsed.data };
|
|
16367
16368
|
}
|
|
16369
|
+
var scene3DInputAssetSchema = zod.z.object({
|
|
16370
|
+
id: zod.z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/),
|
|
16371
|
+
revisionId: zod.z.uuid(),
|
|
16372
|
+
assetId: zod.z.uuid(),
|
|
16373
|
+
label: zod.z.string().min(1).max(64).regex(/^[^\u0000-\u001f]+$/).optional()
|
|
16374
|
+
}).strict();
|
|
16375
|
+
var scene3DInputAssetsSchema = zod.z.array(scene3DInputAssetSchema).max(8).superRefine((values, ctx) => {
|
|
16376
|
+
if (new Set(values.map((value) => value.id)).size !== values.length || new Set(values.map((value) => value.assetId)).size !== values.length) {
|
|
16377
|
+
ctx.addIssue({ code: "custom", message: "Scene input assets must have unique identities" });
|
|
16378
|
+
}
|
|
16379
|
+
});
|
|
16380
|
+
function scene3DInputAssetsForEngine(value, engine) {
|
|
16381
|
+
const assets = scene3DInputAssetsSchema.parse(value ?? []);
|
|
16382
|
+
if (assets.length && engine !== "blender-cloud" && engine !== "blender-local") {
|
|
16383
|
+
throw new Error("Imported 3D assets require an advanced scene engine");
|
|
16384
|
+
}
|
|
16385
|
+
return assets;
|
|
16386
|
+
}
|
|
16387
|
+
|
|
16388
|
+
// src/pro-3d-render.ts
|
|
16368
16389
|
var PRO3D_RENDER_NODE_TYPE = "pro-3d-render";
|
|
16369
16390
|
var PRO3D_RENDER_LABEL = "3D Render Pro";
|
|
16370
16391
|
var PRO3D_RENDER_CREDIT_ID = "pro-3d-render";
|
|
@@ -16467,9 +16488,16 @@ function buildPro3DRenderSource(input) {
|
|
|
16467
16488
|
return { ok: false, message: "no brief \u2014 describe the scene, or wire a prompt in." };
|
|
16468
16489
|
}
|
|
16469
16490
|
const references = input.references ?? [];
|
|
16491
|
+
const parsedAssets = scene3DInputAssetsSchema.safeParse(input.inputAssets ?? []);
|
|
16492
|
+
if (!parsedAssets.success) return { ok: false, message: "invalid scene input assets" };
|
|
16470
16493
|
return {
|
|
16471
16494
|
ok: true,
|
|
16472
|
-
source: {
|
|
16495
|
+
source: {
|
|
16496
|
+
kind: "prompt",
|
|
16497
|
+
prompt,
|
|
16498
|
+
...references.length > 0 ? { references } : {},
|
|
16499
|
+
...parsedAssets.data.length ? { inputAssets: parsedAssets.data } : {}
|
|
16500
|
+
}
|
|
16473
16501
|
};
|
|
16474
16502
|
}
|
|
16475
16503
|
function pro3DRenderTimingOverrides(input) {
|
|
@@ -16662,6 +16690,28 @@ async function applyScene3DV2EditOperations(input, operations, options) {
|
|
|
16662
16690
|
return { ok: true, plan: { ...plan, provenance: { ...plan.provenance, contentHash } }, changeSummary: `Applied ${ops.data.length} scene edit${ops.data.length === 1 ? "" : "s"}` };
|
|
16663
16691
|
}
|
|
16664
16692
|
|
|
16693
|
+
// src/sequence-execution.ts
|
|
16694
|
+
var STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1";
|
|
16695
|
+
var SequenceExecutionRequiredError = class extends Error {
|
|
16696
|
+
constructor(nodeIds) {
|
|
16697
|
+
super("Generate linked frames and clips in Studio or through its production API so the reviewed images are used.");
|
|
16698
|
+
this.nodeIds = nodeIds;
|
|
16699
|
+
this.name = "SequenceExecutionRequiredError";
|
|
16700
|
+
}
|
|
16701
|
+
nodeIds;
|
|
16702
|
+
code = "sequence_execution_required";
|
|
16703
|
+
statusCode = 400;
|
|
16704
|
+
};
|
|
16705
|
+
function requiresSequenceExecution(node) {
|
|
16706
|
+
if (!node.data || typeof node.data !== "object" || Array.isArray(node.data)) return false;
|
|
16707
|
+
const data = node.data;
|
|
16708
|
+
return data.keyframeId !== void 0 || data.sequenceBinding !== void 0 || Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY);
|
|
16709
|
+
}
|
|
16710
|
+
function assertCanvasExecutionAllowed(nodes) {
|
|
16711
|
+
const blocked = nodes.filter(requiresSequenceExecution).map((node) => node.id);
|
|
16712
|
+
if (blocked.length) throw new SequenceExecutionRequiredError(blocked);
|
|
16713
|
+
}
|
|
16714
|
+
|
|
16665
16715
|
// src/scene3d-authoring-engine.ts
|
|
16666
16716
|
var SCENE3D_BASIC_ENGINE = "basic";
|
|
16667
16717
|
var SCENE3D_AUTHORING_ENGINES = [SCENE3D_BASIC_ENGINE, ...SCENE3D_V2_ENGINES];
|
|
@@ -17154,6 +17204,7 @@ exports.STAGE_PATCH_SCHEMA = STAGE_PATCH_SCHEMA;
|
|
|
17154
17204
|
exports.STATIC_CAPTION_STYLES = STATIC_CAPTION_STYLES;
|
|
17155
17205
|
exports.STRUCTURAL_SECTIONS = STRUCTURAL_SECTIONS;
|
|
17156
17206
|
exports.STRUCTURED_VISION_MODELS = STRUCTURED_VISION_MODELS;
|
|
17207
|
+
exports.STUDIO_DEPENDENT_FRAMES_CAPABILITY = STUDIO_DEPENDENT_FRAMES_CAPABILITY;
|
|
17157
17208
|
exports.STUDIO_SHOT_TRANSIENT_KEYS = STUDIO_SHOT_TRANSIENT_KEYS;
|
|
17158
17209
|
exports.STUDIO_TRANSIENT_KEYS = STUDIO_TRANSIENT_KEYS;
|
|
17159
17210
|
exports.SUBMISSION_STATUSES = SUBMISSION_STATUSES;
|
|
@@ -17176,6 +17227,7 @@ exports.SceneMetadataSchema = SceneMetadataSchema;
|
|
|
17176
17227
|
exports.SceneNodeDataSchema = SceneNodeDataSchema;
|
|
17177
17228
|
exports.SceneSpecSchema = SceneSpecSchema;
|
|
17178
17229
|
exports.ScriptCriticVerdictSchema = ScriptCriticVerdictSchema;
|
|
17230
|
+
exports.SequenceExecutionRequiredError = SequenceExecutionRequiredError;
|
|
17179
17231
|
exports.ShotSpecSchema = ShotSpecSchema;
|
|
17180
17232
|
exports.ShowrunnerPlanSchema = ShowrunnerPlanSchema;
|
|
17181
17233
|
exports.StageAwaitingSubGateEventSchema = StageAwaitingSubGateEventSchema;
|
|
@@ -17290,6 +17342,7 @@ exports.aspectRatioFromDims = aspectRatioFromDims;
|
|
|
17290
17342
|
exports.aspectRatioOptionsByKind = aspectRatioOptionsByKind;
|
|
17291
17343
|
exports.aspectRatioToNumber = aspectRatioToNumber;
|
|
17292
17344
|
exports.assembleNarratedVideoCredits = assembleNarratedVideoCredits;
|
|
17345
|
+
exports.assertCanvasExecutionAllowed = assertCanvasExecutionAllowed;
|
|
17293
17346
|
exports.availableReasoningEfforts = availableReasoningEfforts;
|
|
17294
17347
|
exports.bucketSecondsFromAuditCreditId = bucketSecondsFromAuditCreditId;
|
|
17295
17348
|
exports.bucketSecondsFromCreditId = bucketSecondsFromCreditId;
|
|
@@ -17557,6 +17610,7 @@ exports.referenceSheetCreditId = referenceSheetCreditId;
|
|
|
17557
17610
|
exports.registerCatalogSidecars = registerCatalogSidecars;
|
|
17558
17611
|
exports.registerSidecarLoaders = registerSidecarLoaders;
|
|
17559
17612
|
exports.renderAnalyzedScene = renderAnalyzedScene;
|
|
17613
|
+
exports.requiresSequenceExecution = requiresSequenceExecution;
|
|
17560
17614
|
exports.resetCatalogSidecars = resetCatalogSidecars;
|
|
17561
17615
|
exports.resolutionOptionsByKind = resolutionOptionsByKind;
|
|
17562
17616
|
exports.resolveAiAvatarCreditId = resolveAiAvatarCreditId;
|
|
@@ -17636,6 +17690,9 @@ exports.scene3DEntityCapabilitySchema = scene3DEntityCapabilitySchema;
|
|
|
17636
17690
|
exports.scene3DEntityV2Schema = scene3DEntityV2Schema;
|
|
17637
17691
|
exports.scene3DEntityVisualSchema = scene3DEntityVisualSchema;
|
|
17638
17692
|
exports.scene3DIdSchema = scene3DIdSchema;
|
|
17693
|
+
exports.scene3DInputAssetSchema = scene3DInputAssetSchema;
|
|
17694
|
+
exports.scene3DInputAssetsForEngine = scene3DInputAssetsForEngine;
|
|
17695
|
+
exports.scene3DInputAssetsSchema = scene3DInputAssetsSchema;
|
|
17639
17696
|
exports.scene3DJsonByteLength = scene3DJsonByteLength;
|
|
17640
17697
|
exports.scene3DLightingChangesSchema = scene3DLightingChangesSchema;
|
|
17641
17698
|
exports.scene3DLightingSchema = scene3DLightingSchema;
|