@fedify/vocab-tools 2.5.0-dev.2562 → 2.5.0-dev.2597

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.2562+d712c1d0",
3
+ "version": "2.5.0-dev.2597+7bed9e2b",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
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.2562+d712c1d0";
11
+ var version = "2.5.0-dev.2597+7bed9e2b";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -150,7 +150,8 @@ const scalarTypes = {
150
150
  },
151
151
  decoder(v) {
152
152
  return `${v}["@value"]`;
153
- }
153
+ },
154
+ skipUnparsable: true
154
155
  },
155
156
  "http://www.w3.org/2001/XMLSchema#anyURI": {
156
157
  name: "URL",
@@ -1833,8 +1834,8 @@ async function* generateInspector(typeUri, types) {
1833
1834
  if (this.id != null) {
1834
1835
  proxy.id = {
1835
1836
  [Symbol.for("Deno.customInspect")]: (
1836
- inspect: typeof Deno.inspect,
1837
- options: Deno.InspectOptions,
1837
+ inspect: (value: unknown, options: unknown) => string,
1838
+ options: unknown,
1838
1839
  ): string => "URL " + inspect(inspectIri(this.id!), options),
1839
1840
  [Symbol.for("nodejs.util.inspect.custom")]: (
1840
1841
  _depth: number,
@@ -1854,8 +1855,8 @@ async function* generateInspector(typeUri, types) {
1854
1855
  .map((v: any) => v instanceof URL
1855
1856
  ? {
1856
1857
  [Symbol.for("Deno.customInspect")]: (
1857
- inspect: typeof Deno.inspect,
1858
- options: Deno.InspectOptions,
1858
+ inspect: (value: unknown, options: unknown) => string,
1859
+ options: unknown,
1859
1860
  ): string => "URL " + inspect(inspectIri(v), options),
1860
1861
  [Symbol.for("nodejs.util.inspect.custom")]: (
1861
1862
  _depth: number,
@@ -1898,8 +1899,8 @@ async function* generateInspectorPostClass(typeUri, types) {
1898
1899
  (${className}.prototype as any)[Symbol.for("Deno.customInspect")] =
1899
1900
  function (
1900
1901
  this: ${className},
1901
- inspect: typeof Deno.inspect,
1902
- options: Deno.InspectOptions,
1902
+ inspect: (value: unknown, options: unknown) => string,
1903
+ options: unknown,
1903
1904
  ): string {
1904
1905
  const proxy = this._getCustomInspectProxy();
1905
1906
  return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
package/dist/mod.d.cts CHANGED
@@ -217,7 +217,19 @@ type PropertySchema = PropertySchemaBase & PropertySchemaTyping & {
217
217
  type Context = Uri | EmbeddedContext | (Uri | EmbeddedContext)[];
218
218
  type Uri = "http://{string}" | "https://{string}";
219
219
  type EmbeddedContext = Record<string, TermDefinition>;
220
- type TermDefinition = Uri | Record<string, Uri | "@id">;
220
+ type TermDefinition = Uri | Record<string, Uri | "@id"> | ContainerTermDefinition;
221
+ /**
222
+ * A term definition that carries a JSON-LD `@container` keyword.
223
+ *
224
+ * The JSON Schema in *schema.yaml* enforces this shape conditionally whenever
225
+ * an embedded context term has `@container`; the TypeScript union cannot
226
+ * express the conditional and serves only as a guide.
227
+ */
228
+ interface ContainerTermDefinition {
229
+ "@id": string;
230
+ "@type"?: Uri | "@id";
231
+ "@container": "@set" | "@list";
232
+ }
221
233
  /**
222
234
  * Type guard to check if a property is not functional (has pluralName).
223
235
  */
package/dist/mod.d.ts CHANGED
@@ -217,7 +217,19 @@ type PropertySchema = PropertySchemaBase & PropertySchemaTyping & {
217
217
  type Context = Uri | EmbeddedContext | (Uri | EmbeddedContext)[];
218
218
  type Uri = "http://{string}" | "https://{string}";
219
219
  type EmbeddedContext = Record<string, TermDefinition>;
220
- type TermDefinition = Uri | Record<string, Uri | "@id">;
220
+ type TermDefinition = Uri | Record<string, Uri | "@id"> | ContainerTermDefinition;
221
+ /**
222
+ * A term definition that carries a JSON-LD `@container` keyword.
223
+ *
224
+ * The JSON Schema in *schema.yaml* enforces this shape conditionally whenever
225
+ * an embedded context term has `@container`; the TypeScript union cannot
226
+ * express the conditional and serves only as a guide.
227
+ */
228
+ interface ContainerTermDefinition {
229
+ "@id": string;
230
+ "@type"?: Uri | "@id";
231
+ "@container": "@set" | "@list";
232
+ }
221
233
  /**
222
234
  * Type guard to check if a property is not functional (has pluralName).
223
235
  */
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.2562+d712c1d0";
10
+ var version = "2.5.0-dev.2597+7bed9e2b";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -149,7 +149,8 @@ const scalarTypes = {
149
149
  },
150
150
  decoder(v) {
151
151
  return `${v}["@value"]`;
152
- }
152
+ },
153
+ skipUnparsable: true
153
154
  },
154
155
  "http://www.w3.org/2001/XMLSchema#anyURI": {
155
156
  name: "URL",
@@ -1832,8 +1833,8 @@ async function* generateInspector(typeUri, types) {
1832
1833
  if (this.id != null) {
1833
1834
  proxy.id = {
1834
1835
  [Symbol.for("Deno.customInspect")]: (
1835
- inspect: typeof Deno.inspect,
1836
- options: Deno.InspectOptions,
1836
+ inspect: (value: unknown, options: unknown) => string,
1837
+ options: unknown,
1837
1838
  ): string => "URL " + inspect(inspectIri(this.id!), options),
1838
1839
  [Symbol.for("nodejs.util.inspect.custom")]: (
1839
1840
  _depth: number,
@@ -1853,8 +1854,8 @@ async function* generateInspector(typeUri, types) {
1853
1854
  .map((v: any) => v instanceof URL
1854
1855
  ? {
1855
1856
  [Symbol.for("Deno.customInspect")]: (
1856
- inspect: typeof Deno.inspect,
1857
- options: Deno.InspectOptions,
1857
+ inspect: (value: unknown, options: unknown) => string,
1858
+ options: unknown,
1858
1859
  ): string => "URL " + inspect(inspectIri(v), options),
1859
1860
  [Symbol.for("nodejs.util.inspect.custom")]: (
1860
1861
  _depth: number,
@@ -1897,8 +1898,8 @@ async function* generateInspectorPostClass(typeUri, types) {
1897
1898
  (${className}.prototype as any)[Symbol.for("Deno.customInspect")] =
1898
1899
  function (
1899
1900
  this: ${className},
1900
- inspect: typeof Deno.inspect,
1901
- options: Deno.InspectOptions,
1901
+ inspect: (value: unknown, options: unknown) => string,
1902
+ options: unknown,
1902
1903
  ): string {
1903
1904
  const proxy = this._getCustomInspectProxy();
1904
1905
  return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
package/dist/schema.yaml CHANGED
@@ -228,16 +228,44 @@ $defs:
228
228
  $ref: "#/$defs/ldTermDefinition"
229
229
 
230
230
  ldTermDefinition:
231
- anyOf:
232
- - type: string
233
- format: uri
234
- - type: object
235
- patternProperties:
236
- "^.+$":
237
- anyOf:
238
- - type: string
239
- format: uri
240
- - const: "@id"
231
+ allOf:
232
+ - anyOf:
233
+ - type: string
234
+ format: uri
235
+ - type: object
236
+ patternProperties:
237
+ "^.+$":
238
+ anyOf:
239
+ - type: string
240
+ format: uri
241
+ - const: "@id"
242
+ - $ref: "#/$defs/ldContainerTermDefinition"
243
+ - if:
244
+ type: object
245
+ required:
246
+ - "@container"
247
+ then:
248
+ $ref: "#/$defs/ldContainerTermDefinition"
249
+
250
+ ldContainerTermDefinition:
251
+ type: object
252
+ properties:
253
+ "@id":
254
+ type: string
255
+ format: uri
256
+ "@type":
257
+ anyOf:
258
+ - type: string
259
+ format: uri
260
+ - const: "@id"
261
+ "@container":
262
+ enum:
263
+ - "@set"
264
+ - "@list"
265
+ required:
266
+ - "@id"
267
+ - "@container"
268
+ additionalProperties: false
241
269
 
242
270
  description: The schema of a type. It is used to generate a class.
243
271
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.5.0-dev.2562+d712c1d0",
3
+ "version": "2.5.0-dev.2597+7bed9e2b",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {
@@ -50,8 +50,8 @@
50
50
  "@opentelemetry/api": "~1.9.1",
51
51
  "@types/node": "^24.12.2",
52
52
  "tsdown": "^0.22.0",
53
- "typescript": "^6.0.0",
54
- "@fedify/vocab-runtime": "^2.5.0-dev.2562+d712c1d0"
53
+ "typescript": "^6.0.3",
54
+ "@fedify/vocab-runtime": "^2.5.0-dev.2597+7bed9e2b"
55
55
  },
56
56
  "dependencies": {
57
57
  "@cfworker/json-schema": "^4.1.1",