alexanderwe / the-traveler Goto Github PK
View Code? Open in Web Editor NEWThe Traveler is a small npm package which wraps around the Destiny 2 API.
Home Page: https://alexanderwe.github.io/the-traveler/
License: MIT License
The Traveler is a small npm package which wraps around the Destiny 2 API.
Home Page: https://alexanderwe.github.io/the-traveler/
License: MIT License
I'm a front end web developer (mostly html/css/js/php) and I decided to dive into Node.js/Angular, so I'm definitely doing something wrong, there's no doubt about it. I'm just hoping somebody can help.
Any time I add this to app.component.ts:
`import Traveler from 'the-traveler';
import { ComponentType } from 'the-traveler/build/enums';
const traveler = new Traveler({
apikey: 'pasteYourAPIkey',
userAgent: 'yourUserAgent', //used to identify your request to the API
});`
It fails to compile, and I get this in cmd:
`ERROR in ./node_modules/aws-sign2/index.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\aws-sign2'
ERROR in ./node_modules/aws4/aws4.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\aws4'
ERROR in ./node_modules/ecc-jsbn/index.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\ecc-jsbn'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib'
ERROR in ./node_modules/http-signature/lib/verify.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib'
ERROR in ./node_modules/oauth-sign/index.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\oauth-sign'
ERROR in ./node_modules/request/lib/helpers.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib'
ERROR in ./node_modules/request/lib/hawk.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib'
ERROR in ./node_modules/request/lib/oauth.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib'
ERROR in ./node_modules/sshpk/lib/key.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/dhe.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/certificate.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/signature.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/fingerprint.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/identity.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/utils.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/private-key.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/sshpk/lib/formats/pem.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats'
ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats'
ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib\formats'
ERROR in ./node_modules/node-stream-zip/node_stream_zip.js
Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip'
ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\request\lib'
ERROR in ./node_modules/the-traveler/build/Traveler.js
Module not found: Error: Can't resolve 'fs' in 'D:\Coding\BitBucket\testiny\node_modules\the-traveler\build'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\http-signature\lib'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\request'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'http' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\request'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'https' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent'
ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\tough-cookie\lib'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent'
ERROR in ./node_modules/mime-types/index.js
Module not found: Error: Can't resolve 'path' in 'D:\Coding\BitBucket\testiny\node_modules\mime-types'
ERROR in ./node_modules/node-stream-zip/node_stream_zip.js
Module not found: Error: Can't resolve 'path' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip'
ERROR in ./node_modules/assert-plus/assert.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\assert-plus'
ERROR in ./node_modules/combined-stream/lib/combined_stream.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\combined-stream\lib'
ERROR in ./node_modules/delayed-stream/lib/delayed_stream.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\delayed-stream\lib'
ERROR in ./node_modules/isstream/isstream.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\isstream'
ERROR in ./node_modules/node-stream-zip/node_stream_zip.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\request'
ERROR in ./node_modules/sshpk/lib/ed-compat.js
Module not found: Error: Can't resolve 'stream' in 'D:\Coding\BitBucket\testiny\node_modules\sshpk\lib'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\Coding\BitBucket\testiny\node_modules\forever-agent'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\Coding\BitBucket\testiny\node_modules\tunnel-agent'
ERROR in ./node_modules/node-stream-zip/node_stream_zip.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Coding\BitBucket\testiny\node_modules\node-stream-zip'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Coding\BitBucket\testiny\node_modules\request'
i 「wdm」: Failed to compile.
ERROR in src/app/app.component.ts(3,1): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node
.
src/app/app.component.ts(4,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node
.`
Now if I'm putting it in the wrong place, let me know. I'm pretty new at this. And yes, I do have an API key.
Any help would be very appreciated.
Some of the enums have updated with the new release of the OpenAPI spec files.
For example the ActivityModeType now includes Raid and TrialsOfTheNine; however, these updates are not reflected in enums.ts.
| Software | Version(s) |
| OSX | Catalina |
| the-traveler -> 1.0.1 |
| Node 13 |
| Operating System |
OSX
Hey, not sure if this is bug, or i have somethign wrong in my code. But iam getting this error when i am calling getAccessToken()
TypeError: Right-hand side of 'instanceof' is not an object at normalize (normalize-arguments.js:153) at got (create.js:32) at Function.got.<computed> [as post] (create.js:64) at HttpService.js:44 at new Promise (<anonymous>) at HTTPService.post (HttpService.js:43) at OAuthResource.js:87 at new Promise (<anonymous>) at OAuthResource.getAccessToken (OAuthResource.js:86) at Module../src/components/Auth/OAuthReturn.js (OAuthReturn.js:13) at __webpack_require__ (bootstrap:785) at fn (bootstrap:150) at Module../src/index.js (index.css?e32c:37) at __webpack_require__ (bootstrap:785) at fn (bootstrap:150) at Object.1 (travelerClient.js:10) at __webpack_require__ (bootstrap:785) at checkDeferredModules (bootstrap:45) at Array.webpackJsonpCallback [as push] (bootstrap:32) at main.chunk.js:1
Iam trying just authorize my account on bungie. Iam used "create-react-app"to boostrap the basic project and then just import traveler..
I also can provide whole git with this project in case if it will be needed
Can download the manifest fine, but then when I then try to download the manifest again I get
Error: EPERM: operation not permitted, open 'mylongfilepath\world_sql_content_d122ea6e6d07e448d34868985f7a9cb9.content.zip'
Software | Version(s) |
---|---|
the-traveler | 0.7.2 |
Node | 8.9.0 |
Operating System | Windows 10 |
The property emblemBackgroundPath
of IDestinyCharacterComponent
should be spelled correctly.
The property emblemBackgroundPath
is currently spelled emplemBackgroundPath
.
N/A
The docs say:
If you want to use this package inside a ES5 project you can import it like so:
var Traveler = require('the-traveler').default;
const Enums = require('the-traveler/build/enums')
const traveler = new Traveler({
apikey: 'yourAPIkey',
userAgent: 'yourUserAgent' //used to identify your request to the API
});
//Access the enums (example componentType profiles)
var profilesType = Enums.ComponentType.Profiles;
But at least when I npm install the-traveler, my node_modules/the-traveler/build directory does not contains any "enums".
Make the IAPIResponse interface generic to correctly set the Response value type.
Implement post method Destiny2.PullFromPostmaster
After longer time of no updates - update library to reflect recent changes in the API.
Finish writing tests for each method of Traveler.ts
and HTTPService.ts
.
Software | Version(s) |
---|---|
the-traveler | 0.7.4 |
Node | 8.9.1 |
Operating System | Ubuntu Server 16.04 LTS |
Do you create a new traveler instance for each connected client?
I am, because you have to set traveler_instance.oauth
to the oAuth token that you get from Bungie. Wouldn't it make more sense to pass your oAuth key to any oAuth API calls that you make so that we only need a single instance of the-traveler?
Each one of my websocket clients has their own instance of the-traveler, plus the web-socket server has it's own instance for manafest management. It would be ideal if the-traveler did not rely on having the oAuth token set, but instead took it as a parameter when making oAuth API calls.
Implement Destiny2.ReportOffensivePostGameCarnageReportPlayer
Implement OAuth to have access to endpoints which require it
to ensure everything is returning the right interface
Related issues:
Software | Version(s) |
---|---|
the-traveler | 0.7.4 |
Node | 8.9.1 |
Operating System | Ubuntu Server 16.04 LTS |
Creating an instance of manifest
using the path to the manifest.content file should create an sqlite3 database handle to the manifest database as specified in the documentation
Process fails with the error
(node:31520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Manifest is not a constructor
const Manifest = require( 'the-traveler/build/Manifest' );
const manifest = new Manifest( __dirname + '/../destiny-2/manifest.content' );
const queryResult = await manifest.queryManifest( 'SELECT name FROM sqlite_master WHERE type="table"' );
console.log( queryResult );
due to issue #39 I manually unzipped the manifest, renamed it manifest.content, and placed it in the appropriate directory.
I'm trying to write a basic script to use getProfile to return my Destiny profile data. Here's my code.
const traveler = require('the-traveler'); const d2 = new traveler.default({ apikey: '67b5059f0dd947928a6af***********', userAgent: "Agent-Name", debug:true }) d2.destiny2.getProfile(3,"[My Destiny ID]",[100]).then(res => { console.log(res); })
It's spitting out this error.
{"ErrorCode":2102,"ThrottleSeconds":0,"ErrorStatus":"ApiKeyMissingFromRequest","Message":"Please add valid X-API-Key header to request. Visit https://www.bungie.net/developer for details.","MessageData":{}}
Any help is welcome.
Can https://www.bungie.net/Platform/GlobalAlerts/ be added? Would be pretty handy to get Status Reports 👍
The manifest now comes in a JSON format, tried to get this working but guessing it's only currently supported with .ZIP to extract the .content file.
Maybe needs to have two different ways of handling it depending on the file type, so both work 👍
Maybe switch the test file to typescript, to not use the build files to test.
Software | Version(s) |
---|---|
the-traveler | 1.0.1 |
Node | 10.16.0 |
Operating System | Windows 10 |
obtain the OAuth Access token with the getAccessToken() method
Using the sample given in the documentation
traveler.oauth.getAccessToken(hereComesTheCode).then(oauth => { // Provide your traveler object with the oauth object. This is later used for making authenticated calls traveler.oauth = oauth; }).catch(err => { console.log(err) })
Just changed hereComesTheCode to my own variable which has the code stored.
Implement the following POST mehtods:
Destiny2.TransferItem
Destiny2.EquipItem
Destiny2.EquipItems
Destiny2.SetItemLockState
Destiny2.InsertSocketPlug (implemented but not released from API side)
Destiny2.ActivateTalentNode (implemented but not released from API side)
Add OAuth to methods which require it
Software | Version(s) |
---|---|
the-traveler | 0.7.4 |
Node | 8.9.1 |
Operating System | Ubuntu Server 16.04 LTS |
Expected the downloadManifest
method to unzip the manifest file in the directory specified as stated in the documentation
an error results stating the unzipping the file failed.
(node:28670) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Error extracting zip
(node:28670) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
const result = await self.Destiny2.Api.getDestinyManifest();
const filepath = await self.Destiny2.Api.downloadManifest(result.Response.mobileWorldContentPaths.en, '../destiny-2/manifest.content' );
const manifest = new Manifest( filepath );
const queryResult = await manifest.queryManifest( 'SELECT name FROM sqlite_master WHERE type="table"' );
console.log( queryResult );
First, thank you for the package it's very helpful.
How can I help with implementing GetDestinyEntityDefinition request?
It would be a good thing to have a integrated way to access the Destiny Manifest right from the package
Suggestion: Can you make it delete the world_sql_content_version.content.zip after manifest.content has been made/updated? Would help clean up 👍
Could GetPublicVendors Endpoint be added sometime in the future? 👍
I think this is the new endpoint for the public Xur API!
Implement new features mentioned in the changelog of the API
Attempting to use the-traveler without es6-promise results in
'Error: Cannot find module 'es6-promise'
Call stack places the error at HttpService.js:3:1 and from looking at HttpService.ts there's an import for 'es6-promise'
I'm not entirely familiar with your project so I can't tell if the package.json should be updated so that it is no longer listed as a devdependency or if it is being included unnecessarily.
I saw your recent update and I wanted to give you a heads up on the ReportOffensivePostGameCarnageReportPlayer endpoint.
In the docs it lists the OAuth scope needed as BnetWrite. Our Applications can't get this scope so I created an Issue to ask about it.
Basically we can't use this endpoint. Details in the issue linked above.
Software | Version(s) |
---|---|
the-traveler | 0.7.4 |
Node | 8.9.1 |
Operating System | Ubuntu server 16.04 LTS |
Is there a method to getMembershipDataById? It seems like several endpoints are not yet implemented
I play on PC and using the searchDestinyPlayer( Enums.BungieMembershipType.All ) does not return my PC account, only my XBox account. This is evidently by design, as I'm not the only one who has noticed this behavior in the destiny 2 api. Even using Enums.BungieMembershipType.PC returns an empty array. I have read that using the getMembershipDataById endpoint will pull the PC account info.
I'm poking at the enums for the first time and I currently have:
const Enums = require('the-traveler/build/type-definitions');
console.log(Enums);
and the output is:
{
"App": {},
"User": {},
"Content": {},
"Forum": {},
"GroupV2": {},
"Destiny2": {},
"CommunityContent": {},
"Trending": {},
"Fireteam": {}
}
Naturally that seems wrong, so I dug into the package and it looks like there are interfaces.d.ts
files (https://github.com/alexanderwe/the-traveler/blob/master/src/type-definitions/destiny2/interfaces.ts for example) that are full of definitions sitting next to empty interfaces.js
files, which are the ones that actually get used. These are meant to be the generated files right? I'm not familiar with TypeScript but this is wrong yeah?
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.