Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for browser only (Svelte + Vite)? #1381

Closed
nine-2-five opened this issue Sep 20, 2024 · 12 comments · Fixed by microsoft/kiota#5477
Closed

Support for browser only (Svelte + Vite)? #1381

nine-2-five opened this issue Sep 20, 2024 · 12 comments · Fixed by microsoft/kiota#5477
Assignees
Labels
bug Something isn't working priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days type:bug A broken experience

Comments

@nine-2-five
Copy link

nine-2-five commented Sep 20, 2024

I have successfully tested a Kiota Typescript client in a standalone Node project ran with npx tsx index.ts.
However my requirement is to call this client from a Svelte (Vite bundled) app, and that is browser only.
Is there any chance this could happen, with current standings?

The plan was to use it from a Svelte SPA running inside MAUI HybridWebView.

@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Sep 20, 2024
@baywet
Copy link
Member

baywet commented Sep 20, 2024

Hi @nine-2-five
Thank you for using kiota and for reaching out.

While we have no tested this specific framework, the dependencies and the generated code are supposed to work both in a node or browser context.
Let us know if you have any additional comments or questions.

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question labels Sep 20, 2024
@nine-2-five
Copy link
Author

I got it to compile, but this pops out in browser:

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@microsoft_kiota-abstractions.js?v=80e0625c' does not provide an export named 'UntypedNode' (at index.ts:5:135)

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 20, 2024
@baywet
Copy link
Member

baywet commented Sep 23, 2024

Thank you for the additional information.

Can you run npm list @microsoft/kiota-abstractions and share what results you get please?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Sep 23, 2024
@nine-2-five
Copy link
Author

nine-2-five commented Sep 25, 2024

Sure, this the result:
(I don't know whether you saw in my initial post, but, the client is working fine in the Node environment):

├── @microsoft/[email protected]
├─┬ @microsoft/[email protected]
│ └── @microsoft/[email protected] deduped
├─┬ @microsoft/[email protected]
│ └── @microsoft/[email protected] deduped
├─┬ @microsoft/[email protected]
│ └── @microsoft/[email protected] deduped
├─┬ @microsoft/[email protected]
│ └── @microsoft/[email protected] deduped
└─┬ @microsoft/[email protected]
└── @microsoft/[email protected] deduped

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 25, 2024
@baywet
Copy link
Member

baywet commented Sep 25, 2024

Thank you for the additional information.
I wanted to confirm you were running on the latest version of the package.

Since UntypedNode is an interface, my guess is that it gets "erased at transpilation" but somehow something still refers to it. In the generated client, can you search for any reference to UntypedNode please and share how they are used here please?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Sep 25, 2024
@nine-2-five
Copy link
Author

nine-2-five commented Sep 25, 2024

It is referenced on multiple lines in client/models/index.ts (I'm using Google Place object)

export interface GOpeningHours extends Parsable {
    /**
     * The open_now property
     */
    openNow?: boolean | null;
    /**
     * The periods property
     */
    periods?: Period[] | null;
    /**
     * The weekday_text property
     */
    weekdayText?: UntypedNode | null;
}

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 25, 2024
@baywet
Copy link
Member

baywet commented Sep 25, 2024

Thank you for the additional information.

Can you also share the import for the untyped node please?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Sep 25, 2024
@nine-2-five
Copy link
Author

import { createUntypedNodeFromDiscriminatorValue, type AdditionalDataHolder, type Parsable, type ParseNode, type SerializationWriter, UntypedNode } from '@microsoft/kiota-abstractions';

@baywet
Copy link
Member

baywet commented Sep 26, 2024

Thank you for the additional information.
That's the issue, the import for UntypedNode should have a type marker as well.
Authored microsoft/kiota#5477 to address the issue in the generator.

@baywet baywet removed Needs: Attention 👋 type:question An issue that's a question labels Sep 26, 2024
@baywet baywet added bug Something isn't working type:bug A broken experience priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days labels Sep 26, 2024
@baywet baywet self-assigned this Sep 26, 2024
@baywet baywet moved this from Needs Triage 🔍 to In Progress 🚧 in Kiota Sep 26, 2024
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Sep 26, 2024
@nine-2-five
Copy link
Author

Do you know when this will be available in NPM?

@baywet
Copy link
Member

baywet commented Sep 29, 2024

It's not a change of the NPM package but of the generator.
Once the change is available with release 1.19 planned to go out on October the 4th, you'll need to refresh your client.

@nine-2-five
Copy link
Author

nine-2-five commented Sep 29, 2024

Ah, sorry, I thought I installed it globally by npm, but it was installed by dotnet cmd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants