wapi-client 0.15.8 → 0.16.0-beta.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/dist/api/base-client.browser.cjs +62 -41
- package/dist/api/base-client.browser.js +62 -41
- package/dist/api/base-client.cjs +62 -41
- package/dist/api/base-client.js +62 -41
- package/dist/api/http-client.browser.cjs +13 -13
- package/dist/api/http-client.browser.js +14 -14
- package/dist/api/http-client.cjs +13 -13
- package/dist/api/http-client.js +14 -14
- package/dist/api/ws-client.browser.cjs +2 -2
- package/dist/api/ws-client.browser.js +2 -2
- package/dist/api/ws-client.cjs +2 -2
- package/dist/api/ws-client.js +2 -2
- package/dist/client-options.schema.zod.browser.cjs +12 -17
- package/dist/client-options.schema.zod.browser.js +12 -17
- package/dist/client-options.schema.zod.cjs +15 -21
- package/dist/client-options.schema.zod.js +12 -17
- package/dist/client.browser.cjs +19 -5
- package/dist/client.browser.js +19 -5
- package/dist/client.cjs +19 -5
- package/dist/client.js +19 -5
- package/dist/lib/env.browser.cjs +1 -1
- package/dist/lib/env.browser.js +1 -1
- package/dist/lib/env.cjs +1 -1
- package/dist/lib/env.js +1 -1
- package/dist/lib/errors.browser.cjs +5 -0
- package/dist/lib/errors.browser.js +5 -0
- package/dist/lib/errors.cjs +5 -0
- package/dist/lib/errors.js +5 -0
- package/dist/lib/utils.browser.cjs +10 -4
- package/dist/lib/utils.browser.js +10 -4
- package/dist/lib/utils.cjs +11 -4
- package/dist/lib/utils.js +10 -4
- package/dist/types/wapi-client.d.ts +79 -52
- package/dist/wapi-client-web.iife.js +7 -7
- package/dist/wapi-client.browser.cjs +4 -6
- package/dist/wapi-client.browser.js +5 -10
- package/dist/wapi-client.cjs +4 -6
- package/dist/wapi-client.iife.js +7 -7
- package/dist/wapi-client.js +5 -10
- package/package.json +2 -2
|
@@ -58,21 +58,19 @@ var import_aggregate_query_builder = require("./lib/query-builder/aggregate-quer
|
|
|
58
58
|
var import_reverse_query_builder = require("./lib/query-builder/reverse-query-builder.browser.cjs");
|
|
59
59
|
var import_update_query_builder = require("./lib/query-builder/update-query-builder.browser.cjs");
|
|
60
60
|
(0, import_polyfill.initPolyfills)();
|
|
61
|
-
var
|
|
62
|
-
var zodHTTPSConnectionValidator = (0, import_validation.getValidator)(import_client_options_schema_zod.httpsConnectionSchema);
|
|
61
|
+
var connectionValidator = (0, import_validation.getValidator)(import_client_options_schema_zod.connectionSchema);
|
|
63
62
|
var WapiClientType = {
|
|
64
63
|
ws: "ws",
|
|
65
64
|
https: "https"
|
|
66
65
|
};
|
|
67
66
|
function create(options) {
|
|
68
67
|
const { config, client, connection } = options;
|
|
68
|
+
const validatedConnection = connectionValidator.validateInput(connection);
|
|
69
69
|
if ((client != null ? client : WapiClientType.ws) === WapiClientType.ws) {
|
|
70
|
-
|
|
71
|
-
return (0, import_client.createClientWithWS)(wsConnection, config);
|
|
70
|
+
return (0, import_client.createClientWithWS)(validatedConnection, config);
|
|
72
71
|
}
|
|
73
72
|
if (client === WapiClientType.https) {
|
|
74
|
-
|
|
75
|
-
return (0, import_client.createClientWithHttp)(httpsConnection, config);
|
|
73
|
+
return (0, import_client.createClientWithHttp)(validatedConnection, config);
|
|
76
74
|
}
|
|
77
75
|
throw new TypeError("Invalid client type");
|
|
78
76
|
}
|
|
@@ -4,10 +4,7 @@ import {
|
|
|
4
4
|
createClientWithHttp,
|
|
5
5
|
createClientWithWS
|
|
6
6
|
} from "./client.browser.js";
|
|
7
|
-
import {
|
|
8
|
-
httpsConnectionSchema,
|
|
9
|
-
wsConnectionSchema
|
|
10
|
-
} from "./client-options.schema.zod.browser.js";
|
|
7
|
+
import { connectionSchema } from "./client-options.schema.zod.browser.js";
|
|
11
8
|
import {
|
|
12
9
|
ERROR_MESSAGES as ErrorMessage,
|
|
13
10
|
ERROR_TYPES as ErrorType,
|
|
@@ -30,21 +27,19 @@ import { AggregateQueryBuilder } from "./lib/query-builder/aggregate-query-build
|
|
|
30
27
|
import { ReverseQueryBuilder } from "./lib/query-builder/reverse-query-builder.browser.js";
|
|
31
28
|
import { UpdateQueryBuilder } from "./lib/query-builder/update-query-builder.browser.js";
|
|
32
29
|
initPolyfills();
|
|
33
|
-
var
|
|
34
|
-
var zodHTTPSConnectionValidator = getValidator(httpsConnectionSchema);
|
|
30
|
+
var connectionValidator = getValidator(connectionSchema);
|
|
35
31
|
var WapiClientType = {
|
|
36
32
|
ws: "ws",
|
|
37
33
|
https: "https"
|
|
38
34
|
};
|
|
39
35
|
function create(options) {
|
|
40
36
|
const { config, client, connection } = options;
|
|
37
|
+
const validatedConnection = connectionValidator.validateInput(connection);
|
|
41
38
|
if ((client != null ? client : WapiClientType.ws) === WapiClientType.ws) {
|
|
42
|
-
|
|
43
|
-
return createClientWithWS(wsConnection, config);
|
|
39
|
+
return createClientWithWS(validatedConnection, config);
|
|
44
40
|
}
|
|
45
41
|
if (client === WapiClientType.https) {
|
|
46
|
-
|
|
47
|
-
return createClientWithHttp(httpsConnection, config);
|
|
42
|
+
return createClientWithHttp(validatedConnection, config);
|
|
48
43
|
}
|
|
49
44
|
throw new TypeError("Invalid client type");
|
|
50
45
|
}
|
package/dist/wapi-client.cjs
CHANGED
|
@@ -58,21 +58,19 @@ var import_aggregate_query_builder = require("./lib/query-builder/aggregate-que
|
|
|
58
58
|
var import_reverse_query_builder = require("./lib/query-builder/reverse-query-builder.cjs");
|
|
59
59
|
var import_update_query_builder = require("./lib/query-builder/update-query-builder.cjs");
|
|
60
60
|
(0, import_polyfill.initPolyfills)();
|
|
61
|
-
var
|
|
62
|
-
var zodHTTPSConnectionValidator = (0, import_validation.getValidator)(import_client_options_schema_zod.httpsConnectionSchema);
|
|
61
|
+
var connectionValidator = (0, import_validation.getValidator)(import_client_options_schema_zod.connectionSchema);
|
|
63
62
|
var WapiClientType = {
|
|
64
63
|
ws: "ws",
|
|
65
64
|
https: "https"
|
|
66
65
|
};
|
|
67
66
|
function create(options) {
|
|
68
67
|
const { config, client, connection } = options;
|
|
68
|
+
const validatedConnection = connectionValidator.validateInput(connection);
|
|
69
69
|
if ((client != null ? client : WapiClientType.ws) === WapiClientType.ws) {
|
|
70
|
-
|
|
71
|
-
return (0, import_client.createClientWithWS)(wsConnection, config);
|
|
70
|
+
return (0, import_client.createClientWithWS)(validatedConnection, config);
|
|
72
71
|
}
|
|
73
72
|
if (client === WapiClientType.https) {
|
|
74
|
-
|
|
75
|
-
return (0, import_client.createClientWithHttp)(httpsConnection, config);
|
|
73
|
+
return (0, import_client.createClientWithHttp)(validatedConnection, config);
|
|
76
74
|
}
|
|
77
75
|
throw new TypeError("Invalid client type");
|
|
78
76
|
}
|