destinyitemmanager / bungie-api-ts Goto Github PK
View Code? Open in Web Editor NEWTypeScript definitions for the Bungie.net API
License: MIT License
TypeScript definitions for the Bungie.net API
License: MIT License
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
.
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/
getPostGameCarnageReport needs to direct to https://stats.bungie.net
existing www.
is hitting double redirects to stats.
and then to https and losing headers and also bungie dont like that
Please push button for Bungie-net/api@6f3bb4c
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
}
});
}
Need to figure out how to watch another repo?
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 🙏
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.