
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
@praxisui/specification-core
Advanced tools
Core types and base class for the Specification pattern used across Praxis UI packages.
Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
@praxisui/* em um app Angular, incluindo instalação, configuração e uso em telas reais.Tipos e classe base do padrão Specification, compartilhados entre os pacotes Praxis.
A biblioteca @praxisui/specification-core fornece a fundação do padrão Specification no ecossistema Praxis:
Specification<T> com ciclo de vida e utilitários (metadata, clone, serialização/DSL).SpecificationMetadata, SpecificationOptions) para enriquecer validações e integrações de UI.@praxisui/specification para composições lógicas (and/or/not/xor/implies).Este pacote não contém componentes Angular nem composições; ele expõe apenas os contratos (core) e a classe base.
npm i @praxisui/specification-core
Peer dependencies (Angular v20):
@angular/core ^20.0.0@angular/common ^20.0.0Dependências em runtime:
tslib (instalada automaticamente)Crie uma especificação concreta estendendo Specification<T> e implemente os métodos abstratos.
import { Specification, SpecificationMetadata } from '@praxisui/specification-core';
interface Person { age: number }
export class AdultSpecification extends Specification<Person> {
constructor(private minAge = 18, metadata?: SpecificationMetadata) {
super(metadata);
}
isSatisfiedBy(person: Person): boolean {
return person.age >= this.minAge;
}
toJSON() {
return { kind: 'adult', minAge: this.minAge, metadata: this.getMetadata() };
}
static fromJSON(json: any): AdultSpecification {
return new AdultSpecification(json.minAge, json.metadata);
}
toDSL(): string {
return `age >= ${this.minAge}`;
}
clone(): AdultSpecification {
return new AdultSpecification(this.minAge, this.getMetadata());
}
}
// Uso
const spec = new AdultSpecification(21, { code: 'ADULT_ONLY', message: 'Somente maiores de 21' });
const ok = spec.isSatisfiedBy({ age: 25 }); // true
// Metadata helper
const withUi = spec.withMetadata({ uiConfig: { severity: 'warning' } });
Observação: métodos de composição (and, or, not, xor, implies) existem como stubs que lançam erro — use as fábricas em @praxisui/specification para composições lógicas.
Exports principais:
Specification<T extends object>SpecificationMetadataSpecificationOptionsMétodos de Specification<T>:
isSatisfiedBy(obj: T): boolean — verifica se o objeto satisfaz a regra.toJSON(): any e static fromJSON(json: any) — serialização customizável.toDSL(): string — representação textual para logs/editores.getMetadata() | setMetadata(m) | withMetadata(m) — metadata de validação/UI.clone(): Specification<T> — cópia profunda.getOperatorKind() — para precedência (usado por composições em @praxisui/specification).Para operações lógicas e coleções de specifications, utilize @praxisui/specification.
FAQs
Core types and base class for the Specification pattern used across Praxis UI packages.
We found that @praxisui/specification-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.