packaging-run.d.mts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Persist one credential-free packaging event before its operation.
  3. * @param directory Private run directory.
  4. * @param event Whitelisted fields, excluding arguments and environments.
  5. * @returns Nothing.
  6. */
  7. export function recordPackagingEvent(directory: string, event: object): void
  8. /**
  9. * Publish a fatal marker that stops the supervised stage tree.
  10. * @param directory Private run directory.
  11. * @param reason Credential-free failure category.
  12. * @returns Nothing.
  13. */
  14. export function failPackagingRun(directory: string, reason: string): void
  15. /**
  16. * Redact inherited secret values across arbitrary output chunk boundaries.
  17. * @param secrets Exact credential values to remove.
  18. * @param emit Redacted output sink.
  19. * @returns A UTF-8 stream consumer that flushes its suffix on end.
  20. */
  21. export function packagingOutputRedactor(secrets: readonly string[], emit: (text: string) => void): {
  22. write(chunk: Buffer): void
  23. end(): void
  24. }
  25. /**
  26. * Allocate retained evidence and supervise sequential child-process stages.
  27. * @param root Parent directory for retained records.
  28. * @param metadata Public target/version metadata only.
  29. * @returns A run that blocks later stages after failure and awaits owned process termination.
  30. */
  31. export function createPackagingRun(root: string, metadata: object): {
  32. directory: string
  33. run(stage: string, executable: string, args: readonly string[], options: {
  34. cwd: string
  35. env: NodeJS.ProcessEnv
  36. /** Optional stage deadline; timeout fails the run even if the child reports exit zero. */
  37. timeoutMs?: number
  38. }): Promise<void>
  39. finish(success: boolean): void
  40. }