Skip to content

Commit 4b59622

Browse files
committed
Initial files.
1 parent 1db380f commit 4b59622

File tree

17 files changed

+690
-1
lines changed

17 files changed

+690
-1
lines changed

.github/workflows/main.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Main CI
2+
3+
on: [push]
4+
5+
permissions: {}
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
strategy:
12+
matrix:
13+
node-version: [24.x]
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
persist-credentials: false
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm install
23+
- name: Run eslint
24+
run: npm run lint
25+
test-node:
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
strategy:
29+
matrix:
30+
node-version: [20.x, 22.x, 24.x]
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
persist-credentials: false
35+
- name: Use Node.js ${{ matrix.node-version }}
36+
uses: actions/setup-node@v6
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
- name: Install
40+
run: npm install
41+
- name: Run test with Node.js ${{ matrix.node-version }}
42+
run: npm run test-node
43+
test-karma:
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 10
46+
strategy:
47+
matrix:
48+
node-version: [22.x]
49+
steps:
50+
- uses: actions/checkout@v6
51+
with:
52+
persist-credentials: false
53+
- name: Use Node.js ${{ matrix.node-version }}
54+
uses: actions/setup-node@v6
55+
with:
56+
node-version: ${{ matrix.node-version }}
57+
- name: Install
58+
run: npm install
59+
- name: Run karma tests
60+
run: npm run test-karma

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Library snapshot
2+
package-lock.json
3+
yarn.lock
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# TypeScript v1 declaration files
49+
typings/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
76+
.env
77+
.env.test
78+
79+
# parcel-bundler cache (https://parceljs.org/)
80+
.cache
81+
82+
# Next.js build output
83+
.next
84+
85+
# Nuxt.js build / generate output
86+
.nuxt
87+
dist
88+
89+
# Gatsby files
90+
.cache/
91+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
92+
# https://nextjs.org/blog/next-9-1#public-directory-support
93+
# public
94+
95+
# vuepress build output
96+
.vuepress/dist
97+
98+
# Serverless directories
99+
.serverless/
100+
101+
# FuseBox cache
102+
.fusebox/
103+
104+
# DynamoDB Local files
105+
.dynamodb/
106+
107+
# TernJS port file
108+
.tern-port
109+
110+
# Editor files
111+
*~
112+
*.sw[nop]
113+
114+
# VSCode
115+
.vscode

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# @digitalbazaar/vc-dpp-context ChangeLog
2+
3+
## 1.0.0 - 2026-01-xx
4+
5+
- Initial release.
6+
- See git history for changes for this release.

LICENSE.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Context data files in this repository are from the [vc-dpp][] spec and
2+
are licensed by contributors under the [W3C Software and Document License][].
3+
4+
All other files are licensed under a BSD 3-Clause license:
5+
6+
```
7+
BSD 3-Clause License
8+
9+
Copyright (c) 2019-2025, Digital Bazaar, Inc.
10+
All rights reserved.
11+
12+
Redistribution and use in source and binary forms, with or without
13+
modification, are permitted provided that the following conditions are met:
14+
15+
* Redistributions of source code must retain the above copyright notice, this
16+
list of conditions and the following disclaimer.
17+
18+
* Redistributions in binary form must reproduce the above copyright notice,
19+
this list of conditions and the following disclaimer in the documentation
20+
and/or other materials provided with the distribution.
21+
22+
* Neither the name of the copyright holder nor the names of its
23+
contributors may be used to endorse or promote products derived from
24+
this software without specific prior written permission.
25+
26+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
```
37+
38+
[vc-dpp]: https://github.com/digitalbazaar/vc-dpp
39+
[W3C Software and Document License]: http://www.w3.org/Consortium/Legal/copyright-software

README.md

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,110 @@
1-
# vc-dpp-context
1+
# VC Disabled Parking Placard JSON-LD Contexts _(@digitalbazaar/vc-dpp-context)_
2+
3+
[![Build Status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/vc-dpp-context/main.yaml)](https://github.com/digitalbazaar/vc-dpp-context/actions/workflows/main.yaml)
4+
[![NPM Version](https://img.shields.io/npm/v/@digitalbazaar/vc-dpp-context.svg)](https://npm.im/@digitalbazaar/vc-dpp-context)
5+
6+
> VC Disabled Parking Placard JSON-LD contexts for JavaScript.
7+
8+
## Table of Contents
9+
10+
- [Background](#background)
11+
- [Security](#security)
12+
- [Install](#install)
13+
- [Usage](#usage)
14+
- [API](#api)
15+
- [Status](#status)
16+
- [Developing](#developing)
17+
- [Commercial Support](#commercial-support)
18+
- [License](#license)
19+
20+
## Background
21+
22+
See related specs:
23+
24+
- VC Disabled Parking Placard
25+
- https://github.com/digitalbazaar/vc-dpp
26+
- https://digitalbazaar.github.io/vc-dpp
27+
28+
## Security
29+
30+
TBD
31+
32+
## Install
33+
34+
Requires [Node.js][] 20+
35+
36+
To install via [NPM][]:
37+
38+
```
39+
npm install @digitalbazaar/vc-dpp-context
40+
```
41+
42+
## Usage
43+
44+
```js
45+
import {contexts, metadata, named} from '@digitalbazaar/vc-dpp-context';
46+
// or
47+
const {contexts, metadata, named} = require('@digitalbazaar/vc-dpp-context');
48+
```
49+
50+
The `contexts` [Map][] can be used to access individual contexts by id or load
51+
them into a JSON-LD document loader. The `metadata` [Map][] contains
52+
extra information about each context.
53+
54+
This package can be used with bundlers, such as [webpack][], in browser
55+
applications.
56+
57+
## API
58+
59+
The library exports the following properties:
60+
- `contexts`: A [Map][] associating context URLs to context data.
61+
- `metadata`: A [Map][] associating context URLs to context metadata.
62+
- `named`: A [Map][] associating short package specific names to context
63+
metadata.
64+
65+
Note that the `metadata` format is experimental and subject to change. The `id`
66+
field is expected to stay stable and can be used with the `named` Map to get a
67+
context URL for a short name such as `v1`.
68+
69+
The context files are available in the published `contexts/` directory. The
70+
metadata has a URL for each context. Note that these files are semantically
71+
equivalent to published spec contexts but the formatting may differ such that
72+
strict file digests are not equivalent.
73+
74+
## Status
75+
76+
The following contexts are available as of early-2026. They track the published
77+
spec contexts.
78+
79+
- VC Disabled Parking Placard v1rc1 context
80+
- URL: `https://w3id.org/vc-dpp/v1rc1`
81+
- Short name: `v1rc1`
82+
- Status: development
83+
84+
## Developing
85+
86+
Source is available at:
87+
- https://github.com/digitalbazaar/vc-dpp-context
88+
89+
**WARNING**: The `.jsonld` files in `contexts/` are auto-generated by the `npm
90+
run build` script each time the test suite is run.
91+
92+
DO NOT edit them directly since changes will be overwritten.
93+
94+
Make all context changes to `lib/*.js`.
95+
96+
## Commercial Support
97+
98+
Commercial support for this library is available upon request from
99+
Digital Bazaar: [email protected]
100+
101+
## License
102+
103+
- Code: BSD 3-Clause © Digital Bazaar
104+
- Contexts: W3C Software and Document License
105+
- See the [LICENSE](./LICENSE.md) file for details.
106+
107+
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
108+
[NPM]: https://www.npmjs.com/
109+
[Node.js]: https://nodejs.org/
110+
[webpack]: https://webpack.js.org/

bin/serialize.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
/*!
3+
* Copyright (c) 2023-2026 Digital Bazaar, Inc. All rights reserved.
4+
*/
5+
import fs from 'node:fs';
6+
import {metadata} from '../lib/index.js';
7+
8+
// Serialize the contexts as JSON-LD
9+
for(const {fileUrl, context} of metadata.values()) {
10+
fs.writeFileSync(fileUrl, JSON.stringify(context, null, 2) + '\n');
11+
}

contexts/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## WARNING: Generated files, do not edit!
2+
3+
Warning: The `.jsonld` files here are auto-generated by the `npm run build`
4+
step every time the test suite is run.
5+
6+
DO NOT edit them directly since changes will be overwritten.
7+
8+
Make all changes in `lib/*.js` files instead.

contexts/v1rc1.jsonld

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"@context": {
3+
"@protected": true,
4+
"DisabledPersonParkingPlacard": {
5+
"@id": "https://w3id.org/vc-dpp#DisabledPersonParkingPlacard",
6+
"@context": {
7+
"@protected": true,
8+
"id": "@id",
9+
"type": "@type",
10+
"placardExpirationDate": {
11+
"@id": "https://w3id.org/vc-dpp#placardExpirationDate",
12+
"@type": "http://www.w3.org/2001/XMLSchema#date"
13+
},
14+
"placardNumber": "https://w3id.org/vc-dpp#placardNumber",
15+
"placardType": "https://w3id.org/vc-dpp#placardType"
16+
}
17+
},
18+
"PlacardHolder": {
19+
"@id": "https://w3id.org/vc-dpp#PlacardHolder",
20+
"@context": {
21+
"@protected": true,
22+
"id": "@id",
23+
"type": "@type",
24+
"dateOfBirth": {
25+
"@id": "https://w3id.org/vc-dpp#dateOfBirth",
26+
"@type": "http://www.w3.org/2001/XMLSchema#date"
27+
},
28+
"entitledPlacard": "https://w3id.org/vc-dpp#entitledPlacard",
29+
"name": "https://schema.org/name"
30+
}
31+
},
32+
"DisabledPersonParkingPlacardCredential": "https://w3id.org/vc-dpp#DisabledPersonParkingPlacardCredential",
33+
"DisabledPersonParkingEntitlementCredential": "https://w3id.org/vc-dpp#DisabledPersonParkingEntitlementCredential"
34+
}
35+
}

eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import config from '@digitalbazaar/eslint-config/universal-recommended';
2+
3+
export default [
4+
...config
5+
];

0 commit comments

Comments
 (0)