@0xsequence/metadata 2.3.35 → 3.0.0-beta.2

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.
package/LICENSE CHANGED
@@ -1,20 +1,3 @@
1
- Copyright (c) 2017-present Horizon Blockchain Games Inc.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
-
16
- ------------------------------------------------------------------------
17
-
18
1
 
19
2
  Apache License
20
3
  Version 2.0, January 2004
package/README.md CHANGED
@@ -1,4 +1,3 @@
1
- @0xsequence/metadata
2
- ====================
1
+ # @0xsequence/metadata
3
2
 
4
3
  See [0xsequence project page](https://github.com/0xsequence/sequence.js).
@@ -1,5 +1,5 @@
1
- export * from "./metadata.gen.js";
2
- import { Metadata as MetadataRpc, Collections as CollectionsRpc } from "./metadata.gen.js";
1
+ export * from './metadata.gen';
2
+ import { Metadata as MetadataRpc, Collections as CollectionsRpc } from './metadata.gen';
3
3
  export declare class SequenceMetadata extends MetadataRpc {
4
4
  projectAccessKey?: string | undefined;
5
5
  jwtAuth?: string | undefined;
@@ -11,3 +11,4 @@ export declare class SequenceCollections extends CollectionsRpc {
11
11
  constructor(hostname?: string, jwtAuth?: string | undefined);
12
12
  _fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
13
13
  }
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAE9B,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEvF,qBAAa,gBAAiB,SAAQ,WAAW;IAGtC,gBAAgB,CAAC,EAAE,MAAM;IACzB,OAAO,CAAC,EAAE,MAAM;gBAFvB,QAAQ,GAAE,MAAwC,EAC3C,gBAAgB,CAAC,EAAE,MAAM,YAAA,EACzB,OAAO,CAAC,EAAE,MAAM,YAAA;IAMzB,MAAM,GAAI,OAAO,WAAW,EAAE,OAAO,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoBnE;CACF;AAED,qBAAa,mBAAoB,SAAQ,cAAc;IAG5C,OAAO,CAAC,EAAE,MAAM;gBADvB,QAAQ,GAAE,MAAwC,EAC3C,OAAO,CAAC,EAAE,MAAM,YAAA;IAMzB,MAAM,GAAI,OAAO,WAAW,EAAE,OAAO,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC,CAenE;CAIF"}
package/dist/index.js ADDED
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SequenceCollections = exports.SequenceMetadata = void 0;
18
+ __exportStar(require("./metadata.gen"), exports);
19
+ const metadata_gen_1 = require("./metadata.gen");
20
+ class SequenceMetadata extends metadata_gen_1.Metadata {
21
+ projectAccessKey;
22
+ jwtAuth;
23
+ constructor(hostname = 'https://metadata.sequence.app', projectAccessKey, jwtAuth) {
24
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
25
+ this.projectAccessKey = projectAccessKey;
26
+ this.jwtAuth = jwtAuth;
27
+ this.fetch = this._fetch;
28
+ }
29
+ _fetch = (input, init) => {
30
+ // automatically include jwt and access key auth header to requests
31
+ // if its been set on the client
32
+ const headers = {};
33
+ const jwtAuth = this.jwtAuth;
34
+ const projectAccessKey = this.projectAccessKey;
35
+ if (jwtAuth && jwtAuth.length > 0) {
36
+ headers['Authorization'] = `BEARER ${jwtAuth}`;
37
+ }
38
+ if (projectAccessKey && projectAccessKey.length > 0) {
39
+ headers['X-Access-Key'] = projectAccessKey;
40
+ }
41
+ // before the request is made
42
+ init.headers = { ...init.headers, ...headers };
43
+ return fetch(input, init);
44
+ };
45
+ }
46
+ exports.SequenceMetadata = SequenceMetadata;
47
+ class SequenceCollections extends metadata_gen_1.Collections {
48
+ jwtAuth;
49
+ constructor(hostname = 'https://metadata.sequence.app', jwtAuth) {
50
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
51
+ this.jwtAuth = jwtAuth;
52
+ this.fetch = this._fetch;
53
+ }
54
+ _fetch = (input, init) => {
55
+ // automatically include jwt auth header to requests
56
+ // if its been set on the client
57
+ const headers = {};
58
+ const jwtAuth = this.jwtAuth;
59
+ if (jwtAuth && jwtAuth.length > 0) {
60
+ headers['Authorization'] = `BEARER ${jwtAuth}`;
61
+ }
62
+ // before the request is made
63
+ init.headers = { ...init.headers, ...headers };
64
+ return fetch(input, init);
65
+ };
66
+ }
67
+ exports.SequenceCollections = SequenceCollections;