Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Validate schema assets
run: bun run schema:validate

- name: Check generated schema.org vocabulary
run: bun run schema-org:check-generated

- name: Check generated predicate modules
run: bun run predicates:check-generated

Expand Down
10 changes: 9 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
"files": {
"includes": ["**", "!node_modules", "!dist", "!.git", "!.turbo", "!.cache"]
"includes": [
"**",
"!node_modules",
"!dist",
"!.git",
"!.turbo",
"!.cache",
"!packages/schema-org/vendor"
]
},
"vcs": {
"enabled": true,
Expand Down
12 changes: 11 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"clean": "turbo run clean",
"schema:validate": "node scripts/validate-schema.mjs",
"schema:verify-live": "node scripts/verify-live-schema.mjs",
"schema-org:generate": "node scripts/generate-schema-org-package.mjs",
"schema-org:refresh": "node scripts/generate-schema-org-package.mjs --refresh",
"schema-org:check-generated": "node scripts/check-schema-org-generation.mjs",
"predicates:check-generated": "node scripts/check-predicate-generation.mjs",
"pack:dry-run": "node scripts/pack-dry-run.mjs",
"smoke:tarballs": "node scripts/smoke-tarballs.mjs",
Expand Down
38 changes: 38 additions & 0 deletions packages/schema-org/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @0xintuition/schema-org

Pinned schema.org type and property vocabulary for Intuition alpha packages.

Runtime: ESM-only. This package does not publish CommonJS `require` entrypoints.

## Included

- schema.org V30.0 vocabulary generated from `https://schema.org/version/30.0/schemaorg-current-https.jsonld`
- Generation reads the vendored V30.0 JSON-LD snapshot by default; maintainers can refresh the snapshot explicitly with `bun run schema-org:refresh`
- One typed source module per `schema:` class
- Normalized type records with directly declared properties and resolved `subClassOf` chains
- Runtime accessors that resolve inherited properties and tag each property with its originating type

## Install

```bash
bun add @0xintuition/schema-org@alpha
```

## Usage

```ts
import { getPropertiesFor, getType } from '@0xintuition/schema-org'
import { schemaOrgBook } from '@0xintuition/schema-org/Book'

const book = getType('Book')
const bookProperties = getPropertiesFor('Book')
const title = bookProperties.find((property) => property.name === 'name')

console.log(book?.subClassOf)
console.log(schemaOrgBook.name)
console.log(title?.originType)
```

Generated artifacts are intentionally normalized: a type file stores only that type's directly declared properties plus its `subClassOf` chain. `getPropertiesFor` derives inherited properties at runtime.

Types whose schema.org names are not safe exact JavaScript exports, such as `3DModel`, `Number`, `Date`, or `Map`, are still available from their subpath module via the `schemaOrg<Name>` named export or default export.
65 changes: 65 additions & 0 deletions packages/schema-org/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@0xintuition/schema-org",
"version": "0.1.0-alpha.0",
"description": "Pinned schema.org type and property vocabulary for Intuition data packages",
"private": false,
"license": "MIT",
"type": "module",
"sideEffects": false,
"types": "./src/index.ts",
"files": [
"src",
"README.md"
],
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json",
"./*": "./src/generated/types/*.ts"
},
"keywords": [
"intuition",
"schema-org",
"json-ld",
"vocabulary"
],
"repository": {
"type": "git",
"url": "git+https://github.com/0xIntuition/packages.git",
"directory": "packages/schema-org"
},
"bugs": {
"url": "https://github.com/0xIntuition/packages/issues"
},
"homepage": "https://github.com/0xIntuition/packages/tree/main/packages/schema-org#readme",
"publishConfig": {
"access": "public",
"tag": "alpha"
},
"scripts": {
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.build.json && node ../../scripts/normalize-dist-imports.mjs",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"dev": "tsc --watch",
"generate": "node ../../scripts/generate-schema-org-package.mjs",
"refresh": "node ../../scripts/generate-schema-org-package.mjs --refresh",
"check:generated": "node ../../scripts/check-schema-org-generation.mjs",
"pack:dry-run": "bun run build && node ../../scripts/pack-release.mjs --dry-run --json --dist-entrypoints --rewrite-workspace-deps",
"pack:release": "bun run build && node ../../scripts/pack-release.mjs --dist-entrypoints --rewrite-workspace-deps",
"prepack": "bun run build",
"prepublishOnly": "node ../../scripts/guard-direct-publish.mjs",
"test": "vitest run",
"test:watch": "vitest",
"typecheck": "tsc --noEmit",
"ci": "biome check",
"lint": "biome lint",
"format": "biome format",
"check": "biome check",
"lint:write": "biome lint --write",
"format:write": "biome format --write",
"check:write": "biome check --write",
"check:unsafe:write": "biome check --write --unsafe"
},
"devDependencies": {
"typescript": "catalog:",
"vitest": "catalog:"
}
}
Loading
Loading