intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
121 stars 156 forks source link

Extend the library to support TypeScript #33

Closed abisalehalliprasan closed 4 years ago

abisalehalliprasan commented 4 years ago

Goal : To be able to support typescript community

Ref : https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gapi.client.oauth2 https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/simple-oauth2

spencerwi commented 4 years ago

I think I can take a crack at it.

There are two ways to handle Typescript support:

  1. Include declaration file(s) in your own repo, and point the types property of package.json at the "root" type declaration file (or just name it index.d.ts). This makes everything "just work" out of the box for devs using Typescript, as the Typescript compiler will know where to find the type definition files when Typescript devs do const OAuthClient = require('intuit-oauth');

  2. Create declaration files, and submit them to DefinitelyTyped (the repo you linked to). In this case, Typescript developers will need to install a separate dev dependency from the @types namespace that corresponds to your library:

$ npm install --save-dev @types/intuit-oauth
abisalehalliprasan commented 4 years ago

@qjd2413 : Awesome. Just did that 👨‍💻. Appreciate that @qjd2413

spencerwi commented 4 years ago

Oh, shoot, I'm just a tiny bit late. womp womp, I'll find another issue.

abisalehalliprasan commented 4 years ago

@spencerwi: There might be more. I will keep you posted. Thank you.

29er commented 4 years ago

im kinda surprised you dont have these yet. anything on the horizon ?

abisalehalliprasan commented 4 years ago

@29er : We will be releasing the typescript version soon. Thanks.

jponc commented 4 years ago

@abisalehalliprasan did the TS types pushed through?

abisalehalliprasan commented 4 years ago

@jponc : We have a typescript branch but the code is not Production-ready yet. Ref : oauth-jsclient typescript

I cannot provide exact timelines on the release at the moment. But you are free to look at the sample example here if it helps.

jponc commented 4 years ago

No worries, thanks mate 👍

salvadorbarb1 commented 3 years ago

im kinda surprised you dont have these yet. anything on the horizon ?

ryannewton commented 3 years ago

Is this published?

I just tried running npm install --save-dev @types/intuit-oauth and I can't tell if I'm missing something or if it's still being developed.

ryannewton commented 3 years ago

@abisalehalliprasan Could you provide an update on this?

I'm just jumping into using intuit-oauth and am using Typescript. It'd be nice to have confirmation if I'm missing something or if this project got shelved.

abisalehalliprasan commented 3 years ago

Hi @ryannewton : There a few things which need to be tested before we release the typescript version. We will try to prioritize a release very soon. Thank you for your understanding!

jesuschris commented 3 years ago

Hello @abisalehalliprasan! Just checking in :dancers:

zenininja commented 2 years ago

Hi, What is the status of typescript type definition ? Could you please provide it ?

lsacco-nutreense commented 2 years ago

Hello @abisalehalliprasan...It's been almost 6 months since your last post and I don't see anything posted on NPM in this regard. This would be a big help for us. Thanks.

AshMartian commented 2 years ago

Quick work around for Typescript users.

This has not been fully tested, but seems to work. Someone should test this and make a PR as Typescript support here seems essential.

thesoftwarephilosopher commented 2 years ago

Why is this closed if it's not released (13 months later)?

GuiSim commented 2 years ago

@abisalehalliprasan can you comment on the current state of type definitions for TypeScript?

bluefire2121 commented 1 year ago

Bump

juanjalvarez commented 1 year ago

Quick work around for Typescript users.

  • Create a new folder in root of project types
  • New folder inside that called intuit-oauth
  • Reference this folder in tsconfig.json
...
        "types": [
            "intuit-oauth",
        ],
        "typeRoots": [ "./types", "./node_modules/@types"],
...
  • New file inside intuit-oauth called index.d.ts
  • I copied the type definitions from the typescript branch but was full of errors. Cleaned it up and it's eslint happy in this gist

This has not been fully tested, but seems to work. Someone should test this and make a PR as Typescript support here seems essential.

This worked perfectly for me, thank you!

tedyme commented 1 year ago

Really guys? Three+ years? That's totally not serious!

flare-autobots commented 1 year ago

@juanjalvarez does it work for production? I am having an issue.

2023-03-24T18:21:19.164Z    undefined   ERROR   Uncaught Exception  {
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module './development.js'\nRequire stack:\n- /var/task/node_modules/@dabh/diagnostics/node/index.js\n- /var/task/node_modules/winston/lib/winston/exception-handler.js\n- /var/task/node_modules/winston/lib/winston/logger.js\n- /var/task/node_modules/winston/lib/winston/create-logger.js\n- /var/task/node_modules/winston/lib/winston.js\n- /var/task/node_modules/intuit-oauth/src/OAuthClient.js\n- /var/task/src/functions/quickBooks/oauth/handler.js\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module './development.js'",
        "Require stack:",
        "- /var/task/node_modules/@dabh/diagnostics/node/index.js",
        "- /var/task/node_modules/winston/lib/winston/exception-handler.js",
        "- /var/task/node_modules/winston/lib/winston/logger.js",
        "- /var/task/node_modules/winston/lib/winston/create-logger.js",
        "- /var/task/node_modules/winston/lib/winston.js",
        "- /var/task/node_modules/intuit-oauth/src/OAuthClient.js",
        "- /var/task/src/functions/quickBooks/oauth/handler.js",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:996:17)",
        "    at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1031:21)",
        "    at async start (file:///var/runtime/index.mjs:1194:23)",
        "    at async file:///var/runtime/index.mjs:1200:1"
    ]
}
zahinz commented 9 months ago

Hello from Nov 2023...

yannickcare commented 8 months ago

26 Dec 2023 and this is still not implemented?

vinu-ablabs commented 7 months ago

Hello from 2024

egervari commented 7 months ago

It's essential to include TypeScript support. TypeScript, introduced in 2012 and further popularized by Angular in 2016, has become a cornerstone of modern development. With frameworks like NestJS leveraging its capabilities since 2017, it's evident that TypeScript is integral to contemporary programming practices. Given the significant financial transactions your customers conduct, the absence of TypeScript support seems unwarranted. It's high time for this support to be officially integrated.

AliHydr commented 5 months ago

I don't think they will introduce it anytime soon :(

ananay commented 5 months ago

lol, this isn't happening folks. it's time for us to step in

kuang commented 2 months ago

What's the status on this? @IntuitDeveloperRelations

jjuli93 commented 2 weeks ago

Why is this closed? Is there no plan on supporting typescript?

luis-ryestrategy commented 1 week ago

Is there a custom implementation somewhere? I don't think we're going to get an official one anytime soon