eth-graph-query 1.0.63 → 1.1.1
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/README.md +0 -6
- package/dist/cjs/eth-graph-query.d.ts +41 -0
- package/dist/cjs/eth-graph-query.d.ts.map +1 -0
- package/dist/cjs/eth-graph-query.js +63 -0
- package/dist/cjs/eth-graph-query.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -40
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +18 -58
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/normal-query.d.ts +1 -1
- package/dist/cjs/normal-query.d.ts.map +1 -1
- package/dist/cjs/normal-query.js +6 -3
- package/dist/cjs/normal-query.js.map +1 -1
- package/dist/cjs/query-builder.d.ts +2 -2
- package/dist/cjs/query-builder.d.ts.map +1 -1
- package/dist/cjs/query-builder.js +4 -3
- package/dist/cjs/query-builder.js.map +1 -1
- package/dist/cjs/type.d.ts +9 -9
- package/dist/cjs/type.d.ts.map +1 -1
- package/dist/esm/eth-graph-query.d.ts +41 -0
- package/dist/esm/eth-graph-query.d.ts.map +1 -0
- package/dist/esm/eth-graph-query.js +59 -0
- package/dist/esm/eth-graph-query.js.map +1 -0
- package/dist/esm/index.d.ts +3 -40
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -58
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/normal-query.d.ts +1 -1
- package/dist/esm/normal-query.d.ts.map +1 -1
- package/dist/esm/normal-query.js +1 -1
- package/dist/esm/normal-query.js.map +1 -1
- package/dist/esm/query-builder.d.ts +2 -2
- package/dist/esm/query-builder.d.ts.map +1 -1
- package/dist/esm/query-builder.js +2 -2
- package/dist/esm/query-builder.js.map +1 -1
- package/dist/esm/type.d.ts +9 -9
- package/dist/esm/type.d.ts.map +1 -1
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/eth-graph-query.ts +55 -0
- package/src/index.ts +3 -55
- package/src/normal-query.ts +1 -1
- package/src/query-builder.ts +2 -2
package/README.md
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { NormalQuery } from './normal-query.js';
|
|
3
|
+
import { GraphParams, Metadata } from './type.js';
|
|
4
|
+
export declare class EthGraphQuery extends NormalQuery {
|
|
5
|
+
queryName: string;
|
|
6
|
+
/**
|
|
7
|
+
* The constructor for create a query instance.
|
|
8
|
+
* @param {string} rootUrl The url leading to the graph
|
|
9
|
+
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
10
|
+
*/
|
|
11
|
+
constructor(rootUrl: string, config?: AxiosRequestConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Given query string, returns the data respective with it.
|
|
14
|
+
* @param {string} query A query string containing all data you want to fetch
|
|
15
|
+
* @returns The data respective with the query string
|
|
16
|
+
*/
|
|
17
|
+
_fetch<T>(query: string): Promise<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a query to a particular collection, returns the data respective with the query data.
|
|
20
|
+
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
21
|
+
* 1. collection: string - collection name
|
|
22
|
+
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
23
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
24
|
+
* @returns The data respective with the query data
|
|
25
|
+
*/
|
|
26
|
+
query<T = any>(data: {
|
|
27
|
+
collection: string;
|
|
28
|
+
params?: GraphParams;
|
|
29
|
+
}, metadata?: Metadata): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a query to many collections, returns the data respective with the query data.
|
|
32
|
+
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
33
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
34
|
+
* @returns The data respective with the query data
|
|
35
|
+
*/
|
|
36
|
+
mergeQuery<T = any>(data: Array<{
|
|
37
|
+
collection: string;
|
|
38
|
+
params?: GraphParams;
|
|
39
|
+
}>, metadata?: Metadata): Promise<T>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=eth-graph-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-graph-query.d.ts","sourceRoot":"","sources":["../../src/eth-graph-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAKxD;;;;OAIG;IACG,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1C;;;;;;;OAOG;IACG,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAKzG;;;;;OAKG;IACG,UAAU,CAAC,CAAC,GAAG,GAAG,EACtB,IAAI,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC,EACzD,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,CAAC,CAAC;CAId"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EthGraphQuery = void 0;
|
|
13
|
+
const normal_query_js_1 = require("./normal-query.js");
|
|
14
|
+
const query_builder_js_1 = require("./query-builder.js");
|
|
15
|
+
class EthGraphQuery extends normal_query_js_1.NormalQuery {
|
|
16
|
+
/**
|
|
17
|
+
* The constructor for create a query instance.
|
|
18
|
+
* @param {string} rootUrl The url leading to the graph
|
|
19
|
+
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
20
|
+
*/
|
|
21
|
+
constructor(rootUrl, config) {
|
|
22
|
+
super(rootUrl, config);
|
|
23
|
+
this.queryName = 'query';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Given query string, returns the data respective with it.
|
|
27
|
+
* @param {string} query A query string containing all data you want to fetch
|
|
28
|
+
* @returns The data respective with the query string
|
|
29
|
+
*/
|
|
30
|
+
_fetch(query) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return yield this.post('', { query: query });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a query to a particular collection, returns the data respective with the query data.
|
|
37
|
+
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
38
|
+
* 1. collection: string - collection name
|
|
39
|
+
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
40
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
41
|
+
* @returns The data respective with the query data
|
|
42
|
+
*/
|
|
43
|
+
query(data, metadata) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const sQuery = query_builder_js_1.QueryBuilder.buildQuery({ collection: data.collection, params: data.params }, metadata);
|
|
46
|
+
return yield this._fetch(query_builder_js_1.QueryBuilder.makeFullQuery(sQuery, this.queryName));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a query to many collections, returns the data respective with the query data.
|
|
51
|
+
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
52
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
53
|
+
* @returns The data respective with the query data
|
|
54
|
+
*/
|
|
55
|
+
mergeQuery(data, metadata) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const sQuery = query_builder_js_1.QueryBuilder.mergeQuery(data, metadata);
|
|
58
|
+
return yield this._fetch(query_builder_js_1.QueryBuilder.makeFullQuery(sQuery, this.queryName));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.EthGraphQuery = EthGraphQuery;
|
|
63
|
+
//# sourceMappingURL=eth-graph-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-graph-query.js","sourceRoot":"","sources":["../../src/eth-graph-query.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,uDAAgD;AAChD,yDAAkD;AAGlD,MAAa,aAAc,SAAQ,6BAAW;IAG5C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAA2B;QACtD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACG,MAAM,CAAI,KAAa;;YAC3B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAuB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,KAAK,CAAU,IAAkD,EAAE,QAAmB;;YAC1F,MAAM,MAAM,GAAG,+BAAY,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;YACvG,OAAO,MAAM,IAAI,CAAC,MAAM,CAAI,+BAAY,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CACd,IAAyD,EACzD,QAAmB;;YAEnB,MAAM,MAAM,GAAG,+BAAY,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACvD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAI,+BAAY,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;CACF;AAhDD,sCAgDC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default class EthGraphQuery extends NormalQuery {
|
|
5
|
-
queryName: string;
|
|
6
|
-
/**
|
|
7
|
-
* The constructor for create a query instance.
|
|
8
|
-
* @param {string} rootUrl The url leading to the graph
|
|
9
|
-
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
10
|
-
*/
|
|
11
|
-
constructor(rootUrl: string, config?: AxiosRequestConfig);
|
|
12
|
-
/**
|
|
13
|
-
* Given query string, returns the data respective with it.
|
|
14
|
-
* @param {string} query A query string containing all data you want to fetch
|
|
15
|
-
* @returns The data respective with the query string
|
|
16
|
-
*/
|
|
17
|
-
_fetch<T>(query: string): Promise<T>;
|
|
18
|
-
/**
|
|
19
|
-
* Create a query to a particular collection, returns the data respective with the query data.
|
|
20
|
-
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
21
|
-
* 1. collection: string - collection name
|
|
22
|
-
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
23
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
24
|
-
* @returns The data respective with the query data
|
|
25
|
-
*/
|
|
26
|
-
query<T = any>(data: {
|
|
27
|
-
collection: string;
|
|
28
|
-
params?: GraphParams;
|
|
29
|
-
}, metadata?: Metadata): Promise<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a query to many collections, returns the data respective with the query data.
|
|
32
|
-
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
33
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
34
|
-
* @returns The data respective with the query data
|
|
35
|
-
*/
|
|
36
|
-
mergeQuery<T = any>(data: Array<{
|
|
37
|
-
collection: string;
|
|
38
|
-
params?: GraphParams;
|
|
39
|
-
}>, metadata?: Metadata): Promise<T>;
|
|
40
|
-
}
|
|
1
|
+
export { EthGraphQuery } from './eth-graph-query.js';
|
|
2
|
+
export * from './query-builder.js';
|
|
3
|
+
export * from './type.js';
|
|
41
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,62 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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);
|
|
10
15
|
};
|
|
11
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param {string} rootUrl The url leading to the graph
|
|
18
|
-
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
19
|
-
*/
|
|
20
|
-
constructor(rootUrl, config) {
|
|
21
|
-
super(rootUrl, config);
|
|
22
|
-
this.queryName = 'query';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Given query string, returns the data respective with it.
|
|
26
|
-
* @param {string} query A query string containing all data you want to fetch
|
|
27
|
-
* @returns The data respective with the query string
|
|
28
|
-
*/
|
|
29
|
-
_fetch(query) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return yield this.post('', { query: query });
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create a query to a particular collection, returns the data respective with the query data.
|
|
36
|
-
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
37
|
-
* 1. collection: string - collection name
|
|
38
|
-
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
39
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
40
|
-
* @returns The data respective with the query data
|
|
41
|
-
*/
|
|
42
|
-
query(data, metadata) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const sQuery = query_builder_1.default.buildQuery({ collection: data.collection, params: data.params }, metadata);
|
|
45
|
-
return yield this._fetch(query_builder_1.default.makeFullQuery(sQuery, this.queryName));
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create a query to many collections, returns the data respective with the query data.
|
|
50
|
-
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
51
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
52
|
-
* @returns The data respective with the query data
|
|
53
|
-
*/
|
|
54
|
-
mergeQuery(data, metadata) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const sQuery = query_builder_1.default.mergeQuery(data, metadata);
|
|
57
|
-
return yield this._fetch(query_builder_1.default.makeFullQuery(sQuery, this.queryName));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.default = EthGraphQuery;
|
|
17
|
+
exports.EthGraphQuery = void 0;
|
|
18
|
+
var eth_graph_query_js_1 = require("./eth-graph-query.js");
|
|
19
|
+
Object.defineProperty(exports, "EthGraphQuery", { enumerable: true, get: function () { return eth_graph_query_js_1.EthGraphQuery; } });
|
|
20
|
+
__exportStar(require("./query-builder.js"), exports);
|
|
21
|
+
__exportStar(require("./type.js"), exports);
|
|
62
22
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAqD;AAA5C,mHAAA,aAAa,OAAA;AACtB,qDAAmC;AACnC,4CAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normal-query.d.ts","sourceRoot":"","sources":["../../src/normal-query.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAEjE,eAAO,MAAM,aAAa;;;CAAqE,CAAC;AAMhG,
|
|
1
|
+
{"version":3,"file":"normal-query.d.ts","sourceRoot":"","sources":["../../src/normal-query.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAEjE,eAAO,MAAM,aAAa;;;CAAqE,CAAC;AAMhG,qBAAa,WAAW;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;cAKxC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;cAIrD,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB;cAIzE,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB;cAIxE,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;CAGtE"}
|
package/dist/cjs/normal-query.js
CHANGED
|
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.defaultHeader = void 0;
|
|
15
|
+
exports.NormalQuery = exports.defaultHeader = void 0;
|
|
13
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
const axios_1 = require("axios");
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
15
18
|
exports.defaultHeader = { Accept: 'application/json', 'Content-Type': 'application/json' };
|
|
16
19
|
function responseBody(res) {
|
|
17
20
|
return res.data;
|
|
@@ -42,5 +45,5 @@ class NormalQuery {
|
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
|
-
exports.
|
|
48
|
+
exports.NormalQuery = NormalQuery;
|
|
46
49
|
//# sourceMappingURL=normal-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normal-query.js","sourceRoot":"","sources":["../../src/normal-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normal-query.js","sourceRoot":"","sources":["../../src/normal-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,kDAAiE;AAEpD,QAAA,aAAa,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;AAEhG,SAAS,YAAY,CAAI,GAAqB;IAC5C,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC;AAED,MAAa,WAAW;IAItB,YAAY,OAAe,EAAE,MAA2B;QACtD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,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|
|
2
|
+
export declare class QueryBuilder {
|
|
3
3
|
private static isWhereOptions;
|
|
4
4
|
/**
|
|
5
5
|
* Create a query string from a query with json format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../../src/query-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAA0B,SAAS,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../../src/query-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAA0B,SAAS,EAAgB,MAAM,WAAW,CAAC;AAEhH,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAwB/C;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAYjE;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;IA8BhD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAuClG;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAYzG;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAU,GAAG,MAAM;CAGjE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.QueryBuilder = void 0;
|
|
4
|
+
const type_js_1 = require("./type.js");
|
|
4
5
|
class QueryBuilder {
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
static isWhereOptions(data) {
|
|
@@ -8,7 +9,7 @@ class QueryBuilder {
|
|
|
8
9
|
if (keys.length == 0)
|
|
9
10
|
return true;
|
|
10
11
|
for (const key of keys) {
|
|
11
|
-
if (!
|
|
12
|
+
if (!type_js_1.OptionKeys.includes(key))
|
|
12
13
|
return false;
|
|
13
14
|
}
|
|
14
15
|
return true;
|
|
@@ -197,5 +198,5 @@ class QueryBuilder {
|
|
|
197
198
|
return `query ${queryName} {${query}}`;
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
|
-
exports.
|
|
201
|
+
exports.QueryBuilder = QueryBuilder;
|
|
201
202
|
//# sourceMappingURL=query-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-builder.js","sourceRoot":"","sources":["../../src/query-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-builder.js","sourceRoot":"","sources":["../../src/query-builder.ts"],"names":[],"mappings":";;;AAAA,uCAAgH;AAEhH,MAAa,YAAY;IACvB,8DAA8D;IACtD,MAAM,CAAC,cAAc,CAAC,IAAS;QACrC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,CAAC,oBAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAC;SAC7C;QACD,OAAO,IAAI,CAAC;IACd,CAA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AAO,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;;gBACzD,OAAO,UAAU,CAAC;SACxB;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,IAAyD,EAAE,QAAmB;QAC9F,MAAM,OAAO,GAAkB,EAAE,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC7G,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,QAAQ,EAAE;YACZ,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;;gBACzD,OAAO,UAAU,CAAC;SACxB;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,SAAS,GAAG,OAAO;QACrD,OAAO,SAAS,SAAS,KAAK,KAAK,GAAG,CAAC;IACzC,CAAC;CACF;AAtKD,oCAsKC"}
|
package/dist/cjs/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
type BaseQueryType = Array<string> | string | number | boolean | undefined;
|
|
1
|
+
declare type BaseQueryType = Array<string> | string | number | boolean | undefined;
|
|
2
2
|
export declare const OptionKeys: string[];
|
|
3
|
-
export type OptionsKey = 'contains' | 'contains_nocase' | 'ends_with' | 'end_with_nocase' | 'starts_with' | 'starts_with_nocase' | 'not_contains' | 'not_contains_nocase' | 'not_ends_with' | 'not_ends_with_nocase' | 'not_starts_with' | 'not_starts_with_nocase' | 'gt' | 'gte' | 'lt' | 'lte' | 'not' | 'in' | 'not_in';
|
|
4
|
-
export type TextWhereOptions = {
|
|
3
|
+
export declare type OptionsKey = 'contains' | 'contains_nocase' | 'ends_with' | 'end_with_nocase' | 'starts_with' | 'starts_with_nocase' | 'not_contains' | 'not_contains_nocase' | 'not_ends_with' | 'not_ends_with_nocase' | 'not_starts_with' | 'not_starts_with_nocase' | 'gt' | 'gte' | 'lt' | 'lte' | 'not' | 'in' | 'not_in';
|
|
4
|
+
export declare type TextWhereOptions = {
|
|
5
5
|
contains?: BaseQueryType;
|
|
6
6
|
contains_nocase?: BaseQueryType;
|
|
7
7
|
ends_with?: BaseQueryType;
|
|
@@ -15,7 +15,7 @@ export type TextWhereOptions = {
|
|
|
15
15
|
not_starts_with?: BaseQueryType;
|
|
16
16
|
not_starts_with_nocase?: BaseQueryType;
|
|
17
17
|
};
|
|
18
|
-
export type CommonWhereOptions = {
|
|
18
|
+
export declare type CommonWhereOptions = {
|
|
19
19
|
gt?: BaseQueryType;
|
|
20
20
|
gte?: BaseQueryType;
|
|
21
21
|
lt?: BaseQueryType;
|
|
@@ -24,20 +24,20 @@ export type CommonWhereOptions = {
|
|
|
24
24
|
in?: BaseQueryType;
|
|
25
25
|
not_in?: BaseQueryType;
|
|
26
26
|
};
|
|
27
|
-
export type WhereOptions = TextWhereOptions & CommonWhereOptions;
|
|
28
|
-
export type QueryJson = {
|
|
27
|
+
export declare type WhereOptions = TextWhereOptions & CommonWhereOptions;
|
|
28
|
+
export declare type QueryJson = {
|
|
29
29
|
[key: string]: QueryJson | WhereOptions | BaseQueryType;
|
|
30
30
|
};
|
|
31
|
-
export type BlockQuery = {
|
|
31
|
+
export declare type BlockQuery = {
|
|
32
32
|
hash?: string;
|
|
33
33
|
number?: number;
|
|
34
34
|
number_gte?: number;
|
|
35
35
|
};
|
|
36
|
-
export type Metadata = {
|
|
36
|
+
export declare type Metadata = {
|
|
37
37
|
elements?: Array<'deployment' | 'hasIndexingErrors' | 'hash' | 'number' | 'timestamp'>;
|
|
38
38
|
blockQuery?: BlockQuery;
|
|
39
39
|
};
|
|
40
|
-
export type ElementType = string | {
|
|
40
|
+
export declare type ElementType = string | {
|
|
41
41
|
collection: string;
|
|
42
42
|
params?: GraphParams;
|
|
43
43
|
};
|
package/dist/cjs/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,aAAK,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3E,eAAO,MAAM,UAAU,UAoBtB,CAAC;AACF,oBAAY,UAAU,GAClB,UAAU,GACV,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,cAAc,GACd,qBAAqB,GACrB,eAAe,GACf,sBAAsB,GACtB,iBAAiB,GACjB,wBAAwB,GACxB,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,IAAI,GACJ,QAAQ,CAAC;AAEb,oBAAY,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,mBAAmB,CAAC,EAAE,aAAa,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,sBAAsB,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AAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { NormalQuery } from './normal-query.js';
|
|
3
|
+
import { GraphParams, Metadata } from './type.js';
|
|
4
|
+
export declare class EthGraphQuery extends NormalQuery {
|
|
5
|
+
queryName: string;
|
|
6
|
+
/**
|
|
7
|
+
* The constructor for create a query instance.
|
|
8
|
+
* @param {string} rootUrl The url leading to the graph
|
|
9
|
+
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
10
|
+
*/
|
|
11
|
+
constructor(rootUrl: string, config?: AxiosRequestConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Given query string, returns the data respective with it.
|
|
14
|
+
* @param {string} query A query string containing all data you want to fetch
|
|
15
|
+
* @returns The data respective with the query string
|
|
16
|
+
*/
|
|
17
|
+
_fetch<T>(query: string): Promise<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a query to a particular collection, returns the data respective with the query data.
|
|
20
|
+
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
21
|
+
* 1. collection: string - collection name
|
|
22
|
+
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
23
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
24
|
+
* @returns The data respective with the query data
|
|
25
|
+
*/
|
|
26
|
+
query<T = any>(data: {
|
|
27
|
+
collection: string;
|
|
28
|
+
params?: GraphParams;
|
|
29
|
+
}, metadata?: Metadata): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a query to many collections, returns the data respective with the query data.
|
|
32
|
+
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
33
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
34
|
+
* @returns The data respective with the query data
|
|
35
|
+
*/
|
|
36
|
+
mergeQuery<T = any>(data: Array<{
|
|
37
|
+
collection: string;
|
|
38
|
+
params?: GraphParams;
|
|
39
|
+
}>, metadata?: Metadata): Promise<T>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=eth-graph-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-graph-query.d.ts","sourceRoot":"","sources":["../../src/eth-graph-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAKxD;;;;OAIG;IACG,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1C;;;;;;;OAOG;IACG,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAKzG;;;;;OAKG;IACG,UAAU,CAAC,CAAC,GAAG,GAAG,EACtB,IAAI,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC,EACzD,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,CAAC,CAAC;CAId"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { NormalQuery } from './normal-query.js';
|
|
11
|
+
import { QueryBuilder } from './query-builder.js';
|
|
12
|
+
export class EthGraphQuery extends NormalQuery {
|
|
13
|
+
/**
|
|
14
|
+
* The constructor for create a query instance.
|
|
15
|
+
* @param {string} rootUrl The url leading to the graph
|
|
16
|
+
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
17
|
+
*/
|
|
18
|
+
constructor(rootUrl, config) {
|
|
19
|
+
super(rootUrl, config);
|
|
20
|
+
this.queryName = 'query';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Given query string, returns the data respective with it.
|
|
24
|
+
* @param {string} query A query string containing all data you want to fetch
|
|
25
|
+
* @returns The data respective with the query string
|
|
26
|
+
*/
|
|
27
|
+
_fetch(query) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.post('', { query: query });
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a query to a particular collection, returns the data respective with the query data.
|
|
34
|
+
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
35
|
+
* 1. collection: string - collection name
|
|
36
|
+
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
37
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
38
|
+
* @returns The data respective with the query data
|
|
39
|
+
*/
|
|
40
|
+
query(data, metadata) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const sQuery = QueryBuilder.buildQuery({ collection: data.collection, params: data.params }, metadata);
|
|
43
|
+
return yield this._fetch(QueryBuilder.makeFullQuery(sQuery, this.queryName));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a query to many collections, returns the data respective with the query data.
|
|
48
|
+
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
49
|
+
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
50
|
+
* @returns The data respective with the query data
|
|
51
|
+
*/
|
|
52
|
+
mergeQuery(data, metadata) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const sQuery = QueryBuilder.mergeQuery(data, metadata);
|
|
55
|
+
return yield this._fetch(QueryBuilder.makeFullQuery(sQuery, this.queryName));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=eth-graph-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth-graph-query.js","sourceRoot":"","sources":["../../src/eth-graph-query.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,OAAO,aAAc,SAAQ,WAAW;IAG5C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAA2B;QACtD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACG,MAAM,CAAI,KAAa;;YAC3B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAuB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,KAAK,CAAU,IAAkD,EAAE,QAAmB;;YAC1F,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;YACvG,OAAO,MAAM,IAAI,CAAC,MAAM,CAAI,YAAY,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CACd,IAAyD,EACzD,QAAmB;;YAEnB,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACvD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAI,YAAY,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;CACF"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default class EthGraphQuery extends NormalQuery {
|
|
5
|
-
queryName: string;
|
|
6
|
-
/**
|
|
7
|
-
* The constructor for create a query instance.
|
|
8
|
-
* @param {string} rootUrl The url leading to the graph
|
|
9
|
-
* @param {AxiosRequestConfig | undefined} config Config for base axios
|
|
10
|
-
*/
|
|
11
|
-
constructor(rootUrl: string, config?: AxiosRequestConfig);
|
|
12
|
-
/**
|
|
13
|
-
* Given query string, returns the data respective with it.
|
|
14
|
-
* @param {string} query A query string containing all data you want to fetch
|
|
15
|
-
* @returns The data respective with the query string
|
|
16
|
-
*/
|
|
17
|
-
_fetch<T>(query: string): Promise<T>;
|
|
18
|
-
/**
|
|
19
|
-
* Create a query to a particular collection, returns the data respective with the query data.
|
|
20
|
-
* @param {{ collection: string; params?: GraphParams }} data An data for create query, contains two elements:
|
|
21
|
-
* 1. collection: string - collection name
|
|
22
|
-
* 2. params: GraphParams | undefined - If it is defined, it create a query to the collection
|
|
23
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
24
|
-
* @returns The data respective with the query data
|
|
25
|
-
*/
|
|
26
|
-
query<T = any>(data: {
|
|
27
|
-
collection: string;
|
|
28
|
-
params?: GraphParams;
|
|
29
|
-
}, metadata?: Metadata): Promise<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a query to many collections, returns the data respective with the query data.
|
|
32
|
-
* @param {Array<{ collection: string; params?: GraphParams }>} data An array contain data to query to many collections
|
|
33
|
-
* @param {Metadata | undefined} metadata If it is defined, the query can get metadata that you defined
|
|
34
|
-
* @returns The data respective with the query data
|
|
35
|
-
*/
|
|
36
|
-
mergeQuery<T = any>(data: Array<{
|
|
37
|
-
collection: string;
|
|
38
|
-
params?: GraphParams;
|
|
39
|
-
}>, metadata?: Metadata): Promise<T>;
|
|
40
|
-
}
|
|
1
|
+
export { EthGraphQuery } from './eth-graph-query.js';
|
|
2
|
+
export * from './query-builder.js';
|
|
3
|
+
export * from './type.js';
|
|
41
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
|