@fedify/vocab-tools 2.5.0-dev.2619 → 2.5.0-dev.2664

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.5.0-dev.2619+88aa7efd",
3
+ "version": "2.5.0-dev.2664+4790a72e",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
@@ -26,7 +26,7 @@
26
26
  ]
27
27
  },
28
28
  "tasks": {
29
- "check": "deno fmt --check && deno lint && deno check src/*.ts",
29
+ "check": "deno fmt --check && deno check src/*.ts",
30
30
  "test": "deno test -A"
31
31
  }
32
32
  }
package/dist/mod.cjs CHANGED
@@ -8,7 +8,7 @@ let yaml = require("yaml");
8
8
  let es_toolkit = require("es-toolkit");
9
9
  //#region deno.json
10
10
  var name = "@fedify/vocab-tools";
11
- var version = "2.5.0-dev.2619+88aa7efd";
11
+ var version = "2.5.0-dev.2664+4790a72e";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -710,7 +710,7 @@ async function loadSchema(path) {
710
710
  const errors = [];
711
711
  if (result.valid) return schema;
712
712
  for (const e of result.errors) errors.push(new SchemaError(path, `${path}:${e.instanceLocation}: ${e.error}`));
713
- throw new AggregateError(errors);
713
+ throw new AggregateError(errors, "Invalid schema data");
714
714
  }
715
715
  /**
716
716
  * Loads all schema files in the directory.
@@ -739,7 +739,7 @@ async function loadSchemaFiles(dir) {
739
739
  }
740
740
  result[schema.uri] = schema;
741
741
  }
742
- if (errors.length > 0) throw new AggregateError(errors);
742
+ if (errors.length > 0) throw new AggregateError(errors, "Failed to load schema files");
743
743
  const entries = Object.entries(result);
744
744
  entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
745
745
  return Object.fromEntries(entries);
@@ -2964,10 +2964,10 @@ async function* generateClass(typeUri, types, moduleVarNames) {
2964
2964
  for await (const code of generateInspectorPostClass(typeUri, types)) yield code;
2965
2965
  }
2966
2966
  function* generateEntityTypeHelpers(sortedTypeUris, types) {
2967
- const entityTypes = sortedTypeUris.filter((typeUri) => types[typeUri].entity).map((typeUri) => ({
2967
+ const entityTypes = sortedTypeUris.flatMap((typeUri) => types[typeUri].entity ? [{
2968
2968
  name: types[typeUri].name,
2969
2969
  uri: typeUri
2970
- }));
2970
+ }] : []);
2971
2971
  const entityTypeNames = entityTypes.map((entityType) => entityType.name);
2972
2972
  yield `/**
2973
2973
  * Constructor types for all generated vocabulary entity classes.
@@ -3024,6 +3024,7 @@ function addPortableIriKeys(keys, property, types) {
3024
3024
  async function* generateClasses(types) {
3025
3025
  validateTypeSchemas(types);
3026
3026
  yield "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax\n";
3027
+ yield "// oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const\n";
3027
3028
  yield "import jsonld from \"@fedify/vocab-runtime/jsonld\";\n";
3028
3029
  yield "import { getLogger } from \"@logtape/logtape\";\n";
3029
3030
  yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
package/dist/mod.js CHANGED
@@ -7,7 +7,7 @@ import { parse } from "yaml";
7
7
  import { pascalCase } from "es-toolkit";
8
8
  //#region deno.json
9
9
  var name = "@fedify/vocab-tools";
10
- var version = "2.5.0-dev.2619+88aa7efd";
10
+ var version = "2.5.0-dev.2664+4790a72e";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -709,7 +709,7 @@ async function loadSchema(path) {
709
709
  const errors = [];
710
710
  if (result.valid) return schema;
711
711
  for (const e of result.errors) errors.push(new SchemaError(path, `${path}:${e.instanceLocation}: ${e.error}`));
712
- throw new AggregateError(errors);
712
+ throw new AggregateError(errors, "Invalid schema data");
713
713
  }
714
714
  /**
715
715
  * Loads all schema files in the directory.
@@ -738,7 +738,7 @@ async function loadSchemaFiles(dir) {
738
738
  }
739
739
  result[schema.uri] = schema;
740
740
  }
741
- if (errors.length > 0) throw new AggregateError(errors);
741
+ if (errors.length > 0) throw new AggregateError(errors, "Failed to load schema files");
742
742
  const entries = Object.entries(result);
743
743
  entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
744
744
  return Object.fromEntries(entries);
@@ -2963,10 +2963,10 @@ async function* generateClass(typeUri, types, moduleVarNames) {
2963
2963
  for await (const code of generateInspectorPostClass(typeUri, types)) yield code;
2964
2964
  }
2965
2965
  function* generateEntityTypeHelpers(sortedTypeUris, types) {
2966
- const entityTypes = sortedTypeUris.filter((typeUri) => types[typeUri].entity).map((typeUri) => ({
2966
+ const entityTypes = sortedTypeUris.flatMap((typeUri) => types[typeUri].entity ? [{
2967
2967
  name: types[typeUri].name,
2968
2968
  uri: typeUri
2969
- }));
2969
+ }] : []);
2970
2970
  const entityTypeNames = entityTypes.map((entityType) => entityType.name);
2971
2971
  yield `/**
2972
2972
  * Constructor types for all generated vocabulary entity classes.
@@ -3023,6 +3023,7 @@ function addPortableIriKeys(keys, property, types) {
3023
3023
  async function* generateClasses(types) {
3024
3024
  validateTypeSchemas(types);
3025
3025
  yield "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax\n";
3026
+ yield "// oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const\n";
3026
3027
  yield "import jsonld from \"@fedify/vocab-runtime/jsonld\";\n";
3027
3028
  yield "import { getLogger } from \"@logtape/logtape\";\n";
3028
3029
  yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.5.0-dev.2619+88aa7efd",
3
+ "version": "2.5.0-dev.2664+4790a72e",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {
@@ -46,12 +46,12 @@
46
46
  },
47
47
  "license": "MIT",
48
48
  "devDependencies": {
49
- "@logtape/logtape": "^2.2.0",
49
+ "@logtape/logtape": "2.4.2",
50
50
  "@opentelemetry/api": "~1.9.1",
51
51
  "@types/node": "^24.12.2",
52
52
  "tsdown": "^0.22.0",
53
53
  "typescript": "^6.0.3",
54
- "@fedify/vocab-runtime": "^2.5.0-dev.2619+88aa7efd"
54
+ "@fedify/vocab-runtime": "^2.5.0-dev.2664+4790a72e"
55
55
  },
56
56
  "dependencies": {
57
57
  "@cfworker/json-schema": "^4.1.1",
@@ -2,6 +2,7 @@ export const snapshot = {};
2
2
 
3
3
  snapshot[`generateClasses() 1`] = `
4
4
  "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax
5
+ // oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const
5
6
  import jsonld from \\"@fedify/vocab-runtime/jsonld\\";
6
7
  import { getLogger } from \\"@logtape/logtape\\";
7
8
  import { type Span, SpanStatusCode, type TracerProvider, trace }
@@ -1,5 +1,6 @@
1
1
  exports[`generateClasses() 1`] = `
2
2
  "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax
3
+ // oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const
3
4
  import jsonld from \\"@fedify/vocab-runtime/jsonld\\";
4
5
  import { getLogger } from \\"@logtape/logtape\\";
5
6
  import { type Span, SpanStatusCode, type TracerProvider, trace }
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports[`generateClasses() 1`] = `
4
4
  "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax
5
+ // oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const
5
6
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
7
  import { getLogger } from "@logtape/logtape";
7
8
  import { type Span, SpanStatusCode, type TracerProvider, trace }
package/src/class.ts CHANGED
@@ -226,8 +226,9 @@ function* generateEntityTypeHelpers(
226
226
  sortedTypeUris: string[],
227
227
  types: Record<string, TypeSchema>,
228
228
  ): Iterable<string> {
229
- const entityTypes = sortedTypeUris.filter((typeUri) => types[typeUri].entity)
230
- .map((typeUri) => ({ name: types[typeUri].name, uri: typeUri }));
229
+ const entityTypes = sortedTypeUris.flatMap((typeUri) =>
230
+ types[typeUri].entity ? [{ name: types[typeUri].name, uri: typeUri }] : []
231
+ );
231
232
  const entityTypeNames = entityTypes.map((entityType) => entityType.name);
232
233
  const entityTypeUnion = entityTypeNames.length < 1
233
234
  ? " never"
@@ -317,6 +318,7 @@ export async function* generateClasses(
317
318
  ): AsyncIterable<string> {
318
319
  validateTypeSchemas(types);
319
320
  yield "// deno-lint-ignore-file ban-unused-ignore no-explicit-any no-unused-vars prefer-const verbatim-module-syntax\n";
321
+ yield "// oxlint-disable typescript/no-explicit-any, no-unused-vars, prefer-const\n";
320
322
  yield 'import jsonld from "@fedify/vocab-runtime/jsonld";\n';
321
323
  yield 'import { getLogger } from "@logtape/logtape";\n';
322
324
  yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
package/src/schema.ts CHANGED
@@ -393,7 +393,7 @@ async function loadSchema(path: string): Promise<TypeSchema> {
393
393
  new SchemaError(path, `${path}:${e.instanceLocation}: ${e.error}`),
394
394
  );
395
395
  }
396
- throw new AggregateError(errors);
396
+ throw new AggregateError(errors, "Invalid schema data");
397
397
  }
398
398
 
399
399
  /**
@@ -430,7 +430,9 @@ export async function loadSchemaFiles(
430
430
  }
431
431
  result[schema.uri] = schema;
432
432
  }
433
- if (errors.length > 0) throw new AggregateError(errors);
433
+ if (errors.length > 0) {
434
+ throw new AggregateError(errors, "Failed to load schema files");
435
+ }
434
436
  const entries = Object.entries(result);
435
437
  entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
436
438
  return Object.fromEntries(entries);