@findlane/server 0.23.0 → 0.24.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 CHANGED
@@ -291,6 +291,17 @@ class SearchServerClient {
291
291
  uploadFromUrl: (url, signal) => request("/images", "POST", { url }, signal),
292
292
  delete: (key, signal) => request(`/images/${key}`, "DELETE", undefined, signal)
293
293
  },
294
+ feed: {
295
+ get: async (signal) => (await request("/feed", "GET", undefined, signal)).feed,
296
+ set: async (setup, signal) => (await request("/feed", "PUT", setup, signal)).feed,
297
+ remove: async (signal) => {
298
+ await request("/feed", "DELETE", undefined, signal);
299
+ },
300
+ check: (setup = {}, signal) => request("/feed/check", "POST", setup, signal),
301
+ run: async (signal) => (await request("/feed/runs", "POST", undefined, signal)).run,
302
+ runs: async (signal) => (await request("/feed/runs", "GET", undefined, signal)).runs,
303
+ importHeld: async (runId, signal) => (await request(`/feed/runs/${encodeURIComponent(runId)}/import`, "POST", undefined, signal)).run
304
+ },
294
305
  lists: {
295
306
  get: (id, options = {}) => request(`/lists/${encodeURIComponent(id)}${options.limit ? `?limit=${options.limit}` : ""}`, "GET", undefined, options.signal),
296
307
  getMany: async (ids, options = {}) => {
package/dist/index.d.cts CHANGED
@@ -832,6 +832,71 @@ export type BannerStatsReport = {
832
832
  }[];
833
833
  analytics: "ok" | "off" | "unavailable";
834
834
  };
835
+ export type FeedFormat = "xml" | "tsv" | "csv" | "json" | "jsonl";
836
+ /** One run of a product feed: unchanged when the file hadn't changed; held when it would have emptied the index,
837
+ * removed more than half its products, or refused a fifth of its items (`message` says which). */
838
+ export type FeedRun = {
839
+ id: string;
840
+ trigger: "schedule" | "manual" | "connect" | "held";
841
+ status: "running" | "unchanged" | "imported" | "held" | "failed";
842
+ startedAt: string;
843
+ finishedAt: string | null;
844
+ format: FeedFormat | null;
845
+ bytes: number | null;
846
+ items: number | null;
847
+ records: number | null;
848
+ added: number | null;
849
+ changed: number | null;
850
+ removed: number | null;
851
+ refused: number | null;
852
+ reasons: Record<string, number>;
853
+ refusals: {
854
+ id?: string;
855
+ reason: string;
856
+ }[];
857
+ message: string | null;
858
+ };
859
+ /** An index's product feed: where it's read from, when, and how its last run went. `password` says whether it has one. */
860
+ export type ProductFeed = {
861
+ url: string;
862
+ username: string | null;
863
+ password: boolean;
864
+ schedule: "hourly" | "6h" | "daily";
865
+ hour: number | null;
866
+ variants: "group" | "separate";
867
+ paused: boolean;
868
+ pausedReason: "owner" | "failing" | null;
869
+ failures: number;
870
+ running: boolean;
871
+ nextRunAt: string | null;
872
+ lastRun: FeedRun | null;
873
+ held: FeedRun | null;
874
+ };
875
+ /** A feed's setup: each field given replaces the current one; null clears the username or password. */
876
+ export type FeedSetup = {
877
+ url?: string;
878
+ username?: string | null;
879
+ password?: string | null;
880
+ schedule?: "hourly" | "6h" | "daily";
881
+ hour?: number;
882
+ variants?: "group" | "separate";
883
+ paused?: boolean;
884
+ };
885
+ /** What a feed's first 2,000 items hold: the records they make (the first five in `sample`), and refused items. */
886
+ export type FeedCheck = {
887
+ format: FeedFormat | null;
888
+ complete: boolean;
889
+ items: number;
890
+ records: number;
891
+ refused: number;
892
+ sample: Record<string, unknown>[];
893
+ fields: string[];
894
+ reasons: Record<string, number>;
895
+ refusals: {
896
+ id?: string;
897
+ reason: string;
898
+ }[];
899
+ };
835
900
  /** A past order for importOrders; `timestamp` is when it was placed (ms, a Date, or an ISO string). */
836
901
  export type Order = {
837
902
  orderID: string;
@@ -1158,6 +1223,25 @@ export declare class SearchServerClient {
1158
1223
  deleted: true;
1159
1224
  }>;
1160
1225
  };
1226
+ /** The index's product feed (0.24.0): a store's Google or Meta product feed, or a JSON file of records, read on
1227
+ * a schedule (hourly, every 6 hours, or daily), replacing the index's records with only what changed. Reading
1228
+ * needs the `search` or `write` scope; the rest, `write`. */
1229
+ feed: {
1230
+ /** The feed and its last run, or null. */
1231
+ get: (signal?: AbortSignal) => Promise<ProductFeed | null>;
1232
+ /** Connects a feed or changes its setup; a new address, sign-in or variants setting reads it now. */
1233
+ set: (setup: FeedSetup, signal?: AbortSignal) => Promise<ProductFeed>;
1234
+ /** Disconnects it; the index keeps its records. */
1235
+ remove: (signal?: AbortSignal) => Promise<void>;
1236
+ /** Reads a feed's first 2,000 items without saving anything; without a url, the connected feed's. */
1237
+ check: (setup?: Pick<FeedSetup, "url" | "username" | "password" | "variants">, signal?: AbortSignal) => Promise<FeedCheck>;
1238
+ /** Reads it now, in full, in the background; `runs` shows how it went. */
1239
+ run: (signal?: AbortSignal) => Promise<FeedRun>;
1240
+ /** The last 20 runs, newest first. */
1241
+ runs: (signal?: AbortSignal) => Promise<FeedRun[]>;
1242
+ /** Imports a held run's copy of the feed as it is, without the checks that held it. */
1243
+ importHeld: (runId: string, signal?: AbortSignal) => Promise<FeedRun>;
1244
+ };
1161
1245
  lists: {
1162
1246
  /** One list by its ID; throws a FindlaneError with status 404 when there's none. `limit` shows fewer. */
1163
1247
  get: <R = T>(id: string, options?: {
package/dist/index.d.ts CHANGED
@@ -832,6 +832,71 @@ export type BannerStatsReport = {
832
832
  }[];
833
833
  analytics: "ok" | "off" | "unavailable";
834
834
  };
835
+ export type FeedFormat = "xml" | "tsv" | "csv" | "json" | "jsonl";
836
+ /** One run of a product feed: unchanged when the file hadn't changed; held when it would have emptied the index,
837
+ * removed more than half its products, or refused a fifth of its items (`message` says which). */
838
+ export type FeedRun = {
839
+ id: string;
840
+ trigger: "schedule" | "manual" | "connect" | "held";
841
+ status: "running" | "unchanged" | "imported" | "held" | "failed";
842
+ startedAt: string;
843
+ finishedAt: string | null;
844
+ format: FeedFormat | null;
845
+ bytes: number | null;
846
+ items: number | null;
847
+ records: number | null;
848
+ added: number | null;
849
+ changed: number | null;
850
+ removed: number | null;
851
+ refused: number | null;
852
+ reasons: Record<string, number>;
853
+ refusals: {
854
+ id?: string;
855
+ reason: string;
856
+ }[];
857
+ message: string | null;
858
+ };
859
+ /** An index's product feed: where it's read from, when, and how its last run went. `password` says whether it has one. */
860
+ export type ProductFeed = {
861
+ url: string;
862
+ username: string | null;
863
+ password: boolean;
864
+ schedule: "hourly" | "6h" | "daily";
865
+ hour: number | null;
866
+ variants: "group" | "separate";
867
+ paused: boolean;
868
+ pausedReason: "owner" | "failing" | null;
869
+ failures: number;
870
+ running: boolean;
871
+ nextRunAt: string | null;
872
+ lastRun: FeedRun | null;
873
+ held: FeedRun | null;
874
+ };
875
+ /** A feed's setup: each field given replaces the current one; null clears the username or password. */
876
+ export type FeedSetup = {
877
+ url?: string;
878
+ username?: string | null;
879
+ password?: string | null;
880
+ schedule?: "hourly" | "6h" | "daily";
881
+ hour?: number;
882
+ variants?: "group" | "separate";
883
+ paused?: boolean;
884
+ };
885
+ /** What a feed's first 2,000 items hold: the records they make (the first five in `sample`), and refused items. */
886
+ export type FeedCheck = {
887
+ format: FeedFormat | null;
888
+ complete: boolean;
889
+ items: number;
890
+ records: number;
891
+ refused: number;
892
+ sample: Record<string, unknown>[];
893
+ fields: string[];
894
+ reasons: Record<string, number>;
895
+ refusals: {
896
+ id?: string;
897
+ reason: string;
898
+ }[];
899
+ };
835
900
  /** A past order for importOrders; `timestamp` is when it was placed (ms, a Date, or an ISO string). */
836
901
  export type Order = {
837
902
  orderID: string;
@@ -1158,6 +1223,25 @@ export declare class SearchServerClient {
1158
1223
  deleted: true;
1159
1224
  }>;
1160
1225
  };
1226
+ /** The index's product feed (0.24.0): a store's Google or Meta product feed, or a JSON file of records, read on
1227
+ * a schedule (hourly, every 6 hours, or daily), replacing the index's records with only what changed. Reading
1228
+ * needs the `search` or `write` scope; the rest, `write`. */
1229
+ feed: {
1230
+ /** The feed and its last run, or null. */
1231
+ get: (signal?: AbortSignal) => Promise<ProductFeed | null>;
1232
+ /** Connects a feed or changes its setup; a new address, sign-in or variants setting reads it now. */
1233
+ set: (setup: FeedSetup, signal?: AbortSignal) => Promise<ProductFeed>;
1234
+ /** Disconnects it; the index keeps its records. */
1235
+ remove: (signal?: AbortSignal) => Promise<void>;
1236
+ /** Reads a feed's first 2,000 items without saving anything; without a url, the connected feed's. */
1237
+ check: (setup?: Pick<FeedSetup, "url" | "username" | "password" | "variants">, signal?: AbortSignal) => Promise<FeedCheck>;
1238
+ /** Reads it now, in full, in the background; `runs` shows how it went. */
1239
+ run: (signal?: AbortSignal) => Promise<FeedRun>;
1240
+ /** The last 20 runs, newest first. */
1241
+ runs: (signal?: AbortSignal) => Promise<FeedRun[]>;
1242
+ /** Imports a held run's copy of the feed as it is, without the checks that held it. */
1243
+ importHeld: (runId: string, signal?: AbortSignal) => Promise<FeedRun>;
1244
+ };
1161
1245
  lists: {
1162
1246
  /** One list by its ID; throws a FindlaneError with status 404 when there's none. `limit` shows fewer. */
1163
1247
  get: <R = T>(id: string, options?: {
package/dist/index.js CHANGED
@@ -245,6 +245,17 @@ class SearchServerClient {
245
245
  uploadFromUrl: (url, signal) => request("/images", "POST", { url }, signal),
246
246
  delete: (key, signal) => request(`/images/${key}`, "DELETE", undefined, signal)
247
247
  },
248
+ feed: {
249
+ get: async (signal) => (await request("/feed", "GET", undefined, signal)).feed,
250
+ set: async (setup, signal) => (await request("/feed", "PUT", setup, signal)).feed,
251
+ remove: async (signal) => {
252
+ await request("/feed", "DELETE", undefined, signal);
253
+ },
254
+ check: (setup = {}, signal) => request("/feed/check", "POST", setup, signal),
255
+ run: async (signal) => (await request("/feed/runs", "POST", undefined, signal)).run,
256
+ runs: async (signal) => (await request("/feed/runs", "GET", undefined, signal)).runs,
257
+ importHeld: async (runId, signal) => (await request(`/feed/runs/${encodeURIComponent(runId)}/import`, "POST", undefined, signal)).run
258
+ },
248
259
  lists: {
249
260
  get: (id, options = {}) => request(`/lists/${encodeURIComponent(id)}${options.limit ? `?limit=${options.limit}` : ""}`, "GET", undefined, options.signal),
250
261
  getMany: async (ids, options = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/server",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Findlane server SDK: upload catalogs, manage index settings, and search with a secret workspace API key.",
5
5
  "keywords": ["findlane", "search", "full-text search", "typo tolerance", "ecommerce search", "search api", "sdk"],
6
6
  "license": "MIT",