Skip to content
Open
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
21 changes: 21 additions & 0 deletions src/hooks.client.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { getAuthUser } from '$lib/stores/auth-user';
import { consumeAuthCookies } from '$lib/utilities/auth-user-cookie';
import { initCoreProvider } from '$lib/utilities/core-provider';
import {
ossGetDataEncoderEndpoint,
ossPostResponse,
ossPreRequest,
} from '$lib/utilities/oss-provider.svelte';

if (typeof crypto !== 'undefined' && !crypto.randomUUID) {
crypto.randomUUID = function randomUUID() {
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => {
Expand All @@ -9,3 +18,15 @@ if (typeof crypto !== 'undefined' && !crypto.randomUUID) {
}) as `${string}-${string}-${string}-${string}-${string}`;
};
}

consumeAuthCookies();

initCoreProvider({
getAccessToken: async () => getAuthUser().accessToken ?? '',
getIdToken: async () => getAuthUser().idToken,
api: {
preRequest: ossPreRequest,
postResponse: ossPostResponse,
},
getDataEncoderEndpoint: ossGetDataEncoderEndpoint,
});
3 changes: 0 additions & 3 deletions src/lib/components/event/event-summary-row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
eventOrGroupIsTerminated,
} from '$lib/models/event-groups/get-event-in-group';
import { isCloud } from '$lib/stores/advanced-visibility';
import { authUser } from '$lib/stores/auth-user';
import type { IterableEvent, WorkflowEvent } from '$lib/types/events';
import { decodeLocalActivity } from '$lib/utilities/decode-local-activity';
import { spaceBetweenCapitalLetters } from '$lib/utilities/format-camel-case';
Expand Down Expand Up @@ -187,7 +186,6 @@
primaryLocalAttribute = await decodeLocalActivity(event, {
namespace: page.params.namespace,
settings: page.data.settings,
accessToken: $authUser.accessToken,
});
} else if (
isEventGroup(event) &&
Expand All @@ -196,7 +194,6 @@
primaryLocalAttribute = await decodeLocalActivity(event.initialEvent, {
namespace: page.params.namespace,
settings: page.data.settings,
accessToken: $authUser.accessToken,
});
}
});
Expand All @@ -220,7 +217,7 @@
{#if isEventGroup(event)}
<td class="font-mono">
<div class="flex items-center gap-0.5">
{#each event.eventList as groupEvent}

Check warning on line 220 in src/lib/components/event/event-summary-row.svelte

View workflow job for this annotation

GitHub Actions / lint

Each block should have a key
<Link
data-testid="link"
href={routeForEventHistoryEvent({
Expand Down
2 changes: 0 additions & 2 deletions src/lib/components/event/payload-decoder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import { page } from '$app/stores';

import { authUser } from '$lib/stores/auth-user';
import type { Memo } from '$lib/types';
import type { EventAttribute, WorkflowEvent } from '$lib/types/events';
import {
Expand Down Expand Up @@ -51,7 +50,6 @@
_value,
$page.params.namespace,
settings,
$authUser.accessToken,
);
const decodedAttributes = decodePayloadAttributes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Argument of type 'WorkflowEvent | EventAttribute | IMemo | PotentiallyDecodable' is not assignable to parameter of type 'Optional<WorkflowEvent | EventAttribute | PotentiallyDecodable>'.

convertedAttributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { translate } from '$lib/i18n/translate';
import type { EventGroup } from '$lib/models/event-groups/event-groups';
import { setActiveGroup } from '$lib/stores/active-events';
import { authUser } from '$lib/stores/auth-user';
import {
decodeLocalActivity,
getLocalActivityMarkerEvent,
Expand Down Expand Up @@ -68,7 +67,6 @@
decodedLocalActivity = await decodeLocalActivity(localActivityEvent, {
namespace: page.params.namespace,
settings: page.data.settings,
accessToken: $authUser.accessToken,
});

if (decodedLocalActivity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import Markdown from '$lib/holocene/markdown-editor/preview.svelte';
import { translate } from '$lib/i18n/translate';
import { getWorkflowMetadata } from '$lib/services/query-service';
import { authUser } from '$lib/stores/auth-user';
import { workflowRun } from '$lib/stores/workflow-run';

const { namespace } = $derived(page.params);
Expand All @@ -34,7 +33,6 @@
},
},
settings,
$authUser?.accessToken ?? '',
);
$workflowRun.metadata = metadata;
lastFetched = new Date();
Expand Down
2 changes: 0 additions & 2 deletions src/lib/layouts/workflow-run-layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import { getPollers } from '$lib/services/pollers-service';
import { getWorkflowMetadata } from '$lib/services/query-service';
import { fetchWorkflow } from '$lib/services/workflow-service';
import { authUser } from '$lib/stores/auth-user';
import { resetLastDataEncoderSuccess } from '$lib/stores/data-encoder-config';
import { eventFilterSort, type EventSortOrder } from '$lib/stores/event-view';
import {
Expand Down Expand Up @@ -117,7 +116,6 @@
},
},
settings,
$authUser?.accessToken,
workflowRunController.signal,
).then((metadata) => {
$workflowRun.metadata = metadata;
Expand Down
5 changes: 0 additions & 5 deletions src/lib/models/event-history/get-event-attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const historyEvent = {

const namespace = 'unit-tests';
const settings = settingsFixture as unknown as Settings;
const accessToken = 'xxx.yyy.zzz';

describe('getEventAttributes', () => {
beforeEach(() => {
Expand All @@ -110,7 +109,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
});
expect(event.type).toBe(eventType);
});
Expand All @@ -123,7 +121,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
},
{
convertWithCodec,
Expand All @@ -141,7 +138,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings: { ...settings, codec: { endpoint: 'https://localhost' } },
accessToken,
},
{
convertWithCodec,
Expand All @@ -159,7 +155,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
},
{
convertWithCodec,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/models/event-history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getEventClassification } from './get-event-classification';
import { simplifyAttributes } from './simplify-attributes';

export async function getEventAttributes(
{ historyEvent, namespace, settings, accessToken }: EventWithMetadata,
{ historyEvent, namespace, settings }: EventWithMetadata,
{
convertWithCodec = convertPayloadToJsonWithCodec,
decodeAttributes = decodePayloadAttributes,
Expand All @@ -38,7 +38,6 @@ export async function getEventAttributes(
attributes,
namespace,
settings,
accessToken,
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Argument of type 'EventAttribute | IFailure | PotentiallyDecodable' is not assignable to parameter of type 'Optional<WorkflowEvent | EventAttribute | PotentiallyDecodable>'.

const decodedAttributes = decodeAttributes(convertedAttributes) as object;
Expand Down
5 changes: 0 additions & 5 deletions src/lib/models/event-history/to-event-history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const historyEvent = {

const namespace = 'unit-tests';
const settings = settingsFixture as unknown as Settings;
const accessToken = 'token-test';

describe('getEventAttributes', () => {
beforeEach(() => {
Expand All @@ -110,7 +109,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
});
expect(event.type).toBe(eventType);
});
Expand All @@ -123,7 +121,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
},
{
convertWithCodec,
Expand All @@ -141,7 +138,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings: { ...settings, codec: { endpoint: 'https://localhost' } },
accessToken,
},
{
convertWithCodec,
Expand All @@ -159,7 +155,6 @@ describe('getEventAttributes', () => {
historyEvent,
namespace,
settings,
accessToken,
},
{
convertWithCodec,
Expand Down
8 changes: 1 addition & 7 deletions src/lib/models/pending-activities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { get } from 'svelte/store';

import { page } from '$app/stores';

import { authUser } from '$lib/stores/auth-user';
import type {
PendingActivity,
PendingActivityWithMetadata,
Expand All @@ -16,7 +15,7 @@ import {
} from '$lib/utilities/decode-payload';

export async function getActivityAttributes(
{ activity, namespace, settings, accessToken }: PendingActivityWithMetadata,
{ activity, namespace, settings }: PendingActivityWithMetadata,
{
convertWithCodec = convertPayloadToJsonWithCodec,
decodeAttributes = decodePayloadAttributes,
Expand All @@ -26,7 +25,6 @@ export async function getActivityAttributes(
attributes: activity,
namespace,
settings,
accessToken,
});

const decodedAttributes = decodeAttributes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Argument of type 'EventAttribute | IFailure | PotentiallyDecodable' is not assignable to parameter of type 'Optional<WorkflowEvent | EventAttribute | PotentiallyDecodable>'.

Expand All @@ -39,13 +37,11 @@ const decodePendingActivity = async ({
activity,
namespace,
settings,
accessToken,
}: PendingActivityWithMetadata): Promise<PendingActivity> => {
const decodedActivity = await getActivityAttributes({
activity,
namespace,
settings,
accessToken,
});
return decodedActivity;
};
Expand All @@ -54,7 +50,6 @@ export const toDecodedPendingActivities = async (
workflow: WorkflowExecution,
namespace: string = get(page).params.namespace,
settings: Settings = get(page).data.settings,
accessToken: string = get(authUser).accessToken,
) => {
const pendingActivities = workflow?.pendingActivities ?? [];
const decodedActivities: PendingActivity[] = [];
Expand All @@ -63,7 +58,6 @@ export const toDecodedPendingActivities = async (
activity,
namespace,
settings,
accessToken,
});
decodedActivities.push(decodedActivity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import pendingActivityWorkflow from '$fixtures/workflow.pending-activities.json'

const namespace = 'unit-tests';
const settings = settingsFixture as unknown as Settings;
const accessToken = 'access-token';

describe('toDecodedPendingActivities', () => {
it('should decode heartbeatDetails', async () => {
Expand All @@ -19,7 +18,6 @@ describe('toDecodedPendingActivities', () => {
workflow,
namespace,
settings,
accessToken,
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Object is possibly 'null' or 'undefined'.
  • ⚠️ Object is possibly 'null' or 'undefined'.

expect(decodedHeartbeatDetails[0].heartbeatDetails.payloads[0]).toBe(2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Object is possibly 'null' or 'undefined'.
  • ⚠️ Object is possibly 'null' or 'undefined'.

Expand Down
2 changes: 0 additions & 2 deletions src/lib/pages/workflow-call-stack.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import { translate } from '$lib/i18n/translate';
import type { ParsedQuery } from '$lib/services/query-service';
import { getWorkflowStackTrace } from '$lib/services/query-service';
import { authUser } from '$lib/stores/auth-user';
import { refresh, workflowRun } from '$lib/stores/workflow-run';
import type { Eventual } from '$lib/types/global';

Expand All @@ -31,7 +30,6 @@
namespace,
},
page.data?.settings,
$authUser?.accessToken,
);

$effect(() => {
Expand Down
3 changes: 0 additions & 3 deletions src/lib/pages/workflow-query.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
getWorkflowMetadata,
type ParsedQuery,
} from '$lib/services/query-service';
import { authUser } from '$lib/stores/auth-user';
import { workflowRun } from '$lib/stores/workflow-run';
import type { Payloads } from '$lib/types';
import type { WorkflowInteractionDefinition } from '$lib/types/workflows';
Expand Down Expand Up @@ -84,7 +83,6 @@
},
},
settings,
$authUser?.accessToken,
);
$workflowRun.metadata = metadata;
};
Expand Down Expand Up @@ -121,7 +119,6 @@
queryArgs: payloads ? { payloads } : null,
},
$page.data?.settings,
$authUser?.accessToken,
).finally(() => {
reset();
});
Expand Down
Loading
Loading