@reactionary/provider-algolia 0.0.41 → 0.0.48

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/provider-algolia",
3
- "version": "0.0.41",
3
+ "version": "0.0.48",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.0.41",
7
+ "@reactionary/core": "0.0.48",
8
8
  "algoliasearch": "^5.23.4",
9
9
  "zod": "4.1.9"
10
10
  }
@@ -6,7 +6,7 @@ class AlgoliaProductProvider extends ProductProvider {
6
6
  super(schema, cache);
7
7
  this.config = config;
8
8
  }
9
- async getById(payload, _session) {
9
+ async getById(payload, _reqCtx) {
10
10
  const result = this.newModel();
11
11
  result.identifier = { key: payload.id };
12
12
  result.name = `Algolia Product ${payload.id}`;
@@ -18,7 +18,7 @@ class AlgoliaProductProvider extends ProductProvider {
18
18
  };
19
19
  return this.assert(result);
20
20
  }
21
- async getBySlug(payload, _session) {
21
+ async getBySlug(payload, _reqCtx) {
22
22
  const result = this.newModel();
23
23
  result.identifier = { key: payload.slug };
24
24
  result.name = `Algolia Product ${payload.slug}`;
@@ -7,7 +7,7 @@ class AlgoliaSearchProvider extends SearchProvider {
7
7
  super(schema, cache);
8
8
  this.config = config;
9
9
  }
10
- async queryByTerm(payload, _session) {
10
+ async queryByTerm(payload, _reqCtx) {
11
11
  const client = algoliasearch(this.config.appId, this.config.apiKey);
12
12
  const remote = await client.search({
13
13
  requests: [
@@ -1,4 +1,4 @@
1
- import { Client, Cache } from "@reactionary/core";
2
- import { AlgoliaCapabilities } from "../schema/capabilities.schema";
3
- import { AlgoliaConfiguration } from "../schema/configuration.schema";
1
+ import type { Client, Cache } from "@reactionary/core";
2
+ import type { AlgoliaCapabilities } from "../schema/capabilities.schema";
3
+ import type { AlgoliaConfiguration } from "../schema/configuration.schema";
4
4
  export declare function withAlgoliaCapabilities(configuration: AlgoliaConfiguration, capabilities: AlgoliaCapabilities): (cache: Cache) => Partial<Client>;
@@ -1,9 +1,10 @@
1
- import { Product, ProductProvider, ProductQueryById, ProductQueryBySlug, Session, Cache } from '@reactionary/core';
2
- import { z } from 'zod';
3
- import { AlgoliaConfiguration } from '../schema/configuration.schema';
1
+ import type { Product, ProductQueryById, ProductQueryBySlug, RequestContext, Cache } from '@reactionary/core';
2
+ import { ProductProvider } from '@reactionary/core';
3
+ import type { z } from 'zod';
4
+ import type { AlgoliaConfiguration } from '../schema/configuration.schema';
4
5
  export declare class AlgoliaProductProvider<T extends Product = Product> extends ProductProvider<T> {
5
6
  protected config: AlgoliaConfiguration;
6
7
  constructor(config: AlgoliaConfiguration, schema: z.ZodType<T>, cache: Cache);
7
- getById(payload: ProductQueryById, _session: Session): Promise<T>;
8
- getBySlug(payload: ProductQueryBySlug, _session: Session): Promise<T>;
8
+ getById(payload: ProductQueryById, _reqCtx: RequestContext): Promise<T>;
9
+ getBySlug(payload: ProductQueryBySlug, _reqCtx: RequestContext): Promise<T>;
9
10
  }
@@ -1,9 +1,9 @@
1
- import { SearchProvider, SearchQueryByTerm, SearchResult, Session, Cache } from '@reactionary/core';
2
- import { z } from 'zod';
3
- import { AlgoliaConfiguration } from '../schema/configuration.schema';
1
+ import { type SearchQueryByTerm, type SearchResult, type RequestContext, type Cache, SearchProvider } from '@reactionary/core';
2
+ import type { z } from 'zod';
3
+ import type { AlgoliaConfiguration } from '../schema/configuration.schema';
4
4
  export declare class AlgoliaSearchProvider<T extends SearchResult = SearchResult> extends SearchProvider<T> {
5
5
  protected config: AlgoliaConfiguration;
6
6
  constructor(config: AlgoliaConfiguration, schema: z.ZodType<T>, cache: Cache);
7
- queryByTerm(payload: SearchQueryByTerm, _session: Session): Promise<SearchResult>;
7
+ queryByTerm(payload: SearchQueryByTerm, _reqCtx: RequestContext): Promise<SearchResult>;
8
8
  protected parseSearchResult(remote: unknown, payload: SearchQueryByTerm): T;
9
9
  }
@@ -1,7 +1,7 @@
1
- import { z } from 'zod';
1
+ import type { z } from 'zod';
2
2
  export declare const AlgoliaCapabilitiesSchema: z.ZodObject<{
3
- analytics: z.ZodOptional<z.ZodBoolean>;
4
3
  product: z.ZodOptional<z.ZodBoolean>;
4
+ analytics: z.ZodOptional<z.ZodBoolean>;
5
5
  search: z.ZodOptional<z.ZodBoolean>;
6
6
  }, z.core.$loose>;
7
7
  export type AlgoliaCapabilities = z.infer<typeof AlgoliaCapabilitiesSchema>;
@@ -1,2 +1,2 @@
1
- import { Session } from "@reactionary/core";
1
+ import type { Session } from "@reactionary/core";
2
2
  export declare function createAnonymousTestSession(): Session;
@@ -7,11 +7,15 @@ function createAnonymousTestSession() {
7
7
  cache: { hit: false, key: "" },
8
8
  placeholder: false
9
9
  },
10
- id: "",
10
+ id: { userId: "anonymous" },
11
11
  token: void 0,
12
12
  issued: /* @__PURE__ */ new Date(),
13
- expiry: new Date((/* @__PURE__ */ new Date()).getTime() + 3600 * 1e3)
14
- // 1 hour from now
13
+ expiry: new Date((/* @__PURE__ */ new Date()).getTime() + 3600 * 1e3),
14
+ logonId: "",
15
+ createdAt: "",
16
+ updatedAt: "",
17
+ keyring: [],
18
+ currentService: void 0
15
19
  },
16
20
  languageContext: {
17
21
  locale: "en-US",