Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 6b9e354

Browse files
authored
Fixed compiler for node and for browser (#9)
1 parent 9c985c3 commit 6b9e354

File tree

186 files changed

+11103
-8345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+11103
-8345
lines changed

dist/apisearch.js

Lines changed: 2004 additions & 1046 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.node.js

Lines changed: 0 additions & 6994 deletions
This file was deleted.

dist/apisearch.node.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/apisearch.node.min.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

dist/apisearch.node.min.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/Apisearch.d.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { KeyValueCache } from "./Cache/KeyValueCache";
2+
import { Coordinate } from "./Model/Coordinate";
3+
import { ItemUUID } from "./Model/ItemUUID";
4+
import { Query } from "./Query/Query";
5+
import { SortBy } from "./Query/SortBy";
6+
import { Repository } from "./Repository/Repository";
7+
import { Result } from "./Result/Result";
8+
/**
9+
* Apisearch class
10+
*/
11+
export default class Apisearch {
12+
/**
13+
* Constructor
14+
*
15+
* @param config
16+
*
17+
* @returns {Repository}
18+
*/
19+
static createRepository(config: {
20+
app_id: string;
21+
index_id: string;
22+
token: string;
23+
options: {
24+
endpoint?: string;
25+
api_version?: string;
26+
timeout?: number;
27+
override_queries?: boolean;
28+
cache?: KeyValueCache;
29+
};
30+
}): Repository;
31+
/**
32+
* Created located
33+
*
34+
* @param coordinate
35+
* @param queryText
36+
* @param page
37+
* @param size
38+
*
39+
* @returns {Query}
40+
*/
41+
static createQueryLocated(coordinate: Coordinate, queryText: string, page?: number, size?: number): Query;
42+
/**
43+
* Create
44+
*
45+
* @param queryText
46+
* @param page
47+
* @param size
48+
*
49+
* @returns {Query}
50+
*/
51+
static createQuery(queryText: string, page?: number, size?: number): Query;
52+
/**
53+
* Create match all
54+
*
55+
* @return {Query}
56+
*/
57+
static createQueryMatchAll(): Query;
58+
/**
59+
* Create by UUID
60+
*
61+
* @param uuid
62+
*
63+
* @return {Query}
64+
*/
65+
static createQueryByUUID(uuid: ItemUUID): Query;
66+
/**
67+
* Create by UUIDs
68+
*
69+
* @param uuids
70+
*
71+
* @return {Query}
72+
*/
73+
static createQueryByUUIDs(...uuids: ItemUUID[]): Query;
74+
/**
75+
* Create empty result
76+
*
77+
* @return {Result}
78+
*/
79+
static createEmptyResult(): Result;
80+
/**
81+
* Create empty sortby
82+
*
83+
* @return {SortBy}
84+
*/
85+
static createEmptySortBy(): SortBy;
86+
}

lib/Apisearch.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
"use strict";
2+
var __assign = (this && this.__assign) || Object.assign || function(t) {
3+
for (var s, i = 1, n = arguments.length; i < n; i++) {
4+
s = arguments[i];
5+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6+
t[p] = s[p];
7+
}
8+
return t;
9+
};
10+
exports.__esModule = true;
11+
var NoCache_1 = require("./Cache/NoCache");
12+
var AxiosClient_1 = require("./Http/AxiosClient");
13+
var RetryMap_1 = require("./Http/RetryMap");
14+
var Query_1 = require("./Query/Query");
15+
var Query_2 = require("./Query/Query");
16+
var Query_3 = require("./Query/Query");
17+
var SortBy_1 = require("./Query/SortBy");
18+
var HttpRepository_1 = require("./Repository/HttpRepository");
19+
var ResultAggregations_1 = require("./Result/ResultAggregations");
20+
var Result_1 = require("./Result/Result");
21+
var Transformer_1 = require("./Transformer/Transformer");
22+
/**
23+
* Apisearch class
24+
*/
25+
var Apisearch = /** @class */ (function () {
26+
function Apisearch() {
27+
}
28+
/**
29+
* Constructor
30+
*
31+
* @param config
32+
*
33+
* @returns {Repository}
34+
*/
35+
Apisearch.createRepository = function (config) {
36+
config.options = __assign({ api_version: "v1", cache: new NoCache_1.NoCache(), timeout: 10000, override_queries: true }, config.options);
37+
/**
38+
* Client
39+
*/
40+
var httpClient = new AxiosClient_1.AxiosClient(config.options.endpoint, config.options.api_version, config.options.timeout, new RetryMap_1.RetryMap(), config.options.override_queries, config.options.cache);
41+
return new HttpRepository_1.HttpRepository(httpClient, config.app_id, config.index_id, config.token, new Transformer_1.Transformer());
42+
};
43+
/**
44+
* Created located
45+
*
46+
* @param coordinate
47+
* @param queryText
48+
* @param page
49+
* @param size
50+
*
51+
* @returns {Query}
52+
*/
53+
Apisearch.createQueryLocated = function (coordinate, queryText, page, size) {
54+
if (page === void 0) { page = Query_2.QUERY_DEFAULT_PAGE; }
55+
if (size === void 0) { size = Query_3.QUERY_DEFAULT_SIZE; }
56+
return Query_1.Query.createLocated(coordinate, queryText, page, size);
57+
};
58+
/**
59+
* Create
60+
*
61+
* @param queryText
62+
* @param page
63+
* @param size
64+
*
65+
* @returns {Query}
66+
*/
67+
Apisearch.createQuery = function (queryText, page, size) {
68+
if (page === void 0) { page = Query_2.QUERY_DEFAULT_PAGE; }
69+
if (size === void 0) { size = Query_3.QUERY_DEFAULT_SIZE; }
70+
return Query_1.Query.create(queryText, page, size);
71+
};
72+
/**
73+
* Create match all
74+
*
75+
* @return {Query}
76+
*/
77+
Apisearch.createQueryMatchAll = function () {
78+
return Query_1.Query.createMatchAll();
79+
};
80+
/**
81+
* Create by UUID
82+
*
83+
* @param uuid
84+
*
85+
* @return {Query}
86+
*/
87+
Apisearch.createQueryByUUID = function (uuid) {
88+
return Query_1.Query.createByUUID(uuid);
89+
};
90+
/**
91+
* Create by UUIDs
92+
*
93+
* @param uuids
94+
*
95+
* @return {Query}
96+
*/
97+
Apisearch.createQueryByUUIDs = function () {
98+
var uuids = [];
99+
for (var _i = 0; _i < arguments.length; _i++) {
100+
uuids[_i] = arguments[_i];
101+
}
102+
return Query_1.Query.createByUUIDs.apply(Query_1.Query, uuids);
103+
};
104+
/**
105+
* Create empty result
106+
*
107+
* @return {Result}
108+
*/
109+
Apisearch.createEmptyResult = function () {
110+
return Result_1.Result.create(Apisearch.createQueryMatchAll(), 0, 0, new ResultAggregations_1.ResultAggregations(0), [], []);
111+
};
112+
/**
113+
* Create empty sortby
114+
*
115+
* @return {SortBy}
116+
*/
117+
Apisearch.createEmptySortBy = function () {
118+
return SortBy_1.SortBy.create();
119+
};
120+
return Apisearch;
121+
}());
122+
exports["default"] = Apisearch;

0 commit comments

Comments
 (0)