@vertesia/workflow 0.60.0 → 0.62.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.
Files changed (38) hide show
  1. package/lib/cjs/activities/executeInteraction.js +7 -1
  2. package/lib/cjs/activities/executeInteraction.js.map +1 -1
  3. package/lib/cjs/activities/generateEmbeddings.js +23 -6
  4. package/lib/cjs/activities/generateEmbeddings.js.map +1 -1
  5. package/lib/cjs/activities/media/processPdfWithTextract.js +3 -2
  6. package/lib/cjs/activities/media/processPdfWithTextract.js.map +1 -1
  7. package/lib/cjs/activities/media/transcribeMediaWithGladia.js +1 -1
  8. package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +1 -1
  9. package/lib/cjs/errors.js +16 -2
  10. package/lib/cjs/errors.js.map +1 -1
  11. package/lib/cjs/utils/client.js +6 -3
  12. package/lib/cjs/utils/client.js.map +1 -1
  13. package/lib/esm/activities/executeInteraction.js +7 -1
  14. package/lib/esm/activities/executeInteraction.js.map +1 -1
  15. package/lib/esm/activities/generateEmbeddings.js +23 -6
  16. package/lib/esm/activities/generateEmbeddings.js.map +1 -1
  17. package/lib/esm/activities/media/processPdfWithTextract.js +3 -2
  18. package/lib/esm/activities/media/processPdfWithTextract.js.map +1 -1
  19. package/lib/esm/activities/media/transcribeMediaWithGladia.js +1 -1
  20. package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +1 -1
  21. package/lib/esm/errors.js +14 -1
  22. package/lib/esm/errors.js.map +1 -1
  23. package/lib/esm/utils/client.js +5 -3
  24. package/lib/esm/utils/client.js.map +1 -1
  25. package/lib/types/activities/executeInteraction.d.ts.map +1 -1
  26. package/lib/types/activities/generateEmbeddings.d.ts.map +1 -1
  27. package/lib/types/errors.d.ts +5 -0
  28. package/lib/types/errors.d.ts.map +1 -1
  29. package/lib/types/utils/client.d.ts +5 -0
  30. package/lib/types/utils/client.d.ts.map +1 -1
  31. package/lib/workflows-bundle.js +848 -230
  32. package/package.json +5 -6
  33. package/src/activities/executeInteraction.ts +8 -1
  34. package/src/activities/generateEmbeddings.ts +440 -418
  35. package/src/activities/media/processPdfWithTextract.ts +3 -3
  36. package/src/activities/media/transcribeMediaWithGladia.ts +1 -1
  37. package/src/errors.ts +17 -1
  38. package/src/utils/client.ts +5 -5
@@ -58,9 +58,9 @@ export async function convertPdfToStructuredText(payload: DSLActivityExecutionPa
58
58
  throw new NoDocumentFound(`Error fetching source ${object.content.source}`);
59
59
  }
60
60
 
61
-
62
- const awsConfig = (await client.projects.integrations.retrieve(client.project!, SupportedIntegrations.aws)) as AwsConfiguration;
63
- const credentials = await getS3AWSCredentials(awsConfig, payload.auth_token, client.project!);
61
+ const project = await client.getProject();
62
+ const awsConfig = (await client.projects.integrations.retrieve(project!.id, SupportedIntegrations.aws)) as AwsConfiguration;
63
+ const credentials = await getS3AWSCredentials(awsConfig, payload.auth_token, project!.id);
64
64
 
65
65
  const processor = new TextractProcessor({
66
66
  fileKey: objectId,
@@ -1,6 +1,6 @@
1
1
  import { DSLActivityExecutionPayload, DSLActivitySpec, GladiaConfiguration, SupportedIntegrations } from "@vertesia/common";
2
2
  import { activityInfo, CompleteAsyncError, log } from "@temporalio/activity";
3
- import { FetchClient } from "api-fetch-client";
3
+ import { FetchClient } from "@vertesia/api-fetch-client";
4
4
  import { setupActivity } from "../../dsl/setup/ActivityContext.js";
5
5
  import { NoDocumentFound } from "../../errors.js";
6
6
  import { TextExtractionResult, TextExtractionStatus } from "../../index.js";
package/src/errors.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ApplicationFailure } from "@temporalio/workflow";
1
2
  import { DSLActivitySpec, DSLWorkflowSpec } from "@vertesia/common";
2
3
 
3
4
  export class NoDocumentFound extends Error {
@@ -11,6 +12,16 @@ export class NoDocumentFound extends Error {
11
12
  }
12
13
  }
13
14
 
15
+ export class DocumentNotFoundError extends ApplicationFailure {
16
+ constructor(message: string, public ids?: string[]) {
17
+ super(
18
+ message,
19
+ "DocumentNotFoundError",
20
+ true, // non-retryable
21
+ )
22
+ }
23
+ }
24
+
14
25
  export class ActivityParamNotFound extends Error {
15
26
  constructor(
16
27
  public paramName: string,
@@ -42,4 +53,9 @@ export class WorkflowParamNotFound extends Error {
42
53
  }
43
54
  }
44
55
 
45
- export const WF_NON_RETRYABLE_ERRORS = ["NoDocumentFound", "ActivityParamNotFound", "WorkflowParamNotFound"];
56
+ export const WF_NON_RETRYABLE_ERRORS = [
57
+ "NoDocumentFound",
58
+ "DocumentNotFoundError",
59
+ "ActivityParamNotFound",
60
+ "WorkflowParamNotFound",
61
+ ];
@@ -8,7 +8,10 @@ import { WorkflowParamNotFound } from "../errors.js";
8
8
 
9
9
 
10
10
  export function getVertesiaClient(payload: WorkflowExecutionBaseParams) {
11
+ return new VertesiaClient(getVertesiaClientOptions(payload));
12
+ }
11
13
 
14
+ export function getVertesiaClientOptions(payload: WorkflowExecutionBaseParams) {
12
15
  if (!payload.auth_token) {
13
16
  throw new WorkflowParamNotFound("Authentication Token is missing from WorkflowExecutionPayload.authToken");
14
17
  }
@@ -21,12 +24,9 @@ export function getVertesiaClient(payload: WorkflowExecutionBaseParams) {
21
24
  throw new WorkflowParamNotFound("Content Store URL is missing from WorkflowExecutionPayload.servers.storeUrl");
22
25
  }
23
26
 
24
- const client = new VertesiaClient({
27
+ return {
25
28
  serverUrl: payload.config.studio_url,
26
29
  storeUrl: payload.config.store_url,
27
30
  apikey: payload.auth_token
28
- });
29
-
30
- return client;
31
-
31
+ };
32
32
  }