@rslsp1/fa-app-tools 1.2.5 → 1.2.7

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.
@@ -46,10 +46,14 @@ async function hfUploadProject(zipBase64, name, token) {
46
46
  const hashBuffer = await crypto.subtle.digest("SHA-256", bytes);
47
47
  const oid = Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
48
48
  const size = bytes.length;
49
+ const sampleBytes = bytes.slice(0, 512);
50
+ let sampleBinary = "";
51
+ for (let i = 0; i < sampleBytes.length; i++) sampleBinary += String.fromCharCode(sampleBytes[i]);
52
+ const sample = btoa(sampleBinary);
49
53
  const preRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/preupload/main`, {
50
54
  method: "POST",
51
55
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
52
- body: JSON.stringify({ files: [{ path: filename, sample: btoa(String.fromCharCode(...bytes.slice(0, 128))) }] })
56
+ body: JSON.stringify({ files: [{ path: filename, size, sample }] })
53
57
  });
54
58
  if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status} ${preRes.statusText}`);
55
59
  const preData = await preRes.json();
@@ -6,7 +6,7 @@ import {
6
6
  hfListProjects,
7
7
  hfUploadProject,
8
8
  setHFToken
9
- } from "./chunk-UZE44WOR.mjs";
9
+ } from "./chunk-3GEDIA7J.mjs";
10
10
  export {
11
11
  HF_TOKEN_KEY,
12
12
  getHFToken,
package/dist/index.d.mts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.2.5";
451
+ declare const LIB_VERSION = "1.2.7";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.2.5";
451
+ declare const LIB_VERSION = "1.2.7";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.js CHANGED
@@ -314,10 +314,14 @@ async function hfUploadProject(zipBase64, name, token) {
314
314
  const hashBuffer = await crypto.subtle.digest("SHA-256", bytes);
315
315
  const oid = Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
316
316
  const size = bytes.length;
317
+ const sampleBytes = bytes.slice(0, 512);
318
+ let sampleBinary = "";
319
+ for (let i = 0; i < sampleBytes.length; i++) sampleBinary += String.fromCharCode(sampleBytes[i]);
320
+ const sample = btoa(sampleBinary);
317
321
  const preRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/preupload/main`, {
318
322
  method: "POST",
319
323
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
320
- body: JSON.stringify({ files: [{ path: filename, sample: btoa(String.fromCharCode(...bytes.slice(0, 128))) }] })
324
+ body: JSON.stringify({ files: [{ path: filename, size, sample }] })
321
325
  });
322
326
  if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status} ${preRes.statusText}`);
323
327
  const preData = await preRes.json();
@@ -4230,7 +4234,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4230
4234
  hfToken: hfToken || void 0,
4231
4235
  onHfLoad: (f) => handleProjectImport(f),
4232
4236
  onProjectExportBase64: async () => {
4233
- const { base64 } = await Promise.resolve().then(() => (init_project(), project_exports)).then((m) => m.exportProjectToZip(nodes, edges, history, galleryItems, { aspectRatio, selectedModel, seed, seedMode }, workspaceTags, recentLabItems.map((i) => i.id)));
4237
+ const { base64 } = await exportProjectToZip(nodes, edges, history, galleryItems, { aspectRatio, selectedModel, seed, seedMode }, workspaceTags, recentLabItems.map((i) => i.id));
4234
4238
  return base64;
4235
4239
  }
4236
4240
  }
@@ -4570,7 +4574,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4570
4574
  }
4571
4575
 
4572
4576
  // src/index.ts
4573
- var LIB_VERSION = "1.2.5";
4577
+ var LIB_VERSION = "1.2.7";
4574
4578
  // Annotate the CommonJS export names for ESM import in node:
4575
4579
  0 && (module.exports = {
4576
4580
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  hfDeleteProject,
8
8
  hfListProjects,
9
9
  hfUploadProject
10
- } from "./chunk-UZE44WOR.mjs";
10
+ } from "./chunk-3GEDIA7J.mjs";
11
11
 
12
12
  // src/hooks/useOnClickOutside.ts
13
13
  import { useEffect } from "react";
@@ -1547,7 +1547,7 @@ var ProjectSyncTab = ({
1547
1547
  {
1548
1548
  onClick: async () => {
1549
1549
  try {
1550
- const { hfDownloadProject } = await import("./hfStateService-Y563AT2M.mjs");
1550
+ const { hfDownloadProject } = await import("./hfStateService-MQ33VAMR.mjs");
1551
1551
  const file = await hfDownloadProject(p.path, hfToken);
1552
1552
  onHfLoad(file);
1553
1553
  } catch (e) {
@@ -3494,7 +3494,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3494
3494
  onClick: async () => {
3495
3495
  setIsLoadingFromHF(true);
3496
3496
  try {
3497
- const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-Y563AT2M.mjs");
3497
+ const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-MQ33VAMR.mjs");
3498
3498
  const projects = await hfListProjects2(hfToken);
3499
3499
  if (projects.length > 0) {
3500
3500
  const file = await hfDownloadProject(projects[0].path, hfToken);
@@ -3812,7 +3812,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3812
3812
  hfToken: hfToken || void 0,
3813
3813
  onHfLoad: (f) => handleProjectImport(f),
3814
3814
  onProjectExportBase64: async () => {
3815
- const { base64 } = await import("./project-O4ORKXY5.mjs").then((m) => m.exportProjectToZip(nodes, edges, history, galleryItems, { aspectRatio, selectedModel, seed, seedMode }, workspaceTags, recentLabItems.map((i) => i.id)));
3815
+ const { base64 } = await exportProjectToZip(nodes, edges, history, galleryItems, { aspectRatio, selectedModel, seed, seedMode }, workspaceTags, recentLabItems.map((i) => i.id));
3816
3816
  return base64;
3817
3817
  }
3818
3818
  }
@@ -4152,7 +4152,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4152
4152
  }
4153
4153
 
4154
4154
  // src/index.ts
4155
- var LIB_VERSION = "1.2.5";
4155
+ var LIB_VERSION = "1.2.7";
4156
4156
  export {
4157
4157
  AvatarArchitectApp,
4158
4158
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",