Giter Club home page Giter Club logo

book-sdk's People

Contributors

jaredtibs avatar jstewart avatar jwbrew avatar mkaszubowski avatar nlukic-blvd avatar opsb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nithisb

book-sdk's Issues

`Cannot use import statement outside a module` error when importing client

When attempting to run the following code with typescript using Node version 12.14.0

import { Blvd } from "@boulevard/blvd-book-sdk";

(async()=>{
    const API_KEY='...'
    const BUSINESS_ID = '09cf52dc-a001-4b9f-9f4a-198ddf23dcad'
    const client = new Blvd(API_KEY, BUSINESS_ID);

    const business = await client.businesses.get();
    const locations = await business.getLocations();

    console.log(locations)
})();

I get the following error:

import { GraphQLClient, gql as gql$1 } from 'graphql-request';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/alejandro/Documents/upk/upk-api/scripts/adhoc/run.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Module.m._compile (/Users/alejandro/Documents/upk/upk-api/node_modules/ts-node/src/index.ts:392:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:995:10)

I have also tried the import statement: const Blvd = require("@boulevard/blvd-book-sdk") and obtained the same error.

My package JSON is the following:

{
 "scripts": {
   "start": "ts-node app.ts",
    ...,
   "dependencies": {
        "@boulevard/blvd-book-sdk": "^1.0.37"
    },
   "devDependencies": {
      "ts-node": "3.3.0"
   } 
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.