ts-japi 1.5.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +10 -0
- package/CHANGELOG.md +56 -16
- package/Makefile +19 -0
- package/README.md +235 -159
- package/api-extractor.json +14 -0
- package/benchmarks/playground.benchmark.ts +32 -32
- package/benchmarks/serializer.benchmark.ts +29 -29
- package/lib/classes/cache.d.ts +6 -6
- package/lib/classes/cache.d.ts.map +1 -1
- package/lib/classes/cache.js +26 -48
- package/lib/classes/cache.js.map +1 -1
- package/lib/classes/error-serializer.d.ts +9 -9
- package/lib/classes/error-serializer.d.ts.map +1 -1
- package/lib/classes/error-serializer.js +58 -125
- package/lib/classes/error-serializer.js.map +1 -1
- package/lib/classes/linker.d.ts +8 -8
- package/lib/classes/linker.d.ts.map +1 -1
- package/lib/classes/linker.js +15 -40
- package/lib/classes/linker.js.map +1 -1
- package/lib/classes/metaizer.d.ts +6 -6
- package/lib/classes/metaizer.d.ts.map +1 -1
- package/lib/classes/metaizer.js +12 -37
- package/lib/classes/metaizer.js.map +1 -1
- package/lib/classes/paginator.d.ts +6 -6
- package/lib/classes/paginator.d.ts.map +1 -1
- package/lib/classes/paginator.js +17 -16
- package/lib/classes/paginator.js.map +1 -1
- package/lib/classes/relator.d.ts +19 -18
- package/lib/classes/relator.d.ts.map +1 -1
- package/lib/classes/relator.js +70 -110
- package/lib/classes/relator.js.map +1 -1
- package/lib/classes/serializer.d.ts +20 -19
- package/lib/classes/serializer.d.ts.map +1 -1
- package/lib/classes/serializer.js +213 -311
- package/lib/classes/serializer.js.map +1 -1
- package/lib/index.d.ts +20 -20
- package/lib/index.js +17 -10
- package/lib/index.js.map +1 -1
- package/lib/interfaces/cache.interface.d.ts +3 -3
- package/lib/interfaces/cache.interface.d.ts.map +1 -1
- package/lib/interfaces/cache.interface.js +1 -1
- package/lib/interfaces/error-serializer.interface.d.ts +15 -15
- package/lib/interfaces/error-serializer.interface.d.ts.map +1 -1
- package/lib/interfaces/error-serializer.interface.js +1 -1
- package/lib/interfaces/error.interface.d.ts.map +1 -1
- package/lib/interfaces/error.interface.js +1 -1
- package/lib/interfaces/json-api.interface.d.ts +7 -7
- package/lib/interfaces/json-api.interface.d.ts.map +1 -1
- package/lib/interfaces/json-api.interface.js +1 -1
- package/lib/interfaces/linker.interface.d.ts +2 -2
- package/lib/interfaces/linker.interface.d.ts.map +1 -1
- package/lib/interfaces/linker.interface.js +1 -1
- package/lib/interfaces/paginator.interface.d.ts +1 -1
- package/lib/interfaces/paginator.interface.d.ts.map +1 -1
- package/lib/interfaces/paginator.interface.js +1 -1
- package/lib/interfaces/relator.interface.d.ts +7 -7
- package/lib/interfaces/relator.interface.d.ts.map +1 -1
- package/lib/interfaces/relator.interface.js +1 -1
- package/lib/interfaces/serializer.interface.d.ts +30 -30
- package/lib/interfaces/serializer.interface.d.ts.map +1 -1
- package/lib/interfaces/serializer.interface.js +1 -1
- package/lib/models/error.model.d.ts +5 -5
- package/lib/models/error.model.d.ts.map +1 -1
- package/lib/models/error.model.js +59 -22
- package/lib/models/error.model.js.map +1 -1
- package/lib/models/link.model.d.ts +2 -2
- package/lib/models/link.model.d.ts.map +1 -1
- package/lib/models/link.model.js +11 -10
- package/lib/models/link.model.js.map +1 -1
- package/lib/models/meta.model.d.ts.map +1 -1
- package/lib/models/meta.model.js +5 -6
- package/lib/models/meta.model.js.map +1 -1
- package/lib/models/relationship.model.d.ts +4 -4
- package/lib/models/relationship.model.d.ts.map +1 -1
- package/lib/models/relationship.model.js +11 -9
- package/lib/models/relationship.model.js.map +1 -1
- package/lib/models/resource-identifier.model.d.ts +1 -1
- package/lib/models/resource-identifier.model.d.ts.map +1 -1
- package/lib/models/resource-identifier.model.js +11 -9
- package/lib/models/resource-identifier.model.js.map +1 -1
- package/lib/models/resource.model.d.ts +4 -4
- package/lib/models/resource.model.d.ts.map +1 -1
- package/lib/models/resource.model.js +13 -26
- package/lib/models/resource.model.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types/global.types.d.ts.map +1 -1
- package/lib/types/global.types.js +1 -1
- package/lib/utils/is-error-document.d.ts +2 -2
- package/lib/utils/is-error-document.js +7 -9
- package/lib/utils/is-error-document.js.map +1 -1
- package/lib/utils/is-object.js +2 -2
- package/lib/utils/is-object.js.map +1 -1
- package/lib/utils/is-plain-object.js +6 -6
- package/lib/utils/is-plain-object.js.map +1 -1
- package/lib/utils/merge.d.ts +3 -3
- package/lib/utils/merge.d.ts.map +1 -1
- package/lib/utils/merge.js +16 -62
- package/lib/utils/merge.js.map +1 -1
- package/lib/utils/serializer.utils.d.ts +5 -4
- package/lib/utils/serializer.utils.d.ts.map +1 -1
- package/lib/utils/serializer.utils.js +57 -168
- package/lib/utils/serializer.utils.js.map +1 -1
- package/package.json +94 -107
- package/tools/generate_docs.ts +33 -0
- package/tools/internal/custom_markdown_action.ts +32 -0
- package/tools/internal/custom_markdown_documenter.ts +1337 -0
- package/tsconfig.json +60 -83
- package/CONTRIBUTING.md +0 -127
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Benchmark from
|
|
1
|
+
import Benchmark from 'benchmark';
|
|
2
2
|
|
|
3
3
|
const suite = new Benchmark.Suite();
|
|
4
4
|
|
|
5
5
|
const a: any = new Map();
|
|
6
|
-
a.set(
|
|
6
|
+
a.set('test', 'test');
|
|
7
7
|
|
|
8
8
|
const b: any = {};
|
|
9
|
-
b.test =
|
|
9
|
+
b.test = 'test';
|
|
10
10
|
|
|
11
11
|
var length = 100; // user defined length
|
|
12
12
|
|
|
@@ -14,37 +14,37 @@ const array: number[] = [];
|
|
|
14
14
|
const map = new Map();
|
|
15
15
|
|
|
16
16
|
for (var i = 0; i < length; i++) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
array.push(i);
|
|
18
|
+
map.set(i, 0);
|
|
19
19
|
}
|
|
20
20
|
const tobepushed = [1, 2, 3];
|
|
21
21
|
|
|
22
22
|
// add tests
|
|
23
23
|
suite
|
|
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
|
-
|
|
24
|
+
.add('Array#ForOf', async function () {
|
|
25
|
+
const g = [];
|
|
26
|
+
for (const test of array) {
|
|
27
|
+
g.push(test);
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.add('Array#index', async function () {
|
|
31
|
+
const g = [];
|
|
32
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
33
|
+
g.push(array[i]);
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.add('Array#indexWithTemp', async function () {
|
|
37
|
+
const g = [];
|
|
38
|
+
for (let i = 0, temp = array[i]; i < array.length; temp = array[++i]) {
|
|
39
|
+
g.push(temp);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
// add listeners
|
|
43
|
+
.on('cycle', function (event: any) {
|
|
44
|
+
console.log(String(event.target));
|
|
45
|
+
})
|
|
46
|
+
.on('complete', function (this: any) {
|
|
47
|
+
console.log('Fastest is ' + this.filter('fastest').map('name'));
|
|
48
|
+
})
|
|
49
|
+
// run async
|
|
50
|
+
.run({ async: true });
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import Benchmark from
|
|
2
|
-
import { Relator, Serializer } from
|
|
3
|
-
import { Article, Comment, User } from
|
|
1
|
+
import Benchmark from 'benchmark';
|
|
2
|
+
import { Relator, Serializer } from '../src';
|
|
3
|
+
import { Article, Comment, User } from '../test/models';
|
|
4
4
|
|
|
5
5
|
const suite = new Benchmark.Suite();
|
|
6
6
|
|
|
7
7
|
for (let i = 0; i < 5; i++) {
|
|
8
|
-
|
|
8
|
+
User.save(new User(String(i)));
|
|
9
9
|
}
|
|
10
10
|
for (let i = 0; i < 5; i++) {
|
|
11
|
-
|
|
11
|
+
Article.save(new Article(String(i), User.storage[0]));
|
|
12
12
|
}
|
|
13
13
|
for (let i = 0; i < 10; i++) {
|
|
14
|
-
|
|
14
|
+
Comment.save(new Comment(String(i), User.storage[0], Article.storage[0]));
|
|
15
15
|
}
|
|
16
|
-
let UserSerializer = new Serializer<User>(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let UserSerializer = new Serializer<User>('users', {
|
|
17
|
+
depth: 0, // Change to 2 to see the difference
|
|
18
|
+
cache: true,
|
|
19
19
|
});
|
|
20
|
-
let CommentSerializer = new Serializer<Comment>(
|
|
21
|
-
let ArticleSerializer = new Serializer<Article>(
|
|
20
|
+
let CommentSerializer = new Serializer<Comment>('comments');
|
|
21
|
+
let ArticleSerializer = new Serializer<Article>('articles');
|
|
22
22
|
const UserArticleRelator = new Relator<User, Article>(
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
async (user: User) => user.getArticles(),
|
|
24
|
+
ArticleSerializer
|
|
25
25
|
);
|
|
26
26
|
const ArticleCommentRelator = new Relator<Article, Comment>(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
async (article: Article) => article.getComments(),
|
|
28
|
+
CommentSerializer
|
|
29
29
|
);
|
|
30
30
|
const CommentUserRelator = new Relator<Comment, User>(
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
async (comment: Comment) => comment.getAuthor(),
|
|
32
|
+
UserSerializer
|
|
33
33
|
);
|
|
34
34
|
CommentSerializer.setRelators(CommentUserRelator);
|
|
35
35
|
UserSerializer.setRelators(UserArticleRelator);
|
|
@@ -39,15 +39,15 @@ const user = User.storage[0];
|
|
|
39
39
|
|
|
40
40
|
// add tests
|
|
41
41
|
suite
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
.add('Serializer#Test', async function () {
|
|
43
|
+
await UserSerializer.serialize(user);
|
|
44
|
+
})
|
|
45
|
+
// add listeners
|
|
46
|
+
.on('cycle', function (event: any) {
|
|
47
|
+
console.log(String(event.target));
|
|
48
|
+
})
|
|
49
|
+
.on('complete', function (this: any) {
|
|
50
|
+
console.log('Fastest is ' + this.filter('fastest').map('name'));
|
|
51
|
+
})
|
|
52
|
+
// run async
|
|
53
|
+
.run({ async: true });
|
package/lib/classes/cache.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SerializerOptions } from
|
|
2
|
-
import { DataDocument } from
|
|
3
|
-
import { SingleOrArray, nullish } from
|
|
4
|
-
import { CacheOptions } from
|
|
1
|
+
import { SerializerOptions } from '../interfaces/serializer.interface';
|
|
2
|
+
import { DataDocument } from '../interfaces/json-api.interface';
|
|
3
|
+
import { SingleOrArray, nullish } from '../types/global.types';
|
|
4
|
+
import { CacheOptions } from '../interfaces/cache.interface';
|
|
5
5
|
export default class Cache<PrimaryType> {
|
|
6
6
|
/**
|
|
7
7
|
* The default max for document storage
|
|
@@ -18,9 +18,9 @@ export default class Cache<PrimaryType> {
|
|
|
18
18
|
*/
|
|
19
19
|
private resolver;
|
|
20
20
|
/**
|
|
21
|
-
* Creates a {@
|
|
21
|
+
* Creates a {@link Cache}
|
|
22
22
|
*
|
|
23
|
-
* @param limit The maximum amount of documents that can be stored before erasure.
|
|
23
|
+
* @param limit - The maximum amount of documents that can be stored before erasure.
|
|
24
24
|
*/
|
|
25
25
|
constructor(options?: Partial<CacheOptions<PrimaryType>>);
|
|
26
26
|
/** @internal Gets a document in the cache */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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/cache.js
CHANGED
|
@@ -1,69 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
exports.__esModule = true;
|
|
19
|
-
var Cache = /** @class */ (function () {
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Cache {
|
|
4
|
+
/**
|
|
5
|
+
* The default max for document storage
|
|
6
|
+
*/
|
|
7
|
+
static defaultLimit = 10;
|
|
8
|
+
/** @internal The storage for the cache */
|
|
9
|
+
storage = [];
|
|
10
|
+
/**
|
|
11
|
+
* The maximum amount of documents that can be storage before erasure.
|
|
12
|
+
*/
|
|
13
|
+
limit = Cache.defaultLimit;
|
|
20
14
|
/**
|
|
21
|
-
*
|
|
15
|
+
* The method to use in determining data equality
|
|
16
|
+
*/
|
|
17
|
+
resolver = Object.is;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a {@link Cache}
|
|
22
20
|
*
|
|
23
|
-
* @param limit The maximum amount of documents that can be stored before erasure.
|
|
21
|
+
* @param limit - The maximum amount of documents that can be stored before erasure.
|
|
24
22
|
*/
|
|
25
|
-
|
|
26
|
-
if (options === void 0) { options = {}; }
|
|
27
|
-
/** @internal The storage for the cache */
|
|
28
|
-
this.storage = [];
|
|
29
|
-
/**
|
|
30
|
-
* The maximum amount of documents that can be storage before erasure.
|
|
31
|
-
*/
|
|
32
|
-
this.limit = Cache.defaultLimit;
|
|
33
|
-
/**
|
|
34
|
-
* The method to use in determining data equality
|
|
35
|
-
*/
|
|
36
|
-
this.resolver = Object.is;
|
|
23
|
+
constructor(options = {}) {
|
|
37
24
|
if (options.limit)
|
|
38
25
|
this.limit = options.limit;
|
|
39
26
|
if (options.resolver)
|
|
40
27
|
this.resolver = options.resolver;
|
|
41
28
|
}
|
|
42
29
|
/** @internal Gets a document in the cache */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var document = this.storage.find(function (_a) {
|
|
46
|
-
var _b = __read(_a, 2), storedData = _b[0], storedOptions = _b[1];
|
|
47
|
-
return _this.resolver(storedData, data) && Object.is(storedOptions, options);
|
|
48
|
-
});
|
|
30
|
+
get(data, options) {
|
|
31
|
+
const document = this.storage.find(([storedData, storedOptions]) => this.resolver(storedData, data) && Object.is(storedOptions, options));
|
|
49
32
|
if (document)
|
|
50
33
|
return document[2];
|
|
51
34
|
else
|
|
52
35
|
return false;
|
|
53
|
-
}
|
|
36
|
+
}
|
|
54
37
|
/** @internal Sets a document in the cache */
|
|
55
|
-
|
|
38
|
+
set(data, document, options) {
|
|
56
39
|
if (this.storage.length > this.limit) {
|
|
57
40
|
this.storage.shift();
|
|
58
41
|
}
|
|
59
42
|
this.storage.push([data, options, document]);
|
|
60
43
|
return document;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
Cache.defaultLimit = 10;
|
|
66
|
-
return Cache;
|
|
67
|
-
}());
|
|
68
|
-
exports["default"] = Cache;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = Cache;
|
|
69
47
|
//# sourceMappingURL=cache.js.map
|
package/lib/classes/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/classes/cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/classes/cache.ts"],"names":[],"mappings":";;AAKA,MAAqB,KAAK;IACxB;;OAEG;IACI,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC;IAEhC,0CAA0C;IAClC,OAAO,GAMX,EAAE,CAAC;IAEP;;OAEG;IACK,KAAK,GAAW,KAAK,CAAC,YAAY,CAAC;IAE3C;;OAEG;IACK,QAAQ,GAGD,MAAM,CAAC,EAAE,CAAC;IAEzB;;;;OAIG;IACH,YAAmB,UAA8C,EAAE;QACjE,IAAI,OAAO,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9C,IAAI,OAAO,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACzD,CAAC;IAED,6CAA6C;IACtC,GAAG,CACR,IAA0C,EAC1C,OAAiD;QAEjD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAChC,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,EAAE,EAAE,CAC9B,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CACvE,CAAC;QACF,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;;YAC5B,OAAO,KAAK,CAAC;IACpB,CAAC;IAED,6CAA6C;IACtC,GAAG,CACR,IAA0C,EAC1C,QAA4C,EAC5C,OAAiD;QAEjD,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE;YACpC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SACtB;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC7C,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA9DH,wBA+DC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ErrorSerializerOptions } from
|
|
2
|
-
import { ErrorDocument } from
|
|
3
|
-
import { SingleOrArray } from
|
|
1
|
+
import { ErrorSerializerOptions } from '../interfaces/error-serializer.interface';
|
|
2
|
+
import { ErrorDocument } from '../interfaces/json-api.interface';
|
|
3
|
+
import { SingleOrArray } from '../types/global.types';
|
|
4
4
|
/**
|
|
5
|
-
* The {@
|
|
5
|
+
* The {@link ErrorSerializer} class is used to serialize errors.
|
|
6
6
|
*
|
|
7
7
|
* Example:
|
|
8
8
|
* ```typescript
|
|
@@ -34,17 +34,17 @@ export default class ErrorSerializer<ErrorType> {
|
|
|
34
34
|
*/
|
|
35
35
|
private options;
|
|
36
36
|
/**
|
|
37
|
-
* Creates a {@
|
|
37
|
+
* Creates a {@link Serializer}.
|
|
38
38
|
*
|
|
39
|
-
* @param collectionName The name of the collection of objects.
|
|
40
|
-
* @param options Options for the serializer.
|
|
39
|
+
* @param collectionName - The name of the collection of objects.
|
|
40
|
+
* @param options - Options for the serializer.
|
|
41
41
|
*/
|
|
42
42
|
constructor(options?: Partial<ErrorSerializerOptions<ErrorType>>);
|
|
43
43
|
/**
|
|
44
44
|
* The actual serialization function.
|
|
45
45
|
*
|
|
46
|
-
* @param errors Errors to serialize.
|
|
47
|
-
* @param options Options to use at runtime.
|
|
46
|
+
* @param errors - Errors to serialize.
|
|
47
|
+
* @param options - Options to use at runtime.
|
|
48
48
|
*/
|
|
49
49
|
serialize(errors: SingleOrArray<ErrorType>, options?: Partial<ErrorSerializerOptions<ErrorType>>): ErrorDocument;
|
|
50
50
|
}
|
|
@@ -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;AAGtD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,SAAS;
|
|
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;AAGtD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,SAAS;IAC5C;;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,93 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __values = (this && this.__values) || function(o) {
|
|
14
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
-
if (m) return m.call(o);
|
|
16
|
-
if (o && typeof o.length === "number") return {
|
|
17
|
-
next: function () {
|
|
18
|
-
if (o && i >= o.length) o = void 0;
|
|
19
|
-
return { value: o && o[i++], done: !o };
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
-
};
|
|
24
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
-
if (!m) return o;
|
|
27
|
-
var i = m.call(o), r, ar = [], e;
|
|
28
|
-
try {
|
|
29
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
-
}
|
|
31
|
-
catch (error) { e = { error: error }; }
|
|
32
|
-
finally {
|
|
33
|
-
try {
|
|
34
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
-
}
|
|
36
|
-
finally { if (e) throw e.error; }
|
|
37
|
-
}
|
|
38
|
-
return ar;
|
|
39
|
-
};
|
|
40
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
4
|
};
|
|
43
|
-
exports
|
|
44
|
-
|
|
45
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const error_model_1 = __importDefault(require("../models/error.model"));
|
|
7
|
+
const merge_1 = __importDefault(require("../utils/merge"));
|
|
46
8
|
/**
|
|
47
|
-
* The {@
|
|
9
|
+
* The {@link ErrorSerializer} class is used to serialize errors.
|
|
48
10
|
*
|
|
49
11
|
* Example:
|
|
50
12
|
* ```typescript
|
|
51
13
|
* [[include:error-serializer.example.ts]]
|
|
52
14
|
* ```
|
|
53
15
|
*/
|
|
54
|
-
|
|
16
|
+
class ErrorSerializer {
|
|
17
|
+
/**
|
|
18
|
+
* Default options. Can be edited to change default options globally.
|
|
19
|
+
*/
|
|
20
|
+
static defaultOptions = {
|
|
21
|
+
version: '1.0',
|
|
22
|
+
attributes: {
|
|
23
|
+
id: 'id',
|
|
24
|
+
status: 'code',
|
|
25
|
+
code: 'name',
|
|
26
|
+
title: 'reason',
|
|
27
|
+
detail: 'message',
|
|
28
|
+
source: {
|
|
29
|
+
pointer: 'location',
|
|
30
|
+
parameter: undefined,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
metaizers: {},
|
|
34
|
+
linkers: {},
|
|
35
|
+
};
|
|
55
36
|
/**
|
|
56
|
-
*
|
|
37
|
+
* The set of options for the serializer.
|
|
38
|
+
*/
|
|
39
|
+
options;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a {@link Serializer}.
|
|
57
42
|
*
|
|
58
|
-
* @param collectionName The name of the collection of objects.
|
|
59
|
-
* @param options Options for the serializer.
|
|
43
|
+
* @param collectionName - The name of the collection of objects.
|
|
44
|
+
* @param options - Options for the serializer.
|
|
60
45
|
*/
|
|
61
|
-
|
|
62
|
-
if (options === void 0) { options = {}; }
|
|
46
|
+
constructor(options = {}) {
|
|
63
47
|
// Setting default options.
|
|
64
|
-
this.options = merge_1
|
|
48
|
+
this.options = (0, merge_1.default)({}, ErrorSerializer.defaultOptions, options);
|
|
65
49
|
}
|
|
66
50
|
/**
|
|
67
51
|
* The actual serialization function.
|
|
68
52
|
*
|
|
69
|
-
* @param errors Errors to serialize.
|
|
70
|
-
* @param options Options to use at runtime.
|
|
53
|
+
* @param errors - Errors to serialize.
|
|
54
|
+
* @param options - Options to use at runtime.
|
|
71
55
|
*/
|
|
72
|
-
|
|
73
|
-
var e_1, _a, e_2, _b, e_3, _c, _d;
|
|
56
|
+
serialize(errors, options) {
|
|
74
57
|
// Get options.
|
|
75
|
-
|
|
58
|
+
let o = this.options;
|
|
76
59
|
if (options)
|
|
77
|
-
o = merge_1
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
o = (0, merge_1.default)({}, this.options, options);
|
|
61
|
+
const attributes = o.attributes;
|
|
62
|
+
const linkers = o.linkers;
|
|
63
|
+
const metaizers = o.metaizers;
|
|
64
|
+
const version = o.version;
|
|
65
|
+
const document = { errors: [] };
|
|
83
66
|
// Normalize error input
|
|
84
67
|
if (!Array.isArray(errors)) {
|
|
85
68
|
errors = [errors];
|
|
86
69
|
}
|
|
87
|
-
document.errors = errors.map(
|
|
88
|
-
if (e instanceof error_model_1
|
|
70
|
+
document.errors = errors.map((e) => {
|
|
71
|
+
if (e instanceof error_model_1.default)
|
|
89
72
|
return e;
|
|
90
|
-
|
|
73
|
+
const eo = {};
|
|
91
74
|
if (attributes.id && e[attributes.id]) {
|
|
92
75
|
eo.id = String(e[attributes.id]);
|
|
93
76
|
}
|
|
@@ -115,86 +98,36 @@ var ErrorSerializer = /** @class */ (function () {
|
|
|
115
98
|
delete eo.source;
|
|
116
99
|
}
|
|
117
100
|
}
|
|
118
|
-
return new error_model_1
|
|
101
|
+
return new error_model_1.default(eo);
|
|
119
102
|
});
|
|
120
103
|
// Constructing base document.
|
|
121
104
|
if (version) {
|
|
122
|
-
document.jsonapi = { version
|
|
105
|
+
document.jsonapi = { version };
|
|
123
106
|
}
|
|
124
107
|
// Handling document metadata.
|
|
125
108
|
if (metaizers.jsonapi) {
|
|
126
|
-
document.jsonapi =
|
|
109
|
+
document.jsonapi = { ...document.jsonapi, meta: metaizers.jsonapi.metaize() };
|
|
127
110
|
}
|
|
128
111
|
if (metaizers.document) {
|
|
129
112
|
document.meta = metaizers.document.metaize(document.errors);
|
|
130
113
|
}
|
|
131
114
|
if (metaizers.error) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
var error = _f.value;
|
|
135
|
-
error.meta = metaizers.error.metaize(error);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
139
|
-
finally {
|
|
140
|
-
try {
|
|
141
|
-
if (_f && !_f.done && (_a = _e["return"])) _a.call(_e);
|
|
142
|
-
}
|
|
143
|
-
finally { if (e_1) throw e_1.error; }
|
|
115
|
+
for (const error of document.errors) {
|
|
116
|
+
error.meta = metaizers.error.metaize(error);
|
|
144
117
|
}
|
|
145
118
|
}
|
|
146
119
|
// Handling links.
|
|
147
120
|
if (Object.keys(linkers).length > 0) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
for (var _k = (e_3 = void 0, __values(document.errors)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
154
|
-
var error = _l.value;
|
|
155
|
-
error.links = __assign(__assign({}, error.links), (_d = {}, _d[key] = linker.link(error), _d));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
159
|
-
finally {
|
|
160
|
-
try {
|
|
161
|
-
if (_l && !_l.done && (_c = _k["return"])) _c.call(_k);
|
|
162
|
-
}
|
|
163
|
-
finally { if (e_3) throw e_3.error; }
|
|
164
|
-
}
|
|
121
|
+
for (const [key, linker] of Object.entries(linkers)) {
|
|
122
|
+
if (linker) {
|
|
123
|
+
for (const error of document.errors) {
|
|
124
|
+
error.links = { ...error.links, [key]: linker.link(error) };
|
|
165
125
|
}
|
|
166
126
|
}
|
|
167
127
|
}
|
|
168
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
169
|
-
finally {
|
|
170
|
-
try {
|
|
171
|
-
if (_h && !_h.done && (_b = _g["return"])) _b.call(_g);
|
|
172
|
-
}
|
|
173
|
-
finally { if (e_2) throw e_2.error; }
|
|
174
|
-
}
|
|
175
128
|
}
|
|
176
129
|
return document;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*/
|
|
181
|
-
ErrorSerializer.defaultOptions = {
|
|
182
|
-
version: "1.0",
|
|
183
|
-
attributes: {
|
|
184
|
-
id: "id",
|
|
185
|
-
status: "code",
|
|
186
|
-
code: "name",
|
|
187
|
-
title: "reason",
|
|
188
|
-
detail: "message",
|
|
189
|
-
source: {
|
|
190
|
-
pointer: "location",
|
|
191
|
-
parameter: undefined
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
metaizers: {},
|
|
195
|
-
linkers: {}
|
|
196
|
-
};
|
|
197
|
-
return ErrorSerializer;
|
|
198
|
-
}());
|
|
199
|
-
exports["default"] = ErrorSerializer;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.default = ErrorSerializer;
|
|
200
133
|
//# sourceMappingURL=error-serializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-serializer.js","sourceRoot":"","sources":["../../src/classes/error-serializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error-serializer.js","sourceRoot":"","sources":["../../src/classes/error-serializer.ts"],"names":[],"mappings":";;;;;AAGA,wEAA8C;AAE9C,2DAAmC;AAEnC;;;;;;;GAOG;AACH,MAAqB,eAAe;IAClC;;OAEG;IACI,MAAM,CAAC,cAAc,GAAG;QAC7B,OAAO,EAAE,KAAK;QACd,UAAU,EAAE;YACV,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE;gBACN,OAAO,EAAE,UAAU;gBACnB,SAAS,EAAE,SAAS;aACrB;SACF;QACD,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF;;OAEG;IACK,OAAO,CAA8C;IAE7D;;;;;OAKG;IACH,YAAmB,UAAsD,EAAE;QACzE,2BAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAA,eAAK,EAAC,EAAE,EAAE,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;;OAKG;IACI,SAAS,CACd,MAAgC,EAChC,OAAoD;QAEpD,eAAe;QACf,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACrB,IAAI,OAAO;YAAE,CAAC,GAAG,IAAA,eAAK,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAElD,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;QAChC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;QAC1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,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SAC7D;QACD,IAAI,SAAS,CAAC,KAAK,EAAE;YACnB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;aAC7C;SACF;QAED,kBAAkB;QAClB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACnC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACnD,IAAI,MAAM,EAAE;oBACV,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE;wBACnC,KAAK,CAAC,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;qBAC7D;iBACF;aACF;SACF;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA7HH,kCA8HC"}
|
package/lib/classes/linker.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LinkerOptions } from
|
|
2
|
-
import Link from
|
|
3
|
-
import { VariadicFunction } from
|
|
1
|
+
import { LinkerOptions } from '../interfaces/linker.interface';
|
|
2
|
+
import Link from '../models/link.model';
|
|
3
|
+
import { VariadicFunction } from '../types/global.types';
|
|
4
4
|
/**
|
|
5
|
-
* The {@
|
|
5
|
+
* The {@link Linker} class is used to construct a [link](https://jsonapi.org/format/#document-links).
|
|
6
6
|
*
|
|
7
7
|
* Example:
|
|
8
8
|
* ```typescript
|
|
@@ -10,13 +10,13 @@ import { VariadicFunction } from "../types/global.types";
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
export default class Linker<Dependencies extends any[]> {
|
|
13
|
-
/** @internal Generates a {@
|
|
13
|
+
/** @internal Generates a {@link Link}. */
|
|
14
14
|
link: VariadicFunction<Dependencies, Link>;
|
|
15
15
|
/**
|
|
16
|
-
* Creates a {@
|
|
16
|
+
* Creates a {@link Linker}.
|
|
17
17
|
*
|
|
18
|
-
* @param link A {@
|
|
19
|
-
* @param options Options for the linker.
|
|
18
|
+
* @param link - A {@link LinkFunction} used to generate a string URI from its arguments.
|
|
19
|
+
* @param options - Options for the linker.
|
|
20
20
|
*/
|
|
21
21
|
constructor(link: VariadicFunction<Dependencies, string>, options?: LinkerOptions<Dependencies>);
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../src/classes/linker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM,CAAC,YAAY,SAAS,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../src/classes/linker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM,CAAC,YAAY,SAAS,GAAG,EAAE;IACpD,0CAA0C;IACnC,IAAI,EAAE,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAElD;;;;;OAKG;gBAED,IAAI,EAAE,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,EAC5C,OAAO,GAAE,aAAa,CAAC,YAAY,CAAM;CAQ5C"}
|