GithubHelp home page GithubHelp logo

destinyitemmanager / bungie-api-ts Goto Github PK

View Code? Open in Web Editor NEW
106.0 106.0 21.0 9.78 MB

TypeScript definitions for the Bungie.net API

License: MIT License

Shell 0.09% TypeScript 90.74% JavaScript 9.18%
bungie bungie-api typescript-definitions

bungie-api-ts's People

Contributors

48klocs avatar archived-2f4dd0 avatar bhollis avatar delphiactual avatar dependabot[bot] avatar lauriys avatar nev-r avatar robojumper avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bungie-api-ts's Issues

`bungie-api-ts/common` is not exposed in the generated package.json's `exports` field

I’m trying to use BungieMembershipType from bungie-api-ts/common and webpack 5 is yelling at me:

Module not found: Error: Package path ./common is not exported from package ./node_modules/bungie-api-ts (see exports field in ./node_modules/bungie-api-ts/package.json)

At the moment I’m digging around to see if I can override the exports field with a plugin. Worst case scenario: I’ll hard-code the enum value. Not the end of the world, but it’s not Technically Correct™.

(Personal opinion: Given that 1. this module only exports ESM code and 2. the structure of the generated code perfectly matches what the exports field contains, the exports field can [again IMO] probably be omitted. One less thing to maintain!)

Thank you for this fantastic package 🙏

Error require() of ES Module when importing functions

Hello, I'm trying to get the manifest with the example in the readme but when I do the imports, I get error for require() of ES Module.

To reproduce it:

import { getDestinyManifest, getDestinyManifestSlice } from 'bungie-api-ts/destiny2';
console.log(getDestinyManifest);

the console.log it's for reproduce the problem

Error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /destiny2-api/node_modules/bungie-api-ts/destiny2/index.js from /destiny2-api/src/manifest/index.ts not supported.
Instead change the require of index.js in /destiny2-api/src/manifest/index.ts to a dynamic import() which is available in all CommonJS modules.
    at Object.nodeDevHook [as .js] (/destiny2-api/node_modules/ts-node-dev/lib/hook.js:63:13)
    at Object.<anonymous> (/destiny2-api/src/manifest/index.ts:42:18)
    at Module._compile (/destiny2-api/node_modules/source-map-support/source-map-support.js:568:25)
    at Module.m._compile (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:69:33)
    at require.extensions.<computed> (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:71:20)
    at Object.nodeDevHook [as .ts] (/destiny2-api/node_modules/ts-node-dev/lib/hook.js:63:13)
    at Object.<anonymous> (/destiny2-api/src/prueba/prueba.router.ts:47:34)
    at Module._compile (/destiny2-api/node_modules/source-map-support/source-map-support.js:568:25)
    at Module.m._compile (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:69:33)
    at require.extensions.<computed> (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:71:20)
    at Object.nodeDevHook [as .ts] (/destiny2-api/node_modules/ts-node-dev/lib/hook.js:63:13)
    at Object.<anonymous> (/destiny2-api/src/index.ts:29:23)
    at Module._compile (/destiny2-api/node_modules/source-map-support/source-map-support.js:568:25)
    at Module.m._compile (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:69:33)
    at require.extensions.<computed> (/private/var/folders/1m/j_r9mhw56_g26n_8dxw1dkdc0000gn/T/ts-node-dev-hook-8312512297435408.js:71:20)
    at Object.nodeDevHook [as .ts] (/destiny2-api/node_modules/ts-node-dev/lib/hook.js:63:13)
    at Object.<anonymous> (/destiny2-api/node_modules/ts-node-dev/lib/wrap.js:104:1)
    at Module._compile (/destiny2-api/node_modules/source-map-support/source-map-support.js:568:25)
[ERROR] 19:27:02 Error: require() of ES Module /destiny2-api/node_modules/bungie-api-ts/destiny2/index.js from /destiny2-api/src/manifest/index.ts not supported.

If I import types and use them there is no problem, the problem is when I import any function like getDestinyManifest.

getMembersOfGroup does not pass all parameters to endpoint

Specifically: currentpage is a required property in GetMembersOfGroupParams but is not passed to the endpoint:

function getMembersOfGroup(http, params) {
    return http({
        method: 'GET',
        url: "https://www.bungie.net/Platform/GroupV2/" + params.groupId + "/Members/",
        params: {
            memberType: params.memberType,
            nameSearch: params.nameSearch
        }
    });
}

Can't use with isolated modules

I'm new to typescript, so I don't fully understand this compilation error:

Type error: Cannot access ambient const enums when the '--isolatedModules' flag is provided.

  83 |             const playerResp = await searchDestinyPlayer($http, {
  84 |                 displayName: encodeURIComponent(name),
> 85 |                 membershipType: BungieMembershipType.All,
     |                                 ^
  86 |             })
  87 |             if (!playerResp.Response.length) {
  88 |                 console.log("Couldn't find player (retry?)")

but it led me here:
https://ncjamieson.com/dont-export-const-enums/

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.