@mdbase-dev/connect-dev 0.1.0-beta.21 → 0.1.0-beta.22

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.js +13 -7
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,17 +1,23 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { Ajv2020 } from "ajv/dist/2020.js";
3
- import { MdbaseCollectionClient, MdbaseConnectError } from "@mdbase-dev/connect";
3
+ import { MdbaseCollectionClient, connectError } from "@mdbase-dev/connect";
4
4
  import { isNativeRedirectUri } from "@mdbase-dev/connect-protocol";
5
5
  import appManifestSchema from "@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json" with { type: "json" };
6
+ import connectProblemSchema from "@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json" with { type: "json" };
6
7
  import dataContractSchema from "@mdbase-dev/connect-protocol/schemas/data-contract.schema.json" with { type: "json" };
7
8
  import connectProtocolSchema from "@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json" with { type: "json" };
9
+ import filesSchema from "@mdbase-dev/connect-protocol/schemas/files.v1.schema.json" with { type: "json" };
8
10
  const ajv = new Ajv2020({
9
11
  allErrors: true,
10
12
  strict: true,
11
- formats: { "date-time": true, uri: true }
13
+ // `required` may name properties declared by an enclosing allOf branch.
14
+ strictRequired: false,
15
+ formats: { "date-time": true, uri: true, uuid: true }
12
16
  });
13
17
  ajv.addSchema(appManifestSchema);
18
+ ajv.addSchema(connectProblemSchema);
14
19
  ajv.addSchema(dataContractSchema);
20
+ ajv.addSchema(filesSchema);
15
21
  ajv.addSchema(connectProtocolSchema);
16
22
  const appManifestValidator = requiredValidator(String(appManifestSchema.$id));
17
23
  const contractValidator = requiredValidator(String(dataContractSchema.$id));
@@ -154,7 +160,7 @@ export class SandboxTransport {
154
160
  case "rename":
155
161
  result = this.rename(object);
156
162
  break;
157
- default: throw new MdbaseConnectError("unsupported_operation", `Unsupported sandbox operation: ${operation}`);
163
+ default: throw connectError("unsupported_operation", `Unsupported sandbox operation: ${operation}`);
158
164
  }
159
165
  return clone(result);
160
166
  }
@@ -183,7 +189,7 @@ export class SandboxTransport {
183
189
  }
184
190
  query(input) {
185
191
  if (input.where !== undefined || input.order_by !== undefined) {
186
- throw new MdbaseConnectError("sandbox_unsupported", "The in-memory sandbox does not emulate CEL or ordering. Run this test against a real connector.");
192
+ throw connectError("sandbox_unsupported", "The in-memory sandbox does not emulate CEL or ordering. Run this test against a real connector.");
187
193
  }
188
194
  const types = Array.isArray(input.types)
189
195
  ? input.types.filter((value) => typeof value === "string")
@@ -541,7 +547,7 @@ function explicitTypes(frontmatter) {
541
547
  }
542
548
  function assertSafePath(path) {
543
549
  if (!path || path.startsWith("/") || path.includes("\\") || path.split("/").includes("..")) {
544
- throw new MdbaseConnectError("invalid_path", `Unsafe sandbox path: ${path}`);
550
+ throw connectError("invalid_path", `Unsafe sandbox path: ${path}`);
545
551
  }
546
552
  }
547
553
  function asObject(value) {
@@ -551,13 +557,13 @@ function asObject(value) {
551
557
  }
552
558
  function string(value, field) {
553
559
  if (typeof value !== "string" || value.length === 0) {
554
- throw new MdbaseConnectError("invalid_request", `${field} must be a non-empty string.`);
560
+ throw connectError("invalid_request", `${field} must be a non-empty string.`);
555
561
  }
556
562
  return value;
557
563
  }
558
564
  function integer(value, field, minimum) {
559
565
  if (!Number.isInteger(value) || Number(value) < minimum) {
560
- throw new MdbaseConnectError("invalid_request", `${field} must be an integer of at least ${minimum}.`);
566
+ throw connectError("invalid_request", `${field} must be an integer of at least ${minimum}.`);
561
567
  }
562
568
  return Number(value);
563
569
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/connect-dev",
3
- "version": "0.1.0-beta.21",
3
+ "version": "0.1.0-beta.22",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "ajv": "^8.20.0",
28
- "@mdbase-dev/connect": "0.1.0-beta.21",
29
- "@mdbase-dev/connect-protocol": "0.1.0-beta.21"
28
+ "@mdbase-dev/connect": "0.1.0-beta.22",
29
+ "@mdbase-dev/connect-protocol": "0.1.0-beta.22"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^24.0.0",