@sheet2db/sdk 1.0.9 → 2.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.
package/package.json CHANGED
@@ -1,31 +1,23 @@
1
1
  {
2
- "name": "@sheet2db/sdk",
3
- "version": "1.0.9",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "test": "jest",
8
- "build":"tsc",
9
- "prepublish": "tsc && npm run test"
10
- },
11
- "exports":{
12
- ".":{
13
- "import":"./dist/index.js",
14
- "require":"./dist/index.js"
2
+ "name": "@sheet2db/sdk",
3
+ "version": "2.0.1",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "dependencies": {
7
+ "@sheet2db/core": "0.0.1"
8
+ },
9
+ "peerDependencies": {
10
+ "axios": "^1.9.0",
11
+ "zod":"^3.25.45"
12
+ },
13
+ "devDependencies": {
14
+ "tsup": "^8.5.0",
15
+ "jest": "^29.7.0",
16
+ "ts-jest": "^29.3.4",
17
+ "@types/jest": "^29.5.14"
18
+ },
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format esm,cjs --dts",
21
+ "test": "jest"
15
22
  }
16
- },
17
- "author": "",
18
- "license": "MIT",
19
- "devDependencies": {
20
- "@jest/globals": "^29.7.0",
21
- "jest": "^29.7.0",
22
- "ts-jest": "^29.1.4",
23
- "typescript": "^5.4.5"
24
- },
25
- "dependencies": {
26
- "node-fetch": "^3.3.2"
27
- },
28
- "homepage": "https://sheet2db.com",
29
- "readme": "https://sheet2db.com/docs/sdks/javascript",
30
- "private":false
31
- }
23
+ }
@@ -0,0 +1,116 @@
1
+ import axios from 'axios';
2
+ import { Sheet2DBClient } from './index';
3
+
4
+ // Create mock Axios instance
5
+ const mockedAxios = {
6
+ get: jest.fn(),
7
+ post: jest.fn(),
8
+ patch: jest.fn(),
9
+ delete: jest.fn(),
10
+ interceptors: {
11
+ request: { use: jest.fn() }
12
+ }
13
+ };
14
+ jest.mock('axios', () => {
15
+ const actualAxios = jest.requireActual('axios');
16
+ return {
17
+ ...actualAxios,
18
+ create: jest.fn(() => mockedAxios),
19
+ };
20
+ });
21
+
22
+ describe('Sheet2DBClient', () => {
23
+ const apiId = 'test-api-id';
24
+
25
+ beforeEach(() => {
26
+ jest.clearAllMocks();
27
+ });
28
+
29
+ test('should throw error if apiId is missing', () => {
30
+ expect(() => new Sheet2DBClient('')).toThrow('apiId is required to create a Sheet2DBClient.');
31
+ });
32
+
33
+ test('should set Basic authentication header', () => {
34
+ const client = new Sheet2DBClient(apiId);
35
+ client.useBasicAuthentication('user', 'pass');
36
+
37
+ const expected = typeof window === 'undefined'
38
+ ? 'Basic ' + Buffer.from('user:pass').toString('base64')
39
+ : 'Basic ' + btoa('user:pass');
40
+
41
+ expect(client.authentication).toBe(expected);
42
+ });
43
+
44
+ test('should set JWT/Bearer token', () => {
45
+ const client = new Sheet2DBClient(apiId);
46
+
47
+ client.useJWTAuthentication('jwt_token');
48
+ expect(client.authentication).toBe('Bearer jwt_token');
49
+
50
+ client.useBearerTokenAuthentication('bearer_token');
51
+ expect(client.authentication).toBe('Bearer bearer_token');
52
+ });
53
+
54
+ test('should call Read with correct params', async () => {
55
+ const client = new Sheet2DBClient(apiId);
56
+ const fakeData = { result: 'ok' };
57
+
58
+ mockedAxios.get.mockResolvedValueOnce({ data: fakeData });
59
+
60
+ const result = await client.Read({ filter: "name:eq:test", format: "rows", sortDirection: "asc", offset: 0 }, 'users');
61
+ expect(mockedAxios.get).toHaveBeenCalledWith('/users', { params: { filter: "name:eq:test", format: "rows", sortDirection: "asc", offset: 0 } });
62
+ expect(result).toEqual(fakeData);
63
+ });
64
+
65
+ test('should call Insert and return inserted count', async () => {
66
+ const client = new Sheet2DBClient(apiId);
67
+ mockedAxios.post.mockResolvedValueOnce({ data: { inserted: 1 } });
68
+
69
+ const result = await client.Insert({ data: [{ name: 'Rushabh' }] }, 'users');
70
+ expect(mockedAxios.post).toHaveBeenCalledWith('/users', { data: [{ name: 'Rushabh' }] });
71
+ expect(result.inserted).toBe(1);
72
+ });
73
+
74
+ test('should call Update and return updated count', async () => {
75
+ const client = new Sheet2DBClient(apiId);
76
+ mockedAxios.patch.mockResolvedValueOnce({ data: { updated: 2 } });
77
+
78
+ const result = await client.Update({ type: 'row', row: 1, data: { name: 'updated' } }, 'users');
79
+ expect(mockedAxios.patch).toHaveBeenCalledWith('/users', { type: 'row', row: 1, data: { name: 'updated' } });
80
+ expect(result.updated).toBe(2);
81
+ });
82
+
83
+ test('should call Delete and return deleted count', async () => {
84
+ const client = new Sheet2DBClient(apiId);
85
+ mockedAxios.delete.mockResolvedValueOnce({ data: { deleted: 1 } });
86
+
87
+ const result = await client.Delete({ type: 'filter', filter: "name:eq:updated" }, 'users');
88
+ expect(mockedAxios.delete).toHaveBeenCalledWith('/users', {
89
+ params: { type: 'filter', filter: "name:eq:updated" }
90
+ });
91
+ expect(result.deleted).toBe(1);
92
+ });
93
+
94
+ test('should call AddSheet and return ok', async () => {
95
+ const client = new Sheet2DBClient(apiId);
96
+ mockedAxios.post.mockResolvedValueOnce({ data: { ok: true } });
97
+
98
+ const result = await client.AddSheet({ name: 'new_sheet' });
99
+ expect(mockedAxios.post).toHaveBeenCalledWith('/sheet', { name: 'new_sheet' });
100
+ expect(result.ok).toBe(true);
101
+ });
102
+
103
+ test('should call DeleteSheet and return ok', async () => {
104
+ const client = new Sheet2DBClient(apiId);
105
+ mockedAxios.delete.mockResolvedValueOnce({ data: { ok: true } });
106
+
107
+ const result = await client.DeleteSheet('users');
108
+ expect(mockedAxios.delete).toHaveBeenCalledWith('/users');
109
+ expect(result.ok).toBe(true);
110
+ });
111
+
112
+ test('should throw error when deleting sheet without name', async () => {
113
+ const client = new Sheet2DBClient(apiId);
114
+ await expect(client.DeleteSheet('')).rejects.toThrow('sheet is required to Delete Sheet');
115
+ });
116
+ });
package/src/index.ts CHANGED
@@ -1,256 +1,67 @@
1
- let fetchFunction: typeof fetch;
2
-
3
- if (typeof window !== 'undefined' && typeof window.fetch !== 'undefined') {
4
- // We are in a browser environment
5
- fetchFunction = window.fetch.bind(window);
6
- } else {
7
- // We are in a Node.js environment
8
- fetchFunction = async (...args) => {
9
- const fetch = global.fetch;
10
- return fetch.apply(null, args)
11
- };
12
- }
13
-
14
- export type Sheet2DBOptions = {
15
- mode: 'apikey';
16
- apiKey: string;
17
- spreadsheetId: string;
18
- version: "v1";
19
- fetchFn?: typeof fetch;
20
- } | {
21
- mode: 'connectionId';
22
- connectionId: string;
23
- basicAuth?: {
24
- username: string;
25
- password: string;
26
- };
27
- jwtAuth?: {
28
- bearerToken: string;
29
- };
30
- version: "v1";
31
- fetchFn?: typeof fetch;
32
- };
33
-
34
- export type ReadOptions = {
35
- limit?: number;
36
- offset?: number;
37
- sheet?: string;
38
- format?: 'records' | 'dict' | 'series' | 'split' | 'index' | 'raw';
39
- cast_numbers?: string[] | string;
40
- value_render?: "FORMATTED_VALUE" | "UNFORMATTED_VALUE" | "FORMULA";
41
- columns?: string[] | string;
42
- sort?: string;
43
- sort_method?: 'date',
44
- sort_date_format?: string;
45
- };
46
-
47
- export type GetKeysOptions = {
48
- sheet?: string;
49
- };
50
-
51
- export type GetCountOptions = {
52
- sheet?: string;
53
- };
54
-
55
- export type GetRangeOptions = {
56
- range: string;
57
- };
58
-
59
- export type SearchOptions = {
60
- sheet?: string;
61
- or?: boolean;
62
- query: string;
63
- };
64
-
65
- export type InsertOptions = {
66
- data: Record<string, any> | Record<string, any>[];
67
- sheet?: string;
68
- };
69
-
70
- export type UpdateRowOptions = {
71
- row: number;
72
- sheet?: string;
73
- data: Record<string, any>;
74
- };
75
-
76
- export type UpdateWithQueryOptions = {
77
- sheet?: string;
78
- query: string;
79
- data: Record<string, any>;
80
- };
81
-
82
- export type BatchUpdateOptions = {
83
- sheet?: string;
84
- batches: { query: string, record: Record<string, any> }[];
85
- };
86
-
87
- export type DeleteRowOptions = {
88
- sheet?: string;
89
- row: number;
90
- };
91
-
92
- export type DeleteWithQueryOptions = {
93
- sheet?: string;
94
- query: string;
95
- };
96
-
97
- export type ClearSheetOptions = {
98
- sheet: string;
99
- };
100
-
101
- export type CreateSheetOptions = {
102
- title?: string;
103
- };
104
-
105
- export type DeleteSheetOptions = {
106
- sheet: string;
107
- };
108
-
109
- export class Sheet2DB {
110
-
111
- private apiEndpoint: string = "https://api.sheet2db.com";
112
- private fetchFn: typeof fetch;
113
-
114
- constructor(private readonly options: Sheet2DBOptions) {
115
- this.fetchFn = options.fetchFn || fetchFunction;
116
- }
117
-
118
- private async fetch<T>(path: string, method: "GET" | "POST" | "PATCH" | "DELETE" = "GET", queryParams?: URLSearchParams | string, body?: any): Promise<T> {
119
- let endpoint = new URL(this.options.version, this.apiEndpoint);
120
- let headers: Record<string, string> = { "Content-Type": "application/json" };
121
-
122
- if (this.options.mode === 'connectionId') {
123
- endpoint.pathname = `${endpoint.pathname}/${this.options.connectionId}${path}`;
124
- if (this.options.basicAuth) {
125
- let authorization = Buffer.from(`${this.options.basicAuth.username}:${this.options.basicAuth.password}`).toString('base64');
126
- headers["Authorization"] = `Basic ${authorization}`;
127
- } else if (this.options.jwtAuth) {
128
- headers["Authorization"] = `Bearer ${this.options.jwtAuth.bearerToken}`;
1
+ import axios, { Axios, AxiosInstance } from 'axios';
2
+ import type { AddSheetOptions, APIAuthentication, DeleteOptions, InsertOptions, ReadOptions, UpdateOptions } from '../../../core/src/types'
3
+
4
+ const isNode = typeof window == 'undefined'
5
+ export class Sheet2DBClient {
6
+ authentication: string | null = null
7
+ axios: AxiosInstance
8
+ constructor(apiId: string, version = 'v1' as const) {
9
+ if (!apiId?.trim()) throw new Error('apiId is required to create a Sheet2DBClient.');
10
+ this.axios = axios.create({
11
+ baseURL: process.env.SHEET2DB_BASE_URL || 'https://api.sheet2db.io/' + version + '/data/' + apiId,
12
+ paramsSerializer: {
13
+ serialize: (params) => new URLSearchParams(params).toString()
129
14
  }
130
- } else {
131
- endpoint.pathname = `${endpoint.pathname}/${this.options.apiKey}${path}`;
132
- endpoint.searchParams.set("__id", this.options.spreadsheetId);
133
- }
134
-
135
- if (queryParams) {
136
- if (typeof queryParams != 'string') {
137
- queryParams.forEach((value, key) => {
138
- endpoint.searchParams.append(key, value);
139
- });
140
- } else {
141
- endpoint.search = queryParams
142
- if (this.options.mode == 'apikey') {
143
- endpoint.searchParams.set("__id", this.options.spreadsheetId);
144
- }
15
+ })
16
+ this.axios.interceptors.request.use((config) => {
17
+ if (this.authentication) {
18
+ config.headers.Authorization = this.authentication;
145
19
  }
146
- }
147
- const response = await this.fetchFn(endpoint.href, {
148
- headers,
149
- method,
150
- body: body ? JSON.stringify(body) : undefined
20
+ return config;
151
21
  });
152
- if (response.ok) {
153
- return response.json() as Promise<T>;
154
- } else {
155
- throw new Error(await response.text());
156
- }
157
- }
158
-
159
-
160
- ReadContent<T>(options?: ReadOptions) {
161
- if (options.columns && options.columns.constructor == Array) {
162
- options.columns = options.columns.join(',');
163
- }
164
- if (options.cast_numbers && options.cast_numbers.constructor == Array) {
165
- options.cast_numbers = options.cast_numbers.join(',');
166
- }
167
- const query = new URLSearchParams(options as Record<string, string>);
168
- return this.fetch<T>('', "GET", query);
169
- }
170
-
171
- Keys(options?: GetKeysOptions) {
172
- const query = new URLSearchParams(options as Record<string, string>);
173
- return this.fetch<string[]>('/keys', "GET", query);
174
22
  }
175
-
176
- Count(options?: GetCountOptions) {
177
- const query = new URLSearchParams(options as Record<string, string>);
178
- return this.fetch<{ count: number }>('/count', "GET", query);
23
+ private endpoint(sheet?: string): string {
24
+ return sheet ? `/${sheet}` : '/';
179
25
  }
180
-
181
- Title() {
182
- return this.fetch<{ spreadsheet_title: string, api_name: string }>('/title', "GET");
183
- }
184
-
185
- Range(options: GetRangeOptions) {
186
- return this.fetch<string[][]>(`/range/${options.range}`, "GET");
187
- }
188
-
189
- Search(options: SearchOptions) {
190
- let path = options.or ? "/search_or" : "/search";
191
- if (options.sheet) {
192
- path = `${path}/${options.sheet}`;
193
- }
194
- return this.fetch<Record<string, any>>(path, "GET", encodeURIComponent(options.query));
195
- }
196
-
197
- Insert(options: InsertOptions) {
198
- const { data, ...queryParams } = options;
199
- const query = new URLSearchParams(queryParams as Record<string, string>);
200
- return this.fetch<{ inserted: number }>('', "POST", query, data);
26
+ useBasicAuthentication(username: string, password: string) {
27
+ const token = isNode ? Buffer.from(`${username}:${password}`).toString('base64') : btoa(`${username}:${password}`)
28
+ this.authentication = `Basic ${token}`
201
29
  }
202
30
 
203
- UpdateRow(options: UpdateRowOptions) {
204
- const { row, data, ...queryParams } = options;
205
- const query = new URLSearchParams(queryParams as Record<string, string>);
206
- return this.fetch<{ updated: number }>(`/row/${row}`, "PATCH", query, data);
31
+ useJWTAuthentication(token: string) {
32
+ this.authentication = 'Bearer ' + token
207
33
  }
208
34
 
209
- UpdateWithQuery(options: UpdateWithQueryOptions) {
210
- const { sheet, data, query } = options;
211
- let path = '';
212
- if (sheet) {
213
- path = `/${sheet}`;
214
- }
215
- return this.fetch<{ updated: number }>(path, "PATCH", encodeURIComponent(query), data);
35
+ useBearerTokenAuthentication(token: string) {
36
+ this.authentication = 'Bearer ' + token
216
37
  }
217
38
 
218
- BatchUpdate(options: BatchUpdateOptions) {
219
- const { batches, sheet } = options;
220
- let path = '/batch';
221
- if (sheet) {
222
- path = path + '/' + sheet;
223
- }
224
- return this.fetch<{ updated: number }>(path, "PATCH", undefined, batches);
39
+ async Read<T = any>(options: ReadOptions, sheet?: string): Promise<T> {
40
+ return this.axios.get(this.endpoint(sheet), {
41
+ params: options
42
+ }).then((res) => res.data)
225
43
  }
226
44
 
227
- DeleteRow(options: DeleteRowOptions) {
228
- const { row, ...queryParams } = options;
229
- const query = new URLSearchParams(queryParams as Record<string, string>);
230
- return this.fetch<{ deleted: number }>(`/row/${row}`, "DELETE", query);
45
+ async Update(options: UpdateOptions, sheet?: string): Promise<{ updated: number }> {
46
+ return this.axios.patch(this.endpoint(sheet), options).then((res) => res.data)
231
47
  }
232
48
 
233
- DeleteWithQuery(options: DeleteWithQueryOptions) {
234
- const { query, sheet } = options;
235
- let path = '';
236
- if (sheet) {
237
- path = `/${sheet}`;
238
- }
239
- return this.fetch<{ deleted: number }>(path, "DELETE", encodeURIComponent(query));
49
+ async Insert(options: InsertOptions, sheet?: string): Promise<{ inserted: number }> {
50
+ return this.axios.post(this.endpoint(sheet), options).then((res) => res.data)
240
51
  }
241
52
 
242
- Clear(options: ClearSheetOptions) {
243
- const path = `/clear/${options.sheet}`;
244
- return this.fetch<{success: boolean}>(path, "DELETE");
53
+ async Delete(options: DeleteOptions, sheet?: string): Promise<{ deleted: number }> {
54
+ return this.axios.delete(this.endpoint(sheet), {
55
+ params: options
56
+ }).then((res) => res.data)
245
57
  }
246
58
 
247
- CreateSheet(options: CreateSheetOptions) {
248
- const query = new URLSearchParams(options as Record<string, string>);
249
- return this.fetch<{success: boolean}>('/sheet', "POST", query);
59
+ async AddSheet(options: AddSheetOptions): Promise<{ ok: true }> {
60
+ return this.axios.post('/sheet', options).then((res) => res.data)
250
61
  }
251
62
 
252
- DeleteSheet(options: DeleteSheetOptions) {
253
- const path = `/sheet/${options.sheet}`;
254
- return this.fetch<{success: boolean}>(path, "DELETE");
63
+ async DeleteSheet(sheet: string): Promise<{ ok: true }> {
64
+ if(!sheet) throw new Error("sheet is required to Delete Sheet")
65
+ return this.axios.delete(this.endpoint(sheet)).then((res) => res.data)
255
66
  }
256
- }
67
+ }
package/tsconfig.json CHANGED
@@ -1,11 +1,107 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es2019",
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+ /* Projects */
5
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
6
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
8
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
9
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
+ /* Language and Environment */
12
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
15
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
16
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
17
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
18
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
19
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
20
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
21
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
22
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
23
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
24
+ /* Modules */
25
+ "module": "commonjs", /* Specify what module code is generated. */
26
+ // "rootDir": "./", /* Specify the root folder within your source files. */
27
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
28
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
29
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
30
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
31
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
32
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
33
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
34
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
35
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
36
+ // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
37
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
38
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
39
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
40
+ // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
41
+ // "resolveJsonModule": true, /* Enable importing .json files. */
42
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
43
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
44
+ /* JavaScript Support */
45
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
46
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
47
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
48
+ /* Emit */
49
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
50
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
51
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
52
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
53
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
54
+ // "noEmit": true, /* Disable emitting files from a compilation. */
55
+ // "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. */
56
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
57
+ // "removeComments": true, /* Disable emitting comments. */
58
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
59
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
60
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
61
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
62
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
63
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
64
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
65
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
66
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
67
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
68
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
69
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
70
+ /* Interop Constraints */
71
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
72
+ // "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. */
73
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
74
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
75
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
76
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
77
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
78
+ /* Type Checking */
79
+ "strict": true, /* Enable all strict type-checking options. */
80
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
81
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
82
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
83
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
84
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
85
+ // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
86
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
87
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
90
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
91
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
93
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
94
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
95
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
96
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
97
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
98
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99
+ /* Completeness */
100
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
5
102
  "declaration": true,
6
- "outDir": "./dist"
7
- },
8
- "include": [
9
- "src/**/*"
10
- ]
103
+ "emitDeclarationOnly": true,
104
+ "outDir": "dist",
105
+ "composite": false,
106
+ }
11
107
  }