New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atb-as/config-specs

Package Overview
Dependencies
Maintainers
0
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atb-as/config-specs

Shared types and validation for fare product type configs

  • 5.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
516
increased by36.87%
Maintainers
0
Weekly downloads
 
Created
Source

@atb-as/config-specs

Shared types and validation for configs

Collects documentation, JSON Specifications and types for configs. Ensures consistent types and mapping for all fare product configs across projects and organisations.

Progress

  • Fare Product Types
  • Travel Search Filters
  • Mobility operators
  • Urls
  • Harbor connection overrides
  • Notification config
  • Payment Types
  • Other
  • Reference Data
  • Stop Signal Button Config
  • Schedules
  • Feedback Questions
  • App Texts

Usage

API and Types

import {ZoneSelectionMode} from '@atb-as/config-specs';

const selectedZone: ZoneSelectionMode =
  ZoneSelectionMode.parse('multiple-stop');
//> Throws error if not multiple-stop is valid.

const selectedZone2: ZoneSelectionMode =
  ZoneSelectionMode.safeParse('multiple-stop');
//> selectedZone2.success = true | false

Usage in YAML validation

# yaml-language-server: $schema=https://raw.githubusercontent.com/AtB-AS/config-specs/refs/heads/main/schema-definitions/other.json
enableTokenToggleRestrictions: true
tokenToggleMaxLimit: 3
defaultTariffZone: NOR:TariffZone:8040
vatPercent: 12
Running as CLI
Usage: npx @atb-as/config-specs -s [schema] -f [file]

Options:
      --version  Show version number                                   [boolean]
  -f, --file     file to validate                                     [required]
  -s, --schema   choose a schema
         [required] [choices: "fareProductTypeConfigs", "other", "paymentTypes",
                                                   "travelSearchFilters", "url"]
  -h, --help     Show help                                             [boolean]

Examples:
  npx @atb-as/config-specs -s other -f other.json  Validate other.json with position specification
  npx @atb-as/config-specs -s other -f other.yaml  Validate other.yaml with position specification

Install

yarn add @atb-as/config-specs

Tests and fixtures

Note contract/fixture tests in src/tests/contract-fixtures-tests. These tests should never fail unless it is very intentional. These are ment to ensure backwards compatibility with older apps.

If they fail you need to ensure that the change is intentional and that older apps refering to the data that is the cause of change is no longer in use.

Scope and goal of package

Goal of this package is to ensure data quality and consistent data across remote configuration and usage over time for multiple consumers.

This package should collect specification and validation (incl. types) for data stored in Firestore. This should ensure easier consistent validation and data quality across Firestore, Webshop and App for all organisations involved.

  1. Collect specifications ("the standard"™)
  2. Collect documentation ("how to use the standard")
  3. Type generation and Schema validation generation
  4. Input validation (Data INTO Firestore)
  5. Data decoding / encoding validation. (Data OUT of Firestore)

Release package

After your changes are merged to the main branch (which should include changes from yarn build):

  1. Create and checkout a new branch, e.g. called "yourfirstname/v-5-8-0".
  2. Run yarn version (which creates a new commit with updated version number in package.json and creates a version tag):
  • Major: Breaking change. This version require you to do code modifications after upgrading on the consumer side.
  • Minor: This version extends functionality.
  • Patch: This version affects no APIs at all, just changes to existing code.
  1. Push to Github: git push origin yourfirstname/v-5-8-0 (replace with your actual branch name).
  2. Push tags to Github: git push origin yourfirstname/v-5-8-0 --tags (replace with your actual branch name).
  3. Create a PR for this new branch into main and merge when approved.
  4. Make sure you are authenticated through npm by running npm whoami.
  5. Make sure your npm user has access to publish packages to AtB's npm repo.
  6. Checkout and pull the updated main branch.
  7. run npm publish to publish the package to npm.

TODO: Packages should be automatically released when merging a PR created by release-please-action Github Action. Changelog and releases should automatically be updated.

License

EUPL-1.2

FAQs

Package last updated on 20 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc