@tstdl/base 0.90.80 → 0.90.82

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.
@@ -54,11 +54,12 @@ export function compileClient(definition, options = defaultOptions) {
54
54
  const endpointsEntries = normalizedApiDefinitionEndpointsEntries(endpoints);
55
55
  for (const [name, endpoint] of endpointsEntries) {
56
56
  const methods = isArray(endpoint.method) ? endpoint.method : [endpoint.method ?? 'GET'];
57
- const resource = getFullApiEndpointResource({ api: definition, endpoint, defaultPrefix: options.prefix });
57
+ let resource;
58
58
  const hasGet = methods.includes('GET');
59
59
  const fallbackMethod = methods.find((method) => method != 'GET') ?? 'GET';
60
60
  const apiEndpointFunction = {
61
61
  async [name](parameters, requestBody) {
62
+ resource ??= getFullApiEndpointResource({ api: definition, endpoint, defaultPrefix: options.prefix });
62
63
  const context = { endpoint };
63
64
  const method = (hasGet && isUndefined(parameters)) ? 'GET' : fallbackMethod;
64
65
  if (endpoint.result == ServerSentEvents) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.90.80",
3
+ "version": "0.90.82",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -131,7 +131,7 @@
131
131
  "typedoc": "0.25",
132
132
  "typedoc-plugin-missing-exports": "2.2",
133
133
  "typescript": "5.4",
134
- "typescript-eslint": "7.10"
134
+ "typescript-eslint": "7.11"
135
135
  },
136
136
  "peerDependencies": {
137
137
  "@elastic/elasticsearch": "^8.13",
@@ -146,7 +146,7 @@
146
146
  "koa": "^2.15",
147
147
  "minio": "^8.0",
148
148
  "mjml": "^4.15",
149
- "mongodb": "^6.6",
149
+ "mongodb": "^6.7",
150
150
  "nodemailer": "^6.9",
151
151
  "playwright": "^1.44",
152
152
  "preact": "^10.22",
@@ -6,17 +6,10 @@ var UrlBuilderPartType;
6
6
  UrlBuilderPartType[UrlBuilderPartType["Literal"] = 0] = "Literal";
7
7
  UrlBuilderPartType[UrlBuilderPartType["Parameter"] = 1] = "Parameter";
8
8
  })(UrlBuilderPartType || (UrlBuilderPartType = {}));
9
- const urlParseRegex = /(?<literal>[^:]+|:\/+)|:(?<parameter>[\w-]+)/ug;
10
- const isFullUrlRegex = /^\w+:\/\//u;
9
+ const urlParseRegex = /(?<literal>[^:]+|:\/+|:\d[^:]+)|:(?<parameter>[\w-]+)/ug;
11
10
  export function compileUrlBuilder(url) {
12
11
  const parts = [];
13
- const isFullUrl = isFullUrlRegex.test(url);
14
12
  let parseUrl = url;
15
- if (isFullUrl) {
16
- const { origin } = new URL(url);
17
- parts.push({ type: UrlBuilderPartType.Literal, value: origin });
18
- parseUrl = url.slice(origin.length);
19
- }
20
13
  const matches = parseUrl.matchAll(urlParseRegex);
21
14
  for (const { groups } of matches) {
22
15
  const { literal, parameter } = groups;