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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment last merged 馃憤 thanks for TS #24

Closed
matigumma opened this issue Sep 19, 2022 · 6 comments
Closed

comment last merged 馃憤 thanks for TS #24

matigumma opened this issue Sep 19, 2022 · 6 comments

Comments

@matigumma
Copy link

iv been trying last merged with typescript and get this observations:

  • i think should update "version": "0.3.1" to 0.3.2 maybe?
  • at package.json i have to change export types as:
    { ..., "types": "./dist/types/index.d.ts", ... }
    to avoid msg at import * from 'surrealdb.js' // error: Cannot find module 'surrealdb.js' or its corresponding type declarations.

its not easy to understand the use flow (for me)
iv been using like this at server side (nextjs api)

import Surreal from 'surrealdb.js';

const db = new Surreal('https://surreal...:8000/rpc');

try {
      await sdb.use('test', 'test');

      await sdb.signin({
        user: 'root',
        pass: 'root',
      })

      const r = await sdb.query('INFO FOR DB;');
      console.log(r) // successful 
} catch (e) { ... }

my question is,, thats ok?

what about authentication?
how to setup auth?
how about tokens?

ty in advance!

@VixieTSQ
Copy link

Version will likely be incremented once the new changes are ready to push to NPM. Pushing to npm will also probably fix the Cannot find module error I've been told. The code example you gave looks sane to me!

@mathe42
Copy link
Contributor

mathe42 commented Sep 19, 2022

We had the big PR merged yesterday but it is currently not released to npm. (For deno you can use https://raw.githubusercontent.com/surrealdb/surrealdb.js/main/mod.ts as the import to test it).

To test this for node do the following:

  1. clone this repo
  2. run npm i
  3. run npm run build
  4. create a new file in this folder (for example testing.ts) there you can import the module with import Surreal from '.'

@gotjoshua
Copy link

currently not released to npm

Is there an ETA on that? Me===eager

@mathe42
Copy link
Contributor

mathe42 commented Sep 20, 2022

@gotjoshua was expected yesterday but somehow it wasn't. Was published to Deno but not npm... You can use mathe42.surrealbd.js as a drop in replacement (for now).

@tobiemh
Copy link
Member

tobiemh commented Sep 20, 2022

SHould be published now @ NPM and DENO

@tobiemh tobiemh closed this as completed Sep 20, 2022
@tobiemh
Copy link
Member

tobiemh commented Sep 20, 2022

@mathe42 forgot to npm publish 馃槚 .

Would be great to get npm publish as a GitHub workflow action whenever a tag is published in future!

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

No branches or pull requests

5 participants