@semiont/backend 0.2.39 → 0.2.41

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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @semiont/backend
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@semiont/backend.svg)](https://www.npmjs.com/package/@semiont/backend)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@semiont/backend.svg)](https://www.npmjs.com/package/@semiont/backend)
5
+ [![License](https://img.shields.io/npm/l/@semiont/backend.svg)](https://github.com/The-AI-Alliance/semiont/blob/main/LICENSE)
6
+
7
+ Pre-built Semiont backend server for npm consumption. This package contains the compiled backend application with Prisma schema and migrations.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install -g @semiont/backend
13
+ ```
14
+
15
+ This package is typically installed automatically by `semiont provision` when using the [Semiont CLI](https://www.npmjs.com/package/@semiont/cli).
16
+
17
+ ## Usage
18
+
19
+ The recommended way to run Semiont is through the CLI:
20
+
21
+ ```bash
22
+ npm install -g @semiont/cli
23
+ semiont init my-project
24
+ cd my-project
25
+ semiont provision
26
+ semiont start
27
+ ```
28
+
29
+ The CLI handles configuration, database setup, and process management.
30
+
31
+ ## Direct Usage
32
+
33
+ ```bash
34
+ semiont-backend
35
+ # or
36
+ node node_modules/@semiont/backend/dist/index.js
37
+ ```
38
+
39
+ Requires `DATABASE_URL` and other environment variables to be configured.
40
+
41
+ ## What's Included
42
+
43
+ - `dist/` - Compiled backend application (Hono server)
44
+ - `prisma/` - Prisma schema and migrations
45
+
46
+ ## Links
47
+
48
+ - [Semiont GitHub](https://github.com/The-AI-Alliance/semiont)
49
+ - [Semiont CLI](https://www.npmjs.com/package/@semiont/cli)
50
+ - [Documentation](https://github.com/The-AI-Alliance/semiont#readme)
package/dist/index.js CHANGED
@@ -3662,15 +3662,35 @@ var getValidatorLogger = /* @__PURE__ */ __name(() => getLogger().child({
3662
3662
  var ajv = new Ajv({
3663
3663
  allErrors: true,
3664
3664
  coerceTypes: true,
3665
- removeAdditional: false
3665
+ removeAdditional: false,
3666
+ keywords: [
3667
+ "example"
3668
+ ]
3666
3669
  });
3667
3670
  addFormats(ajv);
3671
+ function convertNullable(obj) {
3672
+ if (obj === null || obj === void 0 || typeof obj !== "object") return;
3673
+ const record = obj;
3674
+ if (record.nullable === true && typeof record.type === "string") {
3675
+ record.type = [
3676
+ record.type,
3677
+ "null"
3678
+ ];
3679
+ delete record.nullable;
3680
+ }
3681
+ for (const v of Object.values(record)) {
3682
+ if (typeof v === "object") convertNullable(v);
3683
+ }
3684
+ }
3685
+ __name(convertNullable, "convertNullable");
3668
3686
  var schemasLoaded = false;
3669
3687
  function loadSchemas() {
3670
3688
  if (schemasLoaded) return;
3671
3689
  for (const [name, schema] of Object.entries(openapi_default.components.schemas)) {
3672
3690
  try {
3673
- ajv.addSchema(schema, `#/components/schemas/${name}`);
3691
+ const converted = structuredClone(schema);
3692
+ convertNullable(converted);
3693
+ ajv.addSchema(converted, `#/components/schemas/${name}`);
3674
3694
  } catch (error) {
3675
3695
  getValidatorLogger().error("Failed to load schema", {
3676
3696
  schemaName: name,