@temporalio/client 1.3.0 → 1.4.1

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/src/index.ts CHANGED
@@ -17,16 +17,16 @@ export {
17
17
  DataConverter,
18
18
  defaultPayloadConverter,
19
19
  ProtoFailure,
20
+ RetryPolicy,
20
21
  ServerFailure,
21
22
  TemporalFailure,
22
23
  TerminatedFailure,
23
24
  TimeoutFailure,
24
25
  } from '@temporalio/common';
25
- export { TLSConfig } from '@temporalio/internal-non-workflow-common';
26
- export { RetryPolicy } from '@temporalio/internal-workflow-common';
27
- export * from '@temporalio/internal-workflow-common/lib/errors';
28
- export * from '@temporalio/internal-workflow-common/lib/interfaces';
29
- export * from '@temporalio/internal-workflow-common/lib/workflow-handle';
26
+ export { TLSConfig } from '@temporalio/common/lib/internal-non-workflow';
27
+ export * from '@temporalio/common/lib/errors';
28
+ export * from '@temporalio/common/lib/interfaces';
29
+ export * from '@temporalio/common/lib/workflow-handle';
30
30
  export * from './async-completion-client';
31
31
  export * from './client';
32
32
  export { Connection, ConnectionOptions, ConnectionOptionsWithDefaults, LOCAL_TARGET } from './connection';
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { Headers, Next } from '@temporalio/internal-workflow-common';
7
+ import { Headers, Next } from '@temporalio/common';
8
8
  import { temporal } from '@temporalio/proto';
9
9
  import {
10
10
  DescribeWorkflowExecutionResponse,
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SearchAttributes } from '@temporalio/internal-workflow-common';
1
+ import type { SearchAttributes } from '@temporalio/common';
2
2
  import * as proto from '@temporalio/proto';
3
3
  import type * as grpc from '@grpc/grpc-js';
4
4
 
@@ -21,22 +21,21 @@ import {
21
21
  filterNullAndUndefined,
22
22
  isLoadedDataConverter,
23
23
  loadDataConverter,
24
- } from '@temporalio/internal-non-workflow-common';
24
+ } from '@temporalio/common/lib/internal-non-workflow';
25
25
  import {
26
26
  BaseWorkflowHandle,
27
27
  compileRetryPolicy,
28
- composeInterceptors,
29
- optionalTsToDate,
30
28
  QueryDefinition,
31
- Replace,
32
29
  SearchAttributes,
33
30
  SignalDefinition,
34
- tsToDate,
35
31
  WithWorkflowArgs,
36
32
  Workflow,
37
33
  WorkflowNotFoundError,
38
34
  WorkflowResultType,
39
- } from '@temporalio/internal-workflow-common';
35
+ } from '@temporalio/common';
36
+ import { optionalTsToDate, tsToDate } from '@temporalio/common/lib/time';
37
+ import { composeInterceptors } from '@temporalio/common/lib/interceptors';
38
+ import { Replace } from '@temporalio/common/lib/type-helpers';
40
39
  import { temporal } from '@temporalio/proto';
41
40
  import os from 'os';
42
41
  import { v4 as uuid4 } from 'uuid';
@@ -503,14 +502,9 @@ export class WorkflowClient {
503
502
  } catch (err) {
504
503
  this.rethrowGrpcError(err, { workflowId, runId }, 'Failed to get Workflow execution history');
505
504
  }
506
- if (!res.history) {
507
- throw new Error('No history returned by service');
508
- }
509
- const { events } = res.history;
510
- if (!events) {
511
- throw new Error('No events in history returned by service');
512
- }
513
- if (events.length === 0) {
505
+ const events = res.history?.events;
506
+
507
+ if (events == null || events.length === 0) {
514
508
  req.nextPageToken = res.nextPageToken;
515
509
  continue;
516
510
  }
@@ -877,10 +871,14 @@ export class WorkflowClient {
877
871
  executionTime: optionalTsToDate(raw.workflowExecutionInfo!.executionTime),
878
872
  closeTime: optionalTsToDate(raw.workflowExecutionInfo!.closeTime),
879
873
  memo: await decodeMapFromPayloads(this.client.dataConverter, raw.workflowExecutionInfo!.memo?.fields),
880
- searchAttributes: mapFromPayloads(
881
- searchAttributePayloadConverter,
882
- raw.workflowExecutionInfo!.searchAttributes?.indexedFields ?? {}
883
- ) as SearchAttributes,
874
+ searchAttributes: Object.fromEntries(
875
+ Object.entries(
876
+ mapFromPayloads(
877
+ searchAttributePayloadConverter,
878
+ raw.workflowExecutionInfo!.searchAttributes?.indexedFields ?? {}
879
+ ) as SearchAttributes
880
+ ).filter(([_, v]) => v && v.length > 0) // Filter out empty arrays returned by pre 1.18 servers
881
+ ),
884
882
  parentExecution: raw.workflowExecutionInfo?.parentExecution
885
883
  ? {
886
884
  workflowId: raw.workflowExecutionInfo.parentExecution.workflowId!,
@@ -1,10 +1,6 @@
1
- import {
2
- CommonWorkflowOptions,
3
- SignalDefinition,
4
- WithCompiledWorkflowOptions,
5
- } from '@temporalio/internal-workflow-common';
1
+ import { CommonWorkflowOptions, SignalDefinition, WithCompiledWorkflowOptions } from '@temporalio/common';
6
2
 
7
- export * from '@temporalio/internal-workflow-common/lib/workflow-options';
3
+ export * from '@temporalio/common/lib/workflow-options';
8
4
 
9
5
  export interface CompiledWorkflowOptions extends WithCompiledWorkflowOptions<WorkflowOptions> {
10
6
  args: unknown[];