• TypeScript 98.2%
  • JavaScript 1.3%
  • Dockerfile 0.5%
Find a file
DigiToegankelijk NLdoc 3190c91bfc chore: set .editorconfig
2025-11-19 09:38:43 +00:00
.vscode feat: source code for stub 2025-05-06 16:42:22 +02:00
src fix: update test 2025-07-30 11:58:45 +02:00
.dockerignore feat: source code for stub 2025-05-06 16:42:22 +02:00
.editorconfig chore: set .editorconfig 2025-11-19 09:38:43 +00:00
.gitignore feat: source code for stub 2025-05-06 16:42:22 +02:00
.gitlab-ci.yml feat: event playing based on query params/headers 2025-05-06 17:31:35 +02:00
.npmignore feat: source code for stub 2025-05-06 16:42:22 +02:00
.npmrc feat: source code for stub 2025-05-06 16:42:22 +02:00
CHANGELOG.md chore(release): 3.0.7 2025-09-20 22:25:04 +00:00
CODEOWNERS feat: source code for stub 2025-05-06 16:42:22 +02:00
Dockerfile feat: add Dockerfile for standalone use 2025-05-06 16:50:29 +02:00
eslint.config.mjs feat: source code for stub 2025-05-06 16:42:22 +02:00
LICENSE initial commit 2025-05-06 16:38:58 +02:00
package-lock.json chore(deps): update dependency @nldoc/configs to v1.4.57 2025-09-23 22:44:07 +00:00
package.json chore(release): 3.0.7 2025-09-20 22:25:04 +00:00
prettier.config.mjs feat: source code for stub 2025-05-06 16:42:22 +02:00
README.md feat: allow port to be retrieved using port() 2025-05-06 22:31:42 +02:00
renovate.json chore: npm install twice 2025-11-05 14:11:12 +00:00
tsconfig.dist.json feat: source code for stub 2025-05-06 16:42:22 +02:00
tsconfig.json feat: source code for stub 2025-05-06 16:42:22 +02:00
vitest.config.ts feat!: simplified API 2025-05-06 21:16:10 +02:00
vitest.setup.ts feat: source code for stub 2025-05-06 16:42:22 +02:00

NLdoc's Event Source API Stub

This repository contains a stub for Event Source API's.

Installation

Run:

npm install @nldoc/event-source-api-stub

Usage

Tests

See src/ServerApplication.spec.ts for usage in tests.

For use in tests:

import { afterAll, beforeAll, describe } from 'vitest'
import { ServerApplication } from '@nldoc/event-source-api-stub'

describe('...', () => {
    const serverApp = new ServerApplication({ heartbeatInterval: 1_000 })

    beforeAll(async () => serverApp.start(8123))
    afterAll(async () => serverApp.stop())

    // ...
})

When you pass no port to run on, the operating system will pick a free port. That port can be retrieved by calling serverApp.port().

Standalone

For standalone use, run PORT=1234 event-source-api-stub

Development

Project structure

The project is structured as follows:

  • src/: Contains the TypeScript source files.
    • src/**/*.spec.ts: Contains the tests for the TypeScript source files.
    • src/**/*.ts: Contains the actual code.
  • dist/: Contains the compiled JavaScript files.

Testing

The types in this package are tested against the collection of examples (valid and invalid) that were provided in the NLdoc event specification. These examples will be downloaded to the local filesystem on first run of the tests.

To run the tests, run:

$ npm test

License

See LICENSE.txt for the license of this repository.