Skip to content

Commit f43c90a

Browse files
committed
[sc-11365] transpile typescript files into javascript located in dist/
1 parent 5c6de1e commit f43c90a

15 files changed

+401
-209
lines changed

index.ts

-2
This file was deleted.

package-lock.json

+157-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,19 @@
2828
"url": "https://www.addsearch.com"
2929
}
3030
],
31-
"main": "index.js",
31+
"main": "dist/index.js",
3232
"jsdelivr": "./dist/addsearch-js-client.min.js",
3333
"types": "dist/types/index.d.ts",
3434
"files": [
3535
"dist",
36-
"index.d.ts",
37-
"src"
36+
"index.d.ts"
3837
],
3938
"scripts": {
40-
"build": "tsc && npm run test && webpack",
39+
"build": "npm run test && webpack && tsc",
4140
"watch": "webpack --watch",
4241
"watch:tsc": "tsc --watch",
4342
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
44-
"test": "./node_modules/mocha/bin/mocha.js --recursive --require @babel/register",
43+
"test": "mocha --recursive --require ts-node/register 'test/**/*.test.ts'",
4544
"lint": "eslint . --ext .ts,.js",
4645
"lint:fix": "eslint . --ext .ts,.js --fix",
4746
"lint:watch": "nodemon --exec 'npm run lint' --watch src --ext ts"
@@ -59,6 +58,7 @@
5958
"@babel/preset-env": "^7.23.9",
6059
"@babel/preset-typescript": "^7.26.0",
6160
"@babel/register": "^7.12.1",
61+
"@types/mocha": "^10.0.10",
6262
"@typescript-eslint/parser": "^8.18.1",
6363
"axios-mock-adapter": "^1.21.2",
6464
"babel-loader": "^9.1.2",
@@ -68,11 +68,12 @@
6868
"eslint-webpack-plugin": "^3.1.1",
6969
"esm": "^3.2.25",
7070
"fetch-mock": "^12.1.0",
71-
"mocha": "^10.0.0",
71+
"mocha": "^10.8.2",
7272
"nodemon": "^3.1.9",
7373
"prettier": "^3.3.3",
7474
"terser-webpack-plugin": "^5.3.1",
7575
"ts-loader": "^9.5.1",
76+
"ts-node": "^10.9.2",
7677
"typescript": "^5.7.2",
7778
"typescript-eslint": "^8.18.1",
7879
"uglify-js": "^3.12.0",

src/apifetch.ts

+27
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,33 @@ interface RecommendOptions {
1010
configurationKey?: string;
1111
}
1212

13+
export interface SearchResponseDocument {
14+
id: string;
15+
score: number;
16+
url: string;
17+
title: string;
18+
ts: string;
19+
images: {
20+
main: string;
21+
mainB64: string;
22+
capture: string;
23+
};
24+
categories: string[];
25+
type: string;
26+
custom_fields: Record<string, string>;
27+
document_type: string;
28+
meta_description: string;
29+
highlight: string;
30+
}
31+
32+
export interface SearchResponse {
33+
total_hits: number;
34+
hits: SearchResponseDocument[];
35+
facets: any;
36+
stats: any;
37+
response_time: number;
38+
}
39+
1340
interface Suggestion {
1441
value: string;
1542
}

0 commit comments

Comments
 (0)