@croct/sdk 0.18.1 → 0.18.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/channel/httpBeaconChannel.cjs +2 -1
- package/channel/httpBeaconChannel.js +2 -1
- package/constants.cjs +1 -1
- package/constants.d.cts +2 -2
- package/constants.d.ts +2 -2
- package/constants.js +1 -1
- package/contentFetcher.cjs +3 -3
- package/contentFetcher.js +3 -3
- package/evaluator.cjs +3 -3
- package/evaluator.js +3 -3
- package/package.json +5 -5
package/constants.cjs
CHANGED
|
@@ -25,7 +25,7 @@ __export(constants_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(constants_exports);
|
|
26
26
|
const BASE_ENDPOINT_URL = "https://api.croct.io";
|
|
27
27
|
const MAX_QUERY_LENGTH = parseInt("<@maxQueryLength@>", 10);
|
|
28
|
-
const VERSION = "0.18.
|
|
28
|
+
const VERSION = "0.18.2";
|
|
29
29
|
const CLIENT_LIBRARY = `Croct SDK JS v${VERSION}`;
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
31
|
0 && (module.exports = {
|
package/constants.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const BASE_ENDPOINT_URL = "https://api.croct.io";
|
|
2
2
|
declare const MAX_QUERY_LENGTH: number;
|
|
3
|
-
declare const VERSION = "0.18.
|
|
4
|
-
declare const CLIENT_LIBRARY = "Croct SDK JS v0.18.
|
|
3
|
+
declare const VERSION = "0.18.2";
|
|
4
|
+
declare const CLIENT_LIBRARY = "Croct SDK JS v0.18.2";
|
|
5
5
|
|
|
6
6
|
export { BASE_ENDPOINT_URL, CLIENT_LIBRARY, MAX_QUERY_LENGTH, VERSION };
|
package/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const BASE_ENDPOINT_URL = "https://api.croct.io";
|
|
2
2
|
declare const MAX_QUERY_LENGTH: number;
|
|
3
|
-
declare const VERSION = "0.18.
|
|
4
|
-
declare const CLIENT_LIBRARY = "Croct SDK JS v0.18.
|
|
3
|
+
declare const VERSION = "0.18.2";
|
|
4
|
+
declare const CLIENT_LIBRARY = "Croct SDK JS v0.18.2";
|
|
5
5
|
|
|
6
6
|
export { BASE_ENDPOINT_URL, CLIENT_LIBRARY, MAX_QUERY_LENGTH, VERSION };
|
package/constants.js
CHANGED
package/contentFetcher.cjs
CHANGED
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(contentFetcher_exports);
|
|
|
25
25
|
var import_constants = require('./constants.cjs');
|
|
26
26
|
var import_error = require('./error.cjs');
|
|
27
27
|
var import_logging = require('./logging/index.cjs');
|
|
28
|
+
var import_apiKey = require('./apiKey.cjs');
|
|
28
29
|
var import_help = require('./help.cjs');
|
|
29
30
|
var ContentErrorType = /* @__PURE__ */ ((ContentErrorType2) => {
|
|
30
31
|
ContentErrorType2["TIMEOUT"] = "https://croct.help/api/content#timeout";
|
|
@@ -44,14 +45,13 @@ class ContentFetcher {
|
|
|
44
45
|
throw new Error("Either the application ID or the API key must be provided.");
|
|
45
46
|
}
|
|
46
47
|
const { baseEndpointUrl } = configuration;
|
|
47
|
-
const
|
|
48
|
-
const baseEndpoint = (baseEndpointUrl ?? import_constants.BASE_ENDPOINT_URL).replace(/\/+$/, "") + (apiKey === void 0 ? "/client" : "/external") + "/web";
|
|
48
|
+
const baseEndpoint = (baseEndpointUrl ?? import_constants.BASE_ENDPOINT_URL).replace(/\/+$/, "") + (configuration.apiKey === void 0 ? "/client" : "/external") + "/web";
|
|
49
49
|
this.dynamicEndpoint = `${baseEndpoint}/content`;
|
|
50
50
|
this.staticEndpoint = `${baseEndpoint}/static-content`;
|
|
51
51
|
this.logger = configuration.logger ?? new import_logging.NullLogger();
|
|
52
52
|
this.configuration = {
|
|
53
53
|
appId: configuration.appId,
|
|
54
|
-
apiKey,
|
|
54
|
+
apiKey: configuration.apiKey !== void 0 ? import_apiKey.ApiKey.from(configuration.apiKey).getIdentifier() : configuration.apiKey,
|
|
55
55
|
defaultTimeout: configuration.defaultTimeout,
|
|
56
56
|
defaultPreferredLocale: configuration.defaultPreferredLocale
|
|
57
57
|
};
|
package/contentFetcher.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BASE_ENDPOINT_URL, CLIENT_LIBRARY } from "./constants.js";
|
|
2
2
|
import { formatMessage } from "./error.js";
|
|
3
3
|
import { NullLogger } from "./logging/index.js";
|
|
4
|
+
import { ApiKey } from "./apiKey.js";
|
|
4
5
|
import { Help } from "./help.js";
|
|
5
6
|
var ContentErrorType = /* @__PURE__ */ ((ContentErrorType2) => {
|
|
6
7
|
ContentErrorType2["TIMEOUT"] = "https://croct.help/api/content#timeout";
|
|
@@ -20,14 +21,13 @@ class ContentFetcher {
|
|
|
20
21
|
throw new Error("Either the application ID or the API key must be provided.");
|
|
21
22
|
}
|
|
22
23
|
const { baseEndpointUrl } = configuration;
|
|
23
|
-
const
|
|
24
|
-
const baseEndpoint = (baseEndpointUrl ?? BASE_ENDPOINT_URL).replace(/\/+$/, "") + (apiKey === void 0 ? "/client" : "/external") + "/web";
|
|
24
|
+
const baseEndpoint = (baseEndpointUrl ?? BASE_ENDPOINT_URL).replace(/\/+$/, "") + (configuration.apiKey === void 0 ? "/client" : "/external") + "/web";
|
|
25
25
|
this.dynamicEndpoint = `${baseEndpoint}/content`;
|
|
26
26
|
this.staticEndpoint = `${baseEndpoint}/static-content`;
|
|
27
27
|
this.logger = configuration.logger ?? new NullLogger();
|
|
28
28
|
this.configuration = {
|
|
29
29
|
appId: configuration.appId,
|
|
30
|
-
apiKey,
|
|
30
|
+
apiKey: configuration.apiKey !== void 0 ? ApiKey.from(configuration.apiKey).getIdentifier() : configuration.apiKey,
|
|
31
31
|
defaultTimeout: configuration.defaultTimeout,
|
|
32
32
|
defaultPreferredLocale: configuration.defaultPreferredLocale
|
|
33
33
|
};
|
package/evaluator.cjs
CHANGED
|
@@ -27,6 +27,7 @@ var import_constants = require('./constants.cjs');
|
|
|
27
27
|
var import_error = require('./error.cjs');
|
|
28
28
|
var import_sourceLocation = require('./sourceLocation.cjs');
|
|
29
29
|
var import_logging = require('./logging/index.cjs');
|
|
30
|
+
var import_apiKey = require('./apiKey.cjs');
|
|
30
31
|
var import_help = require('./help.cjs');
|
|
31
32
|
var EvaluationErrorType = /* @__PURE__ */ ((EvaluationErrorType2) => {
|
|
32
33
|
EvaluationErrorType2["TIMEOUT"] = "https://croct.help/api/evaluation#timeout";
|
|
@@ -57,12 +58,11 @@ const _Evaluator = class _Evaluator {
|
|
|
57
58
|
throw new Error("Either the application ID or the API key must be provided.");
|
|
58
59
|
}
|
|
59
60
|
const { baseEndpointUrl } = configuration;
|
|
60
|
-
|
|
61
|
-
this.endpoint = (baseEndpointUrl ?? import_constants.BASE_ENDPOINT_URL).replace(/\/+$/, "") + (apiKey === void 0 ? "/client" : "/external") + "/web/evaluate";
|
|
61
|
+
this.endpoint = (baseEndpointUrl ?? import_constants.BASE_ENDPOINT_URL).replace(/\/+$/, "") + (configuration.apiKey === void 0 ? "/client" : "/external") + "/web/evaluate";
|
|
62
62
|
this.logger = configuration.logger ?? new import_logging.NullLogger();
|
|
63
63
|
this.configuration = {
|
|
64
64
|
appId: configuration.appId,
|
|
65
|
-
apiKey,
|
|
65
|
+
apiKey: configuration.apiKey !== void 0 ? import_apiKey.ApiKey.from(configuration.apiKey).getIdentifier() : configuration.apiKey,
|
|
66
66
|
defaultTimeout: configuration.defaultTimeout
|
|
67
67
|
};
|
|
68
68
|
}
|
package/evaluator.js
CHANGED
|
@@ -2,6 +2,7 @@ import { BASE_ENDPOINT_URL, CLIENT_LIBRARY, MAX_QUERY_LENGTH } from "./constants
|
|
|
2
2
|
import { formatMessage } from "./error.js";
|
|
3
3
|
import { getLength, getLocation } from "./sourceLocation.js";
|
|
4
4
|
import { NullLogger } from "./logging/index.js";
|
|
5
|
+
import { ApiKey } from "./apiKey.js";
|
|
5
6
|
import { Help } from "./help.js";
|
|
6
7
|
var EvaluationErrorType = /* @__PURE__ */ ((EvaluationErrorType2) => {
|
|
7
8
|
EvaluationErrorType2["TIMEOUT"] = "https://croct.help/api/evaluation#timeout";
|
|
@@ -32,12 +33,11 @@ const _Evaluator = class _Evaluator {
|
|
|
32
33
|
throw new Error("Either the application ID or the API key must be provided.");
|
|
33
34
|
}
|
|
34
35
|
const { baseEndpointUrl } = configuration;
|
|
35
|
-
|
|
36
|
-
this.endpoint = (baseEndpointUrl ?? BASE_ENDPOINT_URL).replace(/\/+$/, "") + (apiKey === void 0 ? "/client" : "/external") + "/web/evaluate";
|
|
36
|
+
this.endpoint = (baseEndpointUrl ?? BASE_ENDPOINT_URL).replace(/\/+$/, "") + (configuration.apiKey === void 0 ? "/client" : "/external") + "/web/evaluate";
|
|
37
37
|
this.logger = configuration.logger ?? new NullLogger();
|
|
38
38
|
this.configuration = {
|
|
39
39
|
appId: configuration.appId,
|
|
40
|
-
apiKey,
|
|
40
|
+
apiKey: configuration.apiKey !== void 0 ? ApiKey.from(configuration.apiKey).getIdentifier() : configuration.apiKey,
|
|
41
41
|
defaultTimeout: configuration.defaultTimeout
|
|
42
42
|
};
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@croct/sdk",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "Croct SDK for JavaScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"esbuild-fix-imports-plugin": "^1.0.19",
|
|
88
88
|
"@croct/eslint-plugin": "^0.7.0",
|
|
89
|
-
"@types/jest": "^
|
|
89
|
+
"@types/jest": "^30.0.0",
|
|
90
90
|
"eslint": "^8.57.0",
|
|
91
91
|
"fetch-mock": "^9.11.0",
|
|
92
|
-
"jest": "^
|
|
93
|
-
"jest-environment-jsdom": "^
|
|
94
|
-
"jest-extended": "^
|
|
92
|
+
"jest": "^30.0.0",
|
|
93
|
+
"jest-environment-jsdom": "^30.0.0",
|
|
94
|
+
"jest-extended": "^6.0.0",
|
|
95
95
|
"node-fetch": "^2.6.7",
|
|
96
96
|
"ts-jest": "^29.0.3",
|
|
97
97
|
"tsup": "^8.4.0",
|