@caldik/client 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -693,7 +693,7 @@ function batchRequests(client, input) {
693
693
  for (const [key, request] of entries) {
694
694
  if (!/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/.test(key) || ["constructor", "prototype"].includes(key)) throw new Error("Invalid batch key");
695
695
  if (!(request instanceof CaldikRequest) || request.owner !== client || request.started || seen.has(request)) throw new Error("Batch values must be unstarted, distinct requests from the same Caldik client");
696
- if (request.descriptor.method !== "GET" && !/^\/plugins\/sdk\/[^/]+\/[^/]+$/.test(request.descriptor.path)) throw new Error("Batches support read requests only");
696
+ if (request.descriptor.method !== "GET" && !/^\/plugins\/sdk\/[a-zA-Z][a-zA-Z0-9_-]*\/[a-zA-Z][a-zA-Z0-9_-]*(?:\/[a-zA-Z][a-zA-Z0-9_-]*){0,3}$/.test(request.descriptor.path)) throw new Error("Batches support read requests only");
697
697
  seen.add(request);
698
698
  }
699
699
  } catch (error) {
@@ -831,7 +831,7 @@ function createPluginApi(client) {
831
831
  },
832
832
  apply(_target, _this, args) {
833
833
  while (args.length && args.at(-1) === void 0) args.pop();
834
- const path = `/plugins/sdk/${encodeURIComponent(namespace)}/${encodeURIComponent(keys.join("."))}`;
834
+ const path = `/plugins/sdk/${encodeURIComponent(namespace)}/${keys.map(encodeURIComponent).join("/")}`;
835
835
  if (keys.at(-1) === "subscribe") {
836
836
  const callbacks = args.at(-1);
837
837
  if (!callbacks || typeof callbacks !== "object" || Array.isArray(callbacks)) throw new Error("Provide subscription callbacks");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caldik/client",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",