Drop unused small ID Zod statics (#26908)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { Schema } from "effect"
|
import { Schema } from "effect"
|
||||||
|
|
||||||
import { Identifier } from "@/id/id"
|
import { Identifier } from "@/id/id"
|
||||||
import { zod } from "@opencode-ai/core/effect-zod"
|
|
||||||
import { Newtype } from "@opencode-ai/core/schema"
|
import { Newtype } from "@opencode-ai/core/schema"
|
||||||
|
|
||||||
export class PermissionID extends Newtype<PermissionID>()(
|
export class PermissionID extends Newtype<PermissionID>()(
|
||||||
@@ -11,6 +10,4 @@ export class PermissionID extends Newtype<PermissionID>()(
|
|||||||
static ascending(id?: string): PermissionID {
|
static ascending(id?: string): PermissionID {
|
||||||
return this.make(Identifier.ascending("permission", id))
|
return this.make(Identifier.ascending("permission", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly zod = zod(this)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Schema } from "effect"
|
import { Schema } from "effect"
|
||||||
|
|
||||||
import { zod } from "@opencode-ai/core/effect-zod"
|
|
||||||
import { withStatics } from "@opencode-ai/core/schema"
|
import { withStatics } from "@opencode-ai/core/schema"
|
||||||
|
|
||||||
const projectIdSchema = Schema.String.pipe(Schema.brand("ProjectID"))
|
const projectIdSchema = Schema.String.pipe(Schema.brand("ProjectID"))
|
||||||
@@ -10,6 +9,5 @@ export type ProjectID = typeof projectIdSchema.Type
|
|||||||
export const ProjectID = projectIdSchema.pipe(
|
export const ProjectID = projectIdSchema.pipe(
|
||||||
withStatics((schema: typeof projectIdSchema) => ({
|
withStatics((schema: typeof projectIdSchema) => ({
|
||||||
global: schema.make("global"),
|
global: schema.make("global"),
|
||||||
zod: zod(schema),
|
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Schema } from "effect"
|
import { Schema } from "effect"
|
||||||
|
|
||||||
import { Identifier } from "@/id/id"
|
import { Identifier } from "@/id/id"
|
||||||
import { zod } from "@opencode-ai/core/effect-zod"
|
|
||||||
import { withStatics } from "@opencode-ai/core/schema"
|
import { withStatics } from "@opencode-ai/core/schema"
|
||||||
|
|
||||||
const ptyIdSchema = Schema.String.check(Schema.isStartsWith("pty")).pipe(Schema.brand("PtyID"))
|
const ptyIdSchema = Schema.String.check(Schema.isStartsWith("pty")).pipe(Schema.brand("PtyID"))
|
||||||
@@ -11,6 +10,5 @@ export type PtyID = typeof ptyIdSchema.Type
|
|||||||
export const PtyID = ptyIdSchema.pipe(
|
export const PtyID = ptyIdSchema.pipe(
|
||||||
withStatics((schema: typeof ptyIdSchema) => ({
|
withStatics((schema: typeof ptyIdSchema) => ({
|
||||||
ascending: (id?: string) => schema.make(Identifier.ascending("pty", id)),
|
ascending: (id?: string) => schema.make(Identifier.ascending("pty", id)),
|
||||||
zod: zod(schema),
|
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import { Schema } from "effect"
|
import { Schema } from "effect"
|
||||||
|
|
||||||
import { Identifier } from "@/id/id"
|
import { Identifier } from "@/id/id"
|
||||||
import { zod } from "@opencode-ai/core/effect-zod"
|
|
||||||
import { Newtype } from "@opencode-ai/core/schema"
|
import { Newtype } from "@opencode-ai/core/schema"
|
||||||
|
|
||||||
export class QuestionID extends Newtype<QuestionID>()("QuestionID", Schema.String.check(Schema.isStartsWith("que"))) {
|
export class QuestionID extends Newtype<QuestionID>()("QuestionID", Schema.String.check(Schema.isStartsWith("que"))) {
|
||||||
static ascending(id?: string): QuestionID {
|
static ascending(id?: string): QuestionID {
|
||||||
return this.make(Identifier.ascending("question", id))
|
return this.make(Identifier.ascending("question", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly zod = zod(this)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { Schema } from "effect"
|
import { Schema } from "effect"
|
||||||
|
|
||||||
import { Identifier } from "@/id/id"
|
import { Identifier } from "@/id/id"
|
||||||
import { zod } from "@opencode-ai/core/effect-zod"
|
|
||||||
import { withStatics } from "@opencode-ai/core/schema"
|
import { withStatics } from "@opencode-ai/core/schema"
|
||||||
|
|
||||||
export const EventID = Schema.String.check(Schema.isStartsWith("evt")).pipe(
|
export const EventID = Schema.String.check(Schema.isStartsWith("evt")).pipe(
|
||||||
Schema.brand("EventID"),
|
Schema.brand("EventID"),
|
||||||
withStatics((s) => ({
|
withStatics((s) => ({
|
||||||
ascending: (id?: string) => s.make(Identifier.ascending("event", id)),
|
ascending: (id?: string) => s.make(Identifier.ascending("event", id)),
|
||||||
zod: zod(s),
|
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const sessionID = Schema.decodeUnknownSync(SessionID)("ses_01J5Y5H0AH4Q4NXJ6P4C3
|
|||||||
const sessionIDChild = Schema.decodeUnknownSync(SessionID)("ses_01J5Y5H0AH4Q4NXJ6P4C3P5V2L")
|
const sessionIDChild = Schema.decodeUnknownSync(SessionID)("ses_01J5Y5H0AH4Q4NXJ6P4C3P5V2L")
|
||||||
const messageID = Schema.decodeUnknownSync(MessageID)("msg_01J5Y5H0AH4Q4NXJ6P4C3P5V2M")
|
const messageID = Schema.decodeUnknownSync(MessageID)("msg_01J5Y5H0AH4Q4NXJ6P4C3P5V2M")
|
||||||
const partID = Schema.decodeUnknownSync(PartID)("prt_01J5Y5H0AH4Q4NXJ6P4C3P5V2N")
|
const partID = Schema.decodeUnknownSync(PartID)("prt_01J5Y5H0AH4Q4NXJ6P4C3P5V2N")
|
||||||
const projectID = ProjectID.zod.parse("proj-alpha")
|
const projectID = ProjectID.make("proj-alpha")
|
||||||
const workspaceID = Schema.decodeUnknownSync(WorkspaceID)("wrk-primary")
|
const workspaceID = Schema.decodeUnknownSync(WorkspaceID)("wrk-primary")
|
||||||
|
|
||||||
function decodeUnknown<S extends Schema.Top>(schema: S) {
|
function decodeUnknown<S extends Schema.Top>(schema: S) {
|
||||||
|
|||||||
Reference in New Issue
Block a user