Преглед на файлове

refactor(core): remove unused API members (#42463)

Kit Langton преди 3 дни
родител
ревизия
0e28d651a5
променени са 3 файла, в които са добавени 1 реда и са изтрити 19 реда
  1. 0 2
      packages/core/src/form.ts
  2. 1 8
      packages/core/src/job.ts
  3. 0 9
      packages/core/src/util/encode.ts

+ 0 - 2
packages/core/src/form.ts

@@ -223,8 +223,6 @@ export const layer = Layer.effect(
   }),
 )
 
-export const locationLayer = layer
-
 export const node = makeLocationNode({ service: Service, layer, deps: [Bus.node] })
 
 export function validateAnswer(form: ReadonlyArray<Form.Field>, answer: Answer) {

+ 1 - 8
packages/core/src/job.ts

@@ -89,7 +89,6 @@ export type BackgroundAllInput = {
 }
 
 export interface Interface {
-  readonly list: () => Effect.Effect<Info[]>
   readonly get: (id: string) => Effect.Effect<Info | undefined>
   readonly start: (input: StartInput) => Effect.Effect<Info>
   readonly wait: (input: WaitInput) => Effect.Effect<WaitResult>
@@ -187,12 +186,6 @@ export const make = Effect.gen(function* () {
     )
   })
 
-  const list: Interface["list"] = Effect.fn("Job.list")(function* () {
-    return Array.from((yield* SynchronizedRef.get(state.jobs)).values())
-      .map(snapshot)
-      .toSorted((a, b) => a.started_at - b.started_at)
-  })
-
   const get: Interface["get"] = Effect.fn("Job.get")(function* (id) {
     const job = (yield* SynchronizedRef.get(state.jobs)).get(id)
     if (!job) return undefined
@@ -360,7 +353,7 @@ export const make = Effect.gen(function* () {
     return result.info
   })
 
-  return Service.of({ list, get, start, wait, block, background, backgroundAll, cancel })
+  return Service.of({ get, start, wait, block, background, backgroundAll, cancel })
 })
 
 const layer = Layer.effect(Service, make)

+ 0 - 9
packages/core/src/util/encode.ts

@@ -10,15 +10,6 @@ export function base64Decode(value: string) {
   return new TextDecoder().decode(bytes)
 }
 
-export async function hash(content: string, algorithm = "SHA-256"): Promise<string> {
-  const encoder = new TextEncoder()
-  const data = encoder.encode(content)
-  const hashBuffer = await crypto.subtle.digest(algorithm, data)
-  const hashArray = Array.from(new Uint8Array(hashBuffer))
-  const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("")
-  return hashHex
-}
-
 export function checksum(content: string): string | undefined {
   if (!content) return undefined
   let hash = 0x811c9dc5