@secureideasllc/orion-data
v3.0.3
Published
Contains type definitions for the Orion services.
Downloads
638
Readme
Orion Data Types
Contains type definitions for the Orion services.
Installation
npm install @secureideasllc/orion-data
Important Note
This is pre-release. Breaking changes will be frequent, and will not increment the major version, for the near future. Once we have an initial stable release, we can comply with semantic versioning going forward, but 1.x.x should expect regular changes to data types.`
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.
Note
This repo uses a prepush hook that checks that the last commit has a message in the form of a semantic version. This is because the package publishing will fail if the version isn't incremented. Run npm version patch
, npm version minor
or npm version major
before publishing. This will autoincrement the version in the package.json
, and commit it to the history in a valid form.
Entity Relationship Diagram
Diagram Rev History
| Date | Author | Description | |------|--------|-------------| | 2024-01-24 | Mic | Initial draft | | 2024-01-25 | Mic | Renamed fields to match Orion-Data package | | 2024-02-02 | Mic | Removed backend references |
Diagram
erDiagram
ACCOUNT ||--o{ JOB : contains
JOB ||--o{ TARGETPATH: contains
JOB ||--o{ JOBRUN : relates-to
JOBRUN ||--|{ JOBRUNTARGET : relates-to
JOBRUNTARGET }o--o{ RESOURCE : refers-to
JOBRUN ||--|{ TARGETPATH: contains-copy-of
RISK }o--|{ RESOURCE : affects
ACCOUNT {
string accountId
string objectId
string name
string owner
Job[] jobs
}
JOB {
string jobId
string jobName
string domain
string(base64) favicon
enum runStatus
string[] paths
timestamp lastRun
number lastRiskCount
number lastRiskScore
}
TARGETPATH {
string path
}
JOBRUN {
string id
string jobId
String runId
string runStatus
timestamp runDate
string[] paths
}
JOBRUNTARGET {
string jobRunId
string path
enum targetStatus
number responseCode
string resourceId
string[] referredResourceIds
}
RESOURCE {
string resourceId
string resourceSourceUrl
string resourceHash
string resourceType
}
RISK {
string id
string name
string description
number score
}