@letarette/client 0.1.6 → 0.1.7
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/lib/agent.d.ts +0 -1
- package/lib/agent.js +4 -3
- package/lib/docmanager.d.ts +2 -3
- package/lib/index.js +5 -1
- package/lib/monitor.d.ts +0 -1
- package/lib/natshelper.js +2 -3
- package/lib/protocol.d.ts +1 -1
- package/lib/protocol.js +5 -5
- package/package.json +7 -8
package/lib/agent.d.ts
CHANGED
package/lib/agent.js
CHANGED
|
@@ -9,10 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.SearchAgent = void 0;
|
|
13
|
+
exports.mergeResponses = mergeResponses;
|
|
13
14
|
const events_1 = require("events");
|
|
14
15
|
const monitor_1 = require("./monitor");
|
|
15
16
|
const natshelper_1 = require("./natshelper");
|
|
17
|
+
const protocol_1 = require("./protocol");
|
|
16
18
|
// A Letarette Search Agent
|
|
17
19
|
class SearchAgent extends events_1.EventEmitter {
|
|
18
20
|
constructor(URLs, options = { topic: "leta" }) {
|
|
@@ -108,7 +110,7 @@ function mergeResponses(responses) {
|
|
|
108
110
|
Respelt: "",
|
|
109
111
|
RespeltDistance: 0.0,
|
|
110
112
|
},
|
|
111
|
-
Status:
|
|
113
|
+
Status: protocol_1.SearchStatusCode.NoHit,
|
|
112
114
|
Duration: 0,
|
|
113
115
|
};
|
|
114
116
|
for (const response of responses) {
|
|
@@ -134,4 +136,3 @@ function mergeResponses(responses) {
|
|
|
134
136
|
});
|
|
135
137
|
return merged;
|
|
136
138
|
}
|
|
137
|
-
exports.mergeResponses = mergeResponses;
|
package/lib/docmanager.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { EventEmitter } from "events";
|
|
3
2
|
import { NATSOptions } from "./natshelper";
|
|
4
3
|
import { DocumentRequest, DocumentUpdate, IndexUpdate, IndexUpdateRequest } from "./protocol";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
export type IndexRequestHandler = (req: IndexUpdateRequest) => IndexUpdate;
|
|
5
|
+
export type DocumentRequestHandler = (req: DocumentRequest) => DocumentUpdate;
|
|
7
6
|
export declare class DocumentManager extends EventEmitter {
|
|
8
7
|
private client;
|
|
9
8
|
private readonly URLs;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/monitor.d.ts
CHANGED
package/lib/natshelper.js
CHANGED
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.connect = connect;
|
|
13
|
+
exports.getMaxPayload = getMaxPayload;
|
|
13
14
|
const fs_1 = require("fs");
|
|
14
15
|
const util_1 = require("util");
|
|
15
16
|
const ts_nats_1 = require("ts-nats");
|
|
@@ -39,9 +40,7 @@ function connect(URLs, options) {
|
|
|
39
40
|
return client;
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
exports.connect = connect;
|
|
43
43
|
function getMaxPayload(client) {
|
|
44
44
|
const cAsAny = client;
|
|
45
45
|
return cAsAny.maxPayload || 0;
|
|
46
46
|
}
|
|
47
|
-
exports.getMaxPayload = getMaxPayload;
|
package/lib/protocol.d.ts
CHANGED
package/lib/protocol.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SearchStatusCode = exports.IndexStatusCode = exports.version = void 0;
|
|
4
|
+
exports.indexStatusCodeToString = indexStatusCodeToString;
|
|
5
|
+
exports.searchStatusCodeToString = searchStatusCodeToString;
|
|
4
6
|
exports.version = "0.5.0";
|
|
5
7
|
// Codes returned in index status updates
|
|
6
8
|
var IndexStatusCode;
|
|
@@ -10,7 +12,7 @@ var IndexStatusCode;
|
|
|
10
12
|
IndexStatusCode[IndexStatusCode["Syncing"] = 74] = "Syncing";
|
|
11
13
|
IndexStatusCode[IndexStatusCode["IncompleteShardgroup"] = 75] = "IncompleteShardgroup";
|
|
12
14
|
IndexStatusCode[IndexStatusCode["IndexStatusIncompatible"] = 76] = "IndexStatusIncompatible";
|
|
13
|
-
})(IndexStatusCode
|
|
15
|
+
})(IndexStatusCode || (exports.IndexStatusCode = IndexStatusCode = {}));
|
|
14
16
|
function indexStatusCodeToString(code) {
|
|
15
17
|
switch (code) {
|
|
16
18
|
case IndexStatusCode.InSync:
|
|
@@ -27,7 +29,6 @@ function indexStatusCodeToString(code) {
|
|
|
27
29
|
return `unknown (${code})`;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
exports.indexStatusCodeToString = indexStatusCodeToString;
|
|
31
32
|
// Codes returned in search responses
|
|
32
33
|
var SearchStatusCode;
|
|
33
34
|
(function (SearchStatusCode) {
|
|
@@ -37,7 +38,7 @@ var SearchStatusCode;
|
|
|
37
38
|
SearchStatusCode[SearchStatusCode["Timeout"] = 45] = "Timeout";
|
|
38
39
|
SearchStatusCode[SearchStatusCode["QueryError"] = 46] = "QueryError";
|
|
39
40
|
SearchStatusCode[SearchStatusCode["ServerError"] = 47] = "ServerError";
|
|
40
|
-
})(SearchStatusCode
|
|
41
|
+
})(SearchStatusCode || (exports.SearchStatusCode = SearchStatusCode = {}));
|
|
41
42
|
function searchStatusCodeToString(code) {
|
|
42
43
|
switch (code) {
|
|
43
44
|
case SearchStatusCode.NoHit:
|
|
@@ -56,4 +57,3 @@ function searchStatusCodeToString(code) {
|
|
|
56
57
|
return `unknown (${code})`;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
exports.searchStatusCodeToString = searchStatusCodeToString;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letarette/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/erkkah/letarette.js"
|
|
6
|
+
"url": "git+https://github.com/erkkah/letarette.js.git"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -29,14 +29,13 @@
|
|
|
29
29
|
"lint": "tslint -p tsconfig.json"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/jest": "^
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"jest": "^
|
|
32
|
+
"@types/jest": "^30.0.0",
|
|
33
|
+
"@types/node": "^25.3.0",
|
|
34
|
+
"jest": "^30.2.0",
|
|
35
35
|
"minimist": ">=1.2.2",
|
|
36
|
-
"ts-jest": "^
|
|
36
|
+
"ts-jest": "^29.4.6",
|
|
37
37
|
"ts-node": "^10.2.1",
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^4.4.2"
|
|
38
|
+
"typescript": "^5.9.3"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"ts-nats": "^1.2.15"
|