Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions packages/devtools-types/src/lib/auth-event.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const CorsFlagSchema = Schema.Struct({

export type CorsFlag = Schema.Schema.Type<typeof CorsFlagSchema>;

export const NetworkDataSchema = Schema.Struct({
_tag: Schema.Literal('network'),
export const NetworkDataSchema = Schema.TaggedStruct('network', {
url: Schema.String,
method: Schema.String,
status: Schema.Number,
Expand All @@ -63,8 +62,7 @@ export const SdkAuthorizationSchema = Schema.Struct({
state: Schema.optional(Schema.String),
});

export const SdkDataSchema = Schema.Struct({
_tag: Schema.Literal('sdk'),
export const SdkDataSchema = Schema.TaggedStruct('sdk', {
nodeStatus: Schema.String,
previousStatus: Schema.optional(Schema.String),
interactionId: Schema.optional(Schema.String),
Expand All @@ -82,26 +80,22 @@ export const SdkDataSchema = Schema.Struct({
responseBody: Schema.optional(Schema.Unknown),
});

export const SdkConfigDataSchema = Schema.Struct({
_tag: Schema.Literal('sdk-config'),
export const SdkConfigDataSchema = Schema.TaggedStruct('sdk-config', {
config: Schema.Unknown,
});

export const DomDataSchema = Schema.Struct({
_tag: Schema.Literal('dom'),
export const DomDataSchema = Schema.TaggedStruct('dom', {
element: Schema.optional(Schema.String),
url: Schema.optional(Schema.String),
});

export const SessionDataSchema = Schema.Struct({
_tag: Schema.Literal('session'),
export const SessionDataSchema = Schema.TaggedStruct('session', {
key: Schema.String,
before: Schema.optional(Schema.String),
after: Schema.optional(Schema.String),
});

export const JourneyDataSchema = Schema.Struct({
_tag: Schema.Literal('journey'),
export const JourneyDataSchema = Schema.TaggedStruct('journey', {
stepType: Schema.Union(
Schema.Literal('Step'),
Schema.Literal('LoginSuccess'),
Expand All @@ -120,8 +114,7 @@ export const JourneyDataSchema = Schema.Struct({
errorReason: Schema.optional(Schema.String),
});

export const OidcDataSchema = Schema.Struct({
_tag: Schema.Literal('oidc'),
export const OidcDataSchema = Schema.TaggedStruct('oidc', {
phase: Schema.Union(
Schema.Literal('authorize'),
Schema.Literal('exchange'),
Expand Down Expand Up @@ -164,8 +157,7 @@ export const OidcErrorSchema = Schema.Struct({
errorDescription: Schema.optional(Schema.String),
});

export const OidcSemanticsSchema = Schema.Struct({
_tag: Schema.Literal('oidc-semantics'),
export const OidcSemanticsSchema = Schema.TaggedStruct('oidc-semantics', {
oidcPhase: Schema.Union(
Schema.Literal('discovery'),
Schema.Literal('authorize'),
Expand Down
6 changes: 2 additions & 4 deletions packages/treeshake-check/src/lib/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ export type PackageJsonHints = typeof PackageJsonHints.Type;
// ─── Top-level result ────────────────────────────────────────────────────────

export const TreeshakeResult = Schema.Union(
Schema.Struct({
_tag: Schema.Literal('FullyTreeshakeable'),
Schema.TaggedStruct('FullyTreeshakeable', {
hints: PackageJsonHints,
}),
Schema.Struct({
_tag: Schema.Literal('HasSideEffects'),
Schema.TaggedStruct('HasSideEffects', {
totalOriginalBytes: Schema.Number,
totalRenderedBytes: Schema.Number,
modules: Schema.Array(ModuleAnalysis),
Expand Down
Loading