timezest 1.0.0 → 1.0.2
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.
- package/package.json +7 -2
- package/.github/workflows/npm-publish.yml +0 -32
- package/CODE_STANDARDS.md +0 -89
- package/index.d.ts +0 -104
- package/index.ts +0 -174
- package/prettierrc +0 -18
- package/src/config/config.d.ts +0 -9
- package/src/config/config.ts +0 -10
- package/src/constants/endpoints.d.ts +0 -35
- package/src/constants/endpoints.ts +0 -9
- package/src/entities/entities.d.ts +0 -83
- package/src/entities/schemas.ts +0 -91
- package/src/utils/handleError.d.ts +0 -12
- package/src/utils/handleError.ts +0 -32
- package/src/utils/logger.d.ts +0 -25
- package/src/utils/logger.ts +0 -65
- package/src/utils/makePaginatedRequest.d.ts +0 -20
- package/src/utils/makePaginatedRequest.ts +0 -52
- package/src/utils/makeRequest.d.ts +0 -26
- package/src/utils/makeRequest.ts +0 -68
- package/tsconfig.json +0 -113
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: 20
|
|
18
|
-
- run: npm ci
|
|
19
|
-
|
|
20
|
-
publish-npm:
|
|
21
|
-
needs: build
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v4
|
|
25
|
-
- uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: 20
|
|
28
|
-
registry-url: https://registry.npmjs.org/
|
|
29
|
-
- run: npm ci
|
|
30
|
-
- run: npm publish
|
|
31
|
-
env:
|
|
32
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/CODE_STANDARDS.md
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Code Standards
|
|
2
|
-
|
|
3
|
-
This project follows Microsoft's best practices for TypeScript development and uses Prettier for code formatting. Below are the key standards and guidelines to follow when contributing to this project.
|
|
4
|
-
|
|
5
|
-
## General Guidelines
|
|
6
|
-
|
|
7
|
-
- **TypeScript First**: Always use TypeScript for new files and features. Avoid using `any` unless absolutely necessary.
|
|
8
|
-
- **Strict Typing**: Enable strict mode in `tsconfig.json` and ensure all code adheres to strict typing rules.
|
|
9
|
-
- **Modular Design**: Keep code modular and reusable. Avoid large, monolithic functions or classes.
|
|
10
|
-
- **Documentation**: Use JSDoc comments to document functions, classes, and interfaces.
|
|
11
|
-
- **Error Handling**: Use the provided `handleError` utility for consistent error handling.
|
|
12
|
-
|
|
13
|
-
## Code Formatting
|
|
14
|
-
|
|
15
|
-
### Prettier Rules
|
|
16
|
-
|
|
17
|
-
This project uses Prettier for consistent code formatting. The `.prettierrc` file defines the following rules:
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"semi": true,
|
|
22
|
-
"singleQuote": true,
|
|
23
|
-
"tabWidth": 2,
|
|
24
|
-
"useTabs": false,
|
|
25
|
-
"printWidth": 120,
|
|
26
|
-
"trailingComma": "es5",
|
|
27
|
-
"bracketSpacing": true,
|
|
28
|
-
"arrowParens": "always",
|
|
29
|
-
"endOfLine": "lf",
|
|
30
|
-
"quoteProps": "consistent",
|
|
31
|
-
"jsxSingleQuote": true,
|
|
32
|
-
"objectWrap": "preserve",
|
|
33
|
-
"bracketSameLine": false,
|
|
34
|
-
"proseWrap": "always",
|
|
35
|
-
"singleAttributePerLine": true,
|
|
36
|
-
"htmlWhitespaceSensitivity": "css"
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Run Prettier before committing code:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx prettier --write .
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Naming Conventions
|
|
47
|
-
|
|
48
|
-
- **Files**: Use `camelCase` for file names (e.g., `makeRequest.ts`).
|
|
49
|
-
- **Variables**: Use `camelCase` for variables and functions.
|
|
50
|
-
- **Classes**: Use `PascalCase` for class names.
|
|
51
|
-
- **Constants**: Use `UPPER_CASE` for constants.
|
|
52
|
-
|
|
53
|
-
## Folder Structure
|
|
54
|
-
|
|
55
|
-
- **`src/config`**: Configuration files and types.
|
|
56
|
-
- **`src/constants`**: Constants such as API endpoints.
|
|
57
|
-
- **`src/entities`**: Entity definitions and schemas.
|
|
58
|
-
- **`src/tests`**: Test files for the project.
|
|
59
|
-
- **`src/utils`**: Utility functions for logging, error handling, and HTTP requests.
|
|
60
|
-
|
|
61
|
-
## Testing
|
|
62
|
-
|
|
63
|
-
- Write unit tests for all new features and bug fixes.
|
|
64
|
-
- Place test files in the `src/tests` folder.
|
|
65
|
-
- Use descriptive names for test cases.
|
|
66
|
-
|
|
67
|
-
Run tests using:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
npm test
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Git Commit Messages
|
|
74
|
-
|
|
75
|
-
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages:
|
|
76
|
-
|
|
77
|
-
- **feat**: A new feature
|
|
78
|
-
- **fix**: A bug fix
|
|
79
|
-
- **docs**: Documentation changes
|
|
80
|
-
- **style**: Code style changes (formatting, missing semi-colons, etc.)
|
|
81
|
-
- **refactor**: Code refactoring
|
|
82
|
-
- **test**: Adding or updating tests
|
|
83
|
-
- **chore**: Maintenance tasks (e.g., updating dependencies)
|
|
84
|
-
|
|
85
|
-
## Additional Resources
|
|
86
|
-
|
|
87
|
-
- [TypeScript Best Practices](https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html)
|
|
88
|
-
- [Prettier Documentation](https://prettier.io/docs/en/index.html)
|
|
89
|
-
- [Microsoft TypeScript Guidelines](https://github.com/microsoft/TypeScript/wiki/Coding-guidelines)
|
package/index.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { LogLevel, Logger, log } from "./logger.js";
|
|
2
|
-
export { LogLevel, Logger, log } from "./logger.js";
|
|
3
|
-
export {
|
|
4
|
-
Agent,
|
|
5
|
-
AppointmentType,
|
|
6
|
-
Resource,
|
|
7
|
-
SchedulingRequest,
|
|
8
|
-
Team,
|
|
9
|
-
} from "./src/entities/entities.d";
|
|
10
|
-
export { TimeZestAPIConfig } from "./src/config/config.d";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Represents the main interface for the TimeZest API.
|
|
14
|
-
*/
|
|
15
|
-
export interface TimeZestAPI {
|
|
16
|
-
/**
|
|
17
|
-
* Logs a message with a specified log level.
|
|
18
|
-
* @param level - The log level (e.g., 'info', 'debug').
|
|
19
|
-
* @param message - The message to log.
|
|
20
|
-
* @param data - Optional additional data to log.
|
|
21
|
-
*/
|
|
22
|
-
log: (level: LogLevel, message: string, data?: any) => void;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves a list of resources, optionally filtered by a query.
|
|
26
|
-
* @param filter - An optional filter string in TQL format
|
|
27
|
-
* @returns A promise that resolves to an array of resources.
|
|
28
|
-
*/
|
|
29
|
-
getResources(filter?: string | null): Promise<Resource[]>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves a list of agents, optionally filtered by a query.
|
|
33
|
-
* @param filter - An optional filter string in TQL format
|
|
34
|
-
* @returns A promise that resolves to an array of agents.
|
|
35
|
-
*/
|
|
36
|
-
getAgents(filter?: string | null): Promise<Agent[]>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Retrieves a list of teams, optionally filtered by a query.
|
|
40
|
-
* @param filter - An optional filter string in TQL format
|
|
41
|
-
* @returns A promise that resolves to an array of teams.
|
|
42
|
-
*/
|
|
43
|
-
getTeams(filter?: string | null): Promise<Team[]>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves a list of appointment types, optionally filtered by a query.
|
|
47
|
-
* @param filter - An optional filter string in TQL format
|
|
48
|
-
* @returns A promise that resolves to an array of appointment types.
|
|
49
|
-
*/
|
|
50
|
-
getAppointmentTypes(filter?: string | null): Promise<AppointmentType[]>;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves a specific scheduling request by its ID.
|
|
54
|
-
* @param id - The ID of the scheduling request.
|
|
55
|
-
* @returns A promise that resolves to the scheduling request.
|
|
56
|
-
*/
|
|
57
|
-
getSchedulingRequest(id: string): Promise<SchedulingRequest>;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Retrieves a list of scheduling requests, optionally filtered by a query.
|
|
61
|
-
* @param filter - An optional filter string in TQL format
|
|
62
|
-
* @returns A promise that resolves to an array of scheduling requests.
|
|
63
|
-
*/
|
|
64
|
-
getSchedulingRequests(filter?: string | null): Promise<SchedulingRequest[]>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Creates a new scheduling request.
|
|
68
|
-
* @param data - The data for the new scheduling request.
|
|
69
|
-
* @returns A promise that resolves to the created scheduling request.
|
|
70
|
-
*/
|
|
71
|
-
createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Retrieves the API key.
|
|
75
|
-
* @returns The API key as a string.
|
|
76
|
-
*/
|
|
77
|
-
getApiKey(): string;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Retrieves the configuration object.
|
|
81
|
-
* @returns The configuration object.
|
|
82
|
-
*/
|
|
83
|
-
getConfig(): TimeZestAPIConfig;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Options for configuring the TimeZest API.
|
|
88
|
-
*/
|
|
89
|
-
export interface TimeZestAPIOptions {
|
|
90
|
-
/** The log level for the API (e.g., 'info', 'debug'). */
|
|
91
|
-
logLevel?: LogLevel;
|
|
92
|
-
|
|
93
|
-
/** A custom logger implementation. */
|
|
94
|
-
logger?: Logger;
|
|
95
|
-
|
|
96
|
-
/** The base URL for the API. */
|
|
97
|
-
baseUrl?: string;
|
|
98
|
-
|
|
99
|
-
/** The maximum delay between retries, in milliseconds. */
|
|
100
|
-
maxRetryDelayMs?: number;
|
|
101
|
-
|
|
102
|
-
/** The maximum total retry time, in milliseconds. */
|
|
103
|
-
maxRetryTimeMs?: number;
|
|
104
|
-
}
|
package/index.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TimeZestAPI as TimeZestAPIInterface,
|
|
3
|
-
TimeZestAPIOptions,
|
|
4
|
-
TimeZestAPIConfig,
|
|
5
|
-
LogLevel,
|
|
6
|
-
log,
|
|
7
|
-
Agent,
|
|
8
|
-
AppointmentType,
|
|
9
|
-
Resource,
|
|
10
|
-
SchedulingRequest,
|
|
11
|
-
Team,
|
|
12
|
-
} from "./index.d";
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
ResourceSchema,
|
|
16
|
-
AgentSchema,
|
|
17
|
-
AppointmentTypeSchema,
|
|
18
|
-
SchedulingRequestSchema,
|
|
19
|
-
TeamSchema,
|
|
20
|
-
} from "./src/entities/schemas";
|
|
21
|
-
import { CONFIG } from "./src/config/config";
|
|
22
|
-
import { makeRequest } from "./src/utils/makeRequest";
|
|
23
|
-
import { API_ENDPOINTS } from "./src/constants/endpoints";
|
|
24
|
-
import { buildLogger, withLogging } from "./src/utils/logger";
|
|
25
|
-
import { makePaginatedRequest } from "./src/utils/makePaginatedRequest";
|
|
26
|
-
|
|
27
|
-
class TimeZestAPI implements TimeZestAPIInterface {
|
|
28
|
-
private config: TimeZestAPIConfig;
|
|
29
|
-
private apiKey: string;
|
|
30
|
-
log: log;
|
|
31
|
-
|
|
32
|
-
constructor(apiKey: string, options?: TimeZestAPIOptions) {
|
|
33
|
-
this.apiKey = apiKey;
|
|
34
|
-
this.config = {
|
|
35
|
-
logLevel: options?.logLevel || CONFIG.logLevel,
|
|
36
|
-
logger: options?.logger || CONFIG.logger,
|
|
37
|
-
baseUrl: options?.baseUrl || CONFIG.baseUrl,
|
|
38
|
-
maxRetryDelayMs: options?.maxRetryDelayMs || CONFIG.maxRetryDelayMs,
|
|
39
|
-
maxRetryTimeMs: options?.maxRetryTimeMs || CONFIG.maxRetryTimeMs,
|
|
40
|
-
};
|
|
41
|
-
this.log = buildLogger(this.config.logger, this.config.logLevel);
|
|
42
|
-
// Log the initialization of the API client but remove apiKey
|
|
43
|
-
this.log("info", "TimeZestAPI initialized");
|
|
44
|
-
this.log("debug", "TimeZestAPI initialized with custom config", {
|
|
45
|
-
...options,
|
|
46
|
-
});
|
|
47
|
-
this.log("debug", "TimeZestAPI initialized with final config", {
|
|
48
|
-
...this.config,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Wrap methods with logging middleware using the instance's log method
|
|
52
|
-
this.getResources = withLogging(
|
|
53
|
-
this.getResources.bind(this),
|
|
54
|
-
this,
|
|
55
|
-
"getResources",
|
|
56
|
-
);
|
|
57
|
-
this.getAgents = withLogging(this.getAgents.bind(this), this, "getAgents");
|
|
58
|
-
this.getTeams = withLogging(this.getTeams.bind(this), this, "getTeams");
|
|
59
|
-
this.getAppointmentTypes = withLogging(
|
|
60
|
-
this.getAppointmentTypes.bind(this),
|
|
61
|
-
this,
|
|
62
|
-
"getAppointmentTypes",
|
|
63
|
-
);
|
|
64
|
-
this.getSchedulingRequest = withLogging(
|
|
65
|
-
this.getSchedulingRequest.bind(this),
|
|
66
|
-
this,
|
|
67
|
-
"getSchedulingRequest",
|
|
68
|
-
);
|
|
69
|
-
this.createSchedulingRequest = withLogging(
|
|
70
|
-
this.createSchedulingRequest.bind(this),
|
|
71
|
-
this,
|
|
72
|
-
"createSchedulingRequest",
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
getApiKey(): string {
|
|
77
|
-
return this.apiKey;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
getConfig(): TimeZestAPIConfig {
|
|
81
|
-
return this.config;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getResources = async (filter: string | null = null): Promise<Resource[]> => {
|
|
85
|
-
const response = await makePaginatedRequest<Resource>(
|
|
86
|
-
this,
|
|
87
|
-
API_ENDPOINTS.RESOURCES,
|
|
88
|
-
"GET",
|
|
89
|
-
null,
|
|
90
|
-
filter,
|
|
91
|
-
);
|
|
92
|
-
return response.map((item) => ResourceSchema.parse(item));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
async getAgents(filter: string | null = null): Promise<Agent[]> {
|
|
96
|
-
const response = await makePaginatedRequest<Agent>(
|
|
97
|
-
this,
|
|
98
|
-
API_ENDPOINTS.AGENTS,
|
|
99
|
-
"GET",
|
|
100
|
-
null,
|
|
101
|
-
filter,
|
|
102
|
-
);
|
|
103
|
-
return response.map((item) => AgentSchema.parse(item));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async getTeams(filter: string | null = null): Promise<Team[]> {
|
|
107
|
-
const response = await makePaginatedRequest<Team>(
|
|
108
|
-
this,
|
|
109
|
-
API_ENDPOINTS.TEAMS,
|
|
110
|
-
"GET",
|
|
111
|
-
null,
|
|
112
|
-
filter,
|
|
113
|
-
);
|
|
114
|
-
return response.map((item) => TeamSchema.parse(item));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async getAppointmentTypes(
|
|
118
|
-
filter: string | null = null,
|
|
119
|
-
): Promise<AppointmentType[]> {
|
|
120
|
-
const response = await makePaginatedRequest<AppointmentType>(
|
|
121
|
-
this,
|
|
122
|
-
API_ENDPOINTS.APPOINTMENT_TYPES,
|
|
123
|
-
"GET",
|
|
124
|
-
null,
|
|
125
|
-
filter,
|
|
126
|
-
);
|
|
127
|
-
return response.map((item) => AppointmentTypeSchema.parse(item));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
async getSchedulingRequest(id: string): Promise<SchedulingRequest> {
|
|
131
|
-
const response = await makeRequest<SchedulingRequest>(
|
|
132
|
-
this.log,
|
|
133
|
-
this.apiKey,
|
|
134
|
-
this.config.baseUrl,
|
|
135
|
-
`${API_ENDPOINTS.SCHEDULING_REQUESTS}/${id}`,
|
|
136
|
-
"GET",
|
|
137
|
-
null,
|
|
138
|
-
this.config.maxRetryTimeMs,
|
|
139
|
-
this.config.maxRetryDelayMs,
|
|
140
|
-
);
|
|
141
|
-
return SchedulingRequestSchema.parse(response);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async getSchedulingRequests(
|
|
145
|
-
filter: string | null = null,
|
|
146
|
-
): Promise<SchedulingRequest[]> {
|
|
147
|
-
const response = await makePaginatedRequest<SchedulingRequest>(
|
|
148
|
-
this,
|
|
149
|
-
API_ENDPOINTS.SCHEDULING_REQUESTS,
|
|
150
|
-
"GET",
|
|
151
|
-
null,
|
|
152
|
-
filter,
|
|
153
|
-
);
|
|
154
|
-
return response.map((item) => SchedulingRequestSchema.parse(item));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async createSchedulingRequest(
|
|
158
|
-
data: SchedulingRequest,
|
|
159
|
-
): Promise<SchedulingRequest> {
|
|
160
|
-
const response = await makeRequest<SchedulingRequest>(
|
|
161
|
-
this.log,
|
|
162
|
-
this.apiKey,
|
|
163
|
-
this.config.baseUrl,
|
|
164
|
-
API_ENDPOINTS.SCHEDULING_REQUESTS,
|
|
165
|
-
"POST",
|
|
166
|
-
data,
|
|
167
|
-
this.config.maxRetryTimeMs,
|
|
168
|
-
this.config.maxRetryDelayMs,
|
|
169
|
-
);
|
|
170
|
-
return response;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export default TimeZestAPI;
|
package/prettierrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"semi": true,
|
|
3
|
-
"singleQuote": true,
|
|
4
|
-
"tabWidth": 2,
|
|
5
|
-
"useTabs": false,
|
|
6
|
-
"printWidth": 120,
|
|
7
|
-
"trailingComma": "es5",
|
|
8
|
-
"bracketSpacing": true,
|
|
9
|
-
"arrowParens": "always",
|
|
10
|
-
"endOfLine": "lf",
|
|
11
|
-
"quoteProps": "consistent",
|
|
12
|
-
"jsxSingleQuote": true,
|
|
13
|
-
"objectWrap": "preserve",
|
|
14
|
-
"bracketSameLine": false,
|
|
15
|
-
"proseWrap": "always",
|
|
16
|
-
"singleAttributePerLine": true,
|
|
17
|
-
"htmlWhitespaceSensitivity": "css"
|
|
18
|
-
}
|
package/src/config/config.d.ts
DELETED
package/src/config/config.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { defaultLogger } from "../utils/logger";
|
|
2
|
-
import { TimeZestAPIConfig } from "./config.d";
|
|
3
|
-
|
|
4
|
-
export const CONFIG: TimeZestAPIConfig = {
|
|
5
|
-
logLevel: "error",
|
|
6
|
-
logger: defaultLogger,
|
|
7
|
-
baseUrl: "https://api.timezest.com/v1",
|
|
8
|
-
maxRetryDelayMs: 1.5 * 60 * 1000, // 1.5 minutes
|
|
9
|
-
maxRetryTimeMs: 15 * 1000, // 15 seconds
|
|
10
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the API endpoints used in the TimeZest application.
|
|
3
|
-
*/
|
|
4
|
-
export const API_ENDPOINTS: {
|
|
5
|
-
/** Endpoint for managing resources. */
|
|
6
|
-
RESOURCES: apiEndpoint;
|
|
7
|
-
|
|
8
|
-
/** Endpoint for managing agents. */
|
|
9
|
-
AGENTS: apiEndpoint;
|
|
10
|
-
|
|
11
|
-
/** Endpoint for managing teams. */
|
|
12
|
-
TEAMS: apiEndpoint;
|
|
13
|
-
|
|
14
|
-
/** Endpoint for managing appointment types. */
|
|
15
|
-
APPOINTMENT_TYPES: apiEndpoint;
|
|
16
|
-
|
|
17
|
-
/** Endpoint for managing scheduling requests. */
|
|
18
|
-
SCHEDULING_REQUESTS: apiEndpoint;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type apiEndpoint =
|
|
22
|
-
| "/resources"
|
|
23
|
-
| "/agents"
|
|
24
|
-
| "/teams"
|
|
25
|
-
| "/appointment_types"
|
|
26
|
-
| "/scheduling_requests"
|
|
27
|
-
| `${apiEndpoint}/${string}`;
|
|
28
|
-
|
|
29
|
-
export type apiEndpoints = {
|
|
30
|
-
RESOURCES: apiEndpoint;
|
|
31
|
-
AGENTS: apiEndpoint;
|
|
32
|
-
TEAMS: apiEndpoint;
|
|
33
|
-
APPOINTMENT_TYPES: apiEndpoint;
|
|
34
|
-
SCHEDULING_REQUESTS: apiEndpoint;
|
|
35
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export interface Agent {
|
|
2
|
-
id: string;
|
|
3
|
-
object: string;
|
|
4
|
-
name: string;
|
|
5
|
-
email: string;
|
|
6
|
-
role: string;
|
|
7
|
-
schedulable: boolean;
|
|
8
|
-
two_factor_enabled: boolean;
|
|
9
|
-
url_slug: string;
|
|
10
|
-
created_at: number;
|
|
11
|
-
updated_at: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface AppointmentType {
|
|
15
|
-
id: string;
|
|
16
|
-
object: string;
|
|
17
|
-
internal_name: string;
|
|
18
|
-
external_name: string;
|
|
19
|
-
duration_mins: number;
|
|
20
|
-
url_slug: string;
|
|
21
|
-
created_at: number;
|
|
22
|
-
updated_at: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface Resource {
|
|
26
|
-
id: string;
|
|
27
|
-
object: string;
|
|
28
|
-
name: string;
|
|
29
|
-
email: string;
|
|
30
|
-
role: string;
|
|
31
|
-
schedulable: boolean;
|
|
32
|
-
two_factor_enabled: boolean;
|
|
33
|
-
url_slug: string;
|
|
34
|
-
created_at: number;
|
|
35
|
-
updated_at: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface SchedulingRequest {
|
|
39
|
-
id: string;
|
|
40
|
-
object: string;
|
|
41
|
-
appointment_type_id: string;
|
|
42
|
-
end_user_email: string;
|
|
43
|
-
end_user_name: string;
|
|
44
|
-
associated_entities: Array<{
|
|
45
|
-
type: string;
|
|
46
|
-
id: number;
|
|
47
|
-
number?: string;
|
|
48
|
-
}>;
|
|
49
|
-
resources: Array<{
|
|
50
|
-
type: string;
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
}>;
|
|
54
|
-
scheduled_agents: Array<unknown>;
|
|
55
|
-
scheduled_at: number;
|
|
56
|
-
scheduling_url: string;
|
|
57
|
-
selected_start_time: number;
|
|
58
|
-
selected_time_zone: string;
|
|
59
|
-
status: string;
|
|
60
|
-
created_at: number;
|
|
61
|
-
updated_at: number;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface SchedulingRequestPost {
|
|
65
|
-
appointment_type_id: string;
|
|
66
|
-
trigger_mode: string;
|
|
67
|
-
associated_entities: Array<{
|
|
68
|
-
type: string;
|
|
69
|
-
number: string;
|
|
70
|
-
}>;
|
|
71
|
-
resource_ids: string[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface Team {
|
|
75
|
-
id: string;
|
|
76
|
-
object: string;
|
|
77
|
-
internal_name: string;
|
|
78
|
-
external_name: string;
|
|
79
|
-
team_type: string;
|
|
80
|
-
url_slug: string;
|
|
81
|
-
created_at: number;
|
|
82
|
-
updated_at: number;
|
|
83
|
-
}
|
package/src/entities/schemas.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const AgentSchema = z.object({
|
|
4
|
-
id: z.string(),
|
|
5
|
-
object: z.string(),
|
|
6
|
-
name: z.string(),
|
|
7
|
-
email: z.string(),
|
|
8
|
-
role: z.string(),
|
|
9
|
-
schedulable: z.boolean(),
|
|
10
|
-
two_factor_enabled: z.boolean(),
|
|
11
|
-
url_slug: z.string(),
|
|
12
|
-
created_at: z.number(),
|
|
13
|
-
updated_at: z.number(),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const AppointmentTypeSchema = z.object({
|
|
17
|
-
id: z.string(),
|
|
18
|
-
object: z.string(),
|
|
19
|
-
internal_name: z.string(),
|
|
20
|
-
external_name: z.string(),
|
|
21
|
-
duration_mins: z.number(),
|
|
22
|
-
url_slug: z.string(),
|
|
23
|
-
created_at: z.number(),
|
|
24
|
-
updated_at: z.number(),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export const ResourceSchema = z.object({
|
|
28
|
-
id: z.string(),
|
|
29
|
-
object: z.string(),
|
|
30
|
-
name: z.string(),
|
|
31
|
-
email: z.string(),
|
|
32
|
-
role: z.string(),
|
|
33
|
-
schedulable: z.boolean(),
|
|
34
|
-
two_factor_enabled: z.boolean(),
|
|
35
|
-
url_slug: z.string(),
|
|
36
|
-
created_at: z.number(),
|
|
37
|
-
updated_at: z.number(),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export const SchedulingRequestSchema = z.object({
|
|
41
|
-
id: z.string(),
|
|
42
|
-
object: z.string(),
|
|
43
|
-
appointment_type_id: z.string(),
|
|
44
|
-
end_user_email: z.string(),
|
|
45
|
-
end_user_name: z.string(),
|
|
46
|
-
associated_entities: z.array(
|
|
47
|
-
z.object({
|
|
48
|
-
type: z.string(),
|
|
49
|
-
id: z.number(),
|
|
50
|
-
number: z.string().optional(),
|
|
51
|
-
}),
|
|
52
|
-
),
|
|
53
|
-
resources: z.array(
|
|
54
|
-
z.object({
|
|
55
|
-
type: z.string(),
|
|
56
|
-
id: z.string(),
|
|
57
|
-
name: z.string(),
|
|
58
|
-
}),
|
|
59
|
-
),
|
|
60
|
-
scheduled_agents: z.array(z.unknown()),
|
|
61
|
-
scheduled_at: z.number(),
|
|
62
|
-
scheduling_url: z.string(),
|
|
63
|
-
selected_start_time: z.number(),
|
|
64
|
-
selected_time_zone: z.string(),
|
|
65
|
-
status: z.string(),
|
|
66
|
-
created_at: z.number(),
|
|
67
|
-
updated_at: z.number(),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export const SchedulingRequestPostSchema = z.object({
|
|
71
|
-
appointment_type_id: z.string(),
|
|
72
|
-
trigger_mode: z.string(),
|
|
73
|
-
associated_entities: z.array(
|
|
74
|
-
z.object({
|
|
75
|
-
type: z.string(),
|
|
76
|
-
number: z.string(),
|
|
77
|
-
}),
|
|
78
|
-
),
|
|
79
|
-
resource_ids: z.array(z.string()),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export const TeamSchema = z.object({
|
|
83
|
-
id: z.string(),
|
|
84
|
-
object: z.string(),
|
|
85
|
-
internal_name: z.string(),
|
|
86
|
-
external_name: z.string(),
|
|
87
|
-
team_type: z.string(),
|
|
88
|
-
url_slug: z.string(),
|
|
89
|
-
created_at: z.number(),
|
|
90
|
-
updated_at: z.number(),
|
|
91
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogLevel } from "./logger.d";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Handles errors from API requests.
|
|
5
|
-
* @param log - A logging function to log error details.
|
|
6
|
-
* @param error - The error object to handle.
|
|
7
|
-
* @returns An empty array if the error is a 404, otherwise throws an error.
|
|
8
|
-
*/
|
|
9
|
-
export function handleError(
|
|
10
|
-
log: (level: LogLevel, message: string, data?: any) => void,
|
|
11
|
-
error: any,
|
|
12
|
-
): void | [];
|
package/src/utils/handleError.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { LogLevel } from "./logger.d";
|
|
2
|
-
import { handleError as HandleErrorType } from "./handleError.d";
|
|
3
|
-
|
|
4
|
-
export const handleError: typeof HandleErrorType = (log, error) => {
|
|
5
|
-
if (error.response) {
|
|
6
|
-
const { status, data } = error.response;
|
|
7
|
-
if (status === 404) {
|
|
8
|
-
log("warn", "Resource not found, returning an empty array.", {
|
|
9
|
-
status,
|
|
10
|
-
data,
|
|
11
|
-
});
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
log(
|
|
15
|
-
"error",
|
|
16
|
-
`API Error: ${status} - ${data.message || "Unknown error"}`,
|
|
17
|
-
data,
|
|
18
|
-
);
|
|
19
|
-
if (data.errors) {
|
|
20
|
-
log("error", "Details:", data.errors);
|
|
21
|
-
}
|
|
22
|
-
throw new Error(data.message || `HTTP ${status}`);
|
|
23
|
-
} else if (error.request) {
|
|
24
|
-
log("error", "No response received from the API.", {
|
|
25
|
-
message: error.message,
|
|
26
|
-
});
|
|
27
|
-
throw new Error("No response received from the API");
|
|
28
|
-
} else {
|
|
29
|
-
log("error", "Error setting up the request.", { message: error.message });
|
|
30
|
-
throw new Error("Error setting up the request");
|
|
31
|
-
}
|
|
32
|
-
};
|
package/src/utils/logger.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type log = {
|
|
2
|
-
(level: LogLevel, message: string, data?: any): void;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface Logger {
|
|
7
|
-
silent: (message: string, data?: any) => void;
|
|
8
|
-
error: (message: string, data?: any) => void;
|
|
9
|
-
warn: (message: string, data?: any) => void;
|
|
10
|
-
info: (message: string, data?: any) => void;
|
|
11
|
-
http: (message: string, data?: any) => void;
|
|
12
|
-
verbose: (message: string, data?: any) => void;
|
|
13
|
-
debug: (message: string, data?: any) => void;
|
|
14
|
-
silly: (message: string, data?: any) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type LogLevel =
|
|
18
|
-
| "silent"
|
|
19
|
-
| "error"
|
|
20
|
-
| "warn"
|
|
21
|
-
| "info"
|
|
22
|
-
| "http"
|
|
23
|
-
| "verbose"
|
|
24
|
-
| "debug"
|
|
25
|
-
| "silly";
|
package/src/utils/logger.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Logger, LogLevel } from "./logger.d";
|
|
2
|
-
|
|
3
|
-
export const logLevelPriority: Record<LogLevel, number> = {
|
|
4
|
-
silent: -1,
|
|
5
|
-
error: 0,
|
|
6
|
-
warn: 1,
|
|
7
|
-
info: 2,
|
|
8
|
-
http: 3,
|
|
9
|
-
verbose: 4,
|
|
10
|
-
debug: 5,
|
|
11
|
-
silly: 6,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const defaultLogger: Logger = {
|
|
15
|
-
silent: (_message: string, _data?: any) => {},
|
|
16
|
-
error: (message: string, data?: any) =>
|
|
17
|
-
data ? console.error(message, data) : console.error(message),
|
|
18
|
-
warn: (message: string, data?: any) =>
|
|
19
|
-
data ? console.warn(message, data) : console.warn(message),
|
|
20
|
-
info: (message: string, data?: any) =>
|
|
21
|
-
data ? console.info(message, data) : console.info,
|
|
22
|
-
http: (message: string, data?: any) =>
|
|
23
|
-
data ? console.log(message, data) : console.log(message),
|
|
24
|
-
verbose: (message: string, data?: any) =>
|
|
25
|
-
data ? console.debug(message, data) : console.debug(message),
|
|
26
|
-
debug: (message: string, data?: any) =>
|
|
27
|
-
data ? console.debug(message, data) : console.debug(message),
|
|
28
|
-
silly: (message: string, data?: any) =>
|
|
29
|
-
data ? console.debug(message, data) : console.debug(message),
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export function buildLogger(
|
|
33
|
-
logger: Logger,
|
|
34
|
-
logLevel: LogLevel,
|
|
35
|
-
): (level: LogLevel, message: string, data?: any) => void {
|
|
36
|
-
return (level: LogLevel, message: string, data?: any): void => {
|
|
37
|
-
if (logLevelPriority[level] <= logLevelPriority[logLevel]) {
|
|
38
|
-
logger[level](message, data);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function withLogging<T>(
|
|
44
|
-
fn: (...args: any[]) => Promise<T>,
|
|
45
|
-
instance: { log: (level: LogLevel, message: string, data?: any) => void },
|
|
46
|
-
functionName: string,
|
|
47
|
-
): (...args: any[]) => Promise<T> {
|
|
48
|
-
return async (...args: any[]) => {
|
|
49
|
-
instance.log("debug", `Entering ${functionName}`);
|
|
50
|
-
args ? instance.log("silly", `Entering ${functionName}`, { args }) : null;
|
|
51
|
-
try {
|
|
52
|
-
const result = await fn(...args);
|
|
53
|
-
instance.log("debug", `Exiting ${functionName} successfully`);
|
|
54
|
-
result
|
|
55
|
-
? instance.log("silly", `Exiting ${functionName} successfully`, {
|
|
56
|
-
result,
|
|
57
|
-
})
|
|
58
|
-
: null;
|
|
59
|
-
return result;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
instance.log("error", `Error in ${functionName}`, { error });
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { apiEndpoint } from "../constants/endpoints.d";
|
|
2
|
-
import { TimeZestAPI } from "../../index.d";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Makes a paginated API request.
|
|
6
|
-
* @template T - The type of the response data.
|
|
7
|
-
* @param apiInstance - The instance of the TimeZestAPI.
|
|
8
|
-
* @param endpoint - The API endpoint to call.
|
|
9
|
-
* @param method - The HTTP method (GET or POST).
|
|
10
|
-
* @param data - The request payload.
|
|
11
|
-
* @param filter - An optional filter string.
|
|
12
|
-
* @returns A promise that resolves to an array of response data.
|
|
13
|
-
*/
|
|
14
|
-
export function makePaginatedRequest<T>(
|
|
15
|
-
apiInstance: TimeZestAPI,
|
|
16
|
-
endpoint: apiEndpoint,
|
|
17
|
-
method?: "GET" | "POST",
|
|
18
|
-
data?: any,
|
|
19
|
-
filter?: string | null,
|
|
20
|
-
): Promise<T[]>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
import { handleError } from "./handleError";
|
|
3
|
-
import { makePaginatedRequest as MakePaginatedRequestType } from "./makePaginatedRequest.d";
|
|
4
|
-
|
|
5
|
-
export const makePaginatedRequest: typeof MakePaginatedRequestType = async (
|
|
6
|
-
apiInstance,
|
|
7
|
-
endpoint,
|
|
8
|
-
method = "GET",
|
|
9
|
-
data = null,
|
|
10
|
-
filter = null,
|
|
11
|
-
) => {
|
|
12
|
-
const { log } = apiInstance;
|
|
13
|
-
const apiKey = apiInstance.getApiKey();
|
|
14
|
-
const { baseUrl, maxRetryTimeMs, maxRetryDelayMs } = apiInstance.getConfig();
|
|
15
|
-
|
|
16
|
-
let results: any[] = [];
|
|
17
|
-
let nextPage: number | null = 1;
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
do {
|
|
21
|
-
log("debug", `Fetching page ${nextPage} for ${endpoint}`);
|
|
22
|
-
const response: { data: any[]; next_page: number | null } =
|
|
23
|
-
await makeRequest<{
|
|
24
|
-
data: any[];
|
|
25
|
-
next_page: number | null;
|
|
26
|
-
}>(
|
|
27
|
-
log,
|
|
28
|
-
apiKey,
|
|
29
|
-
baseUrl,
|
|
30
|
-
endpoint,
|
|
31
|
-
method,
|
|
32
|
-
{ ...data, filter, page: nextPage },
|
|
33
|
-
maxRetryTimeMs,
|
|
34
|
-
maxRetryDelayMs,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
log("http", `Page ${nextPage} fetched successfully for ${endpoint}`);
|
|
38
|
-
results = results.concat(response.data);
|
|
39
|
-
nextPage = response.next_page;
|
|
40
|
-
} while (nextPage);
|
|
41
|
-
|
|
42
|
-
log("http", `Paginated request to ${endpoint} completed successfully`);
|
|
43
|
-
return results;
|
|
44
|
-
} catch (error: any) {
|
|
45
|
-
log(
|
|
46
|
-
"error",
|
|
47
|
-
`Paginated request to ${endpoint} failed with error: '${error.message}'`,
|
|
48
|
-
);
|
|
49
|
-
handleError(log, error);
|
|
50
|
-
}
|
|
51
|
-
return results;
|
|
52
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { apiEndpoint } from "../constants/endpoints.d";
|
|
2
|
-
import { LogLevel } from "./logger.d";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Makes an API request with retry logic.
|
|
6
|
-
* @template T - The type of the response data.
|
|
7
|
-
* @param log - A logging function to log request details.
|
|
8
|
-
* @param apiKey - The API key for authentication.
|
|
9
|
-
* @param baseUrl - The base URL of the API.
|
|
10
|
-
* @param endpoint - The API endpoint to call.
|
|
11
|
-
* @param method - The HTTP method (GET or POST).
|
|
12
|
-
* @param data - The request payload.
|
|
13
|
-
* @param maxRetryTimeMs - The maximum retry time in milliseconds.
|
|
14
|
-
* @param maxRetryDelayMs - The maximum delay between retries in milliseconds.
|
|
15
|
-
* @returns A promise that resolves to the response data.
|
|
16
|
-
*/
|
|
17
|
-
export function makeRequest<T>(
|
|
18
|
-
log: (level: LogLevel, message: string, data?: any) => void,
|
|
19
|
-
apiKey: string,
|
|
20
|
-
baseUrl: string,
|
|
21
|
-
endpoint: apiEndpoint,
|
|
22
|
-
method: "GET" | "POST",
|
|
23
|
-
data: any,
|
|
24
|
-
maxRetryTimeMs: number,
|
|
25
|
-
maxRetryDelayMs: number,
|
|
26
|
-
): Promise<T>;
|
package/src/utils/makeRequest.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { handleError } from "./handleError";
|
|
3
|
-
import { makeRequest as MakeRequestType } from "./makeRequest.d";
|
|
4
|
-
|
|
5
|
-
export const makeRequest: typeof MakeRequestType = async (
|
|
6
|
-
log,
|
|
7
|
-
apiKey,
|
|
8
|
-
baseUrl,
|
|
9
|
-
endpoint,
|
|
10
|
-
method = "GET",
|
|
11
|
-
data = null,
|
|
12
|
-
maxRetryTimeMs,
|
|
13
|
-
maxRetryDelayMs,
|
|
14
|
-
) => {
|
|
15
|
-
let totalElapsedTime = 0;
|
|
16
|
-
let retries = 0;
|
|
17
|
-
|
|
18
|
-
while (totalElapsedTime < maxRetryTimeMs) {
|
|
19
|
-
try {
|
|
20
|
-
log(
|
|
21
|
-
"debug",
|
|
22
|
-
`Attempting request to ${endpoint}. Retry count: ${retries}`,
|
|
23
|
-
);
|
|
24
|
-
const response = await axios({
|
|
25
|
-
url: `${baseUrl}${endpoint}`,
|
|
26
|
-
method,
|
|
27
|
-
headers: {
|
|
28
|
-
Authorization: `Bearer ${apiKey}`,
|
|
29
|
-
"Content-Type": "application/json",
|
|
30
|
-
},
|
|
31
|
-
data,
|
|
32
|
-
});
|
|
33
|
-
return response.data;
|
|
34
|
-
} catch (error: any) {
|
|
35
|
-
if (error.response?.status === 429) {
|
|
36
|
-
const retryAfterHeader = parseInt(
|
|
37
|
-
error.response.headers["retry-after"],
|
|
38
|
-
10,
|
|
39
|
-
);
|
|
40
|
-
const retryAfter =
|
|
41
|
-
retryAfterHeader || Math.min(maxRetryDelayMs, Math.pow(2, retries));
|
|
42
|
-
|
|
43
|
-
if (totalElapsedTime + retryAfter * 1000 >= maxRetryTimeMs) {
|
|
44
|
-
log("error", `Max retry time exceeded for ${endpoint}`);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
log(
|
|
49
|
-
"warn",
|
|
50
|
-
`Rate limited on ${endpoint}. Retrying after ${retryAfter} seconds...`,
|
|
51
|
-
);
|
|
52
|
-
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
|
|
53
|
-
totalElapsedTime += retryAfter * 1000;
|
|
54
|
-
retries++;
|
|
55
|
-
} else {
|
|
56
|
-
log(
|
|
57
|
-
"error",
|
|
58
|
-
`Request to ${endpoint} failed with error: ${error.message}`,
|
|
59
|
-
);
|
|
60
|
-
handleError(log, error);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Max retry time of ${maxRetryTimeMs} minutes exceeded for ${endpoint}`,
|
|
67
|
-
);
|
|
68
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "libReplacement": true, /* Enable lib replacement. */
|
|
18
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
19
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
20
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
21
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
22
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
23
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
24
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
25
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
26
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
27
|
-
|
|
28
|
-
/* Modules */
|
|
29
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
30
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
31
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
32
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
36
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
37
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
38
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
39
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
40
|
-
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
41
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
-
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
45
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
46
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
47
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
48
|
-
|
|
49
|
-
/* JavaScript Support */
|
|
50
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
51
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
52
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
53
|
-
|
|
54
|
-
/* Emit */
|
|
55
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
56
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
57
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
58
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
59
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
60
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
-
// "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. */
|
|
62
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
63
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
64
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
65
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
-
|
|
77
|
-
/* Interop Constraints */
|
|
78
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
79
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
80
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
81
|
-
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
|
82
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
83
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
84
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
85
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
86
|
-
|
|
87
|
-
/* Type Checking */
|
|
88
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
89
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
90
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
91
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
92
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
93
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
94
|
-
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
95
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
96
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
97
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
98
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
99
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
100
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
101
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
102
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
103
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
104
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
105
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
106
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
107
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
108
|
-
|
|
109
|
-
/* Completeness */
|
|
110
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
111
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
112
|
-
}
|
|
113
|
-
}
|