Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@
"@sveltejs/adapter-vercel": "^4.0.0",
"@sveltejs/kit": "^2.20.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@temporalio/activity": "1.11.8",
"@temporalio/client": "1.11.8",
"@temporalio/common": "1.11.8",
"@temporalio/proto": "1.11.8",
"@temporalio/testing": "1.11.8",
"@temporalio/worker": "1.11.8",
"@temporalio/workflow": "1.11.8",
"@temporalio/activity": "1.12.1",
"@temporalio/client": "1.12.1",
"@temporalio/common": "1.12.1",
"@temporalio/proto": "1.12.1",
"@temporalio/testing": "1.12.1",
"@temporalio/worker": "1.12.1",
"@temporalio/workflow": "1.12.1",
"@types/base-64": "^1.0.0",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
Expand Down
122 changes: 70 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/lib/components/event/event-card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import Link from '$lib/holocene/link.svelte';
import { translate } from '$lib/i18n/translate';
import { relativeTime, timeFormat } from '$lib/stores/time-format';
import type { EventLink as ELink } from '$lib/types';
import { type Payload } from '$lib/types';
import type { WorkflowEvent } from '$lib/types/events';
import type { EventLink as ELink } from '$lib/types/events';
import { getEventLinkHref } from '$lib/utilities/event-link-href';
import {
format,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/event/event-link.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import Link from '$lib/holocene/link.svelte';
import { translate } from '$lib/i18n/translate';
import type { EventLink } from '$lib/types/events';
import type { EventLink } from '$lib/types';
import { getEventLinkHref } from '$lib/utilities/event-link-href';

export let link: EventLink;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/workflow/workflow-callback.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { translate } from '$lib/i18n/translate';
import { timeFormat } from '$lib/stores/time-format';
import type { CallbackState } from '$lib/types';
import type { EventLink as Link } from '$lib/types/events';
import type { EventLink as Link } from '$lib/types';
import type { Callback } from '$lib/types/nexus';
import { formatDate } from '$lib/utilities/format-date';
import { routeForNamespace } from '$lib/utilities/route-for';
Expand Down
23 changes: 16 additions & 7 deletions src/lib/models/event-history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import {
import { formatDate } from '$lib/utilities/format-date';
import { isWorkflowTaskFailedEventDueToReset } from '$lib/utilities/get-workflow-task-failed-event';
import { has } from '$lib/utilities/has';
import { findAttributesAndKey } from '$lib/utilities/is-event-type';
import {
findAttributesAndKey,
isWorkflowExecutionOptionsUpdatedEvent,
isWorkflowExecutionStartedEvent,
} from '$lib/utilities/is-event-type';
import { toEventNameReadable } from '$lib/utilities/screaming-enums';

import { getEventBillableActions } from './get-event-billable-actions';
Expand Down Expand Up @@ -72,12 +76,17 @@ export const toEvent = (
const category = getEventCategory(eventType);

const { key, attributes } = findAttributesAndKey(historyEvent);
// TODO: When TS SDK supports new fields, remove this workaround
const completionLinks =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(attributes as any)?.completionCallbacks?.[0]?.links ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(attributes as any)?.attachedCompletionCallbacks?.[0]?.links;

const completionCallbacks =
isWorkflowExecutionStartedEvent(historyEvent) &&
historyEvent.workflowExecutionStartedEventAttributes
?.completionCallbacks?.[0]?.links;
const attachedCompletionCallbacks =
isWorkflowExecutionOptionsUpdatedEvent(historyEvent) &&
historyEvent.workflowExecutionOptionsUpdatedEventAttributes
?.attachedCompletionCallbacks?.[0]?.links;

const completionLinks = completionCallbacks || attachedCompletionCallbacks;
const links = historyEvent?.links || completionLinks || [];
const event = {
...historyEvent,
Expand Down
22 changes: 1 addition & 21 deletions src/lib/types/events.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Timestamp } from '@temporalio/common';

import type { EventGroup } from '$lib/models/event-groups/event-groups';
import type { ActivityOptions } from '$lib/types';
import type { ActivityOptions, EventLink } from '$lib/types';

import type { Replace, Settings } from './global';

Expand All @@ -10,26 +10,6 @@ export type EventHistory = Replace<
{ events: HistoryEvent[] }
>;

export type EventLink = {
workflowEvent: {
eventRef?: {
eventType: string;
eventId?: string;
};
requestIdRef?: {
requestId: string;
eventType: string;
};
namespace: string;
workflowId: string;
runId: string;
};

batchJob?: {
jobId: string;
};
};

export type HistoryEvent = Replace<
import('$lib/types').HistoryEvent,
{ eventType: EventType; eventId: string; links?: EventLink[] }
Expand Down
2 changes: 2 additions & 0 deletions src/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export type CallbackState = temporal.api.enums.v1.CallbackState;
export type PendingWorkflowTaskInfo =
temporal.api.workflow.v1.IPendingWorkflowTaskInfo;
export type VersioningBehavior = temporal.api.enums.v1.VersioningBehavior;
export type EventType = temporal.api.enums.v1.EventType;

// temporal.api.enums.v1.ResetReapplyExcludeType
export enum ResetReapplyExcludeType {
Expand Down Expand Up @@ -251,6 +252,7 @@ export type BatchTerminateOperation =
// api.nexus
export type Endpoint = temporal.api.nexus.v1.IEndpoint;
export type EndpointSpec = temporal.api.nexus.v1.IEndpointSpec;
export type EventLink = temporal.api.common.v1.ILink;

// api.failure
export type Failure = temporal.api.failure.v1.IFailure;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/types/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import type {
EndpointSpec,
Callback as ICallback,
} from '$lib/types';

import type { EventLink } from './events';
import type { EventLink } from '$lib/types';

export interface NexusEndpointSpec extends EndpointSpec {
descriptionString?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utilities/event-link-href.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EventLink } from '$lib/types/events';
import type { EventLink, EventType } from '$lib/types';

import { routeForEventHistory, routeForEventHistoryEvent } from './route-for';

Expand All @@ -12,7 +12,7 @@ export const getEventLinkHref = (link: EventLink): string => {
});
} else if (
link.workflowEvent?.eventRef?.eventType ===
'EVENT_TYPE_WORKFLOW_EXECUTION_STARTED'
('EVENT_TYPE_WORKFLOW_EXECUTION_STARTED' as unknown as EventType)
) {
return routeForEventHistoryEvent({
namespace: link.workflowEvent.namespace,
Expand Down
Loading