@byte_fluffy/nexra-sdk 0.1.0-alpha.50 → 0.1.0-alpha.53
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 +15 -110
- package/dist/catalog.d.ts +3 -3
- package/dist/catalog.js +2 -2
- package/dist/{chunk-WXPCZYOK.js → chunk-LWJWWD7Z.js} +6871 -8177
- package/dist/chunk-RBKLCJ3H.js +745 -0
- package/dist/{chunk-BS3B6F7W.js → chunk-V3F6VPMP.js} +122 -13
- package/dist/{errors-DJZuAKoO.d.ts → errors-BXPUVOh7.d.ts} +2 -2
- package/dist/index.d.ts +12 -11
- package/dist/index.js +16 -466
- package/dist/{json-Cz0MkWQn.d.ts → json-dnsDzk-s.d.ts} +1 -1
- package/dist/language.d.ts +3 -3
- package/dist/language.js +28 -243
- package/dist/{media-DzOxLGs-.d.ts → media-IaOdOMQC.d.ts} +14 -2
- package/dist/{media-geometry-COln1N_2.d.ts → media-geometry-B92BvuQL.d.ts} +3 -2
- package/dist/media.d.ts +2 -2
- package/dist/media.js +1 -1
- package/dist/node.d.ts +17 -0
- package/dist/node.js +78 -0
- package/dist/types.d.ts +5 -5
- package/dist/{voices-xyPqhQqR.d.ts → voices-Dc94LfyS.d.ts} +42 -5
- package/package.json +7 -1
|
@@ -10,13 +10,13 @@ var MEDIA_KINDS = [
|
|
|
10
10
|
|
|
11
11
|
// ../contracts/src/public-error-catalog.ts
|
|
12
12
|
var PUBLIC_ERROR_CATALOG = {
|
|
13
|
-
invalid_model_quotation_selection: { "zh-CN": "\u6240\u9009\u6A21\u578B\u6216\u6E20\u9053\u5DF2\u4E0D\u53EF\u5BFC\u51FA\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u540E\u91CD\u8BD5\u3002", en: "The selected models or channels are no longer available for export. Update your selection and try again." },
|
|
14
13
|
api_key_spending_limit_exceeded: { "zh-CN": "\u5F53\u524D\u5BC6\u94A5\u7684\u5269\u4F59\u6D88\u8D39\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7EC4\u7EC7\u7BA1\u7406\u5458\u589E\u52A0\u989D\u5EA6\u3002", en: "This key has insufficient remaining spending allowance. Ask an organization administrator to increase it." },
|
|
15
14
|
organization_key_limit_invalid: { "zh-CN": "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u6D88\u8D39\u989D\u5EA6\uFF0C\u91D1\u989D\u6700\u591A\u4FDD\u7559 8 \u4F4D\u5C0F\u6570\uFF1B\u8C03\u6574\u91D1\u989D\u987B\u5927\u4E8E 0\u3002", en: "Enter a valid spending allowance with up to 8 decimal places. An adjustment must be greater than zero." },
|
|
16
15
|
organization_key_limit_unset: { "zh-CN": "\u5F53\u524D\u5BC6\u94A5\u5C1A\u672A\u8BBE\u7F6E\u6D88\u8D39\u989D\u5EA6\uFF0C\u8BF7\u5148\u589E\u52A0\u989D\u5EA6\u540E\u518D\u51CF\u5C11\u3002", en: "This key has no spending allowance configured. Set it with an increase before decreasing it." },
|
|
17
16
|
organization_key_limit_below_committed: { "zh-CN": "\u8C03\u6574\u540E\u7684\u6D88\u8D39\u989D\u5EA6\u4E0D\u80FD\u4F4E\u4E8E\u5DF2\u6D88\u8D39\u4E0E\u8BF7\u6C42\u9884\u5360\u7684\u5408\u8BA1\u91D1\u989D\u3002", en: "The resulting allowance cannot be less than settled spending plus pending reservations." },
|
|
18
17
|
organization_key_limit_exceeds_wallet: { "zh-CN": "\u5BC6\u94A5\u53EF\u7528\u6D88\u8D39\u989D\u5EA6\u4E0D\u80FD\u8D85\u8FC7\u94B1\u5305\u5F53\u524D\u53EF\u7528\u4F59\u989D\uFF0C\u8BF7\u8C03\u6574\u989D\u5EA6\u6216\u5145\u503C\u540E\u91CD\u8BD5\u3002", en: "The key's available spending allowance cannot exceed the wallet's current available balance. Reduce it or add funds." },
|
|
19
18
|
organization_key_limit_conflict: { "zh-CN": "\u8FD9\u6B21\u989D\u5EA6\u64CD\u4F5C\u5DF2\u88AB\u5904\u7406\uFF0C\u8BF7\u5173\u95ED\u540E\u91CD\u65B0\u6253\u5F00\u518D\u8BD5\u3002", en: "This allowance change has already been processed. Close and reopen the form to try again." },
|
|
19
|
+
invalid_model_quotation_selection: { "zh-CN": "\u6240\u9009\u6A21\u578B\u6216\u6E20\u9053\u5DF2\u4E0D\u53EF\u5BFC\u51FA\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u540E\u91CD\u8BD5\u3002", en: "The selected models or channels are no longer available for export. Update your selection and try again." },
|
|
20
20
|
google_channel_rate_limited: { "zh-CN": "\u5F53\u524D\u6587\u672C\u6A21\u578B\u670D\u52A1\u7E41\u5FD9\u6216\u53D7\u5230\u9650\u6D41\uFF08429\uFF09\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u82E5\u6301\u7EED\u51FA\u73B0\uFF0C\u53EF\u5207\u6362\u5176\u4ED6\u6587\u672C\u6A21\u578B\uFF0C\u518D\u53D1\u9001\u6D88\u606F\u7EE7\u7EED\u3002", en: "The current text model service is busy or rate limited (429). Try again later; if the problem persists, switch to another text model and send a message to continue." },
|
|
21
21
|
queue_wait_timeout: { "zh-CN": "\u4EFB\u52A1\u6392\u961F\u7B49\u5F85\u6267\u884C\u8D85\u8FC7\u65F6\u9650\uFF0C\u5C1A\u672A\u63D0\u4EA4\u7ED9\u6A21\u578B\u670D\u52A1\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF1B\u6301\u7EED\u8D85\u65F6\u65F6\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u3002", en: "The task exceeded its queue wait limit before submission to the model service. Try again later; contact a platform administrator with the request ID if queue timeouts persist." },
|
|
22
22
|
task_execution_timeout: { "zh-CN": "\u4EFB\u52A1\u8D85\u8FC7\u603B\u65F6\u9650\uFF0C\u5DF2\u7ED3\u675F\u3002\u4E0A\u6E38\u53EF\u80FD\u4ECD\u5728\u5904\u7406\uFF0C\u8BF7\u5148\u6838\u5BF9\u539F\u8BF7\u6C42\u7ED3\u679C\uFF0C\u907F\u514D\u91CD\u590D\u63D0\u4EA4\u3002", en: "The task exceeded its total time limit and has ended. The upstream service may still be processing it; check the original request before submitting again." },
|
|
@@ -57,9 +57,6 @@ var PUBLIC_ERROR_CATALOG = {
|
|
|
57
57
|
organization_invitation_unavailable: { "zh-CN": "\u9080\u8BF7\u94FE\u63A5\u65E0\u6548\u3001\u5DF2\u8FC7\u671F\u6216\u5DF2\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7EC4\u7EC7\u7BA1\u7406\u5458\u83B7\u53D6\u65B0\u94FE\u63A5\u3002", en: "This invitation link is invalid, expired, or disabled. Ask the organization administrator for a new link." },
|
|
58
58
|
organization_member_removed: { "zh-CN": "\u4F60\u5DF2\u88AB\u79FB\u51FA\u8BE5\u7EC4\u7EC7\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u901A\u8FC7\u7528\u6237 ID \u91CD\u65B0\u6DFB\u52A0\u3002", en: "You were removed from this organization. Ask an administrator to add your user ID again." },
|
|
59
59
|
organization_default_key_unavailable: { "zh-CN": "\u5F53\u524D\u7EC4\u7EC7\u6CA1\u6709\u53EF\u7528\u7684 API Key\uFF0C\u8BF7\u8054\u7CFB\u7EC4\u7EC7\u7BA1\u7406\u5458\u3002", en: "This organization has no available API key. Contact an organization administrator." },
|
|
60
|
-
organization_key_assignment_required: { "zh-CN": "\u6CA1\u6709\u5DF2\u5206\u914D\u7684\u53EF\u7528\u5BC6\u94A5\uFF0C\u8BF7\u8054\u7CFB\u7EC4\u7EC7\u7BA1\u7406\u5458\u5206\u914D\u3002", en: "No available key is assigned to you. Ask an organization administrator to assign one." },
|
|
61
|
-
organization_key_selection_required: { "zh-CN": "\u8BF7\u5148\u5728 Nexra \u4E2D\u9009\u62E9\u672C\u6B21\u8C03\u7528\u4F7F\u7528\u7684\u5BC6\u94A5\u3002", en: "Select a key in Nexra before making this request." },
|
|
62
|
-
organization_execution_key_unavailable: { "zh-CN": "\u6B64\u524D\u9009\u7528\u7684\u5BC6\u94A5\u5DF2\u4E0D\u53EF\u7528\u6216\u6743\u9650\u5DF2\u64A4\u56DE\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6216\u8054\u7CFB\u7EC4\u7EC7\u7BA1\u7406\u5458\u3002", en: "Your selected key is unavailable or access was withdrawn. Select another key or contact an organization administrator." },
|
|
63
60
|
organization_default_key_change_unavailable: { "zh-CN": "\u81F3\u5C11\u9700\u8981\u4E24\u4E2A\u53EF\u7528\u7684\u7EC4\u7EC7 Key \u624D\u80FD\u66F4\u6539\u9ED8\u8BA4 Key\u3002", en: "At least two available organization keys are required to change the default key." },
|
|
64
61
|
personal_key_unavailable: { "zh-CN": "\u5F53\u524D\u4E2A\u4EBA\u8EAB\u4EFD\u6CA1\u6709\u53EF\u7528\u7684 API \u5BC6\u94A5\uFF0C\u8BF7\u5148\u521B\u5EFA\u4E2A\u4EBA\u5BC6\u94A5\u3002", en: "Your personal identity has no available API key. Create a personal key first." },
|
|
65
62
|
api_key_not_found: { "zh-CN": "\u672A\u627E\u5230\u53EF\u64CD\u4F5C\u7684 API Key\uFF0C\u6216\u8BE5 Key \u4E0D\u5C5E\u4E8E\u5F53\u524D\u8BBF\u95EE\u8303\u56F4\u3002\u8BF7\u5237\u65B0 Key \u5217\u8868\u5E76\u6838\u5BF9 Key ID\u3002", en: "No accessible API key was found for this operation. Refresh the key list and check the key ID." },
|
|
@@ -694,6 +691,8 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
|
|
|
694
691
|
"image.upscale": inputSchema(
|
|
695
692
|
[mediaPartSchema("image", ["source"])],
|
|
696
693
|
{
|
|
694
|
+
enable_hdr: { type: "boolean", "x-ui": { order: 14, control: "switch" } },
|
|
695
|
+
enable_wb: { type: "boolean", "x-ui": { order: 15, control: "switch" } },
|
|
697
696
|
scale: { type: "number", exclusiveMinimum: 1, "x-ui": { order: 10, control: "number" } },
|
|
698
697
|
resolution: { type: "string", minLength: 1, "x-ui": { order: 11 } },
|
|
699
698
|
output_format: { type: "string", minLength: 1, "x-ui": { order: 12 } },
|
|
@@ -704,6 +703,8 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
|
|
|
704
703
|
"video.upscale": inputSchema(
|
|
705
704
|
[mediaPartSchema("video", ["source"])],
|
|
706
705
|
{
|
|
706
|
+
vid: { type: "string", minLength: 1, "x-ui": { order: 14 } },
|
|
707
|
+
config: { type: "string", "x-ui": { order: 15 } },
|
|
707
708
|
source_duration: { type: "number", exclusiveMinimum: 0, "x-ui": { order: 9, control: "number" } },
|
|
708
709
|
scale: { type: "number", exclusiveMinimum: 1, "x-ui": { order: 10, control: "number" } },
|
|
709
710
|
resolution: { type: "string", minLength: 1, "x-ui": { order: 11 } },
|
|
@@ -714,7 +715,29 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
|
|
|
714
715
|
),
|
|
715
716
|
"video.segment": inputSchema(
|
|
716
717
|
[textPartSchema(["prompt"]), mediaPartSchema("video", ["source"])],
|
|
717
|
-
{
|
|
718
|
+
{
|
|
719
|
+
resolution: { type: "string", minLength: 1, "x-ui": { order: 10 } },
|
|
720
|
+
mode: { type: "string", enum: ["preview", "track"] },
|
|
721
|
+
preview_time_ms: { type: "integer", minimum: 0 },
|
|
722
|
+
prompts: { type: "array", minItems: 1, items: {
|
|
723
|
+
type: "object",
|
|
724
|
+
properties: {
|
|
725
|
+
time_ms: { type: "integer", minimum: 0 },
|
|
726
|
+
points: { type: "array", minItems: 1, items: {
|
|
727
|
+
type: "object",
|
|
728
|
+
properties: {
|
|
729
|
+
x: { type: "number", minimum: 0, maximum: 1 },
|
|
730
|
+
y: { type: "number", minimum: 0, maximum: 1 },
|
|
731
|
+
label: { type: "integer", enum: [0, 1] }
|
|
732
|
+
},
|
|
733
|
+
required: ["x", "y", "label"],
|
|
734
|
+
additionalProperties: false
|
|
735
|
+
} }
|
|
736
|
+
},
|
|
737
|
+
required: ["time_ms", "points"],
|
|
738
|
+
additionalProperties: false
|
|
739
|
+
} }
|
|
740
|
+
},
|
|
718
741
|
{ minItems: 2, maxItems: 2 }
|
|
719
742
|
),
|
|
720
743
|
"video.depth": inputSchema(
|
|
@@ -747,9 +770,9 @@ function isNexraMediaInput(value) {
|
|
|
747
770
|
}
|
|
748
771
|
function nexraMediaOperationForMode(mode) {
|
|
749
772
|
if (["text-to-image", "image-to-image"].includes(mode)) return "image.generate";
|
|
750
|
-
if (["text-to-video", "image-to-video", "multimodal-to-video", "avatar-video"].includes(mode)) return "video.generate";
|
|
773
|
+
if (["text-to-video", "image-to-video", "multimodal-to-video", "avatar-video", "draft-to-video"].includes(mode)) return "video.generate";
|
|
751
774
|
if (mode === "audio-to-text") return "audio.transcribe";
|
|
752
|
-
if (["text-to-speech", "text-to-music", "text-to-sfx"].includes(mode)) return "audio.generate";
|
|
775
|
+
if (["text-to-speech", "text-to-music", "text-to-sfx", "voice-design"].includes(mode)) return "audio.generate";
|
|
753
776
|
if (mode === "image-upscale") return "image.upscale";
|
|
754
777
|
if (mode === "video-upscale") return "video.upscale";
|
|
755
778
|
if (mode === "video-depth") return "video.depth";
|
|
@@ -768,11 +791,11 @@ function nexraMediaInputSchemaForMode(mode) {
|
|
|
768
791
|
for (const variant of variants) {
|
|
769
792
|
const variantProperties = variant.properties;
|
|
770
793
|
if (variantProperties.type.const === "text") {
|
|
771
|
-
variantProperties.role = { type: "string", enum: ["script"] };
|
|
794
|
+
variantProperties.role = { type: "string", enum: ["script", "prompt"] };
|
|
772
795
|
}
|
|
773
796
|
}
|
|
774
797
|
}
|
|
775
|
-
const allowed = mode === "text-to-image" || mode === "text-to-video" || mode === "text-to-music" || mode === "text-to-sfx" ? /* @__PURE__ */ new Set(["text"]) : mode === "image-to-image" ? /* @__PURE__ */ new Set(["text", "image"]) : mode === "image-to-video" ? /* @__PURE__ */ new Set(["text", "image", "audio"]) : mode === "text-to-speech" ? /* @__PURE__ */ new Set(["text", "audio"]) : /* @__PURE__ */ new Set(["text", "image", "video", "audio"]);
|
|
798
|
+
const allowed = mode === "draft-to-video" ? /* @__PURE__ */ new Set(["draft_task"]) : mode === "text-to-image" || mode === "text-to-video" || mode === "text-to-music" || mode === "text-to-sfx" ? /* @__PURE__ */ new Set(["text"]) : mode === "image-to-image" ? /* @__PURE__ */ new Set(["text", "image"]) : mode === "image-to-video" ? /* @__PURE__ */ new Set(["text", "image", "audio"]) : mode === "text-to-speech" ? /* @__PURE__ */ new Set(["text", "audio"]) : /* @__PURE__ */ new Set(["text", "image", "video", "audio"]);
|
|
776
799
|
items.oneOf = variants.filter((variant) => allowed.has(String(variant.properties.type.const)));
|
|
777
800
|
if (mode === "image-to-video") {
|
|
778
801
|
for (const variant of items.oneOf) {
|
|
@@ -798,7 +821,7 @@ function nexraMediaInputSchemaForMode(mode) {
|
|
|
798
821
|
const requiredMedia = ["video-depth", "video-segment"].includes(mode) ? "video" : mode === "image-to-image" || mode === "image-to-video" || mode === "avatar-video" ? "image" : void 0;
|
|
799
822
|
const requiresReferenceMedia = mode === "multimodal-to-video";
|
|
800
823
|
const hasTextPart = items.oneOf.some((variant) => variant.properties.type.const === "text");
|
|
801
|
-
|
|
824
|
+
const contentRules = [
|
|
802
825
|
...mode === "avatar-video" || !hasTextPart ? [] : [{
|
|
803
826
|
contains: { type: "object", properties: { type: { const: "text" } }, required: ["type"] },
|
|
804
827
|
minContains: 1
|
|
@@ -812,6 +835,8 @@ function nexraMediaInputSchemaForMode(mode) {
|
|
|
812
835
|
minContains: 1
|
|
813
836
|
}] : []
|
|
814
837
|
];
|
|
838
|
+
if (contentRules.length) content.allOf = contentRules;
|
|
839
|
+
else delete content.allOf;
|
|
815
840
|
if (mode === "text-to-speech") {
|
|
816
841
|
properties.voice = { ...properties.voice, "x-ui": { order: 10, control: "resource", resource: "voice" } };
|
|
817
842
|
}
|
|
@@ -852,6 +877,84 @@ function isTerminalTaskStatus(status) {
|
|
|
852
877
|
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
853
878
|
}
|
|
854
879
|
|
|
880
|
+
// ../contracts/src/volcengine-asr.ts
|
|
881
|
+
var ASR_SENTENCE_MAX_SECONDS = 60;
|
|
882
|
+
function asrInputSecondsLimit(path) {
|
|
883
|
+
return path === "/api/v3/sauc/bigmodel_nostream" ? ASR_SENTENCE_MAX_SECONDS : void 0;
|
|
884
|
+
}
|
|
885
|
+
var ASR_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
886
|
+
function parseVolcengineAsrFrame(bytes) {
|
|
887
|
+
if (bytes.byteLength < 8 || bytes.byteLength > ASR_MAX_FRAME_BYTES) throw new Error("Invalid ASR frame size");
|
|
888
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
889
|
+
const headerSize = (bytes[0] & 15) * 4;
|
|
890
|
+
if (bytes[0] >> 4 !== 1 || headerSize < 4 || headerSize + 4 > bytes.length) throw new Error("Invalid ASR frame header");
|
|
891
|
+
const type = bytes[1] >> 4, flags = bytes[1] & 15, serialization = bytes[2] >> 4, compression = bytes[2] & 15;
|
|
892
|
+
if (![1, 2, 9, 15].includes(type) || flags > 3 || ![0, 1].includes(serialization) || ![0, 1].includes(compression)) throw new Error("Unsupported ASR frame protocol");
|
|
893
|
+
let offset = headerSize, sequence, errorCode;
|
|
894
|
+
if (type === 15 || flags & 1) {
|
|
895
|
+
if (offset + 8 > bytes.length) throw new Error("Truncated ASR sequence/error");
|
|
896
|
+
if (type === 15) errorCode = view.getUint32(offset);
|
|
897
|
+
else sequence = view.getInt32(offset);
|
|
898
|
+
offset += 4;
|
|
899
|
+
}
|
|
900
|
+
const size = view.getUint32(offset);
|
|
901
|
+
offset += 4;
|
|
902
|
+
if (size !== bytes.length - offset) throw new Error("Invalid ASR payload length");
|
|
903
|
+
return { type, flags, serialization, compression, payload: bytes.subarray(offset), ...sequence === void 0 ? {} : { sequence }, ...errorCode === void 0 ? {} : { errorCode } };
|
|
904
|
+
}
|
|
905
|
+
async function decodeVolcengineAsrFrame(bytes) {
|
|
906
|
+
const frame = parseVolcengineAsrFrame(bytes);
|
|
907
|
+
if (frame.compression === 0) return frame;
|
|
908
|
+
const reader = new Blob([new Uint8Array(frame.payload)]).stream().pipeThrough(new DecompressionStream("gzip")).getReader();
|
|
909
|
+
const chunks = [];
|
|
910
|
+
let length = 0;
|
|
911
|
+
try {
|
|
912
|
+
for (; ; ) {
|
|
913
|
+
const chunk = await reader.read();
|
|
914
|
+
if (chunk.done) break;
|
|
915
|
+
length += chunk.value.byteLength;
|
|
916
|
+
if (length > ASR_MAX_FRAME_BYTES) {
|
|
917
|
+
await reader.cancel();
|
|
918
|
+
throw new Error("ASR response is too large");
|
|
919
|
+
}
|
|
920
|
+
chunks.push(chunk.value);
|
|
921
|
+
}
|
|
922
|
+
} finally {
|
|
923
|
+
reader.releaseLock();
|
|
924
|
+
}
|
|
925
|
+
const payload = new Uint8Array(length);
|
|
926
|
+
let offset = 0;
|
|
927
|
+
for (const chunk of chunks) {
|
|
928
|
+
payload.set(chunk, offset);
|
|
929
|
+
offset += chunk.byteLength;
|
|
930
|
+
}
|
|
931
|
+
return { ...frame, payload };
|
|
932
|
+
}
|
|
933
|
+
function volcengineAsrFrameJson(frame) {
|
|
934
|
+
if (frame.serialization !== 1) throw new Error("ASR configuration/result must be JSON");
|
|
935
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(frame.payload));
|
|
936
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("ASR JSON must be an object");
|
|
937
|
+
return value;
|
|
938
|
+
}
|
|
939
|
+
function encodeVolcengineAsrFrame(type, payload, options = {}) {
|
|
940
|
+
const bytes = new Uint8Array(8 + (options.sequence === void 0 ? 0 : 4) + payload.length);
|
|
941
|
+
bytes.set([
|
|
942
|
+
17,
|
|
943
|
+
type << 4 | (options.final ? 2 : 0) | (options.sequence === void 0 ? 0 : 1),
|
|
944
|
+
(options.json ? 16 : 0) | (options.compression ?? 0),
|
|
945
|
+
0
|
|
946
|
+
]);
|
|
947
|
+
const view = new DataView(bytes.buffer);
|
|
948
|
+
let offset = 4;
|
|
949
|
+
if (options.sequence !== void 0) {
|
|
950
|
+
view.setInt32(offset, options.sequence);
|
|
951
|
+
offset += 4;
|
|
952
|
+
}
|
|
953
|
+
view.setUint32(offset, payload.length);
|
|
954
|
+
bytes.set(payload, offset + 4);
|
|
955
|
+
return bytes;
|
|
956
|
+
}
|
|
957
|
+
|
|
855
958
|
// ../contracts/src/usage-query-reference.ts
|
|
856
959
|
var USAGE_QUERY_LIST_FILTERS = [
|
|
857
960
|
"userIds",
|
|
@@ -914,8 +1017,8 @@ function sortRatioDisplayOrder(values) {
|
|
|
914
1017
|
return [...values].sort(compareRatioDisplayOrder);
|
|
915
1018
|
}
|
|
916
1019
|
|
|
917
|
-
// ../contracts/src/
|
|
918
|
-
var
|
|
1020
|
+
// ../contracts/src/index.ts
|
|
1021
|
+
var ORGANIZATION_HEADER = "x-nexra-organization-id";
|
|
919
1022
|
|
|
920
1023
|
export {
|
|
921
1024
|
MEDIA_KINDS,
|
|
@@ -939,5 +1042,11 @@ export {
|
|
|
939
1042
|
TASK_STATUSES,
|
|
940
1043
|
createTaskRequest,
|
|
941
1044
|
isTerminalTaskStatus,
|
|
942
|
-
sortRatioDisplayOrder
|
|
1045
|
+
sortRatioDisplayOrder,
|
|
1046
|
+
asrInputSecondsLimit,
|
|
1047
|
+
ASR_MAX_FRAME_BYTES,
|
|
1048
|
+
decodeVolcengineAsrFrame,
|
|
1049
|
+
volcengineAsrFrameJson,
|
|
1050
|
+
encodeVolcengineAsrFrame,
|
|
1051
|
+
ORGANIZATION_HEADER
|
|
943
1052
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as JsonValue } from './json-dnsDzk-s.js';
|
|
2
2
|
|
|
3
3
|
type PublicUpstreamUnavailableReason = "no_response" | "not_retained" | "unsupported_capture" | "error_not_emitted" | "size_limit";
|
|
4
4
|
/** Network errors retain unknown codes from older or newer servers. */
|
|
@@ -30,4 +30,4 @@ type ApiErrorPayload = PublicError;
|
|
|
30
30
|
/** Extracts text only from known provider error fields, never arbitrary metadata. */
|
|
31
31
|
declare function extractUpstreamErrorMessage(value: unknown): string | undefined;
|
|
32
32
|
|
|
33
|
-
export { type ApiErrorPayload as A, type NexraError as N, type
|
|
33
|
+
export { type ApiErrorPayload as A, type NexraError as N, type PublicError as P, type PublicErrorContext as a, type PublicErrorFields as b, extractUpstreamErrorMessage as e };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, M as MEDIA_KINDS, d as MediaAsset, e as MediaAssetStatus, f as MediaKind, N as NexraImageLayer, g as NexraImageLayerDecompositionOutput } from './media-
|
|
2
|
-
import { H as HttpTransport,
|
|
3
|
-
export {
|
|
4
|
-
import { C as CursorPage,
|
|
5
|
-
export {
|
|
6
|
-
import { N as NexraError,
|
|
7
|
-
export { A as ApiErrorPayload,
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
1
|
+
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, M as MEDIA_KINDS, d as MediaAsset, e as MediaAssetStatus, f as MediaKind, N as NexraImageLayer, g as NexraImageLayerDecompositionOutput } from './media-IaOdOMQC.js';
|
|
2
|
+
import { H as HttpTransport, j as ModelSearchParams, v as TaskModelSummary, T as TaskModel, i as ModelSchema, g as ModelResourceList, N as NexraClientOptions } from './media-geometry-B92BvuQL.js';
|
|
3
|
+
export { C as CreateNexraDisplayQuoteBatchRequest, a as CreateNexraQuoteRequest, F as FetchLike, M as MediaGeometryField, b as MediaGeometryProjection, c as ModelCapabilitySummary, d as ModelDateVersion, e as ModelEndpointSummary, f as ModelModality, h as ModelResourceOption, k as NexraBillingCurrency, l as NexraCatalogRevision, m as NexraDisplayQuoteBatch, n as NexraDisplayQuoteBatchEntry, o as NexraModelOperation, p as NexraModelSpec, q as NexraModelSpecFilter, r as NexraQuote, s as NexraSalePrice, t as NexraSalePriceList, u as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-B92BvuQL.js';
|
|
4
|
+
import { C as CursorPage, b as JsonValue } from './json-dnsDzk-s.js';
|
|
5
|
+
export { J as JsonObject, a as JsonPrimitive } from './json-dnsDzk-s.js';
|
|
6
|
+
import { N as NexraError, b as PublicErrorFields } from './errors-BXPUVOh7.js';
|
|
7
|
+
export { A as ApiErrorPayload, P as PublicError, a as PublicErrorContext, e as extractUpstreamErrorMessage } from './errors-BXPUVOh7.js';
|
|
8
|
+
import { x as Voice, b as CreateVoiceRequest, y as VoiceCreation, A as AssetsClient, r as TasksClient, t as TranscriptionClient, E as TranscriptionSocketFactory, d as RunTaskOptions, c as RunResult, e as TaskResult } from './voices-Dc94LfyS.js';
|
|
9
|
+
export { C as CreateTaskOptions, a as CreateTaskRequest, N as NexraTranscriptionError, R as RequestDetails, T as TASK_STATUSES, f as TaskCost, g as TaskError, h as TaskEvent, i as TaskEventType, j as TaskListParams, k as TaskPage, l as TaskProgress, m as TaskReceipt, n as TaskStatus, o as TaskTiming, p as TaskUsage, q as TaskWebhookConfig, s as TerminalTaskStatus, u as TranscriptionEvent, v as TranscriptionResponse, w as TranscriptionStreamOptions, V as VerifyWebhookOptions, W as WaitTaskOptions, z as WatchTaskOptions, B as isTerminalTaskStatus, D as verifyWebhook } from './voices-Dc94LfyS.js';
|
|
10
10
|
import { CatalogClient } from './catalog.js';
|
|
11
11
|
export { formatModelDisplayName, getModelSpec, listModelSpecs } from './catalog.js';
|
|
12
12
|
export { ceilDecimal, multiplyDecimal } from './decimal.js';
|
|
@@ -38,7 +38,8 @@ declare class NexraClient {
|
|
|
38
38
|
readonly models: ModelsClient;
|
|
39
39
|
readonly tasks: TasksClient;
|
|
40
40
|
readonly voices: VoicesClient;
|
|
41
|
-
|
|
41
|
+
readonly transcription: TranscriptionClient;
|
|
42
|
+
constructor(options?: NexraClientOptions, connect?: TranscriptionSocketFactory);
|
|
42
43
|
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, input: TInput, options?: RunTaskOptions): Promise<RunResult<TOutput>>;
|
|
43
44
|
}
|
|
44
45
|
declare function createNexra(options?: NexraClientOptions): NexraClient;
|
|
@@ -111,4 +112,4 @@ declare class NexraWaitTimeoutError extends Error {
|
|
|
111
112
|
constructor(taskId: string, timeoutMs: number);
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
export { AssetsClient, CatalogClient, type CreateVoiceOptions, CreateVoiceRequest, CursorPage, JsonValue, ModelResourceList, ModelSchema, ModelSearchParams, ModelsClient, NexraApiError, NexraClient, NexraClientOptions, NexraError, NexraTaskError, NexraWaitTimeoutError, PublicErrorFields, RunResult, RunTaskOptions, TaskResult as Task, TaskModel, TaskModelSummary, TaskResult, TasksClient, Voice, VoiceCreation, VoicesClient, createNexra };
|
|
115
|
+
export { AssetsClient, CatalogClient, type CreateVoiceOptions, CreateVoiceRequest, CursorPage, JsonValue, ModelResourceList, ModelSchema, ModelSearchParams, ModelsClient, NexraApiError, NexraClient, NexraClientOptions, NexraError, NexraTaskError, NexraWaitTimeoutError, PublicErrorFields, RunResult, RunTaskOptions, TaskResult as Task, TaskModel, TaskModelSummary, TaskResult, TasksClient, TranscriptionClient, Voice, VoiceCreation, VoicesClient, createNexra };
|