Skip to content

Commit

Permalink
refactor: moving things around
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Not exporting GotService, getDebug, localDateUtil anymore (they're "in progress", not production ready yet).
  • Loading branch information
kirillgroshkov committed Feb 16, 2019
1 parent 66cbf8c commit 6169c65
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 25 deletions.
12 changes: 12 additions & 0 deletions src/http/got.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { GotJSONOptions } from 'got'
import * as http from 'http'

export interface GotOptions extends GotJSONOptions {}

export interface GotResponse<T = string> extends http.IncomingMessage {
body: T
url: string
requestUrl: string
fromCache: boolean
redirectUrls?: string[]
}
File renamed without changes.
15 changes: 2 additions & 13 deletions src/service/got.service.ts → src/http/got.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import { GotJSONOptions } from 'got'
import * as got from 'got'
import * as http from 'http'
import { getDebug } from '../util/debug'
import { getDebug } from '../log/debug'
import { GotOptions, GotResponse } from './got.model'
const debug = getDebug(__filename)

export interface GotOptions extends GotJSONOptions {}

export interface GotResponse<T = string> extends http.IncomingMessage {
body: T
url: string
requestUrl: string
fromCache: boolean
redirectUrls?: string[]
}

class GotService {
/**
* Just a proxy method, to simplify importing `* as got`, etc.
Expand Down
21 changes: 9 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { GotOptions, GotResponse, gotService } from './service/got.service'
import { getDebug } from './util/debug'
import { localDateUtil, LUXON_ISO_DATE_FORMAT } from './util/localDate.util'
import { localTimeUtil } from './util/localTime.util'
import { processSharedUtil } from './util/process.shared.util'
import { processSharedUtil } from './infra/process.shared.util'
import { zipSharedUtil } from './util/zip.shared.util'
import { ExtendedJoi, Joi } from './validation/joi/joi.extensions'
import {
Expand Down Expand Up @@ -30,13 +26,14 @@ import { JoiValidationError } from './validation/joi/joi.validation.error'
import { JoiValidationResult, joiValidationService } from './validation/joi/joi.validation.service'

export {
GotOptions,
GotResponse,
gotService,
getDebug,
LUXON_ISO_DATE_FORMAT,
localDateUtil,
localTimeUtil,
// todo: in progress, not exported yet
// GotOptions,
// GotResponse,
// gotService,
// getDebug,
// LUXON_ISO_DATE_FORMAT,
// localDateUtil,
// localTimeUtil,
JoiValidationError,
JoiValidationResult,
joiValidationService,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6169c65

Please sign in to comment.