Skip to content

Conversation

@tomalexing
Copy link

@tomalexing tomalexing commented Oct 11, 2023

Closes #580

Description

I was able to make all the requests working (useRunDetails, useEventDetails, useEventRunDetails, useEventRunStatuses, useRunStatuses ).
You may see it at src/routes/+page.svetle as example.
If you run pnpm dev you will see something like this.

eventId - clng4a4yw000iugoom6jd8lnc
status1 - SUCCESS

status2 - SUCCESS

{
."run": {
.."id": "clng4a4yw000iugoom6jd8lnc",
.."status": "SUCCESS",
.."output": {
..."message": "Hello world!"
..}
.},
."statuses": []
}

Also I added statuses request as it is in react package.
This package is able to do pnpm build and package.
P.S.
Because of this package uses core package , it should has module format (esm) as output. Vite and svelte-kit for some reason cant import cjs. Please see core/tsup.config.ts and core/package.json.
The app is working and all other packages should be working.

Should I create some docs?

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2023

⚠️ No Changeset found

Latest commit: 9406349

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tomalexing
Copy link
Author

tomalexing commented Oct 11, 2023

Ex1 useEventDetails

<script lang="ts"  >
  import { useEventDetails} from '@trigger.dev/svelte'
  import { type GetEvent } from '@trigger.dev/core';
  let useEventDetailsData: GetEvent;
  let useEventDetailsError: Error;

  const event = useEventDetails('test:test.event:1696688090005');
  event.subscribe(e => {
	 if(e.error){
	 	useEventDetailsError = e.error as Error;
	 }
		
	 if(e.data){
	 	useEventDetailsData = e.data;
	 }
 })

 </script>
 {#if !useEventDetailsData}
	Loading...
 {/if}
 {#if useEventDetailsError}
	{useEventDetailsError.message}
 {/if}
 {#if useEventDetailsData}
 <div>
	<h1>{useEventDetailsData.name}</h1>
	<p>Runs: {useEventDetailsData.runs?.length}</p>
	<div>
		{#each useEventDetailsData.runs as run}
		  <div>
			<p>
			  Run {run.id}: {run.status}
			</p>
		  </div>
		{/each}
	</div>
  </div>
 {/if}

@ericallam ericallam changed the base branch from main to features/svelte December 6, 2023 13:52
@ericallam ericallam merged commit 9c6bf1b into triggerdotdev:features/svelte Dec 6, 2023
@ericallam ericallam mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TRI-1375] [TRI-1376] Svelte hooks (like the @trigger.dev/react package)

3 participants