Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glazed/types

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glazed/types

Shared types for Glaze packages

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Glaze types

Shared types for Glaze packages

Installation

npm install --dev @glazed/types

Types

EncodedDagJWS

Uses JWSSignature from the dids package

type EncodedDagJWS = {
  payload: string
  signatures: Array<JWSSignature>
  link?: string
}

EncodedDagJWS

type EncodedDagJWSResult = {
  jws: EncodedDagJWS
  linkedBlock: string // base64
}

Schema

Uses JSONSchemaType from the ajv package

type Schema<T = Record<string, any>> = JSONSchemaType<T> & {
  $comment?: string
  title?: string
}

ModelData

type ModelData<T> = {
  definitions: Record<string, T>
  schemas: Record<string, T>
  tiles: Record<string, T>
}

MapModelTypes

type MapModelTypes<Model extends ModelData<any>, ToType> = {
  schemas: Record<keyof Model['schemas'], ToType>
  definitions: Record<keyof Model['definitions'], ToType>
  tiles: Record<keyof Model['tiles'], ToType>
}

CastModelTo

type CastModelTo<Model extends ModelData<any> | void, ToType> = Model extends ModelData<any>
  ? MapModelTypes<Model, ToType>
  : ModelData<ToType>

PublishedModel

type PublishedModel<Model extends ModelData<any> | void = void> = CastModelTo<Model, string>

ModelTypeAliases

type ModelTypeAliases<
  // Schema alias to content type
  Schemas extends Record<string, any> = Record<string, any>,
  // Definition alias to schema alias
  Definitions extends Record<string, keyof Schemas> = Record<string, string>,
  // Tile alias to schema alias
  Tiles extends Record<string, keyof Schemas> = Record<string, string>
> = {
  schemas: Schemas
  definitions: Definitions
  tiles: Tiles
}

ModelTypesToAliases

type ModelTypesToAliases<TypeAliases extends ModelTypeAliases> = MapModelTypes<TypeAliases, string>

ManagedID

type ManagedID = string // StreamID

ManagedDoc

Uses DagJWSResult from the dids package

type ManagedDoc<CommitType = DagJWSResult> = {
  alias: string
  commits: Array<CommitType>
  version: string // CommitID
}

ManagedEntry

Uses DagJWSResult from the dids package

type ManagedEntry<CommitType = DagJWSResult> = ManagedDoc<CommitType> & {
  schema: ManagedID
}

ManagedSchema

Uses DagJWSResult from the dids package

type ManagedSchema<CommitType = DagJWSResult> = ManagedDoc<CommitType> & {
  dependencies: Record<string, Array<ManagedID>> // path to schemas ManagedID
}

ManagedModel

Uses DagJWSResult from the dids package

type ManagedModel<CommitType = DagJWSResult> = {
  schemas: Record<ManagedID, ManagedSchema<CommitType>>
  definitions: Record<ManagedID, ManagedEntry<CommitType>>
  tiles: Record<ManagedID, ManagedEntry<CommitType>>
}

EncodedManagedModel

Uses DagJWSResult from the dids package

type EncodedManagedModel = ManagedModel<EncodedDagJWSResult>

License

Dual licensed under MIT and Apache 2

Keywords

FAQs

Package last updated on 19 Apr 2022

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