@be-link/tfs-cli-nodejs 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.husky/commit-msg +4 -0
  2. package/.versionrc +22 -0
  3. package/CHANGELOG.md +121 -0
  4. package/Makefile +2 -0
  5. package/README.md +2 -0
  6. package/ci/index.ts +73 -0
  7. package/commitlint.config.js +3 -0
  8. package/docs/.nojekyll +1 -0
  9. package/docs/assets/highlight.css +71 -0
  10. package/docs/assets/main.js +59 -0
  11. package/docs/assets/navigation.js +1 -0
  12. package/docs/assets/search.js +1 -0
  13. package/docs/assets/style.css +1383 -0
  14. package/docs/classes/_internal_.RosJobService.html +89 -0
  15. package/docs/classes/_internal_.RosProcessService.html +220 -0
  16. package/docs/classes/_internal_.RosQueryService.html +118 -0
  17. package/docs/classes/_internal_.default.html +72 -0
  18. package/docs/enums/_internal_.Constants.OperatorRoleEnum.html +85 -0
  19. package/docs/enums/_internal_.Constants.RefundOrderStatusEnum.html +109 -0
  20. package/docs/index.html +63 -0
  21. package/docs/interfaces/_internal_.IApply.html +147 -0
  22. package/docs/interfaces/_internal_.IAuditReject.html +92 -0
  23. package/docs/interfaces/_internal_.ICancel.html +84 -0
  24. package/docs/interfaces/_internal_.IDoRefund.html +68 -0
  25. package/docs/interfaces/_internal_.IFirstAuditPass.html +108 -0
  26. package/docs/interfaces/_internal_.IGetOrderRequest.html +68 -0
  27. package/docs/interfaces/_internal_.IIsOrderCanBeReverse.html +68 -0
  28. package/docs/interfaces/_internal_.IJobService.html +72 -0
  29. package/docs/interfaces/_internal_.IModifyInfo.html +107 -0
  30. package/docs/interfaces/_internal_.IQueryOrdersRequest.html +118 -0
  31. package/docs/interfaces/_internal_.IReverseOrderDTO.html +50 -0
  32. package/docs/interfaces/_internal_.IReverseOrderProcessController.html +196 -0
  33. package/docs/interfaces/_internal_.IReverseOrderQueryController.html +100 -0
  34. package/docs/interfaces/_internal_.ISecondAuditPass.html +92 -0
  35. package/docs/modules/_internal_.Constants.html +54 -0
  36. package/docs/modules/_internal_.html +72 -0
  37. package/docs/modules.html +52 -0
  38. package/docs/variables/RosConstants.html +45 -0
  39. package/docs/variables/rosJobService.html +42 -0
  40. package/docs/variables/rosProcessService.html +42 -0
  41. package/docs/variables/rosQueryService.html +42 -0
  42. package/jest.config.js +194 -0
  43. package/package.json +47 -0
  44. package/src/errors/BizError.ts +10 -0
  45. package/src/errors/FulfillError.ts +10 -0
  46. package/src/index.ts +8 -0
  47. package/src/tfs/http.ts +66 -0
  48. package/src/tfs/modules/baseService.ts +31 -0
  49. package/src/tfs/modules/reschedule/service.ts +19 -0
  50. package/src/tfs/modules/reschedule/type.d.ts +51 -0
  51. package/src/types.ts +22 -0
  52. package/src/utils/env.ts +14 -0
  53. package/src/utils/string.ts +6 -0
  54. package/tsconfig.json +114 -0
  55. package/typedoc.json +15 -0
package/jest.config.js ADDED
@@ -0,0 +1,194 @@
1
+ /*
2
+ * For a detailed explanation regarding each configuration property, visit:
3
+ * https://jestjs.io/docs/configuration
4
+ */
5
+
6
+ module.exports = {
7
+ // All imported modules in your tests should be mocked automatically
8
+ // automock: false,
9
+
10
+ // Stop running tests after `n` failures
11
+ // bail: 0,
12
+
13
+ // The directory where Jest should store its cached dependency information
14
+ // cacheDirectory: "/private/var/folders/dt/kcn7j7yj36n1881sqpgzqv3c0000gn/T/jest_dx",
15
+
16
+ // Automatically clear mock calls and instances between every test
17
+ clearMocks: true,
18
+
19
+ // Indicates whether the coverage information should be collected while executing the test
20
+ // collectCoverage: false,
21
+
22
+ // An array of glob patterns indicating a set of files for which coverage information should be collected
23
+ // collectCoverageFrom: undefined,
24
+
25
+ // The directory where Jest should output its coverage files
26
+ // coverageDirectory: undefined,
27
+
28
+ // An array of regexp pattern strings used to skip coverage collection
29
+ // coveragePathIgnorePatterns: [
30
+ // "/node_modules/"
31
+ // ],
32
+
33
+ // Indicates which provider should be used to instrument code for coverage
34
+ coverageProvider: 'v8',
35
+
36
+ // A list of reporter names that Jest uses when writing coverage reports
37
+ // coverageReporters: [
38
+ // "json",
39
+ // "text",
40
+ // "lcov",
41
+ // "clover"
42
+ // ],
43
+
44
+ // An object that configures minimum threshold enforcement for coverage results
45
+ // coverageThreshold: undefined,
46
+
47
+ // A path to a custom dependency extractor
48
+ // dependencyExtractor: undefined,
49
+
50
+ // Make calling deprecated APIs throw helpful error messages
51
+ // errorOnDeprecated: false,
52
+
53
+ // Force coverage collection from ignored files using an array of glob patterns
54
+ // forceCoverageMatch: [],
55
+
56
+ // A path to a module which exports an async function that is triggered once before all test suites
57
+ // globalSetup: undefined,
58
+
59
+ // A path to a module which exports an async function that is triggered once after all test suites
60
+ // globalTeardown: undefined,
61
+
62
+ // A set of global variables that need to be available in all test environments
63
+ // globals: {},
64
+
65
+ // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66
+ // maxWorkers: "50%",
67
+
68
+ // An array of directory names to be searched recursively up from the requiring module's location
69
+ // moduleDirectories: [
70
+ // "node_modules"
71
+ // ],
72
+
73
+ // An array of file extensions your modules use
74
+ moduleFileExtensions: [
75
+ "js",
76
+ "jsx",
77
+ "ts",
78
+ "tsx",
79
+ "json",
80
+ "node"
81
+ ],
82
+
83
+ // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84
+ // moduleNameMapper: {},
85
+
86
+ // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87
+ // modulePathIgnorePatterns: [],
88
+
89
+ // Activates notifications for test results
90
+ // notify: false,
91
+
92
+ // An enum that specifies notification mode. Requires { notify: true }
93
+ // notifyMode: "failure-change",
94
+
95
+ // A preset that is used as a base for Jest's configuration
96
+ preset: 'ts-jest',
97
+
98
+ // Run tests from one or more projects
99
+ // projects: undefined,
100
+
101
+ // Use this configuration option to add custom reporters to Jest
102
+ // reporters: undefined,
103
+
104
+ // Automatically reset mock state between every test
105
+ // resetMocks: false,
106
+
107
+ // Reset the module registry before running each individual test
108
+ // resetModules: false,
109
+
110
+ // A path to a custom resolver
111
+ // resolver: undefined,
112
+
113
+ // Automatically restore mock state between every test
114
+ // restoreMocks: false,
115
+
116
+ // The root directory that Jest should scan for tests and modules within
117
+ // rootDir: undefined,
118
+
119
+ // A list of paths to directories that Jest should use to search for files in
120
+ // roots: [
121
+ // "<rootDir>"
122
+ // ],
123
+
124
+ // Allows you to use a custom runner instead of Jest's default test runner
125
+ // runner: "jest-runner",
126
+
127
+ // The paths to modules that run some code to configure or set up the testing environment before each test
128
+ // setupFiles: [],
129
+
130
+ // A list of paths to modules that run some code to configure or set up the testing framework before each test
131
+ // setupFilesAfterEnv: [],
132
+
133
+ // The number of seconds after which a test is considered as slow and reported as such in the results.
134
+ // slowTestThreshold: 5,
135
+
136
+ // A list of paths to snapshot serializer modules Jest should use for snapshot testing
137
+ // snapshotSerializers: [],
138
+
139
+ // The test environment that will be used for testing
140
+ // testEnvironment: "jest-environment-node",
141
+
142
+ // Options that will be passed to the testEnvironment
143
+ // testEnvironmentOptions: {},
144
+
145
+ // Adds a location field to test results
146
+ // testLocationInResults: false,
147
+
148
+ // The glob patterns Jest uses to detect test files
149
+ // testMatch: [
150
+ // "**/__tests__/**/*.[jt]s?(x)",
151
+ // "**/?(*.)+(spec|test).[tj]s?(x)"
152
+ // ],
153
+
154
+ // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
155
+ // testPathIgnorePatterns: [
156
+ // "/node_modules/"
157
+ // ],
158
+
159
+ // The regexp pattern or array of patterns that Jest uses to detect test files
160
+ // testRegex: [],
161
+
162
+ // This option allows the use of a custom results processor
163
+ // testResultsProcessor: undefined,
164
+
165
+ // This option allows use of a custom test runner
166
+ // testRunner: "jest-circus/runner",
167
+
168
+ // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
169
+ // testURL: "http://localhost",
170
+
171
+ // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
172
+ // timers: "real",
173
+
174
+ // A map from regular expressions to paths to transformers
175
+ transform: { "^.+\\.ts?$": "ts-jest" },
176
+
177
+ // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
178
+ // transformIgnorePatterns: [
179
+ // "/node_modules/",
180
+ // "\\.pnp\\.[^\\/]+$"
181
+ // ],
182
+
183
+ // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
184
+ // unmockedModulePathPatterns: undefined,
185
+
186
+ // Indicates whether each individual test should be reported during the run
187
+ // verbose: undefined,
188
+
189
+ // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
190
+ // watchPathIgnorePatterns: [],
191
+
192
+ // Whether to use watchman for file crawling
193
+ // watchman: true,
194
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@be-link/tfs-cli-nodejs",
3
+ "version": "0.0.1",
4
+ "description": "交易履约服务Nodejs客户端",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/",
8
+ "test": "npx jest",
9
+ "gen-doc": "npx typedoc --options typedoc.json",
10
+ "update:major": "standard-version --release-as major",
11
+ "update:minor": "standard-version --release-as minor",
12
+ "update:patch": "standard-version --release-as patch",
13
+ "update:beta": "standard-version --prerelease beta",
14
+ "publish": "ts-node ./ci/index"
15
+ },
16
+ "author": "dev@8848top.com",
17
+ "license": "ISC",
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "devDependencies": {
23
+ "@commitlint/cli": "^18.4.3",
24
+ "@commitlint/config-conventional": "^18.4.3",
25
+ "@types/inquirer": "^9.0.7",
26
+ "@types/jest": "^29.5.7",
27
+ "@types/node": "^20.14.2",
28
+ "@types/uuid": "^9.0.6",
29
+ "husky": "^8.0.3",
30
+ "inquirer": "8.2.6",
31
+ "ioredis": "5.3.2",
32
+ "jest": "29.7.0",
33
+ "standard-version": "^9.5.0",
34
+ "ts-jest": "29.1.1",
35
+ "typedoc": "0.25.2",
36
+ "typedoc-plugin-missing-exports": "2.1.0",
37
+ "typescript": "5.2.2"
38
+ },
39
+ "dependencies": {
40
+ "axios": "0.27.2",
41
+ "uuid": "^9.0.1",
42
+ "vitality-meta": "1.0.67"
43
+ },
44
+ "engines": {
45
+ "node": ">18"
46
+ }
47
+ }
@@ -0,0 +1,10 @@
1
+ export default class BizError extends Error {
2
+
3
+ code: number
4
+
5
+ constructor(message: string, code: number = 400) {
6
+ super(message)
7
+ this.code = code
8
+ this.name = 'BizError'
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ export default class FulfillError extends Error {
2
+
3
+ code: number
4
+
5
+ constructor(message: string, code: number = 500) {
6
+ super(message)
7
+ this.code = code
8
+ this.name = 'UserError'
9
+ }
10
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ import BizError from './errors/BizError'
2
+ import rescheduleService from './tfs/modules/reschedule/service'
3
+
4
+ /** 业务模块 */
5
+ export {
6
+ BizError,
7
+ rescheduleService,
8
+ }
@@ -0,0 +1,66 @@
1
+ import axios, { AxiosError } from 'axios'
2
+ import FulfillError from '../errors/FulfillError'
3
+ import { v4 as uuidV4 } from 'uuid'
4
+ import BizError from '../errors/BizError'
5
+ type ResponseData = {
6
+ data: any
7
+ message: string
8
+ }
9
+
10
+ export async function callApi<T extends (args: any) => Promise<any>>(url: string, ...request: Parameters<T>)
11
+ : Promise<Awaited<ReturnType<T>>> {
12
+ const requestId = uuidV4()
13
+ const maxRetries = 3 // 最大重试次数
14
+ let retries = 0
15
+ let errorInfo: any = null
16
+
17
+ while (retries < maxRetries) {
18
+ try {
19
+ console.info(`准备发起TFS请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
20
+ const response = await axios.post(url, request[0], {
21
+ headers: {
22
+ 'X-Request-Id': requestId,
23
+ 'x-belink-accessType': 'authorizationTokenInside',
24
+ 'x-belink-authorization': process.env.authorizationTokenInside || ""
25
+ },
26
+ timeout: 60000, // 设置超时时间为 60 秒
27
+ });
28
+
29
+ const responseData = response.data as ResponseData
30
+ return responseData.data
31
+ } catch (error: any) {
32
+ console.error(`TFS请求失败[${requestId}]: ${error.message}`)
33
+ errorInfo = error
34
+ const axiosError = error as AxiosError
35
+ const ErrorClass = axiosError.response
36
+ ? axiosError.response.status === 400
37
+ ? BizError
38
+ : FulfillError
39
+ : FulfillError
40
+ if (axiosError.response) {
41
+ const response = axiosError.response
42
+ const data = response.data as ResponseData
43
+ console.error(`TFS 异常: ${axiosError.message},requestId: ${requestId}`)
44
+ console.info('响应信息', data.message)
45
+ console.info('响应信息Data', JSON.stringify(data))
46
+ console.error('异常堆栈', JSON.stringify(error.stack))
47
+ if (axiosError.response.status !== 502) {
48
+ throw new ErrorClass(data.message || 'TFS Error', response.status)
49
+ }
50
+ if (retries === maxRetries) {
51
+ throw new ErrorClass(data.message || 'TFS Error', response.status)
52
+ }
53
+ }
54
+ console.error(`TFS 未知异常: ${axiosError.message}`, error.stack)
55
+ if (retries === maxRetries) {
56
+ throw error
57
+ }
58
+ retries++
59
+ // 进行重试
60
+ await new Promise(resolve => setTimeout(resolve, 1000)) // 延时 1 秒再重试
61
+ }
62
+ }
63
+
64
+ // 如果重试次数达到上限,抛出错误
65
+ throw new Error(errorInfo)
66
+ }
@@ -0,0 +1,31 @@
1
+ import envUtils from '../../utils/env'
2
+ import { camelToKebabCase } from '../../utils/string'
3
+
4
+ export default abstract class BaseService {
5
+ private isPublicEnv: boolean
6
+ /** URL一级路径 */
7
+ protected abstract prefixUrl: string
8
+ /** 子网域名 */
9
+ protected readonly natDevHost = 'http://qgostaxv.tfs.nmkh74o4.rlwzae9d.com:8090'
10
+ protected readonly natProdHost = ''
11
+ /** 公网域名 */
12
+ protected readonly publicDevHost = 'https://tfs-74680-5-1304510571.sh.run.tcloudbase.com'
13
+ protected readonly publicProdHost = ''
14
+
15
+ constructor() {
16
+ /** 如果是云函数环境, 默认走公网访问 */
17
+ this.isPublicEnv = (process.env.CONTAINER_ENV || 'SCF') === 'SCF'
18
+ }
19
+
20
+ /** 获取API URL */
21
+ protected getApiUrl(func: Function): string {
22
+ const host = this.isPublicEnv
23
+ ? envUtils.isProduction()
24
+ ? this.publicProdHost
25
+ : this.publicDevHost
26
+ : envUtils.isProduction()
27
+ ? this.natProdHost
28
+ : this.natDevHost
29
+ return `${host}${this.prefixUrl}/${camelToKebabCase(func.name)}`
30
+ }
31
+ }
@@ -0,0 +1,19 @@
1
+ import { callApi } from '../../http'
2
+ import BaseService from '../baseService'
3
+ import { Reschedule } from './type'
4
+
5
+ class RescheduleService extends BaseService implements Reschedule.Controller {
6
+ protected prefixUrl: string = '/reschedule'
7
+
8
+ rescheduleOrder(request: Reschedule.Request.IRescheduleOrder): Promise<void> {
9
+ return callApi<Reschedule.Controller['rescheduleOrder']>(this.getApiUrl(this.rescheduleOrder), request)
10
+ }
11
+ isOrderCanReschedule(request: Reschedule.Request.IIsOrderCanReschedule): Promise<Reschedule.Response.IIsOrderCanReschedule> {
12
+ return callApi<Reschedule.Controller['isOrderCanReschedule']>(this.getApiUrl(this.isOrderCanReschedule), request)
13
+ }
14
+
15
+ }
16
+
17
+ const rescheduleService = new RescheduleService()
18
+
19
+ export default rescheduleService
@@ -0,0 +1,51 @@
1
+ export namespace Reschedule {
2
+
3
+ export namespace Request {
4
+ export interface IRescheduleOrder {
5
+ /** 订单号 */
6
+ orderId: string
7
+ /** 目标SkuId */
8
+ targetSkuId: string
9
+ /** 原因类型 */
10
+ reasonType: string
11
+ /** 原因描述 */
12
+ reasonDesc: string
13
+ /** 操作人姓名 */
14
+ operatorName: string
15
+ /** 附件列表 */
16
+ attachment: string[]
17
+ }
18
+
19
+ export interface IIsOrderCanReschedule {
20
+ /** 订单号 */
21
+ orderId: string
22
+ /** 目标SkuId */
23
+ targetSkuId: string
24
+ /** 原因类型 */
25
+ reasonType: string
26
+ /** 原因描述 */
27
+ reasonDesc: string
28
+ }
29
+ }
30
+
31
+ export namespace Response {
32
+
33
+ export interface IIsOrderCanReschedule {
34
+ /** 是否允许改期 */
35
+ isCanReschedule: boolean
36
+ }
37
+ }
38
+
39
+ export namespace DTO {
40
+
41
+ }
42
+
43
+ export interface Controller {
44
+ /** 更改订单出行日期 */
45
+ rescheduleOrder(request: Request.IRescheduleOrder): Promise<void>
46
+
47
+ /** 校验订单是否允许改期 */
48
+ isOrderCanReschedule(request: Request.IIsOrderCanReschedule): Promise<Response.IIsOrderCanReschedule>
49
+ }
50
+
51
+ }
package/src/types.ts ADDED
@@ -0,0 +1,22 @@
1
+ export namespace Fulfill {
2
+
3
+ /**
4
+ * 常量类型
5
+ */
6
+ export namespace Constants {
7
+ /**
8
+ * 流水类型
9
+ * @enum
10
+ */
11
+ export const enum OperationEnum {
12
+ /**
13
+ * 增加
14
+ */
15
+ ADD = 'ADD',
16
+ /**
17
+ * 扣减
18
+ */
19
+ SUBTRACT = 'SUBTRACT',
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,14 @@
1
+ const envUtils = {
2
+ // 环境判断
3
+ isProduction() {
4
+ return process.env.NODE_ENV === 'prod'
5
+ },
6
+ isDevelopment() {
7
+ return process.env.NODE_ENV === 'development'
8
+ },
9
+ isPPE() {
10
+ return process.env.NODE_ENV === 'ppe'
11
+ }
12
+ }
13
+
14
+ export default envUtils
@@ -0,0 +1,6 @@
1
+
2
+ /**
3
+ * Camel case to kebab case
4
+ * e.g. camelToKebabCase('camelCase') => 'camel-case'
5
+ */
6
+ export const camelToKebabCase = (str: string) => str.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)
package/tsconfig.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "include": [
3
+ "src/**/*",
4
+ ],
5
+ "exclude": [
6
+ "node_modules",
7
+ "dist"
8
+ ],
9
+ "compilerOptions": {
10
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
11
+
12
+ /* Projects */
13
+ // "incremental": true, /* Enable incremental compilation */
14
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
15
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
16
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
17
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
18
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
19
+
20
+ /* Language and Environment */
21
+ "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
22
+ "lib": [
23
+ "ES2020",
24
+ "DOM"
25
+ ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
26
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
27
+ "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
28
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
29
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
30
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
31
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
32
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
33
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
34
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
35
+
36
+ /* Modules */
37
+ "module": "commonjs", /* Specify what module code is generated. */
38
+ "rootDir": "./src", /* Specify the root folder within your source files. */
39
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
40
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
41
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
42
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
43
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
44
+ "types": [
45
+ "jest",
46
+ "node"
47
+ ], /* Specify type package names to be included without being referenced in a source file. */
48
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
49
+ "resolveJsonModule": true, /* Enable importing .json files */
50
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
51
+
52
+ /* JavaScript Support */
53
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
54
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
55
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
56
+
57
+ /* Emit */
58
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
59
+ "declarationMap": false, /* Create sourcemaps for d.ts files. */
60
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
61
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
62
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
63
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
64
+ "removeComments": false, /* Disable emitting comments. */
65
+ // "noEmit": true, /* Disable emitting files from a compilation. */
66
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
67
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
68
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
69
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
70
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
71
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
72
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
73
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
74
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
75
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
76
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
77
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
78
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
79
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
80
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
81
+
82
+ /* Interop Constraints */
83
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
84
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
85
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
86
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
87
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
88
+
89
+ /* Type Checking */
90
+ "strict": true, /* Enable all strict type-checking options. */
91
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
92
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
93
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
94
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
95
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
96
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
97
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
98
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
99
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
100
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
101
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
102
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
103
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
104
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
105
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
106
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
107
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
108
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
109
+
110
+ /* Completeness */
111
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
112
+ // "skipLibCheck": true /* Skip type checking all .d.ts files. */
113
+ }
114
+ }
package/typedoc.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "entryPoints": [
3
+ "src/index.ts",
4
+ ],
5
+ "out": "./docs",
6
+ "readme": "./README.md",
7
+ "includeVersion": true,
8
+ "disableSources": true,
9
+ "excludePrivate": true,
10
+ "excludeProtected": true,
11
+ "tsconfig": "./tsconfig.json",
12
+ "plugin": [
13
+ "typedoc-plugin-missing-exports"
14
+ ]
15
+ }