ts-japi 1.6.3 → 1.8.0
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/.commitlintrc.ts +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +5 -6
- package/.github/ISSUE_TEMPLATE/feature_request.md +4 -5
- package/.github/ISSUE_TEMPLATE/request-for-comments.md +29 -42
- package/.github/release-please.yml +4 -0
- package/.github/workflows/ci.yaml +73 -0
- package/.github/workflows/publish.yaml +29 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/.prettierignore +4 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +14 -0
- package/lib/classes/cache.d.ts +4 -4
- package/lib/classes/cache.d.ts.map +1 -1
- package/lib/classes/error-serializer.d.ts +2 -2
- package/lib/classes/error-serializer.d.ts.map +1 -1
- package/lib/classes/paginator.js.map +1 -1
- package/lib/classes/relator.d.ts +2 -2
- package/lib/classes/relator.d.ts.map +1 -1
- package/lib/classes/relator.js +5 -1
- package/lib/classes/relator.js.map +1 -1
- package/lib/classes/serializer.d.ts +2 -1
- package/lib/classes/serializer.d.ts.map +1 -1
- package/lib/classes/serializer.js +14 -5
- package/lib/classes/serializer.js.map +1 -1
- package/lib/interfaces/serializer.interface.d.ts +14 -3
- package/lib/interfaces/serializer.interface.d.ts.map +1 -1
- package/lib/models/error.model.d.ts.map +1 -1
- package/lib/models/error.model.js +13 -5
- package/lib/models/error.model.js.map +1 -1
- package/lib/types/global.types.d.ts +6 -0
- package/lib/types/global.types.d.ts.map +1 -1
- package/lib/utils/merge.d.ts.map +1 -1
- package/lib/utils/merge.js +3 -2
- package/lib/utils/merge.js.map +1 -1
- package/lib/utils/serializer.utils.d.ts +3 -3
- package/lib/utils/serializer.utils.d.ts.map +1 -1
- package/lib/utils/serializer.utils.js +29 -6
- package/lib/utils/serializer.utils.js.map +1 -1
- package/package.json +20 -9
- package/release-please-config.json +8 -0
- package/tsconfig.json +56 -61
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -10
- package/lib/tsdoc-metadata.json +0 -11
package/.commitlintrc.ts
ADDED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Bug report
|
|
3
3
|
about: Create a report to help us improve
|
|
4
|
-
title:
|
|
4
|
+
title: '[BUG] {{issue name}}'
|
|
5
5
|
labels: bug
|
|
6
6
|
assignees: jun-sheaf
|
|
7
|
-
|
|
8
7
|
---
|
|
9
8
|
|
|
10
|
-
## Describe the bug<sup
|
|
9
|
+
## Describe the bug<sup>\*</sup>
|
|
11
10
|
|
|
12
11
|
{{A clear and concise description of what the bug is.}}
|
|
13
12
|
|
|
14
|
-
## To Reproduce<sup
|
|
13
|
+
## To Reproduce<sup>\*</sup>
|
|
15
14
|
|
|
16
15
|
{{Add steps/examples to reproduce the behavior.}}
|
|
17
16
|
|
|
18
|
-
## Expected behavior<sup
|
|
17
|
+
## Expected behavior<sup>\*</sup>
|
|
19
18
|
|
|
20
19
|
{{A clear and concise description of what you expected to happen.}}
|
|
21
20
|
|
|
@@ -23,7 +22,7 @@ assignees: jun-sheaf
|
|
|
23
22
|
|
|
24
23
|
{{Add screenshots to help explain your problem.}}
|
|
25
24
|
|
|
26
|
-
## Platform<sup
|
|
25
|
+
## Platform<sup>\*</sup>
|
|
27
26
|
|
|
28
27
|
- [ ] OS: {{ Write the OS name and its version }}
|
|
29
28
|
- [ ] Browser {{ Write the browser name and its version }}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Feature request
|
|
3
3
|
about: Suggest an idea for this project
|
|
4
|
-
title:
|
|
4
|
+
title: '[FR] {{feature request name}}'
|
|
5
5
|
labels: enhancement
|
|
6
6
|
assignees: jun-sheaf
|
|
7
|
-
|
|
8
7
|
---
|
|
9
8
|
|
|
10
|
-
## Is your feature request related to a problem? <sup
|
|
9
|
+
## Is your feature request related to a problem? <sup>\*</sup>
|
|
11
10
|
|
|
12
11
|
{{A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]}}
|
|
13
12
|
|
|
14
|
-
## Describe the solution you'd like<sup
|
|
13
|
+
## Describe the solution you'd like<sup>\*</sup>
|
|
15
14
|
|
|
16
15
|
{{A clear and concise description of what you want to happen.}}
|
|
17
16
|
|
|
18
|
-
## Describe alternatives you've considered<sup
|
|
17
|
+
## Describe alternatives you've considered<sup>\*</sup>
|
|
19
18
|
|
|
20
19
|
{{A clear and concise description of any alternative solutions or features you've considered.}}
|
|
21
20
|
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Request for comments
|
|
3
3
|
about: Request for comments around the community.
|
|
4
|
-
title:
|
|
4
|
+
title: '[RFC] {{RFC name}}'
|
|
5
5
|
labels: good first issue, question
|
|
6
6
|
assignees: jun-sheaf
|
|
7
|
-
|
|
8
7
|
---
|
|
9
8
|
|
|
10
|
-
## Summary<sup
|
|
9
|
+
## Summary<sup>\*</sup>
|
|
11
10
|
|
|
12
11
|
{{One paragraph explanation of the change}}
|
|
13
12
|
|
|
14
|
-
## Motivation<sup
|
|
13
|
+
## Motivation<sup>\*</sup>
|
|
15
14
|
|
|
16
15
|
{{
|
|
17
16
|
Why are we doing this? What use cases does it support? What is the expected
|
|
18
17
|
outcome?
|
|
19
18
|
}}
|
|
20
19
|
|
|
21
|
-
## Design Detail<sup
|
|
20
|
+
## Design Detail<sup>\*</sup>
|
|
22
21
|
|
|
23
22
|
{{
|
|
24
23
|
Explain the design in enough detail for somebody familiar with the
|
|
@@ -27,7 +26,7 @@ and can include examples of how the service is used. Any new terminology should
|
|
|
27
26
|
be defined here.
|
|
28
27
|
}}
|
|
29
28
|
|
|
30
|
-
## Drawbacks<sup
|
|
29
|
+
## Drawbacks<sup>\*</sup>
|
|
31
30
|
|
|
32
31
|
{{
|
|
33
32
|
Why should we *not* do this? Please consider the impact on users, on the
|
|
@@ -35,50 +34,38 @@ integration of this change with other existing and planned features etc. There
|
|
|
35
34
|
are tradeoffs to choosing any path, please attempt to identify them here.
|
|
36
35
|
}}
|
|
37
36
|
|
|
38
|
-
## Rationale and Alternatives<sup
|
|
37
|
+
## Rationale and Alternatives<sup>\*</sup>
|
|
39
38
|
|
|
40
|
-
{{
|
|
41
|
-
Why is this design the best in the space of possible designs?
|
|
39
|
+
{{ Why is this design the best in the space of possible designs?
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
choosing them?
|
|
41
|
+
What other designs have been considered and what is the rationale for not choosing them?
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
}}
|
|
43
|
+
What is the impact of not doing this? }}
|
|
48
44
|
|
|
49
|
-
## Prior Art<sup
|
|
45
|
+
## Prior Art<sup>\*</sup>
|
|
50
46
|
|
|
51
|
-
{{
|
|
52
|
-
|
|
53
|
-
few examples of what this can include are:
|
|
54
|
-
|
|
55
|
-
{{
|
|
56
|
-
How other services / infrastructures in the same domain have solved this
|
|
57
|
-
problem.
|
|
58
|
-
|
|
59
|
-
Are there any published papers or great posts that discuss this? If you have
|
|
60
|
-
some relevant papers to refer to, this can serve as a more detailed
|
|
61
|
-
theoretical background.
|
|
62
|
-
}}
|
|
63
|
-
|
|
64
|
-
This section is intended to encourage you as an author to think about the
|
|
65
|
-
lessons from other organisations, provide readers of your RFC with a fuller
|
|
66
|
-
picture. If there is no prior art, that is fine - your ideas are interesting
|
|
67
|
-
whether they are brand new or if it is an adaptation from other services.
|
|
68
|
-
}}
|
|
47
|
+
{{ Discuss prior art, both the good and the bad, in relation to this proposal. A few examples of
|
|
48
|
+
what this can include are:
|
|
69
49
|
|
|
70
|
-
|
|
50
|
+
{{ How other services / infrastructures in the same domain have solved this problem.
|
|
71
51
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
before this gets merged?
|
|
52
|
+
Are there any published papers or great posts that discuss this? If you have some relevant papers to
|
|
53
|
+
refer to, this can serve as a more detailed theoretical background. }}
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
This section is intended to encourage you as an author to think about the lessons from other
|
|
56
|
+
organisations, provide readers of your RFC with a fuller picture. If there is no prior art, that is
|
|
57
|
+
fine - your ideas are interesting whether they are brand new or if it is an adaptation from other
|
|
58
|
+
services. }}
|
|
78
59
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
RFC
|
|
82
|
-
|
|
60
|
+
## Unresolved questions<sup>\*</sup>
|
|
61
|
+
|
|
62
|
+
{{ What parts of the design do you expect to resolve through the RFC process before this gets
|
|
63
|
+
merged?
|
|
64
|
+
|
|
65
|
+
What parts of the design do you expect to resolve through the implementation of this feature before
|
|
66
|
+
stabilisation?
|
|
67
|
+
|
|
68
|
+
What related issues do you consider out of scope for this RFC that could be addressed in the future
|
|
69
|
+
independently of the solution that comes out of this RFC? }}
|
|
83
70
|
|
|
84
71
|
\* means required.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
# Declare default permissions as read only.
|
|
4
|
+
permissions: read-all
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- '**'
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.head_ref || github.run_id }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
inspect-code:
|
|
20
|
+
name: Inspect code
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v3
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 2
|
|
27
|
+
- name: Set up Node.js
|
|
28
|
+
uses: actions/setup-node@v3.4.1
|
|
29
|
+
with:
|
|
30
|
+
node-version: 18
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: yarn install --frozen-lockfile
|
|
33
|
+
- name: Lint code
|
|
34
|
+
run: yarn lint
|
|
35
|
+
- name: Lint commits
|
|
36
|
+
run: yarn commitlint
|
|
37
|
+
if: github.event_name != 'pull_request'
|
|
38
|
+
|
|
39
|
+
tests:
|
|
40
|
+
name: ${{ matrix.spec.name }} tests (${{ matrix.spec.node }})
|
|
41
|
+
runs-on: ${{ matrix.spec.machine }}
|
|
42
|
+
continue-on-error: true
|
|
43
|
+
strategy:
|
|
44
|
+
matrix:
|
|
45
|
+
spec:
|
|
46
|
+
- name: Linux
|
|
47
|
+
machine: ubuntu-latest
|
|
48
|
+
node: 14
|
|
49
|
+
- name: Linux
|
|
50
|
+
machine: ubuntu-latest
|
|
51
|
+
node: 16
|
|
52
|
+
- name: Linux
|
|
53
|
+
machine: ubuntu-latest
|
|
54
|
+
node: 18
|
|
55
|
+
- name: macOS
|
|
56
|
+
machine: macos-latest
|
|
57
|
+
node: 14
|
|
58
|
+
- name: Windows
|
|
59
|
+
machine: windows-latest
|
|
60
|
+
node: 14
|
|
61
|
+
steps:
|
|
62
|
+
- name: Checkout
|
|
63
|
+
uses: actions/checkout@v3
|
|
64
|
+
- name: Set up Node.js
|
|
65
|
+
uses: actions/setup-node@v3.4.1
|
|
66
|
+
with:
|
|
67
|
+
node-version: ${{ matrix.spec.node }}
|
|
68
|
+
- name: Install dependencies
|
|
69
|
+
run: yarn install --frozen-lockfile
|
|
70
|
+
- name: Build
|
|
71
|
+
run: yarn build
|
|
72
|
+
- name: Test
|
|
73
|
+
run: yarn test
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- v*
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
- name: Set up Node.js
|
|
18
|
+
uses: actions/setup-node@v3.4.1
|
|
19
|
+
with:
|
|
20
|
+
node-version: 18
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: yarn install --frozen-lockfile
|
|
24
|
+
- name: Build
|
|
25
|
+
run: yarn build
|
|
26
|
+
- name: Publish
|
|
27
|
+
run: npm publish
|
|
28
|
+
env:
|
|
29
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.husky/pre-push
ADDED
package/.prettierignore
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.0](https://github.com/mathematic-inc/ts-japi/compare/v1.7.0...v1.8.0) (2022-09-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* implement support for the `include` spec ([#53](https://github.com/mathematic-inc/ts-japi/issues/53)) ([fe4f276](https://github.com/mathematic-inc/ts-japi/commit/fe4f276cb2338b7540a17308cb020ca6e1bd5478))
|
|
9
|
+
|
|
10
|
+
## [1.7.0](https://github.com/mathematic-inc/ts-japi/compare/v1.6.3...v1.7.0) (2022-08-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* ignore relationships if they're not set to support optional relations ([#49](https://github.com/mathematic-inc/ts-japi/issues/49)) ([7bd7d53](https://github.com/mathematic-inc/ts-japi/commit/7bd7d5372c96841583dce9bd01a8bbb4cb220b8e))
|
|
16
|
+
|
|
3
17
|
## 1.6.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/lib/classes/cache.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SerializerOptions } from '../interfaces/serializer.interface';
|
|
2
|
-
import { DataDocument } from '../interfaces/json-api.interface';
|
|
3
|
-
import { SingleOrArray, nullish } from '../types/global.types';
|
|
4
1
|
import { CacheOptions } from '../interfaces/cache.interface';
|
|
5
|
-
|
|
2
|
+
import { DataDocument } from '../interfaces/json-api.interface';
|
|
3
|
+
import { SerializerOptions } from '../interfaces/serializer.interface';
|
|
4
|
+
import { Dictionary, nullish, SingleOrArray } from '../types/global.types';
|
|
5
|
+
export default class Cache<PrimaryType extends Dictionary<any>> {
|
|
6
6
|
/**
|
|
7
7
|
* The default max for document storage
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,CAAC,OAAO,OAAO,KAAK,CAAC,WAAW,SAAS,UAAU,CAAC,GAAG,CAAC;IAC5D;;OAEG;IACH,OAAc,YAAY,SAAM;IAEhC,0CAA0C;IAC1C,OAAO,CAAC,OAAO,CAMR;IAEP;;OAEG;IACH,OAAO,CAAC,KAAK,CAA8B;IAE3C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAGS;IAEzB;;;;OAIG;gBACgB,OAAO,GAAE,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAM;IAKnE,6CAA6C;IACtC,GAAG,CACR,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,EAC1C,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAUnD,6CAA6C;IACtC,GAAG,CACR,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,EAC1C,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAQpD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorSerializerOptions } from '../interfaces/error-serializer.interface';
|
|
2
2
|
import { ErrorDocument } from '../interfaces/json-api.interface';
|
|
3
|
-
import { SingleOrArray } from '../types/global.types';
|
|
3
|
+
import { Dictionary, SingleOrArray } from '../types/global.types';
|
|
4
4
|
/**
|
|
5
5
|
* The {@link ErrorSerializer} class is used to serialize errors.
|
|
6
6
|
*
|
|
@@ -9,7 +9,7 @@ import { SingleOrArray } from '../types/global.types';
|
|
|
9
9
|
* [[include:error-serializer.example.ts]]
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
export default class ErrorSerializer<ErrorType
|
|
12
|
+
export default class ErrorSerializer<ErrorType extends Dictionary<any>> {
|
|
13
13
|
/**
|
|
14
14
|
* Default options. Can be edited to change default options globally.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-serializer.d.ts","sourceRoot":"","sources":["../../src/classes/error-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"error-serializer.d.ts","sourceRoot":"","sources":["../../src/classes/error-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,SAAS,SAAS,UAAU,CAAC,GAAG,CAAC;IACpE;;OAEG;IACH,OAAc,cAAc;;;;;;;;;;;;;;;MAe1B;IAEF;;OAEG;IACH,OAAO,CAAC,OAAO,CAA8C;IAE7D;;;;;OAKG;gBACgB,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAM;IAK3E;;;;;OAKG;IACI,SAAS,CACd,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAChC,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;CAiFvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.js","sourceRoot":"","sources":["../../src/classes/paginator.ts"],"names":[],"mappings":";;;;;AACA,sEAAwC;AAGxC;;;;;;;GAOG;AACH,MAAqB,SAAS;IAC5B,4CAA4C;IACrC,QAAQ,CAA+D;IAE9E;;;;OAIG;IACH,YAAmB,QAAwE;QACzF,IAAI,CAAC,QAAQ,GAAG,CAAC,IAA6B,
|
|
1
|
+
{"version":3,"file":"paginator.js","sourceRoot":"","sources":["../../src/classes/paginator.ts"],"names":[],"mappings":";;;;;AACA,sEAAwC;AAGxC;;;;;;;GAOG;AACH,MAAqB,SAAS;IAC5B,4CAA4C;IACrC,QAAQ,CAA+D;IAE9E;;;;OAIG;IACH,YAAmB,QAAwE;QACzF,IAAI,CAAC,QAAQ,GAAG,CAAC,IAA6B,EAA6B,EAAE;YAC3E,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,OAAO;gBACL,KAAK,EAAE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,oBAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;gBAC5E,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,oBAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;gBACxE,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,oBAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;gBACxE,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,oBAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;aACzE,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AArBD,4BAqBC"}
|
package/lib/classes/relator.d.ts
CHANGED
|
@@ -44,12 +44,12 @@ export default class Relator<PrimaryType, RelatedType extends Dictionary<any> =
|
|
|
44
44
|
/** @internal Creates related identifiers */
|
|
45
45
|
getRelatedIdentifier: (data: RelatedType, options?: SerializerOptions<RelatedType> | undefined) => ResourceIdentifier;
|
|
46
46
|
/** @internal Creates related resources */
|
|
47
|
-
getRelatedResource: (data: RelatedType, options?: SerializerOptions<RelatedType
|
|
47
|
+
getRelatedResource: (data: RelatedType, options?: Partial<SerializerOptions<RelatedType>>, helpers?: Helpers<RelatedType>, relatorDataCache?: Map<Relator<any>, Dictionary<any>[]>) => Promise<Resource<RelatedType>>;
|
|
48
48
|
/** @internal Gets related links from primary data and related data */
|
|
49
49
|
getRelatedLinks(data: PrimaryType, relatedData: RelatedType | RelatedType[] | nullish): Dictionary<nullish | Link> | undefined;
|
|
50
50
|
/** @internal Gets related meta from primary data and related data */
|
|
51
51
|
getRelatedMeta(data: PrimaryType, relatedData: RelatedType | RelatedType[] | nullish): Meta | undefined;
|
|
52
52
|
/** @internal Creates a {@link Relationship}. */
|
|
53
|
-
getRelationship(data: PrimaryType, relatedDataCache?: Dictionary<any>[]): Promise<Relationship>;
|
|
53
|
+
getRelationship(data: PrimaryType, relatedDataCache?: Dictionary<any>[]): Promise<Relationship | undefined>;
|
|
54
54
|
}
|
|
55
55
|
//# sourceMappingURL=relator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relator.d.ts","sourceRoot":"","sources":["../../src/classes/relator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,YAAqC,MAAM,8BAA8B,CAAC;AACjF,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO,CAAC,WAAW,EAAE,WAAW,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG;IACjF;;OAEG;IACH,OAAc,cAAc;;MAE1B;IAEF;;OAEG;IACH,OAAO,CAAC,OAAO,CAA2C;IAEnD,WAAW,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;gBAED,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,EAC5E,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,EACnC,OAAO,GAAE,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAM;IAWjE,qDAAqD;I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,eAAe,CAC1B,IAAI,EAAE,WAAW,EACjB,gBAAgB,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,GACnC,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;CAmCrC"}
|
package/lib/classes/relator.js
CHANGED
|
@@ -97,7 +97,11 @@ class Relator {
|
|
|
97
97
|
const meta = this.getRelatedMeta(data, relatedData);
|
|
98
98
|
if (meta)
|
|
99
99
|
relationshipOptions.meta = meta;
|
|
100
|
-
|
|
100
|
+
let relationship;
|
|
101
|
+
if (relatedData !== undefined || meta || links) {
|
|
102
|
+
relationship = new relationship_model_1.default(relationshipOptions);
|
|
103
|
+
}
|
|
104
|
+
return relationship;
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
exports.default = Relator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relator.js","sourceRoot":"","sources":["../../src/classes/relator.ts"],"names":[],"mappings":";;;;;AAIA,sFAAiF;AAIjF,2DAAmC;AAInC;;;;;;;;GAQG;AACH,MAAqB,OAAO;IAC1B;;OAEG;IACI,MAAM,CAAC,cAAc,GAAG;QAC7B,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF;;OAEG;IACK,OAAO,CAA2C;IAEnD,WAAW,CAAS;IAC3B;;;;;;OAMG;IACH,YACE,KAA4E,EAC5E,UAAmC,EACnC,UAA6D,EAAE;QAE/D,0BAA0B;QAC1B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,UAAU,CAAC,cAAc,CAAC;QACpE,IAAI,CAAC,OAAO,GAAG,IAAA,eAAK,EAAC,EAAE,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,IAAI,CAAC,oBAAoB,GAAG,UAAU,CAAC,gBAAg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,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;oBACnD,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;oBAC5D,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;aAC5C;SACF;QAED,YAAY;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACpD,IAAI,IAAI;YAAE,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC;QAE1C,IAAI,YAAsC,CAAC;QAC3C,IAAI,WAAW,KAAK,SAAS,IAAI,IAAI,IAAI,KAAK,EAAE;YAC9C,YAAY,GAAG,IAAI,4BAAY,CAAC,mBAAmB,CAAC,CAAC;SACtD;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;;AAlHH,0BAmHC"}
|
|
@@ -28,6 +28,7 @@ export default class Serializer<PrimaryType extends Dictionary<any> = any> {
|
|
|
28
28
|
onlyRelationship: boolean;
|
|
29
29
|
cache: boolean;
|
|
30
30
|
depth: number;
|
|
31
|
+
include: number;
|
|
31
32
|
projection: null;
|
|
32
33
|
linkers: {};
|
|
33
34
|
metaizers: {};
|
|
@@ -66,7 +67,7 @@ export default class Serializer<PrimaryType extends Dictionary<any> = any> {
|
|
|
66
67
|
/** @internal Generates a `ResourceIdentifier`. */
|
|
67
68
|
createIdentifier(data: PrimaryType, options?: SerializerOptions<PrimaryType>): ResourceIdentifier;
|
|
68
69
|
/** @internal Generates a `Resource`. */
|
|
69
|
-
createResource(data: PrimaryType, options?: SerializerOptions<PrimaryType
|
|
70
|
+
createResource(data: PrimaryType, options?: Partial<SerializerOptions<PrimaryType>>, helpers?: Helpers<PrimaryType>, relatorDataCache?: Map<Relator<any>, Dictionary<any>[]>): Promise<Resource<PrimaryType>>;
|
|
70
71
|
/**
|
|
71
72
|
* The actual serialization function.
|
|
72
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/classes/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/classes/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,kBAAiD,MAAM,qCAAqC,CAAC;AACpG,OAAO,QAA6B,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAmB,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,WAAW,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG;IACvE;;OAEG;IACH,OAAc,cAAc;;;;;;;;;;;;;MAa1B;IAEF;;OAEG;IACI,cAAc,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,OAAO,CAAiC;IAEhD;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAErC;;OAEG;IACI,KAAK,qBAA4B;IAExC;;;;;OAKG;gBAED,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAM;IAcvD;;OAEG;IACI,WAAW;IAIlB;;OAEG;IACI,WAAW,CAAC,QAAQ,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC;IAKvE,kDAAkD;IAC3C,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC;IAanF,wCAAwC;IAC3B,cAAc,CACzB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,EACjD,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAC9B,gBAAgB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAqDzD;;;;;OAKG;IACU,SAAS,CACpB,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,EAC1C,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAgJpD"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const error_model_1 = __importDefault(require("../models/error.model"));
|
|
6
7
|
const resource_identifier_model_1 = __importDefault(require("../models/resource-identifier.model"));
|
|
7
8
|
const resource_model_1 = __importDefault(require("../models/resource.model"));
|
|
8
9
|
const merge_1 = __importDefault(require("../utils/merge"));
|
|
@@ -30,6 +31,7 @@ class Serializer {
|
|
|
30
31
|
onlyRelationship: false,
|
|
31
32
|
cache: false,
|
|
32
33
|
depth: 0,
|
|
34
|
+
include: 0,
|
|
33
35
|
projection: null,
|
|
34
36
|
linkers: {},
|
|
35
37
|
metaizers: {},
|
|
@@ -97,6 +99,9 @@ class Serializer {
|
|
|
97
99
|
options = this.options;
|
|
98
100
|
helpers = this.helpers;
|
|
99
101
|
}
|
|
102
|
+
if (!options.idKey) {
|
|
103
|
+
throw new error_model_1.default({ detail: 'options must provide a value for `idKey`' });
|
|
104
|
+
}
|
|
100
105
|
const resourceOptions = {};
|
|
101
106
|
// Get ID before projections.
|
|
102
107
|
const id = data[options.idKey];
|
|
@@ -112,15 +117,18 @@ class Serializer {
|
|
|
112
117
|
relatedDataCache = relatorDataCache.get(relator) || [];
|
|
113
118
|
relatorDataCache.set(relator, relatedDataCache);
|
|
114
119
|
}
|
|
115
|
-
|
|
120
|
+
const relationship = await relator.getRelationship(data, relatedDataCache);
|
|
121
|
+
if (relationship) {
|
|
122
|
+
relationships[name] = relationship;
|
|
123
|
+
}
|
|
116
124
|
}));
|
|
117
125
|
resourceOptions.relationships = relationships;
|
|
118
126
|
}
|
|
119
127
|
// Handling links
|
|
120
|
-
if (options.linkers
|
|
128
|
+
if (options.linkers?.resource) {
|
|
121
129
|
resourceOptions.links = { self: options.linkers.resource.link(data) };
|
|
122
130
|
}
|
|
123
|
-
if (options.metaizers
|
|
131
|
+
if (options.metaizers?.resource) {
|
|
124
132
|
resourceOptions.meta = options.metaizers.resource.metaize(data);
|
|
125
133
|
}
|
|
126
134
|
return new resource_model_1.default(id, type, resourceOptions);
|
|
@@ -243,8 +251,9 @@ class Serializer {
|
|
|
243
251
|
else {
|
|
244
252
|
document.data = await Promise.all(dto.map(createResource));
|
|
245
253
|
}
|
|
246
|
-
|
|
247
|
-
|
|
254
|
+
const include = o.include || o.depth;
|
|
255
|
+
if (relators && include) {
|
|
256
|
+
document.included = (document.included || []).concat(await (0, serializer_utils_1.recurseRelators)(dto, relators, include, keys, relatorDataCache));
|
|
248
257
|
}
|
|
249
258
|
if (wasSingle) {
|
|
250
259
|
document.data = document.data[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/classes/serializer.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/classes/serializer.ts"],"names":[],"mappings":";;;;;AAEA,wEAA8C;AAE9C,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IAAI,EAAE,CAAC,CAAC,MAAM,CAClD,MAAM,IAAA,kCAAe,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAC,CACtE,CAAC;SACH;QAED,IAAI,SAAS,EAAE;YACb,QAAQ,CAAC,IAAI,GAAI,QAAQ,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC;SAC7C;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;;AA3SH,6BA4SC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import Cache from '../classes/cache';
|
|
1
2
|
import Linker from '../classes/linker';
|
|
2
3
|
import Metaizer from '../classes/metaizer';
|
|
3
4
|
import Paginator from '../classes/paginator';
|
|
4
5
|
import Relator from '../classes/relator';
|
|
5
|
-
import { Dictionary,
|
|
6
|
-
import Cache from '../classes/cache';
|
|
6
|
+
import { Dictionary, nullish, Paths, SingleOrArray } from '../types/global.types';
|
|
7
7
|
export interface SerializerOptions<PrimaryType extends Dictionary<any> = any> {
|
|
8
8
|
/**
|
|
9
9
|
* The key name for the identifier in the resource.
|
|
@@ -40,7 +40,7 @@ export interface SerializerOptions<PrimaryType extends Dictionary<any> = any> {
|
|
|
40
40
|
* Whether to only serialize the identifier.
|
|
41
41
|
*
|
|
42
42
|
* This option will ignore the options
|
|
43
|
-
* {@link SerializerOptions.
|
|
43
|
+
* {@link SerializerOptions.include | depth}
|
|
44
44
|
*
|
|
45
45
|
* @defaultValue `false`
|
|
46
46
|
*/
|
|
@@ -78,8 +78,19 @@ export interface SerializerOptions<PrimaryType extends Dictionary<any> = any> {
|
|
|
78
78
|
* Must be a number in `[0, Infinity]`.
|
|
79
79
|
*
|
|
80
80
|
* @defaultValue `0`
|
|
81
|
+
* @deprecated Replaced by `include`
|
|
81
82
|
*/
|
|
82
83
|
depth: number;
|
|
84
|
+
/**
|
|
85
|
+
* Which resources to include. See [docs](https://jsonapi.org/format/#fetching-includes)
|
|
86
|
+
*
|
|
87
|
+
* If passed as a numeric value, all related resources will be included up to the given depth.
|
|
88
|
+
*
|
|
89
|
+
* If provided this will superceed the use of `depth`
|
|
90
|
+
* If not provided, or explicitly nullish, then behaviour will default to using `depth`
|
|
91
|
+
* If provided as an empty array, then no relationships will be included.
|
|
92
|
+
*/
|
|
93
|
+
include: number | Paths<PrimaryType>[] | string[];
|
|
83
94
|
/**
|
|
84
95
|
* An object of 0 *OR* 1 (**NOT BOTH**) to denote hide or show attributes respectively.
|
|
85
96
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/serializer.interface.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"serializer.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/serializer.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAElF,MAAM,WAAW,iBAAiB,CAAC,WAAW,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG;IAC1E;;;;OAIG;IACH,KAAK,EAAE,MAAM,WAAW,CAAC;IAEzB;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;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AAC,GAAG,OAAO,CAAC,CAAC,CAAC;QAE5D;;WAEG;QACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;KACpC,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.model.d.ts","sourceRoot":"","sources":["../../src/models/error.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"error.model.d.ts","sourceRoot":"","sources":["../../src/models/error.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;OAIG;WACW,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC;IAuB1E,gBAAgB;IACT,KAAK,EAAG,MAAM,CAAC;IAEtB;;OAEG;IACI,EAAE,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACI,MAAM,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACI,IAAI,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACI,MAAM,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACI,MAAM,CAAC,EAAE;QACd;;;;WAIG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF;;OAEG;IACI,KAAK,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IAE1C;;OAEG;IACI,IAAI,CAAC,EAAE,IAAI,CAAC;gBAEA,OAAO,GAAE,YAAiB;CAS9C"}
|
|
@@ -10,11 +10,19 @@ class JapiError {
|
|
|
10
10
|
static isLikeJapiError(error) {
|
|
11
11
|
if (!(0, is_object_1.isObject)(error))
|
|
12
12
|
return false;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const hasErrorKeys = [
|
|
14
|
+
'id',
|
|
15
|
+
'status',
|
|
16
|
+
'code',
|
|
17
|
+
'title',
|
|
18
|
+
'detail',
|
|
19
|
+
'source',
|
|
20
|
+
'links',
|
|
21
|
+
'meta',
|
|
22
|
+
].some((attrName) => attrName in error);
|
|
23
|
+
const expectedStringKeys = ['id', 'status', 'code', 'title', 'detail'].every((attrName) => !(attrName in error) || error[attrName] === undefined || typeof error[attrName] === 'string');
|
|
24
|
+
const expectedObjectKeys = ['source', 'links', 'meta'].every((attrName) => !(attrName in error) || error[attrName] === undefined || (0, is_object_1.isObject)(error[attrName]));
|
|
25
|
+
return hasErrorKeys && [expectedStringKeys, expectedObjectKeys].every((v) => v);
|
|
18
26
|
}
|
|
19
27
|
/** @internal */
|
|
20
28
|
stack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.model.js","sourceRoot":"","sources":["../../src/models/error.model.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"error.model.js","sourceRoot":"","sources":["../../src/models/error.model.ts"],"names":[],"mappings":";;AAEA,kDAA8C;AAI9C,MAAqB,SAAS;IAC5B;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,KAAc;QAC1C,IAAI,CAAC,IAAA,oBAAQ,EAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,MAAM,YAAY,GAAG;YACnB,IAAI;YACJ,QAAQ;YACR,MAAM;YACN,OAAO;YACP,QAAQ;YAC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AAM;YAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC5D,IAAI,OAAO,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC3C,IAAI,OAAO,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9C,IAAI,OAAO,CAAC,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjD,IAAI,OAAO,CAAC,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AAlGD,4BAkGC"}
|
|
@@ -11,4 +11,10 @@ export declare type VariadicFunction<Dependencies extends any[], ReturnType> = (
|
|
|
11
11
|
export declare type Dictionary<T> = Record<string | number | symbol, T>;
|
|
12
12
|
export declare type nullish = null | undefined;
|
|
13
13
|
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
14
|
+
declare type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
|
|
15
|
+
declare type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, ...0[]];
|
|
16
|
+
export declare type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
|
|
17
|
+
[K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K], Prev[D]>> : never;
|
|
18
|
+
}[keyof T] : '';
|
|
19
|
+
export {};
|
|
14
20
|
//# sourceMappingURL=global.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.types.d.ts","sourceRoot":"","sources":["../../src/types/global.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa,CAAC,CAAC,IAAI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+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGxE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,EAAE,EAClF,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,CAAC,GACZ,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAiBpC"}
|
package/lib/utils/merge.js
CHANGED
|
@@ -13,10 +13,11 @@ function merge(target, ...sources) {
|
|
|
13
13
|
const source = sources.shift();
|
|
14
14
|
if ((0, is_plain_object_1.isPlainObject)(target) && (0, is_plain_object_1.isPlainObject)(source)) {
|
|
15
15
|
for (const key of Object.keys(source)) {
|
|
16
|
-
|
|
16
|
+
const sourceItem = source[key];
|
|
17
|
+
if ((0, is_plain_object_1.isPlainObject)(sourceItem)) {
|
|
17
18
|
if (!target[key])
|
|
18
19
|
Object.assign(target, { [key]: {} });
|
|
19
|
-
merge(target[key],
|
|
20
|
+
merge(target[key], sourceItem);
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
23
|
Object.assign(target, { [key]: source[key] });
|
package/lib/utils/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":";;AACA,uDAAkD;AAElD;;;;;GAKG;AACH,SAAwB,KAAK,CAC3B,MAAS,EACT,GAAG,OAAU;IAEb,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,MAA4C,CAAC;IACzE,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,IAAA,+BAAa,EAAC,MAAM,CAAC,IAAI,IAAA,+BAAa,EAAC,MAAM,CAAC,EAAE;QAClD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACrC,
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":";;AACA,uDAAkD;AAElD;;;;;GAKG;AACH,SAAwB,KAAK,CAC3B,MAAS,EACT,GAAG,OAAU;IAEb,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,MAA4C,CAAC;IACzE,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,IAAA,+BAAa,EAAC,MAAM,CAAC,IAAI,IAAA,+BAAa,EAAC,MAAM,CAAC,EAAE;QAClD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACrC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,IAAA,+BAAa,EAAC,UAAU,CAAC,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;aAChC;iBAAM;gBACL,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;aAC/C;SACF;KACF;IAED,OAAO,KAAK,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AACnC,CAAC;AApBD,wBAoBC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Relator from '../classes/relator';
|
|
2
2
|
import { SerializerOptions } from '../interfaces/serializer.interface';
|
|
3
3
|
import { Dictionary } from '../types/global.types';
|
|
4
|
-
export declare function recurseRelators(data: any[], relators: Record<string, Relator<any>>,
|
|
5
|
-
export declare function normalizeRelators<T
|
|
6
|
-
export declare class Helpers<PrimaryType> {
|
|
4
|
+
export declare function recurseRelators(data: any[], relators: Record<string, Relator<any>>, include: number | string[] | undefined, keys: string[], relatorDataCache?: Map<Relator<any>, Dictionary<any>[]>): Promise<any[]>;
|
|
5
|
+
export declare function normalizeRelators<T extends Dictionary<any>>(relators: SerializerOptions<T>['relators']): Record<string, Relator<T, any>> | undefined;
|
|
6
|
+
export declare class Helpers<PrimaryType extends Dictionary<any> = any> {
|
|
7
7
|
projectAttributes: (data: PrimaryType) => Partial<PrimaryType> | undefined;
|
|
8
8
|
relators: Record<string, Relator<PrimaryType, any>> | undefined;
|
|
9
9
|
constructor(options: SerializerOptions<PrimaryType>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.utils.d.ts","sourceRoot":"","sources":["../../src/utils/serializer.utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,EAAE,EACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EACtC,
|
|
1
|
+
{"version":3,"file":"serializer.utils.d.ts","sourceRoot":"","sources":["../../src/utils/serializer.utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,EAAE,EACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EACtC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,IAAI,EAAE,MAAM,EAAE,EACd,gBAAgB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,kBAuExD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,EACzD,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,+CAiB3C;AAED,qBAAa,OAAO,CAAC,WAAW,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG;IACrD,iBAAiB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAC3E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;gBACpD,OAAO,EAAE,iBAAiB,CAAC,WAAW,CAAC;CA0C3D"}
|
|
@@ -5,8 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Helpers = exports.normalizeRelators = exports.recurseRelators = void 0;
|
|
7
7
|
const relator_1 = __importDefault(require("../classes/relator"));
|
|
8
|
-
async function recurseRelators(data, relators,
|
|
8
|
+
async function recurseRelators(data, relators, include, keys, relatorDataCache) {
|
|
9
9
|
const included = [];
|
|
10
|
+
let depth = typeof include === 'number'
|
|
11
|
+
? include
|
|
12
|
+
: Array.isArray(include)
|
|
13
|
+
? Math.max(...include.map((i) => i.split('.').length))
|
|
14
|
+
: 0;
|
|
10
15
|
let curRelatorDataCache = relatorDataCache || new Map();
|
|
11
16
|
// Required to support backwards compatability where the first dataCache may
|
|
12
17
|
// not be passed in. All subsequent iterations will contain a dataCache
|
|
@@ -22,18 +27,36 @@ async function recurseRelators(data, relators, depth, keys, relatorDataCache) {
|
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
}
|
|
30
|
+
let currentDepth = 0;
|
|
25
31
|
while (depth-- > 0 && curRelatorDataCache.size > 0) {
|
|
26
32
|
const newRelatorDataCache = new Map();
|
|
33
|
+
const includeFields = Array.isArray(include)
|
|
34
|
+
? include
|
|
35
|
+
.map((i) => i.split('.'))
|
|
36
|
+
.filter((i) => i[currentDepth])
|
|
37
|
+
.map((i) => ({ field: i[currentDepth], hasMore: i.length > currentDepth + 1 }))
|
|
38
|
+
: undefined;
|
|
27
39
|
for (const [relator, cache] of curRelatorDataCache) {
|
|
28
40
|
for (let i = 0; i < cache.length; i++) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
const shouldBuildRelatedCache = (!includeFields ||
|
|
42
|
+
includeFields?.filter((i) => i.field === relator.relatedName)?.[i]?.hasMore) ??
|
|
43
|
+
false;
|
|
44
|
+
const resource = await relator.getRelatedResource(cache[i], undefined, undefined,
|
|
45
|
+
// Only build the cache for the nexty iteration if needed.
|
|
46
|
+
shouldBuildRelatedCache ? newRelatorDataCache : undefined);
|
|
47
|
+
// Include if,
|
|
48
|
+
// - includeFields == undefined
|
|
49
|
+
// - includeFields has entry where field = relatedName
|
|
50
|
+
if (!includeFields || includeFields.map((i) => i.field).includes(relator.relatedName)) {
|
|
51
|
+
const key = resource.getKey();
|
|
52
|
+
if (!keys.includes(key)) {
|
|
53
|
+
keys.push(key);
|
|
54
|
+
included.push(resource);
|
|
55
|
+
}
|
|
34
56
|
}
|
|
35
57
|
}
|
|
36
58
|
}
|
|
59
|
+
currentDepth++;
|
|
37
60
|
curRelatorDataCache = newRelatorDataCache;
|
|
38
61
|
}
|
|
39
62
|
return included;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.utils.js","sourceRoot":"","sources":["../../src/utils/serializer.utils.ts"],"names":[],"mappings":";;;;;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AC,KAAK,CAAC,CAAC;oBACjC,OAAO,UAAU,CAAC;gBACpB,CAAC,CAAC;aACH;iBAAM;gBACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAgB,CAAC;gBACpD,IAAI,CAAC,iBAAiB,GAAG,CAAC,IAAiB,EAAE,EAAE;oBAC7C,MAAM,UAAU,GAAyB,EAAE,CAAC;oBAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;wBAC/C,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;qBACrC;oBACD,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACjC,OAAO,UAAU,CAAC;gBACpB,CAAC,CAAC;aACH;SACF;IACH,CAAC;CACF;AA7CD,0BA6CC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-japi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A highly-modular (typescript-friendly)-framework agnostic library for serializing data to the JSON:API specification",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"playground": "ts-node ./benchmarks/playground.benchmark",
|
|
9
|
-
"lint": "eslint .",
|
|
10
|
-
"examples": "ts-node ./examples/",
|
|
11
|
-
"docs": "npm run api-extractor && ts-node tools/generate_docs.ts",
|
|
12
|
-
"clean": "make clean",
|
|
13
|
-
"build": "tsc",
|
|
7
|
+
"api-extractor": "api-extractor run",
|
|
14
8
|
"benchmark": "ts-node ./benchmarks/serializer.benchmark",
|
|
15
|
-
"
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"clean": "make clean",
|
|
11
|
+
"commitlint": "commitlint --from=HEAD~1",
|
|
12
|
+
"docs": "npm run api-extractor && ts-node tools/generate_docs.ts",
|
|
13
|
+
"format": "run-s format:*",
|
|
14
|
+
"format:prettier": "prettier --write .",
|
|
15
|
+
"format:eslint": "eslint --fix .",
|
|
16
|
+
"examples": "ts-node ./examples/",
|
|
17
|
+
"lint": "run-s lint:*",
|
|
18
|
+
"lint:prettier": "prettier --check .",
|
|
19
|
+
"lint:eslint": "eslint .",
|
|
20
|
+
"playground": "ts-node ./benchmarks/playground.benchmark",
|
|
21
|
+
"prepare": "husky install",
|
|
22
|
+
"test": "jest --runInBand --verbose --coverage"
|
|
16
23
|
},
|
|
17
24
|
"publishConfig": {
|
|
18
25
|
"access": "public",
|
|
@@ -46,6 +53,8 @@
|
|
|
46
53
|
"@babel/preset-env": "^7.18.6",
|
|
47
54
|
"@babel/preset-typescript": "^7.18.6",
|
|
48
55
|
"@changesets/cli": "^2.23.0",
|
|
56
|
+
"@commitlint/cli": "^17.0.1",
|
|
57
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
49
58
|
"@microsoft/api-documenter": "^7.18.0",
|
|
50
59
|
"@microsoft/api-extractor": "^7.28.2",
|
|
51
60
|
"@types/benchmark": "^2.1.1",
|
|
@@ -61,8 +70,10 @@
|
|
|
61
70
|
"eslint-config-prettier": "^8.5.0",
|
|
62
71
|
"eslint-plugin-prettier": "^4.2.1",
|
|
63
72
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
73
|
+
"husky": "^8.0.1",
|
|
64
74
|
"jest": "^28.1.2",
|
|
65
75
|
"lodash": "^4.17.21",
|
|
76
|
+
"npm-run-all": "^4.1.5",
|
|
66
77
|
"prettier": "^2.7.1",
|
|
67
78
|
"regenerator-runtime": "^0.13.9",
|
|
68
79
|
"ts-node": "^10.8.2",
|
package/tsconfig.json
CHANGED
|
@@ -1,62 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
"include": [
|
|
60
|
-
"src"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["es2020", "dom"],
|
|
6
|
+
"declaration": true /* Generates corresponding '.d.ts' file. */,
|
|
7
|
+
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
|
|
8
|
+
"sourceMap": true /* Generates corresponding '.map' file. */,
|
|
9
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
10
|
+
"outDir": "./lib/" /* Redirect output structure to the directory. */,
|
|
11
|
+
"rootDir": "./src/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
|
12
|
+
// "composite": true, /* Enable project compilation */
|
|
13
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
14
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
15
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
16
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
17
|
+
"downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
|
|
18
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
19
|
+
/* Strict Type-Checking Options */
|
|
20
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
21
|
+
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
22
|
+
"strictNullChecks": true /* Enable strict null checks. */,
|
|
23
|
+
"strictFunctionTypes": true /* Enable strict checking of function types. */,
|
|
24
|
+
"strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
|
|
25
|
+
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
|
26
|
+
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
|
27
|
+
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
|
28
|
+
/* Additional Checks */
|
|
29
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
30
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
31
|
+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
|
32
|
+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
|
33
|
+
/* Module Resolution Options */
|
|
34
|
+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
35
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
36
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
37
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
38
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
39
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
40
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
41
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
42
|
+
"resolveJsonModule": true,
|
|
43
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
44
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
45
|
+
/* Source Map Options */
|
|
46
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
47
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
48
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
49
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
50
|
+
/* Experimental Options */
|
|
51
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
52
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
53
|
+
/* Advanced Options */
|
|
54
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
55
|
+
},
|
|
56
|
+
"include": ["src"]
|
|
57
|
+
}
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"linked": [],
|
|
6
|
-
"access": "restricted",
|
|
7
|
-
"baseBranch": "master",
|
|
8
|
-
"updateInternalDependencies": "patch",
|
|
9
|
-
"ignore": []
|
|
10
|
-
}
|
package/lib/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.28.2"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|