@remit/search-index-worker 0.0.3 → 0.0.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/search-index-worker",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
package/src/consumer.ts CHANGED
@@ -2,11 +2,10 @@ import {
2
2
  DeleteMessageCommand,
3
3
  ReceiveMessageCommand,
4
4
  type ReceiveMessageCommandOutput,
5
- SQSClient,
5
+ type SQSClient,
6
6
  } from "@aws-sdk/client-sqs";
7
- import { AwsQueryProtocol } from "@aws-sdk/core/protocols";
8
7
  import type { Logger } from "@remit/logger-lambda";
9
- import { resolveSqsCredentials } from "@remit/sqs-client";
8
+ import { createQueueProducer } from "@remit/sqs-client/producer";
10
9
  import type { SQSRecord } from "aws-lambda";
11
10
  import { type IndexOutcome, processBatch } from "./handler.js";
12
11
  import { createIndexWorkStats, type IndexWorkStats } from "./index-stats.js";
@@ -33,18 +32,11 @@ const toSqsRecord = (
33
32
  awsRegion: "",
34
33
  }) satisfies SQSRecord;
35
34
 
36
- const createSqsClient = (queueUrl: string): SQSClient => {
37
- const isLocal = queueUrl.startsWith("http://localhost");
38
- return new SQSClient({
39
- endpoint: isLocal ? new URL(queueUrl).origin : undefined,
40
- ...(isLocal
41
- ? {
42
- protocol: AwsQueryProtocol,
43
- credentials: { accessKeyId: "local", secretAccessKey: "local" },
44
- }
45
- : { credentials: resolveSqsCredentials() }),
35
+ const createSqsClient = (queueUrl: string): SQSClient =>
36
+ createQueueProducer({
37
+ queueUrl,
38
+ localCredentials: { accessKeyId: "local", secretAccessKey: "local" },
46
39
  });
47
- };
48
40
 
49
41
  export interface SqsConsumerConfig {
50
42
  /** Search-index queue URL; defaults to `SQS_QUEUE_URL_SEARCH_INDEX`. */
package/src/services.ts CHANGED
@@ -1,7 +1,4 @@
1
- import {
2
- createSearchService,
3
- type SearchService,
4
- } from "@remit/search-service";
1
+ import { createSearchService, type SearchService } from "@remit/search-service";
5
2
  import {
6
3
  buildEmbeddingServiceFromEnv,
7
4
  buildVectorStoreFromEnv,