Skip to content
orion-data / 0.1.0

orion-data 0.1.0

Install from the command line:
Learn more about npm packages
$ npm install @secureideasllc/orion-data@0.1.0
Install via package.json:
"@secureideasllc/orion-data": "0.1.0"

About this version

Orion Data Types

Contains type definitions for the Orion services.

Installation

Hosted in the GH Package Registry. Add the following to your .npmrc file:

registry=https://registry.yarnpkg.com/

@secureideasllc:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken={yourtokenhere}
always-auth=true

Then install with:

npm install @orion-js

Development

These types are defined with Zod as the schema language. Typescript types are generated from the Zod schemas using its built-in type inference. Enums are an exception, as they are defined in Typescript and then converted to Zod schemas using its z.nativeEnum method. Because of the type inference, any changes to the Zod schemas will be reflected in the Typescript types. A given Zod schema's .parse method will always return a valid instance of the corresponding Typescript type, if it succeeds. However, the Typescript types are not guaranteed to be valid instances of the Zod schemas. This is because the Zod schemas can define additional constraints that are not expressible in Typescript. For example, a Zod schema can define a string that must be a valid email address, but the Typescript type will only be a string. This is a limitation of the Typescript language.

Naming Conventions

Conventionally, the Zod schemas use the suffix Schema to distinguish them from the Typescript types. So for example, the Zod schema for the User type is UserSchema, and the Typescript type is User. In the case of enums, the Zod schema is UserTypeEnum and the Typescript type is UserType.

Amending Existing Types

For now we can modify the types pretty freely, and should expect to. In the future, we may need to consider breaking changes more carefully.

Details


Assets

  • orion-data-0.1.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all