@0xsequence/metadata 0.0.0-20231117190010 → 0.0.0-20231121142317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -262,28 +262,8 @@ const buildResponse = res => {
|
|
|
262
262
|
|
|
263
263
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
264
264
|
class SequenceMetadataClient extends Metadata {
|
|
265
|
-
constructor(hostname = 'https://metadata.sequence.app'
|
|
265
|
+
constructor(hostname = 'https://metadata.sequence.app') {
|
|
266
266
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
267
|
-
this._fetch = (input, init) => {
|
|
268
|
-
// automatically include jwt and access key auth header to requests
|
|
269
|
-
// if its been set on the api client
|
|
270
|
-
const headers = {};
|
|
271
|
-
const jwtAuth = this.jwtAuth;
|
|
272
|
-
const projectAccessKey = this.projectAccessKey;
|
|
273
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
274
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
275
|
-
}
|
|
276
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
277
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// before the request is made
|
|
281
|
-
init.headers = _extends({}, init.headers, headers);
|
|
282
|
-
return fetch(input, init);
|
|
283
|
-
};
|
|
284
|
-
this.projectAccessKey = _projectAccessKey;
|
|
285
|
-
this.jwtAuth = _jwtAuth;
|
|
286
|
-
this.fetch = this._fetch;
|
|
287
267
|
}
|
|
288
268
|
}
|
|
289
269
|
|
|
@@ -262,28 +262,8 @@ const buildResponse = res => {
|
|
|
262
262
|
|
|
263
263
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
264
264
|
class SequenceMetadataClient extends Metadata {
|
|
265
|
-
constructor(hostname = 'https://metadata.sequence.app'
|
|
265
|
+
constructor(hostname = 'https://metadata.sequence.app') {
|
|
266
266
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
267
|
-
this._fetch = (input, init) => {
|
|
268
|
-
// automatically include jwt and access key auth header to requests
|
|
269
|
-
// if its been set on the api client
|
|
270
|
-
const headers = {};
|
|
271
|
-
const jwtAuth = this.jwtAuth;
|
|
272
|
-
const projectAccessKey = this.projectAccessKey;
|
|
273
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
274
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
275
|
-
}
|
|
276
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
277
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// before the request is made
|
|
281
|
-
init.headers = _extends({}, init.headers, headers);
|
|
282
|
-
return fetch(input, init);
|
|
283
|
-
};
|
|
284
|
-
this.projectAccessKey = _projectAccessKey;
|
|
285
|
-
this.jwtAuth = _jwtAuth;
|
|
286
|
-
this.fetch = this._fetch;
|
|
287
267
|
}
|
|
288
268
|
}
|
|
289
269
|
|
|
@@ -258,28 +258,8 @@ const buildResponse = res => {
|
|
|
258
258
|
|
|
259
259
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
260
260
|
class SequenceMetadataClient extends Metadata {
|
|
261
|
-
constructor(hostname = 'https://metadata.sequence.app'
|
|
261
|
+
constructor(hostname = 'https://metadata.sequence.app') {
|
|
262
262
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
263
|
-
this._fetch = (input, init) => {
|
|
264
|
-
// automatically include jwt and access key auth header to requests
|
|
265
|
-
// if its been set on the api client
|
|
266
|
-
const headers = {};
|
|
267
|
-
const jwtAuth = this.jwtAuth;
|
|
268
|
-
const projectAccessKey = this.projectAccessKey;
|
|
269
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
270
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
271
|
-
}
|
|
272
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
273
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// before the request is made
|
|
277
|
-
init.headers = _extends({}, init.headers, headers);
|
|
278
|
-
return fetch(input, init);
|
|
279
|
-
};
|
|
280
|
-
this.projectAccessKey = _projectAccessKey;
|
|
281
|
-
this.jwtAuth = _jwtAuth;
|
|
282
|
-
this.fetch = this._fetch;
|
|
283
263
|
}
|
|
284
264
|
}
|
|
285
265
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export * from "./metadata.gen.js";
|
|
2
2
|
import { Metadata as MetadataRpc } from "./metadata.gen.js";
|
|
3
3
|
export declare class SequenceMetadataClient extends MetadataRpc {
|
|
4
|
-
|
|
5
|
-
jwtAuth?: string | undefined;
|
|
6
|
-
constructor(hostname?: string, projectAccessKey?: string | undefined, jwtAuth?: string | undefined);
|
|
7
|
-
_fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
constructor(hostname?: string);
|
|
8
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/metadata",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20231121142317",
|
|
4
4
|
"description": "metadata sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/metadata",
|
|
6
6
|
"source": "src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -5,34 +5,7 @@ import { Metadata as MetadataRpc } from './metadata.gen'
|
|
|
5
5
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch
|
|
6
6
|
|
|
7
7
|
export class SequenceMetadataClient extends MetadataRpc {
|
|
8
|
-
constructor(
|
|
9
|
-
hostname: string = 'https://metadata.sequence.app',
|
|
10
|
-
public projectAccessKey?: string,
|
|
11
|
-
public jwtAuth?: string
|
|
12
|
-
) {
|
|
8
|
+
constructor(hostname: string = 'https://metadata.sequence.app') {
|
|
13
9
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
|
|
14
|
-
this.fetch = this._fetch
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => {
|
|
18
|
-
// automatically include jwt and access key auth header to requests
|
|
19
|
-
// if its been set on the api client
|
|
20
|
-
const headers: { [key: string]: any } = {}
|
|
21
|
-
|
|
22
|
-
const jwtAuth = this.jwtAuth
|
|
23
|
-
const projectAccessKey = this.projectAccessKey
|
|
24
|
-
|
|
25
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
26
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
30
|
-
headers['X-Access-Key'] = projectAccessKey
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// before the request is made
|
|
34
|
-
init!.headers = { ...init!.headers, ...headers }
|
|
35
|
-
|
|
36
|
-
return fetch(input, init)
|
|
37
10
|
}
|
|
38
11
|
}
|