@nevermined-io/payments 0.1.0 → 0.1.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.
@@ -0,0 +1,7 @@
1
+ export interface EnvironmentInfo {
2
+ frontend: string;
3
+ backend: string;
4
+ }
5
+ export type EnvironmentName = 'staging';
6
+ export declare const Environments: Record<EnvironmentName, EnvironmentInfo>;
7
+ //# sourceMappingURL=environments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CAAA;AAEvC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,eAAe,CAKjE,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Environments = void 0;
4
+ exports.Environments = {
5
+ staging: {
6
+ frontend: 'https://staging.nevermined.app',
7
+ backend: 'https://one-backend.staging.nevermined.app',
8
+ },
9
+ };
10
+ //# sourceMappingURL=environments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environments.js","sourceRoot":"","sources":["../src/environments.ts"],"names":[],"mappings":";;;AAOa,QAAA,YAAY,GAA6C;IACpE,OAAO,EAAE;QACP,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,4CAA4C;KACtD;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './payments';
2
+ export * from './environments';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payments"), exports);
18
+ __exportStar(require("./environments"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,iDAA8B"}
@@ -0,0 +1,18 @@
1
+ import { EnvironmentInfo, EnvironmentName } from './environments';
2
+ export interface PaymentOptions {
3
+ returnUrl: string;
4
+ environment: EnvironmentName;
5
+ }
6
+ export declare class Payments {
7
+ returnUrl: string;
8
+ environment: EnvironmentInfo;
9
+ private sessionKey?;
10
+ constructor(options: PaymentOptions);
11
+ init(): void;
12
+ connect(): void;
13
+ isLoggedIn(): boolean;
14
+ createSubscription(name: string, description: string, price: bigint, tokenAddress: string, amountOfCredits?: number, duration?: number, tags?: string[]): Promise<{
15
+ did: string;
16
+ }>;
17
+ }
18
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAA;AAE/E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,eAAe,CAAA;CAC7B;AAED,qBAAa,QAAQ;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,eAAe,CAAA;IACnC,OAAO,CAAC,UAAU,CAAC,CAAQ;gBAEf,OAAO,EAAE,cAAc;IAK5B,IAAI;IAWJ,OAAO;IAQP,UAAU,IAAI,OAAO;IAIf,kBAAkB,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,eAAe,CAAC,EAAE,MAAM,EACxB,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CA4B5B"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Payments = void 0;
4
+ const environments_1 = require("./environments");
5
+ class Payments {
6
+ constructor(options) {
7
+ this.returnUrl = options.returnUrl;
8
+ this.environment = environments_1.Environments[options.environment];
9
+ }
10
+ init() {
11
+ const url = new URL(window.location.href);
12
+ const sessionKey = url.searchParams.get('sessionKey');
13
+ if (sessionKey) {
14
+ this.sessionKey = sessionKey;
15
+ console.log('sessionKey:', sessionKey);
16
+ url.searchParams.delete('sessionKey');
17
+ history.replaceState(history.state, '', url.toString());
18
+ }
19
+ }
20
+ connect() {
21
+ const url = new URL(`/en/login?nvm-export=session-key&returnUrl=${this.returnUrl}`, this.environment.frontend);
22
+ window.location.href = url.toString();
23
+ }
24
+ isLoggedIn() {
25
+ return !!this.sessionKey;
26
+ }
27
+ async createSubscription(name, description, price, tokenAddress, amountOfCredits, duration, tags) {
28
+ const body = {
29
+ sessionKey: this.sessionKey,
30
+ name,
31
+ description,
32
+ price: price.toString(),
33
+ tokenAddress,
34
+ amountOfCredits,
35
+ duration,
36
+ tags,
37
+ };
38
+ const options = {
39
+ method: 'POST',
40
+ headers: {
41
+ Accept: 'application/json',
42
+ 'Content-Type': 'application/json',
43
+ },
44
+ body: JSON.stringify(body),
45
+ };
46
+ const url = new URL('/api/v1/payments', this.environment.backend);
47
+ const response = await fetch(url, options);
48
+ if (!response.ok) {
49
+ throw Error(response.statusText);
50
+ }
51
+ return response.json();
52
+ }
53
+ }
54
+ exports.Payments = Payments;
55
+ //# sourceMappingURL=payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.js","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":";;;AAAA,iDAA+E;AAO/E,MAAa,QAAQ;IAKnB,YAAY,OAAuB;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,WAAW,GAAG,2BAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACtD,CAAC;IAEM,IAAI;QACT,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QACzC,MAAM,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QACrD,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;YAC5B,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;YACtC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;YACrC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzD,CAAC;IACH,CAAC;IAEM,OAAO;QACZ,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,8CAA8C,IAAI,CAAC,SAAS,EAAE,EAC9D,IAAI,CAAC,WAAW,CAAC,QAAQ,CAC1B,CAAA;QACD,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;IAEM,UAAU;QACf,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAC7B,IAAY,EACZ,WAAmB,EACnB,KAAa,EACb,YAAoB,EACpB,eAAwB,EACxB,QAAiB,EACjB,IAAe;QAEf,MAAM,IAAI,GAAG;YACX,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI;YACJ,WAAW;YACX,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;YACvB,YAAY;YACZ,eAAe;YACf,QAAQ;YACR,IAAI;SACL,CAAA;QACD,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAA;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAEjE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QAClC,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;CACF;AArED,4BAqEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevermined-io/payments",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Typescript SDK to interact with the Nevermined Payments Protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,10 +11,14 @@
11
11
  "author": "Nevermined <root@nevermined.io>",
12
12
  "license": "Apache-2.0",
13
13
  "homepage": "https://github.com/nevermined-io/payments",
14
+ "files": [
15
+ "dist"
16
+ ],
14
17
  "scripts": {
15
- "build": "tsc --build",
18
+ "build": "tsc",
16
19
  "lint": "eslint ./src",
17
- "format": "prettier --check ./src"
20
+ "format": "prettier --check ./src",
21
+ "prepublishOnly": "yarn build"
18
22
  },
19
23
  "dependencies": {},
20
24
  "devDependencies": {
package/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "nevermined"
4
- ]
5
- }
@@ -1 +0,0 @@
1
- * @nevermined-io/nevermined-admin @nevermined-io/nevermined-doers
@@ -1,30 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
- ---
8
-
9
- ## Describe the bug
10
-
11
- A clear and concise description of what the bug is.
12
-
13
- ## To Reproduce
14
-
15
- Steps to reproduce the behavior:
16
-
17
- 1.
18
- 2.
19
-
20
- ## Expected behavior
21
-
22
- A clear and concise description of what you expected to happen.
23
-
24
- ## Screenshots
25
-
26
- If applicable, add screenshots to help explain your problem.
27
-
28
- ## Additional context
29
-
30
- Add any other context about the problem here.
@@ -1,19 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest a new feature for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
- ---
8
-
9
- ## Is your feature request related to a problem? Please describe.
10
-
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- ## Describe the solution you'd like
14
-
15
- A clear and concise description of what you want to happen.
16
-
17
- ## Additional context
18
-
19
- Add any other context or screenshots about the feature request here.
@@ -1,6 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: 'npm'
4
- directory: '/'
5
- schedule:
6
- interval: 'weekly'
@@ -1,47 +0,0 @@
1
- # Prerequisites
2
-
3
- Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.**
4
-
5
- - [ ] I am running the latest version
6
- - [ ] I checked the documentation and found no answer
7
- - [ ] I checked to make sure that this issue has not already been filed
8
- - [ ] I'm reporting the issue to the correct repository.
9
-
10
- ## Expected Behavior
11
-
12
- Please describe the behavior you are expecting
13
-
14
- ## Current Behavior
15
-
16
- What is the current behavior? Please provide as many details as possible.
17
-
18
- ## Failure Information (for bugs)
19
-
20
- Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
21
-
22
- ## Step to Reproduce the problem
23
-
24
- Please provide detailed steps for reproducing the issue.
25
-
26
- 1.
27
- 2.
28
- 3.
29
-
30
- ### Possible Solution
31
-
32
- Fill this section in if you know how this could or should be fixed.
33
-
34
- ## Specifications
35
-
36
- Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
37
-
38
- - Version: x.x.x
39
- - Python: x.x
40
- - Solidity: x.x.x
41
- - JavaScript: x.x.x
42
- - Node: x.x.x
43
- - OS: macOS/linux/win
44
-
45
- ## Failure Logs
46
-
47
- Please include any relevant log snippets or files here.
@@ -1,23 +0,0 @@
1
- ## Description
2
-
3
- Add a description of your changes here.
4
-
5
- ## Is this PR related with an open issue?
6
-
7
- Related to Issue #
8
-
9
- ## Types of changes
10
-
11
- - [ ] Bug fix (non-breaking change which fixes an issue)
12
- - [ ] New feature (non-breaking change which adds functionality)
13
- - [ ] Breaking change (fix or feature that would cause existing functionality to change)
14
-
15
- ## Checklist:
16
-
17
- - [ ] Follows the code style of this project.
18
- - [ ] Tests Cover Changes
19
- - [ ] Documentation
20
-
21
- #### Funny gif
22
-
23
- ![Put a link of a funny gif inside the parenthesis-->]()
@@ -1,71 +0,0 @@
1
- name: GitHub Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*.*.*'
7
-
8
- jobs:
9
- release:
10
- name: 'Tagged Release'
11
- runs-on: 'ubuntu-latest'
12
- steps:
13
- - name: Checkout
14
- uses: actions/checkout@v4
15
- with:
16
- fetch-depth: 0
17
- token: ${{ secrets.API_TOKEN_GITHUB }}
18
-
19
- # Build process
20
- - uses: actions/setup-node@v4
21
- with:
22
- node-version: 18
23
-
24
- - name: Set version to env
25
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
26
-
27
- - name: Build package
28
- run: |
29
- yarn
30
- npm pack
31
-
32
- - name: Update CHANGELOG.md
33
- id: changelog
34
- run: |
35
- yarn add --dev auto-changelog
36
- npx auto-changelog
37
-
38
- - name: Detect branch to commit changelog
39
- id: branch-changelog
40
- run: |
41
- tagged_branches=$(git --no-pager branch -a --contains tags/${{ env.RELEASE_VERSION }} --no-column)
42
- echo "$tagged_branches"
43
- if echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then
44
- commit_branch=main
45
- elif echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then
46
- commit_branch=main
47
- elif echo "$tagged_branches" | grep -E '^[[:space:]]*develop$' > /dev/null; then
48
- commit_branch=develop
49
- else
50
- commit_branch=$(echo "$tagged_branches" | tail -n1)
51
- commit_branch=${commit_branch//[[:blank:]]/}
52
- fi
53
- commit_branch="${commit_branch//remotes\/origin\//}"
54
- echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV
55
-
56
- - name: Commit CHANGELOG.md
57
- uses: stefanzweifel/git-auto-commit-action@v4
58
- with:
59
- commit_message: Automated CHANGELOG.md update
60
- commit_options: '--no-verify --signoff'
61
- file_pattern: CHANGELOG.md
62
- branch: ${{ env.COMMIT_BRANCH }}
63
-
64
- - name: Publish Github relase
65
- uses: 'marvinpinto/action-automatic-releases@latest'
66
- with:
67
- repo_token: '${{ secrets.GITHUB_TOKEN }}'
68
- prerelease: false
69
- files: |
70
- CHANGELOG.md
71
- nevermined-io-payments-${{ env.RELEASE_VERSION }}.tgz
@@ -1,23 +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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: NPM Release
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*'
10
-
11
- jobs:
12
- publish-npm:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 18
19
- registry-url: https://registry.npmjs.org/
20
- - run: yarn install --frozen-lockfile --ignore-engines
21
- - run: npm publish --access public
22
- env:
23
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
@@ -1,22 +0,0 @@
1
- name: Testing
2
-
3
- on: [push]
4
-
5
- jobs:
6
- testing:
7
- runs-on: ubuntu-latest
8
-
9
- steps:
10
- - uses: actions/checkout@v4
11
- - uses: actions/setup-node@v4
12
- with:
13
- node-version: 18
14
-
15
- - name: Install dependencies
16
- run: yarn
17
- - name: Run linters
18
- run: yarn lint
19
- - name: Check code formatting
20
- run: yarn format
21
- - name: Check build
22
- run: yarn build
package/.prettierrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- ...require('eslint-config-nevermined/prettier.config'),
3
- }
@@ -1,13 +0,0 @@
1
- export interface EnvironmentInfo {
2
- frontend: string
3
- backend: string
4
- }
5
-
6
- export type EnvironmentName = 'staging'
7
-
8
- export const Environments: Record<EnvironmentName, EnvironmentInfo> = {
9
- staging: {
10
- frontend: 'https://staging.nevermined.app',
11
- backend: 'https://one-backend.staging.nevermined.app',
12
- },
13
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './payments'
2
- export * from './environments'
package/src/payments.ts DELETED
@@ -1,77 +0,0 @@
1
- import { EnvironmentInfo, EnvironmentName, Environments } from './environments'
2
-
3
- export interface PaymentOptions {
4
- returnUrl: string
5
- environment: EnvironmentName
6
- }
7
-
8
- export class Payments {
9
- public returnUrl: string
10
- public environment: EnvironmentInfo
11
- private sessionKey?: string
12
-
13
- constructor(options: PaymentOptions) {
14
- this.returnUrl = options.returnUrl
15
- this.environment = Environments[options.environment]
16
- }
17
-
18
- public init() {
19
- const url = new URL(window.location.href)
20
- const sessionKey = url.searchParams.get('sessionKey')
21
- if (sessionKey) {
22
- this.sessionKey = sessionKey
23
- console.log('sessionKey:', sessionKey)
24
- url.searchParams.delete('sessionKey')
25
- history.replaceState(history.state, '', url.toString())
26
- }
27
- }
28
-
29
- public connect() {
30
- const url = new URL(
31
- `/en/login?nvm-export=session-key&returnUrl=${this.returnUrl}`,
32
- this.environment.frontend,
33
- )
34
- window.location.href = url.toString()
35
- }
36
-
37
- public isLoggedIn(): boolean {
38
- return !!this.sessionKey
39
- }
40
-
41
- public async createSubscription(
42
- name: string,
43
- description: string,
44
- price: bigint,
45
- tokenAddress: string,
46
- amountOfCredits?: number,
47
- duration?: number,
48
- tags?: string[],
49
- ): Promise<{ did: string }> {
50
- const body = {
51
- sessionKey: this.sessionKey,
52
- name,
53
- description,
54
- price: price.toString(),
55
- tokenAddress,
56
- amountOfCredits,
57
- duration,
58
- tags,
59
- }
60
- const options = {
61
- method: 'POST',
62
- headers: {
63
- Accept: 'application/json',
64
- 'Content-Type': 'application/json',
65
- },
66
- body: JSON.stringify(body),
67
- }
68
- const url = new URL('/api/v1/payments', this.environment.backend)
69
-
70
- const response = await fetch(url, options)
71
- if (!response.ok) {
72
- throw Error(response.statusText)
73
- }
74
-
75
- return response.json()
76
- }
77
- }
package/tsconfig.json DELETED
@@ -1,109 +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": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": ["es2020", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
- /* Modules */
28
- "module": "commonjs", /* Specify what module code is generated. */
29
- "rootDir": "src", /* Specify the root folder within your source files. */
30
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
- // "resolveJsonModule": true, /* Enable importing .json files. */
43
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
-
46
- /* JavaScript Support */
47
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
-
51
- /* Emit */
52
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
- "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
- "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
- // "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. */
58
- "outDir": "dist", /* Specify an output folder for all emitted files. */
59
- // "removeComments": true, /* Disable emitting comments. */
60
- // "noEmit": true, /* Disable emitting files from a compilation. */
61
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68
- // "newLine": "crlf", /* Set the newline character for emitting files. */
69
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
-
76
- /* Interop Constraints */
77
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
- // "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. */
79
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83
-
84
- /* Type Checking */
85
- "strict": true, /* Enable all strict type-checking options. */
86
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
-
105
- /* Completeness */
106
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
- }
109
- }