@fabriktor/client 0.0.105 → 0.0.107

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.
@@ -0,0 +1,6 @@
1
+ import { type PLFeedLinkPreview, type RPFeedLinkPreview } from "@fabriktor/schema";
2
+ import type { OperationResultOf } from "../core/crud.js";
3
+ import type { FeedClientOptions } from "./feed.js";
4
+ export declare function newFeedPreviewClient(opts: FeedClientOptions): {
5
+ preview(input: PLFeedLinkPreview, signal?: AbortSignal): Promise<OperationResultOf<RPFeedLinkPreview>>;
6
+ };
@@ -0,0 +1,26 @@
1
+ // Copyright (C) Fabriktor, Inc. 2025-present.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+ // not use this file except in compliance with the License. You may obtain
5
+ // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ import { ColFeedFeedPosts, HTTPMethodPost, PathFeedLinkPreview, SvcFeed, } from "@fabriktor/schema";
7
+ import { requiredToken } from "../core/auth.js";
8
+ import { buildPath } from "../core/path.js";
9
+ export function newFeedPreviewClient(opts) {
10
+ return {
11
+ async preview(input, signal) {
12
+ return opts.http.do({
13
+ base_url: opts.base_url,
14
+ path: buildPath({
15
+ svc: SvcFeed,
16
+ col: ColFeedFeedPosts,
17
+ action: PathFeedLinkPreview,
18
+ }),
19
+ method: HTTPMethodPost,
20
+ token: await requiredToken(opts.get_token),
21
+ body: input,
22
+ signal,
23
+ });
24
+ },
25
+ };
26
+ }
@@ -14,6 +14,7 @@ export * from "./core/path.js";
14
14
  export * from "./core/type.js";
15
15
  export * from "./core/ws.js";
16
16
  export * from "./feed/feed.js";
17
+ export * from "./feed/preview.js";
17
18
  export * from "./fulfillments/fulfillments.js";
18
19
  export * from "./jobs/jobs.js";
19
20
  export * from "./marketplace/marketplace.js";
package/dist/src/index.js CHANGED
@@ -14,6 +14,7 @@ export * from "./core/path.js";
14
14
  export * from "./core/type.js";
15
15
  export * from "./core/ws.js";
16
16
  export * from "./feed/feed.js";
17
+ export * from "./feed/preview.js";
17
18
  export * from "./fulfillments/fulfillments.js";
18
19
  export * from "./jobs/jobs.js";
19
20
  export * from "./marketplace/marketplace.js";
@@ -208,11 +208,11 @@ function uploadForm(opts) {
208
208
  return form;
209
209
  }
210
210
  function appendFile(form, f) {
211
- if (isFile(f)) {
212
- form.append(fileFieldName, f, f.name);
213
- return;
214
- }
215
- form.append(fileFieldName, f.blob, f.filename);
211
+ const { blob, filename } = isFile(f) ? { blob: f, filename: f.name } : f;
212
+ // WebKit can send an empty multipart body for Files restored from IndexedDB.
213
+ // A Blob slice avoids that file-path branch without buffering the whole file.
214
+ // https://bugs.webkit.org/show_bug.cgi?id=319985
215
+ form.append(fileFieldName, blob.slice(0, blob.size, blob.type), filename);
216
216
  }
217
217
  function isFile(f) {
218
218
  return typeof File !== "undefined" && f instanceof File;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,6 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "0.0.75"
20
+ "@fabriktor/schema": "0.0.78"
21
21
  }
22
22
  }