@rslsp1/fa-app-tools 1.3.1 → 1.3.2

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.
@@ -110,16 +110,14 @@ async function hfUploadProjectForm(zipBase64, name, token) {
110
110
  const bytes = new Uint8Array(binary.length);
111
111
  for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
112
112
  const blob = new Blob([bytes], { type: "application/zip" });
113
- const form = new FormData();
114
- form.append("files[]", blob, filename);
115
- const res = await fetch(
116
- `${HF_BASE}/api/datasets/${HF_REPO}/upload/main`,
117
- { method: "POST", headers: { Authorization: `Bearer ${token}` }, body: form }
118
- );
119
- if (!res.ok) {
120
- const err = await res.text().catch(() => "");
121
- throw new Error(`HF FormData upload failed: ${res.status} \u2014 ${err.slice(0, 300)}`);
122
- }
113
+ const { uploadFile } = await import("@huggingface/hub");
114
+ await uploadFile({
115
+ repo: { type: "dataset", name: HF_REPO },
116
+ credentials: { accessToken: token },
117
+ file: { path: filename, content: blob },
118
+ branch: "main",
119
+ commitTitle: `Upload ${filename}`
120
+ });
123
121
  return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
124
122
  }
125
123
  async function hfDeleteProject(path, token) {
@@ -7,7 +7,7 @@ import {
7
7
  hfUploadProject,
8
8
  hfUploadProjectForm,
9
9
  setHFToken
10
- } from "./chunk-4MIV2ED3.mjs";
10
+ } from "./chunk-JW5O3URT.mjs";
11
11
  export {
12
12
  HF_TOKEN_KEY,
13
13
  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.3.1";
451
+ declare const LIB_VERSION = "1.3.2";
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.3.1";
451
+ declare const LIB_VERSION = "1.3.2";
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
@@ -379,16 +379,14 @@ async function hfUploadProjectForm(zipBase64, name, token) {
379
379
  const bytes = new Uint8Array(binary.length);
380
380
  for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
381
381
  const blob = new Blob([bytes], { type: "application/zip" });
382
- const form = new FormData();
383
- form.append("files[]", blob, filename);
384
- const res = await fetch(
385
- `${HF_BASE}/api/datasets/${HF_REPO}/upload/main`,
386
- { method: "POST", headers: { Authorization: `Bearer ${token}` }, body: form }
387
- );
388
- if (!res.ok) {
389
- const err = await res.text().catch(() => "");
390
- throw new Error(`HF FormData upload failed: ${res.status} \u2014 ${err.slice(0, 300)}`);
391
- }
382
+ const { uploadFile } = await import("@huggingface/hub");
383
+ await uploadFile({
384
+ repo: { type: "dataset", name: HF_REPO },
385
+ credentials: { accessToken: token },
386
+ file: { path: filename, content: blob },
387
+ branch: "main",
388
+ commitTitle: `Upload ${filename}`
389
+ });
392
390
  return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
393
391
  }
394
392
  async function hfDeleteProject(path, token) {
@@ -4630,7 +4628,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4630
4628
  }
4631
4629
 
4632
4630
  // src/index.ts
4633
- var LIB_VERSION = "1.3.1";
4631
+ var LIB_VERSION = "1.3.2";
4634
4632
  // Annotate the CommonJS export names for ESM import in node:
4635
4633
  0 && (module.exports = {
4636
4634
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  hfDeleteProject,
8
8
  hfListProjects,
9
9
  hfUploadProjectForm
10
- } from "./chunk-4MIV2ED3.mjs";
10
+ } from "./chunk-JW5O3URT.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-UKEBY3QR.mjs");
1550
+ const { hfDownloadProject } = await import("./hfStateService-UUDYKEMD.mjs");
1551
1551
  const file = await hfDownloadProject(p.path, hfToken);
1552
1552
  onHfLoad(file);
1553
1553
  } catch (e) {
@@ -3507,7 +3507,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3507
3507
  onClick: async () => {
3508
3508
  setIsLoadingFromHF(true);
3509
3509
  try {
3510
- const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-UKEBY3QR.mjs");
3510
+ const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-UUDYKEMD.mjs");
3511
3511
  const projects = await hfListProjects2(hfToken);
3512
3512
  if (projects.length > 0) {
3513
3513
  const file = await hfDownloadProject(projects[0].path, hfToken);
@@ -4165,7 +4165,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4165
4165
  }
4166
4166
 
4167
4167
  // src/index.ts
4168
- var LIB_VERSION = "1.3.1";
4168
+ var LIB_VERSION = "1.3.2";
4169
4169
  export {
4170
4170
  AvatarArchitectApp,
4171
4171
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,6 +24,7 @@
24
24
  "react": ">=18"
25
25
  },
26
26
  "dependencies": {
27
+ "@huggingface/hub": "^2.13.0",
27
28
  "jszip": "^3.10.1"
28
29
  },
29
30
  "devDependencies": {