comic-vine-sdk 1.3.2 → 2.0.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/README.md +36 -732
- package/lib/index.cjs +1456 -0
- package/lib/index.cjs.map +7 -0
- package/lib/index.d.ts +2716 -0
- package/lib/index.js +845 -0
- package/lib/index.js.map +1 -0
- package/package.json +108 -54
- package/.gitattributes +0 -23
- package/.husky/pre-commit +0 -1
- package/.prettierignore +0 -1
- package/.prettierrc.json +0 -4
- package/.projen/tasks.json +0 -261
- package/.releaserc.json +0 -17
- package/CHANGELOG.md +0 -97
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -294
- package/eslint.config.js +0 -168
- package/lib/cjs/comic-vine.d.ts +0 -44
- package/lib/cjs/comic-vine.js +0 -105
- package/lib/cjs/errors/base-error.d.ts +0 -9
- package/lib/cjs/errors/base-error.js +0 -18
- package/lib/cjs/errors/custom-error.d.ts +0 -2
- package/lib/cjs/errors/custom-error.js +0 -12
- package/lib/cjs/errors/filter-error.d.ts +0 -4
- package/lib/cjs/errors/filter-error.js +0 -14
- package/lib/cjs/errors/generic-error.d.ts +0 -4
- package/lib/cjs/errors/generic-error.js +0 -14
- package/lib/cjs/errors/generic-request-error.d.ts +0 -10
- package/lib/cjs/errors/generic-request-error.js +0 -23
- package/lib/cjs/errors/index.d.ts +0 -10
- package/lib/cjs/errors/index.js +0 -27
- package/lib/cjs/errors/jsonp-callback-missing-error.d.ts +0 -4
- package/lib/cjs/errors/jsonp-callback-missing-error.js +0 -14
- package/lib/cjs/errors/object-not-found-error.d.ts +0 -4
- package/lib/cjs/errors/object-not-found-error.js +0 -14
- package/lib/cjs/errors/options-validation-error.d.ts +0 -4
- package/lib/cjs/errors/options-validation-error.js +0 -14
- package/lib/cjs/errors/subscriber-only-error.d.ts +0 -4
- package/lib/cjs/errors/subscriber-only-error.js +0 -14
- package/lib/cjs/errors/unauthorized-error.d.ts +0 -4
- package/lib/cjs/errors/unauthorized-error.js +0 -14
- package/lib/cjs/errors/url-format-error.d.ts +0 -4
- package/lib/cjs/errors/url-format-error.js +0 -14
- package/lib/cjs/http-client/http-client-factory.d.ts +0 -6
- package/lib/cjs/http-client/http-client-factory.js +0 -15
- package/lib/cjs/http-client/http-client.d.ts +0 -8
- package/lib/cjs/http-client/http-client.js +0 -71
- package/lib/cjs/http-client/index.d.ts +0 -1
- package/lib/cjs/http-client/index.js +0 -18
- package/lib/cjs/http-client/status-code.d.ts +0 -9
- package/lib/cjs/http-client/status-code.js +0 -14
- package/lib/cjs/http-client/url-builder.d.ts +0 -29
- package/lib/cjs/http-client/url-builder.js +0 -107
- package/lib/cjs/index.d.ts +0 -3
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/options/index.d.ts +0 -20
- package/lib/cjs/options/index.js +0 -32
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/resources/base-resource.d.ts +0 -19
- package/lib/cjs/resources/base-resource.js +0 -87
- package/lib/cjs/resources/character/character.d.ts +0 -6
- package/lib/cjs/resources/character/character.js +0 -13
- package/lib/cjs/resources/character/index.d.ts +0 -1
- package/lib/cjs/resources/character/index.js +0 -18
- package/lib/cjs/resources/character/types/character-details.d.ts +0 -110
- package/lib/cjs/resources/character/types/character-details.js +0 -3
- package/lib/cjs/resources/character/types/character-list-item.d.ts +0 -71
- package/lib/cjs/resources/character/types/character-list-item.js +0 -3
- package/lib/cjs/resources/character/types/index.d.ts +0 -2
- package/lib/cjs/resources/character/types/index.js +0 -19
- package/lib/cjs/resources/common-types.d.ts +0 -58
- package/lib/cjs/resources/common-types.js +0 -3
- package/lib/cjs/resources/concept/concept.d.ts +0 -6
- package/lib/cjs/resources/concept/concept.js +0 -13
- package/lib/cjs/resources/concept/index.d.ts +0 -1
- package/lib/cjs/resources/concept/index.js +0 -18
- package/lib/cjs/resources/concept/types/concept-details.d.ts +0 -58
- package/lib/cjs/resources/concept/types/concept-details.js +0 -3
- package/lib/cjs/resources/concept/types/concept-list-item.d.ts +0 -52
- package/lib/cjs/resources/concept/types/concept-list-item.js +0 -3
- package/lib/cjs/resources/concept/types/index.d.ts +0 -2
- package/lib/cjs/resources/concept/types/index.js +0 -19
- package/lib/cjs/resources/episode/episode.d.ts +0 -6
- package/lib/cjs/resources/episode/episode.js +0 -13
- package/lib/cjs/resources/episode/index.d.ts +0 -1
- package/lib/cjs/resources/episode/index.js +0 -18
- package/lib/cjs/resources/episode/types/episode-details.d.ts +0 -87
- package/lib/cjs/resources/episode/types/episode-details.js +0 -3
- package/lib/cjs/resources/episode/types/episode-list-item.d.ts +0 -53
- package/lib/cjs/resources/episode/types/episode-list-item.js +0 -3
- package/lib/cjs/resources/episode/types/index.d.ts +0 -2
- package/lib/cjs/resources/episode/types/index.js +0 -19
- package/lib/cjs/resources/index.d.ts +0 -3
- package/lib/cjs/resources/index.js +0 -20
- package/lib/cjs/resources/issue/index.d.ts +0 -1
- package/lib/cjs/resources/issue/index.js +0 -18
- package/lib/cjs/resources/issue/issue.d.ts +0 -6
- package/lib/cjs/resources/issue/issue.js +0 -13
- package/lib/cjs/resources/issue/types/index.d.ts +0 -2
- package/lib/cjs/resources/issue/types/index.js +0 -19
- package/lib/cjs/resources/issue/types/issue-details.d.ts +0 -94
- package/lib/cjs/resources/issue/types/issue-details.js +0 -3
- package/lib/cjs/resources/issue/types/issue-list-item.d.ts +0 -61
- package/lib/cjs/resources/issue/types/issue-list-item.js +0 -3
- package/lib/cjs/resources/location/index.d.ts +0 -1
- package/lib/cjs/resources/location/index.js +0 -18
- package/lib/cjs/resources/location/location.d.ts +0 -6
- package/lib/cjs/resources/location/location.js +0 -13
- package/lib/cjs/resources/location/types/index.d.ts +0 -2
- package/lib/cjs/resources/location/types/index.js +0 -19
- package/lib/cjs/resources/location/types/location-details.d.ts +0 -62
- package/lib/cjs/resources/location/types/location-details.js +0 -3
- package/lib/cjs/resources/location/types/location-list-item.d.ts +0 -55
- package/lib/cjs/resources/location/types/location-list-item.js +0 -3
- package/lib/cjs/resources/movie/index.d.ts +0 -1
- package/lib/cjs/resources/movie/index.js +0 -18
- package/lib/cjs/resources/movie/movie.d.ts +0 -6
- package/lib/cjs/resources/movie/movie.js +0 -13
- package/lib/cjs/resources/movie/types/index.d.ts +0 -2
- package/lib/cjs/resources/movie/types/index.js +0 -19
- package/lib/cjs/resources/movie/types/movie-details.d.ts +0 -91
- package/lib/cjs/resources/movie/types/movie-details.js +0 -3
- package/lib/cjs/resources/movie/types/movie-list-item.d.ts +0 -74
- package/lib/cjs/resources/movie/types/movie-list-item.js +0 -3
- package/lib/cjs/resources/origin/index.d.ts +0 -1
- package/lib/cjs/resources/origin/index.js +0 -18
- package/lib/cjs/resources/origin/origin.d.ts +0 -6
- package/lib/cjs/resources/origin/origin.js +0 -13
- package/lib/cjs/resources/origin/types/index.d.ts +0 -2
- package/lib/cjs/resources/origin/types/index.js +0 -19
- package/lib/cjs/resources/origin/types/origin-details.d.ts +0 -22
- package/lib/cjs/resources/origin/types/origin-details.js +0 -3
- package/lib/cjs/resources/origin/types/origin-list-item.d.ts +0 -18
- package/lib/cjs/resources/origin/types/origin-list-item.js +0 -3
- package/lib/cjs/resources/person/index.d.ts +0 -1
- package/lib/cjs/resources/person/index.js +0 -18
- package/lib/cjs/resources/person/person.d.ts +0 -6
- package/lib/cjs/resources/person/person.js +0 -13
- package/lib/cjs/resources/person/types/index.d.ts +0 -2
- package/lib/cjs/resources/person/types/index.js +0 -19
- package/lib/cjs/resources/person/types/person-details.d.ts +0 -82
- package/lib/cjs/resources/person/types/person-details.js +0 -3
- package/lib/cjs/resources/person/types/person-list-item.d.ts +0 -77
- package/lib/cjs/resources/person/types/person-list-item.js +0 -8
- package/lib/cjs/resources/power/index.d.ts +0 -1
- package/lib/cjs/resources/power/index.js +0 -18
- package/lib/cjs/resources/power/power.d.ts +0 -6
- package/lib/cjs/resources/power/power.js +0 -13
- package/lib/cjs/resources/power/types/index.d.ts +0 -2
- package/lib/cjs/resources/power/types/index.js +0 -19
- package/lib/cjs/resources/power/types/power-details.d.ts +0 -39
- package/lib/cjs/resources/power/types/power-details.js +0 -3
- package/lib/cjs/resources/power/types/power-list-item.d.ts +0 -34
- package/lib/cjs/resources/power/types/power-list-item.js +0 -3
- package/lib/cjs/resources/promo/index.d.ts +0 -1
- package/lib/cjs/resources/promo/index.js +0 -18
- package/lib/cjs/resources/promo/promo.d.ts +0 -6
- package/lib/cjs/resources/promo/promo.js +0 -13
- package/lib/cjs/resources/promo/types/index.d.ts +0 -2
- package/lib/cjs/resources/promo/types/index.js +0 -19
- package/lib/cjs/resources/promo/types/promo-details.d.ts +0 -40
- package/lib/cjs/resources/promo/types/promo-details.js +0 -3
- package/lib/cjs/resources/promo/types/promo-list-item.d.ts +0 -40
- package/lib/cjs/resources/promo/types/promo-list-item.js +0 -3
- package/lib/cjs/resources/publisher/index.d.ts +0 -1
- package/lib/cjs/resources/publisher/index.js +0 -18
- package/lib/cjs/resources/publisher/publisher.d.ts +0 -6
- package/lib/cjs/resources/publisher/publisher.js +0 -13
- package/lib/cjs/resources/publisher/types/index.d.ts +0 -2
- package/lib/cjs/resources/publisher/types/index.js +0 -19
- package/lib/cjs/resources/publisher/types/publisher-details.d.ts +0 -71
- package/lib/cjs/resources/publisher/types/publisher-details.js +0 -3
- package/lib/cjs/resources/publisher/types/publisher-list-item.d.ts +0 -61
- package/lib/cjs/resources/publisher/types/publisher-list-item.js +0 -11
- package/lib/cjs/resources/resource-factory.d.ts +0 -8
- package/lib/cjs/resources/resource-factory.js +0 -53
- package/lib/cjs/resources/resource-list.d.ts +0 -19
- package/lib/cjs/resources/resource-list.js +0 -36
- package/lib/cjs/resources/resource-map.d.ts +0 -7
- package/lib/cjs/resources/resource-map.js +0 -40
- package/lib/cjs/resources/resource-type.d.ts +0 -21
- package/lib/cjs/resources/resource-type.js +0 -27
- package/lib/cjs/resources/series/index.d.ts +0 -1
- package/lib/cjs/resources/series/index.js +0 -18
- package/lib/cjs/resources/series/series.d.ts +0 -6
- package/lib/cjs/resources/series/series.js +0 -13
- package/lib/cjs/resources/series/types/index.d.ts +0 -2
- package/lib/cjs/resources/series/types/index.js +0 -19
- package/lib/cjs/resources/series/types/series-details.d.ts +0 -68
- package/lib/cjs/resources/series/types/series-details.js +0 -3
- package/lib/cjs/resources/series/types/series-list-item.d.ts +0 -18
- package/lib/cjs/resources/series/types/series-list-item.js +0 -3
- package/lib/cjs/resources/story-arc/index.d.ts +0 -1
- package/lib/cjs/resources/story-arc/index.js +0 -18
- package/lib/cjs/resources/story-arc/story-arc.d.ts +0 -6
- package/lib/cjs/resources/story-arc/story-arc.js +0 -13
- package/lib/cjs/resources/story-arc/types/index.d.ts +0 -2
- package/lib/cjs/resources/story-arc/types/index.js +0 -19
- package/lib/cjs/resources/story-arc/types/story-arc-details.d.ts +0 -62
- package/lib/cjs/resources/story-arc/types/story-arc-details.js +0 -3
- package/lib/cjs/resources/story-arc/types/story-arc-list-item.d.ts +0 -53
- package/lib/cjs/resources/story-arc/types/story-arc-list-item.js +0 -3
- package/lib/cjs/resources/team/index.d.ts +0 -1
- package/lib/cjs/resources/team/index.js +0 -18
- package/lib/cjs/resources/team/team.d.ts +0 -6
- package/lib/cjs/resources/team/team.js +0 -13
- package/lib/cjs/resources/team/types/index.d.ts +0 -2
- package/lib/cjs/resources/team/types/index.js +0 -19
- package/lib/cjs/resources/team/types/team-details.d.ts +0 -80
- package/lib/cjs/resources/team/types/team-details.js +0 -3
- package/lib/cjs/resources/team/types/team-list-item.d.ts +0 -56
- package/lib/cjs/resources/team/types/team-list-item.js +0 -3
- package/lib/cjs/resources/thing/index.d.ts +0 -1
- package/lib/cjs/resources/thing/index.js +0 -18
- package/lib/cjs/resources/thing/thing.d.ts +0 -6
- package/lib/cjs/resources/thing/thing.js +0 -13
- package/lib/cjs/resources/thing/types/index.d.ts +0 -2
- package/lib/cjs/resources/thing/types/index.js +0 -19
- package/lib/cjs/resources/thing/types/thing-details.d.ts +0 -62
- package/lib/cjs/resources/thing/types/thing-details.js +0 -3
- package/lib/cjs/resources/thing/types/thing-list-item.d.ts +0 -55
- package/lib/cjs/resources/thing/types/thing-list-item.js +0 -3
- package/lib/cjs/resources/video/index.d.ts +0 -1
- package/lib/cjs/resources/video/index.js +0 -18
- package/lib/cjs/resources/video/types/index.d.ts +0 -2
- package/lib/cjs/resources/video/types/index.js +0 -19
- package/lib/cjs/resources/video/types/video-details.d.ts +0 -63
- package/lib/cjs/resources/video/types/video-details.js +0 -3
- package/lib/cjs/resources/video/types/video-list-item.d.ts +0 -85
- package/lib/cjs/resources/video/types/video-list-item.js +0 -28
- package/lib/cjs/resources/video/video.d.ts +0 -6
- package/lib/cjs/resources/video/video.js +0 -13
- package/lib/cjs/resources/video-category/index.d.ts +0 -1
- package/lib/cjs/resources/video-category/index.js +0 -18
- package/lib/cjs/resources/video-category/types/index.d.ts +0 -2
- package/lib/cjs/resources/video-category/types/index.js +0 -19
- package/lib/cjs/resources/video-category/types/video-category-details.d.ts +0 -24
- package/lib/cjs/resources/video-category/types/video-category-details.js +0 -3
- package/lib/cjs/resources/video-category/types/video-category-list-item.d.ts +0 -24
- package/lib/cjs/resources/video-category/types/video-category-list-item.js +0 -3
- package/lib/cjs/resources/video-category/video-category.d.ts +0 -6
- package/lib/cjs/resources/video-category/video-category.js +0 -13
- package/lib/cjs/resources/video-type/index.d.ts +0 -1
- package/lib/cjs/resources/video-type/index.js +0 -18
- package/lib/cjs/resources/video-type/types/index.d.ts +0 -2
- package/lib/cjs/resources/video-type/types/index.js +0 -19
- package/lib/cjs/resources/video-type/types/video-type-details.d.ts +0 -22
- package/lib/cjs/resources/video-type/types/video-type-details.js +0 -3
- package/lib/cjs/resources/video-type/types/video-type-list-item.d.ts +0 -22
- package/lib/cjs/resources/video-type/types/video-type-list-item.js +0 -3
- package/lib/cjs/resources/video-type/video-type.d.ts +0 -6
- package/lib/cjs/resources/video-type/video-type.js +0 -13
- package/lib/cjs/resources/volume/index.d.ts +0 -1
- package/lib/cjs/resources/volume/index.js +0 -18
- package/lib/cjs/resources/volume/types/index.d.ts +0 -2
- package/lib/cjs/resources/volume/types/index.js +0 -19
- package/lib/cjs/resources/volume/types/volume-details.d.ts +0 -77
- package/lib/cjs/resources/volume/types/volume-details.js +0 -3
- package/lib/cjs/resources/volume/types/volume-list-item.d.ts +0 -63
- package/lib/cjs/resources/volume/types/volume-list-item.js +0 -3
- package/lib/cjs/resources/volume/volume.d.ts +0 -6
- package/lib/cjs/resources/volume/volume.js +0 -13
- package/lib/cjs/types/apply-override.d.ts +0 -1
- package/lib/cjs/types/apply-override.js +0 -3
- package/lib/cjs/types/http-client.d.ts +0 -4
- package/lib/cjs/types/http-client.js +0 -3
- package/lib/cjs/types/index.d.ts +0 -7
- package/lib/cjs/types/index.js +0 -24
- package/lib/cjs/types/iso-date.d.ts +0 -7
- package/lib/cjs/types/iso-date.js +0 -3
- package/lib/cjs/types/pick-filters.d.ts +0 -6
- package/lib/cjs/types/pick-filters.js +0 -3
- package/lib/cjs/types/request.d.ts +0 -31
- package/lib/cjs/types/request.js +0 -3
- package/lib/cjs/types/response.d.ts +0 -10
- package/lib/cjs/types/response.js +0 -3
- package/lib/cjs/types/url-builder.d.ts +0 -6
- package/lib/cjs/types/url-builder.js +0 -3
- package/lib/cjs/types/valueof.d.ts +0 -1
- package/lib/cjs/types/valueof.js +0 -3
- package/lib/cjs/utils/case-converter.d.ts +0 -4
- package/lib/cjs/utils/case-converter.js +0 -34
- package/lib/cjs/utils/index.d.ts +0 -2
- package/lib/cjs/utils/index.js +0 -19
- package/lib/cjs/utils/is-object.d.ts +0 -1
- package/lib/cjs/utils/is-object.js +0 -8
- package/lib/esm/comic-vine.d.ts +0 -44
- package/lib/esm/comic-vine.js +0 -68
- package/lib/esm/errors/base-error.d.ts +0 -9
- package/lib/esm/errors/base-error.js +0 -14
- package/lib/esm/errors/custom-error.d.ts +0 -2
- package/lib/esm/errors/custom-error.js +0 -8
- package/lib/esm/errors/filter-error.d.ts +0 -4
- package/lib/esm/errors/filter-error.js +0 -10
- package/lib/esm/errors/generic-error.d.ts +0 -4
- package/lib/esm/errors/generic-error.js +0 -10
- package/lib/esm/errors/generic-request-error.d.ts +0 -10
- package/lib/esm/errors/generic-request-error.js +0 -18
- package/lib/esm/errors/index.d.ts +0 -10
- package/lib/esm/errors/index.js +0 -11
- package/lib/esm/errors/jsonp-callback-missing-error.d.ts +0 -4
- package/lib/esm/errors/jsonp-callback-missing-error.js +0 -10
- package/lib/esm/errors/object-not-found-error.d.ts +0 -4
- package/lib/esm/errors/object-not-found-error.js +0 -10
- package/lib/esm/errors/options-validation-error.d.ts +0 -4
- package/lib/esm/errors/options-validation-error.js +0 -10
- package/lib/esm/errors/subscriber-only-error.d.ts +0 -4
- package/lib/esm/errors/subscriber-only-error.js +0 -10
- package/lib/esm/errors/unauthorized-error.d.ts +0 -4
- package/lib/esm/errors/unauthorized-error.js +0 -10
- package/lib/esm/errors/url-format-error.d.ts +0 -4
- package/lib/esm/errors/url-format-error.js +0 -10
- package/lib/esm/http-client/http-client-factory.d.ts +0 -6
- package/lib/esm/http-client/http-client-factory.js +0 -11
- package/lib/esm/http-client/http-client.d.ts +0 -8
- package/lib/esm/http-client/http-client.js +0 -52
- package/lib/esm/http-client/index.d.ts +0 -1
- package/lib/esm/http-client/index.js +0 -2
- package/lib/esm/http-client/status-code.d.ts +0 -9
- package/lib/esm/http-client/status-code.js +0 -11
- package/lib/esm/http-client/url-builder.d.ts +0 -29
- package/lib/esm/http-client/url-builder.js +0 -103
- package/lib/esm/index.d.ts +0 -3
- package/lib/esm/index.js +0 -3
- package/lib/esm/options/index.d.ts +0 -20
- package/lib/esm/options/index.js +0 -28
- package/lib/esm/package.json +0 -3
- package/lib/esm/resources/base-resource.d.ts +0 -19
- package/lib/esm/resources/base-resource.js +0 -54
- package/lib/esm/resources/character/character.d.ts +0 -6
- package/lib/esm/resources/character/character.js +0 -9
- package/lib/esm/resources/character/index.d.ts +0 -1
- package/lib/esm/resources/character/index.js +0 -2
- package/lib/esm/resources/character/types/character-details.d.ts +0 -110
- package/lib/esm/resources/character/types/character-details.js +0 -2
- package/lib/esm/resources/character/types/character-list-item.d.ts +0 -71
- package/lib/esm/resources/character/types/character-list-item.js +0 -2
- package/lib/esm/resources/character/types/index.d.ts +0 -2
- package/lib/esm/resources/character/types/index.js +0 -3
- package/lib/esm/resources/common-types.d.ts +0 -58
- package/lib/esm/resources/common-types.js +0 -2
- package/lib/esm/resources/concept/concept.d.ts +0 -6
- package/lib/esm/resources/concept/concept.js +0 -9
- package/lib/esm/resources/concept/index.d.ts +0 -1
- package/lib/esm/resources/concept/index.js +0 -2
- package/lib/esm/resources/concept/types/concept-details.d.ts +0 -58
- package/lib/esm/resources/concept/types/concept-details.js +0 -2
- package/lib/esm/resources/concept/types/concept-list-item.d.ts +0 -52
- package/lib/esm/resources/concept/types/concept-list-item.js +0 -2
- package/lib/esm/resources/concept/types/index.d.ts +0 -2
- package/lib/esm/resources/concept/types/index.js +0 -3
- package/lib/esm/resources/episode/episode.d.ts +0 -6
- package/lib/esm/resources/episode/episode.js +0 -9
- package/lib/esm/resources/episode/index.d.ts +0 -1
- package/lib/esm/resources/episode/index.js +0 -2
- package/lib/esm/resources/episode/types/episode-details.d.ts +0 -87
- package/lib/esm/resources/episode/types/episode-details.js +0 -2
- package/lib/esm/resources/episode/types/episode-list-item.d.ts +0 -53
- package/lib/esm/resources/episode/types/episode-list-item.js +0 -2
- package/lib/esm/resources/episode/types/index.d.ts +0 -2
- package/lib/esm/resources/episode/types/index.js +0 -3
- package/lib/esm/resources/index.d.ts +0 -3
- package/lib/esm/resources/index.js +0 -4
- package/lib/esm/resources/issue/index.d.ts +0 -1
- package/lib/esm/resources/issue/index.js +0 -2
- package/lib/esm/resources/issue/issue.d.ts +0 -6
- package/lib/esm/resources/issue/issue.js +0 -9
- package/lib/esm/resources/issue/types/index.d.ts +0 -2
- package/lib/esm/resources/issue/types/index.js +0 -3
- package/lib/esm/resources/issue/types/issue-details.d.ts +0 -94
- package/lib/esm/resources/issue/types/issue-details.js +0 -2
- package/lib/esm/resources/issue/types/issue-list-item.d.ts +0 -61
- package/lib/esm/resources/issue/types/issue-list-item.js +0 -2
- package/lib/esm/resources/location/index.d.ts +0 -1
- package/lib/esm/resources/location/index.js +0 -2
- package/lib/esm/resources/location/location.d.ts +0 -6
- package/lib/esm/resources/location/location.js +0 -9
- package/lib/esm/resources/location/types/index.d.ts +0 -2
- package/lib/esm/resources/location/types/index.js +0 -3
- package/lib/esm/resources/location/types/location-details.d.ts +0 -62
- package/lib/esm/resources/location/types/location-details.js +0 -2
- package/lib/esm/resources/location/types/location-list-item.d.ts +0 -55
- package/lib/esm/resources/location/types/location-list-item.js +0 -2
- package/lib/esm/resources/movie/index.d.ts +0 -1
- package/lib/esm/resources/movie/index.js +0 -2
- package/lib/esm/resources/movie/movie.d.ts +0 -6
- package/lib/esm/resources/movie/movie.js +0 -9
- package/lib/esm/resources/movie/types/index.d.ts +0 -2
- package/lib/esm/resources/movie/types/index.js +0 -3
- package/lib/esm/resources/movie/types/movie-details.d.ts +0 -91
- package/lib/esm/resources/movie/types/movie-details.js +0 -2
- package/lib/esm/resources/movie/types/movie-list-item.d.ts +0 -74
- package/lib/esm/resources/movie/types/movie-list-item.js +0 -2
- package/lib/esm/resources/origin/index.d.ts +0 -1
- package/lib/esm/resources/origin/index.js +0 -2
- package/lib/esm/resources/origin/origin.d.ts +0 -6
- package/lib/esm/resources/origin/origin.js +0 -9
- package/lib/esm/resources/origin/types/index.d.ts +0 -2
- package/lib/esm/resources/origin/types/index.js +0 -3
- package/lib/esm/resources/origin/types/origin-details.d.ts +0 -22
- package/lib/esm/resources/origin/types/origin-details.js +0 -2
- package/lib/esm/resources/origin/types/origin-list-item.d.ts +0 -18
- package/lib/esm/resources/origin/types/origin-list-item.js +0 -2
- package/lib/esm/resources/person/index.d.ts +0 -1
- package/lib/esm/resources/person/index.js +0 -2
- package/lib/esm/resources/person/person.d.ts +0 -6
- package/lib/esm/resources/person/person.js +0 -9
- package/lib/esm/resources/person/types/index.d.ts +0 -2
- package/lib/esm/resources/person/types/index.js +0 -3
- package/lib/esm/resources/person/types/person-details.d.ts +0 -82
- package/lib/esm/resources/person/types/person-details.js +0 -2
- package/lib/esm/resources/person/types/person-list-item.d.ts +0 -77
- package/lib/esm/resources/person/types/person-list-item.js +0 -5
- package/lib/esm/resources/power/index.d.ts +0 -1
- package/lib/esm/resources/power/index.js +0 -2
- package/lib/esm/resources/power/power.d.ts +0 -6
- package/lib/esm/resources/power/power.js +0 -9
- package/lib/esm/resources/power/types/index.d.ts +0 -2
- package/lib/esm/resources/power/types/index.js +0 -3
- package/lib/esm/resources/power/types/power-details.d.ts +0 -39
- package/lib/esm/resources/power/types/power-details.js +0 -2
- package/lib/esm/resources/power/types/power-list-item.d.ts +0 -34
- package/lib/esm/resources/power/types/power-list-item.js +0 -2
- package/lib/esm/resources/promo/index.d.ts +0 -1
- package/lib/esm/resources/promo/index.js +0 -2
- package/lib/esm/resources/promo/promo.d.ts +0 -6
- package/lib/esm/resources/promo/promo.js +0 -9
- package/lib/esm/resources/promo/types/index.d.ts +0 -2
- package/lib/esm/resources/promo/types/index.js +0 -3
- package/lib/esm/resources/promo/types/promo-details.d.ts +0 -40
- package/lib/esm/resources/promo/types/promo-details.js +0 -2
- package/lib/esm/resources/promo/types/promo-list-item.d.ts +0 -40
- package/lib/esm/resources/promo/types/promo-list-item.js +0 -2
- package/lib/esm/resources/publisher/index.d.ts +0 -1
- package/lib/esm/resources/publisher/index.js +0 -2
- package/lib/esm/resources/publisher/publisher.d.ts +0 -6
- package/lib/esm/resources/publisher/publisher.js +0 -9
- package/lib/esm/resources/publisher/types/index.d.ts +0 -2
- package/lib/esm/resources/publisher/types/index.js +0 -3
- package/lib/esm/resources/publisher/types/publisher-details.d.ts +0 -71
- package/lib/esm/resources/publisher/types/publisher-details.js +0 -2
- package/lib/esm/resources/publisher/types/publisher-list-item.d.ts +0 -61
- package/lib/esm/resources/publisher/types/publisher-list-item.js +0 -8
- package/lib/esm/resources/resource-factory.d.ts +0 -8
- package/lib/esm/resources/resource-factory.js +0 -16
- package/lib/esm/resources/resource-list.d.ts +0 -19
- package/lib/esm/resources/resource-list.js +0 -20
- package/lib/esm/resources/resource-map.d.ts +0 -7
- package/lib/esm/resources/resource-map.js +0 -36
- package/lib/esm/resources/resource-type.d.ts +0 -21
- package/lib/esm/resources/resource-type.js +0 -24
- package/lib/esm/resources/series/index.d.ts +0 -1
- package/lib/esm/resources/series/index.js +0 -2
- package/lib/esm/resources/series/series.d.ts +0 -6
- package/lib/esm/resources/series/series.js +0 -9
- package/lib/esm/resources/series/types/index.d.ts +0 -2
- package/lib/esm/resources/series/types/index.js +0 -3
- package/lib/esm/resources/series/types/series-details.d.ts +0 -68
- package/lib/esm/resources/series/types/series-details.js +0 -2
- package/lib/esm/resources/series/types/series-list-item.d.ts +0 -18
- package/lib/esm/resources/series/types/series-list-item.js +0 -2
- package/lib/esm/resources/story-arc/index.d.ts +0 -1
- package/lib/esm/resources/story-arc/index.js +0 -2
- package/lib/esm/resources/story-arc/story-arc.d.ts +0 -6
- package/lib/esm/resources/story-arc/story-arc.js +0 -9
- package/lib/esm/resources/story-arc/types/index.d.ts +0 -2
- package/lib/esm/resources/story-arc/types/index.js +0 -3
- package/lib/esm/resources/story-arc/types/story-arc-details.d.ts +0 -62
- package/lib/esm/resources/story-arc/types/story-arc-details.js +0 -2
- package/lib/esm/resources/story-arc/types/story-arc-list-item.d.ts +0 -53
- package/lib/esm/resources/story-arc/types/story-arc-list-item.js +0 -2
- package/lib/esm/resources/team/index.d.ts +0 -1
- package/lib/esm/resources/team/index.js +0 -2
- package/lib/esm/resources/team/team.d.ts +0 -6
- package/lib/esm/resources/team/team.js +0 -9
- package/lib/esm/resources/team/types/index.d.ts +0 -2
- package/lib/esm/resources/team/types/index.js +0 -3
- package/lib/esm/resources/team/types/team-details.d.ts +0 -80
- package/lib/esm/resources/team/types/team-details.js +0 -2
- package/lib/esm/resources/team/types/team-list-item.d.ts +0 -56
- package/lib/esm/resources/team/types/team-list-item.js +0 -2
- package/lib/esm/resources/thing/index.d.ts +0 -1
- package/lib/esm/resources/thing/index.js +0 -2
- package/lib/esm/resources/thing/thing.d.ts +0 -6
- package/lib/esm/resources/thing/thing.js +0 -9
- package/lib/esm/resources/thing/types/index.d.ts +0 -2
- package/lib/esm/resources/thing/types/index.js +0 -3
- package/lib/esm/resources/thing/types/thing-details.d.ts +0 -62
- package/lib/esm/resources/thing/types/thing-details.js +0 -2
- package/lib/esm/resources/thing/types/thing-list-item.d.ts +0 -55
- package/lib/esm/resources/thing/types/thing-list-item.js +0 -2
- package/lib/esm/resources/video/index.d.ts +0 -1
- package/lib/esm/resources/video/index.js +0 -2
- package/lib/esm/resources/video/types/index.d.ts +0 -2
- package/lib/esm/resources/video/types/index.js +0 -3
- package/lib/esm/resources/video/types/video-details.d.ts +0 -63
- package/lib/esm/resources/video/types/video-details.js +0 -2
- package/lib/esm/resources/video/types/video-list-item.d.ts +0 -85
- package/lib/esm/resources/video/types/video-list-item.js +0 -25
- package/lib/esm/resources/video/video.d.ts +0 -6
- package/lib/esm/resources/video/video.js +0 -9
- package/lib/esm/resources/video-category/index.d.ts +0 -1
- package/lib/esm/resources/video-category/index.js +0 -2
- package/lib/esm/resources/video-category/types/index.d.ts +0 -2
- package/lib/esm/resources/video-category/types/index.js +0 -3
- package/lib/esm/resources/video-category/types/video-category-details.d.ts +0 -24
- package/lib/esm/resources/video-category/types/video-category-details.js +0 -2
- package/lib/esm/resources/video-category/types/video-category-list-item.d.ts +0 -24
- package/lib/esm/resources/video-category/types/video-category-list-item.js +0 -2
- package/lib/esm/resources/video-category/video-category.d.ts +0 -6
- package/lib/esm/resources/video-category/video-category.js +0 -9
- package/lib/esm/resources/video-type/index.d.ts +0 -1
- package/lib/esm/resources/video-type/index.js +0 -2
- package/lib/esm/resources/video-type/types/index.d.ts +0 -2
- package/lib/esm/resources/video-type/types/index.js +0 -3
- package/lib/esm/resources/video-type/types/video-type-details.d.ts +0 -22
- package/lib/esm/resources/video-type/types/video-type-details.js +0 -2
- package/lib/esm/resources/video-type/types/video-type-list-item.d.ts +0 -22
- package/lib/esm/resources/video-type/types/video-type-list-item.js +0 -2
- package/lib/esm/resources/video-type/video-type.d.ts +0 -6
- package/lib/esm/resources/video-type/video-type.js +0 -9
- package/lib/esm/resources/volume/index.d.ts +0 -1
- package/lib/esm/resources/volume/index.js +0 -2
- package/lib/esm/resources/volume/types/index.d.ts +0 -2
- package/lib/esm/resources/volume/types/index.js +0 -3
- package/lib/esm/resources/volume/types/volume-details.d.ts +0 -77
- package/lib/esm/resources/volume/types/volume-details.js +0 -2
- package/lib/esm/resources/volume/types/volume-list-item.d.ts +0 -63
- package/lib/esm/resources/volume/types/volume-list-item.js +0 -2
- package/lib/esm/resources/volume/volume.d.ts +0 -6
- package/lib/esm/resources/volume/volume.js +0 -9
- package/lib/esm/types/apply-override.d.ts +0 -1
- package/lib/esm/types/apply-override.js +0 -2
- package/lib/esm/types/http-client.d.ts +0 -4
- package/lib/esm/types/http-client.js +0 -2
- package/lib/esm/types/index.d.ts +0 -7
- package/lib/esm/types/index.js +0 -8
- package/lib/esm/types/iso-date.d.ts +0 -7
- package/lib/esm/types/iso-date.js +0 -2
- package/lib/esm/types/pick-filters.d.ts +0 -6
- package/lib/esm/types/pick-filters.js +0 -2
- package/lib/esm/types/request.d.ts +0 -31
- package/lib/esm/types/request.js +0 -2
- package/lib/esm/types/response.d.ts +0 -10
- package/lib/esm/types/response.js +0 -2
- package/lib/esm/types/url-builder.d.ts +0 -6
- package/lib/esm/types/url-builder.js +0 -2
- package/lib/esm/types/valueof.d.ts +0 -1
- package/lib/esm/types/valueof.js +0 -2
- package/lib/esm/utils/case-converter.d.ts +0 -4
- package/lib/esm/utils/case-converter.js +0 -27
- package/lib/esm/utils/index.d.ts +0 -2
- package/lib/esm/utils/index.js +0 -3
- package/lib/esm/utils/is-object.d.ts +0 -1
- package/lib/esm/utils/is-object.js +0 -4
- package/scripts/create-package-json.ts +0 -29
- package/vitest.config.ts +0 -8
package/lib/index.js
ADDED
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { HttpClient, HttpClientError } from '@http-client-toolkit/core';
|
|
2
|
+
import { z, ZodError } from 'zod';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __async = (__this, __arguments, generator) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
var fulfilled = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.next(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var rejected = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.throw(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
42
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __await = function(promise, isYieldStar) {
|
|
46
|
+
this[0] = promise;
|
|
47
|
+
this[1] = isYieldStar;
|
|
48
|
+
};
|
|
49
|
+
var __asyncGenerator = (__this, __arguments, generator) => {
|
|
50
|
+
var resume = (k, v, yes, no) => {
|
|
51
|
+
try {
|
|
52
|
+
var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
|
|
53
|
+
Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
no(e);
|
|
56
|
+
}
|
|
57
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
58
|
+
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/http-client/status-code.ts
|
|
62
|
+
var StatusCode = /* @__PURE__ */ ((StatusCode2) => {
|
|
63
|
+
StatusCode2[StatusCode2["OK"] = 1] = "OK";
|
|
64
|
+
StatusCode2[StatusCode2["InvalidApiKey"] = 100] = "InvalidApiKey";
|
|
65
|
+
StatusCode2[StatusCode2["ObjectNotFound"] = 101] = "ObjectNotFound";
|
|
66
|
+
StatusCode2[StatusCode2["UrlFormatError"] = 102] = "UrlFormatError";
|
|
67
|
+
StatusCode2[StatusCode2["JsonpCallbackMissing"] = 103] = "JsonpCallbackMissing";
|
|
68
|
+
StatusCode2[StatusCode2["FilterError"] = 104] = "FilterError";
|
|
69
|
+
StatusCode2[StatusCode2["SubscriberOnlyVideo"] = 105] = "SubscriberOnlyVideo";
|
|
70
|
+
return StatusCode2;
|
|
71
|
+
})(StatusCode || {});
|
|
72
|
+
var BaseError = class extends HttpClientError {
|
|
73
|
+
constructor(details) {
|
|
74
|
+
super(details.message);
|
|
75
|
+
this.name = this.constructor.name;
|
|
76
|
+
if (Error.captureStackTrace) {
|
|
77
|
+
Error.captureStackTrace(this, this.constructor);
|
|
78
|
+
}
|
|
79
|
+
this.help = details.help;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/errors/generic-error.ts
|
|
84
|
+
var GenericError = class extends BaseError {
|
|
85
|
+
constructor(message) {
|
|
86
|
+
super({
|
|
87
|
+
message: `An unexpected error occurred: ${message || "Unknown Error"}`,
|
|
88
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/errors/custom-error.ts
|
|
94
|
+
var customError = (error) => {
|
|
95
|
+
if (error instanceof Error) {
|
|
96
|
+
return new GenericError(error.message);
|
|
97
|
+
}
|
|
98
|
+
return new GenericError();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/errors/filter-error.ts
|
|
102
|
+
var ComicVineFilterError = class extends BaseError {
|
|
103
|
+
constructor() {
|
|
104
|
+
super({
|
|
105
|
+
message: "There was a problem trying to filter the API results",
|
|
106
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// src/errors/generic-request-error.ts
|
|
112
|
+
var ComicVineGenericError = class extends BaseError {
|
|
113
|
+
constructor(message) {
|
|
114
|
+
super({
|
|
115
|
+
message: `Request to comic vine failed: ${message != null ? message : "Unknown Error"}`,
|
|
116
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var ComicVineGenericRequestError = class extends ComicVineGenericError {
|
|
121
|
+
constructor(message) {
|
|
122
|
+
super(message);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/errors/jsonp-callback-missing-error.ts
|
|
127
|
+
var ComicJsonpCallbackMissingError = class extends BaseError {
|
|
128
|
+
constructor() {
|
|
129
|
+
super({
|
|
130
|
+
message: "JSONP format requires a callback",
|
|
131
|
+
help: "This library does not use JSONP, please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/errors/object-not-found-error.ts
|
|
137
|
+
var ComicVineObjectNotFoundError = class extends BaseError {
|
|
138
|
+
constructor() {
|
|
139
|
+
super({
|
|
140
|
+
message: "The requested resource could not be found in the Comic Vine API",
|
|
141
|
+
help: "Ensure you have used a valid resource Id"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// src/errors/options-validation-error.ts
|
|
147
|
+
var OptionsValidationError = class extends BaseError {
|
|
148
|
+
constructor(path, message) {
|
|
149
|
+
super({
|
|
150
|
+
message: `Property: ${path.join(".")}, Problem: ${message}`,
|
|
151
|
+
help: "If the error message does not provide enough information or you believe there is a bug, please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/errors/subscriber-only-error.ts
|
|
157
|
+
var ComicVineSubscriberOnlyError = class extends BaseError {
|
|
158
|
+
constructor() {
|
|
159
|
+
super({
|
|
160
|
+
message: "The requested video is for subscribers only",
|
|
161
|
+
help: "Subscriber videos are part of a paid service, if you wish to upgrade you can do so here: https://comicvine.gamespot.com/upgrade/"
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/errors/unauthorized-error.ts
|
|
167
|
+
var ComicVineUnauthorizedError = class extends BaseError {
|
|
168
|
+
constructor() {
|
|
169
|
+
super({
|
|
170
|
+
message: "Unauthorized response received when calling the Comic Vine API",
|
|
171
|
+
help: "Ensure you have a valid API key, you can get one from: https://comicvine.gamespot.com/api/"
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/errors/url-format-error.ts
|
|
177
|
+
var ComicVineUrlFormatError = class extends BaseError {
|
|
178
|
+
constructor() {
|
|
179
|
+
super({
|
|
180
|
+
message: "The url for the request was not in the correct format",
|
|
181
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/utils/is-object.ts
|
|
187
|
+
var isObject = (maybeObject) => maybeObject === Object(maybeObject) && !Array.isArray(maybeObject) && typeof maybeObject !== "function";
|
|
188
|
+
|
|
189
|
+
// src/utils/case-converter.ts
|
|
190
|
+
var toCamelCase = (str) => {
|
|
191
|
+
return str.replace(/([-_][a-z])/gi, ($1) => {
|
|
192
|
+
return $1.toUpperCase().replace("-", "").replace("_", "");
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
var toSnakeCase = (str) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
196
|
+
var convertCase = (caseConverter, object) => {
|
|
197
|
+
if (isObject(object)) {
|
|
198
|
+
const newObject = {};
|
|
199
|
+
Object.keys(object).forEach((key) => {
|
|
200
|
+
newObject[caseConverter(key)] = convertCase(
|
|
201
|
+
caseConverter,
|
|
202
|
+
object[key]
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
return newObject;
|
|
206
|
+
} else if (Array.isArray(object)) {
|
|
207
|
+
return object.map(
|
|
208
|
+
(arrayElement) => convertCase(caseConverter, arrayElement)
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
return object;
|
|
212
|
+
};
|
|
213
|
+
var convertSnakeCaseToCamelCase = (object) => {
|
|
214
|
+
return convertCase(toCamelCase, object);
|
|
215
|
+
};
|
|
216
|
+
var convertCamelCaseToSnakeCase = (object) => {
|
|
217
|
+
return convertCase(toSnakeCase, object);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// src/http-client/hooks.ts
|
|
221
|
+
function comicVineResponseTransformer(data) {
|
|
222
|
+
return convertSnakeCaseToCamelCase(data);
|
|
223
|
+
}
|
|
224
|
+
function comicVineResponseHandler(data) {
|
|
225
|
+
if (data !== null && typeof data === "object" && "statusCode" in data && typeof data.statusCode === "number") {
|
|
226
|
+
const statusCode = data.statusCode;
|
|
227
|
+
switch (statusCode) {
|
|
228
|
+
case 104 /* FilterError */:
|
|
229
|
+
throw new ComicVineFilterError();
|
|
230
|
+
case 103 /* JsonpCallbackMissing */:
|
|
231
|
+
throw new ComicJsonpCallbackMissingError();
|
|
232
|
+
case 101 /* ObjectNotFound */:
|
|
233
|
+
throw new ComicVineObjectNotFoundError();
|
|
234
|
+
case 105 /* SubscriberOnlyVideo */:
|
|
235
|
+
throw new ComicVineSubscriberOnlyError();
|
|
236
|
+
case 102 /* UrlFormatError */:
|
|
237
|
+
throw new ComicVineUrlFormatError();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return data;
|
|
241
|
+
}
|
|
242
|
+
function comicVineErrorHandler(context) {
|
|
243
|
+
if (context.response.status === 401) {
|
|
244
|
+
return new ComicVineUnauthorizedError();
|
|
245
|
+
}
|
|
246
|
+
const bodyMessage = typeof context.response.data === "object" && context.response.data !== null ? context.response.data.message : void 0;
|
|
247
|
+
const message = bodyMessage ? `${context.message}, ${bodyMessage}` : context.message;
|
|
248
|
+
return new ComicVineGenericRequestError(message);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/resources/resource-list.ts
|
|
252
|
+
var resource_list_exports = {};
|
|
253
|
+
__export(resource_list_exports, {
|
|
254
|
+
Character: () => Character,
|
|
255
|
+
Concept: () => Concept,
|
|
256
|
+
Episode: () => Episode,
|
|
257
|
+
Issue: () => Issue,
|
|
258
|
+
Location: () => Location,
|
|
259
|
+
Movie: () => Movie,
|
|
260
|
+
Origin: () => Origin,
|
|
261
|
+
Person: () => Person,
|
|
262
|
+
Power: () => Power,
|
|
263
|
+
Promo: () => Promo,
|
|
264
|
+
Publisher: () => Publisher,
|
|
265
|
+
Series: () => Series,
|
|
266
|
+
StoryArc: () => StoryArc,
|
|
267
|
+
Team: () => Team,
|
|
268
|
+
Thing: () => Thing,
|
|
269
|
+
Video: () => Video,
|
|
270
|
+
VideoCategory: () => VideoCategory,
|
|
271
|
+
VideoType: () => VideoType,
|
|
272
|
+
Volume: () => Volume
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// src/resources/base-resource.ts
|
|
276
|
+
var BaseResource = class {
|
|
277
|
+
constructor(httpClient, urlBuilder) {
|
|
278
|
+
this.httpClient = httpClient;
|
|
279
|
+
this.urlBuilder = urlBuilder;
|
|
280
|
+
}
|
|
281
|
+
retrieve(id, options2) {
|
|
282
|
+
return __async(this, null, function* () {
|
|
283
|
+
const url = this.urlBuilder.retrieve(this.resourceType, id, options2);
|
|
284
|
+
options2 == null ? void 0 : options2.fieldList;
|
|
285
|
+
const response = yield this.httpClient.get(url, {
|
|
286
|
+
priority: options2 == null ? void 0 : options2.priority
|
|
287
|
+
});
|
|
288
|
+
return response.results;
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
fetchPage(options2) {
|
|
292
|
+
return __async(this, null, function* () {
|
|
293
|
+
const url = this.urlBuilder.list(this.resourceType, options2);
|
|
294
|
+
options2 == null ? void 0 : options2.fieldList;
|
|
295
|
+
const response = yield this.httpClient.get(
|
|
296
|
+
url,
|
|
297
|
+
{
|
|
298
|
+
priority: options2 == null ? void 0 : options2.priority
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
return {
|
|
302
|
+
limit: response.limit,
|
|
303
|
+
numberOfPageResults: response.numberOfPageResults,
|
|
304
|
+
numberOfTotalResults: response.numberOfTotalResults,
|
|
305
|
+
offset: response.offset,
|
|
306
|
+
data: response.results
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
list(options2) {
|
|
311
|
+
const fetchPage = (opts) => this.fetchPage.call(this, opts);
|
|
312
|
+
const fetchPagePromise = fetchPage(options2);
|
|
313
|
+
const asyncIterator = {
|
|
314
|
+
[Symbol.asyncIterator]() {
|
|
315
|
+
return __asyncGenerator(this, null, function* () {
|
|
316
|
+
var _a2;
|
|
317
|
+
const defaultPageSize = 100;
|
|
318
|
+
const limit = (_a2 = options2 == null ? void 0 : options2.limit) != null ? _a2 : defaultPageSize;
|
|
319
|
+
let page = (options2 == null ? void 0 : options2.offset) ? options2.offset / limit + 1 : 1;
|
|
320
|
+
let hasMoreResults = true;
|
|
321
|
+
let response = yield new __await(fetchPagePromise);
|
|
322
|
+
do {
|
|
323
|
+
for (const resource of response.data) {
|
|
324
|
+
yield resource;
|
|
325
|
+
}
|
|
326
|
+
hasMoreResults = response.limit + response.offset < response.numberOfTotalResults;
|
|
327
|
+
if (hasMoreResults) {
|
|
328
|
+
response = yield new __await(fetchPage({
|
|
329
|
+
limit,
|
|
330
|
+
offset: response.numberOfPageResults * page++
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
} while (hasMoreResults);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const promiseWithAsyncIterator = Object.assign(
|
|
338
|
+
fetchPagePromise,
|
|
339
|
+
asyncIterator
|
|
340
|
+
);
|
|
341
|
+
return promiseWithAsyncIterator;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// src/resources/resource-type.ts
|
|
346
|
+
var ResourceType = /* @__PURE__ */ ((ResourceType3) => {
|
|
347
|
+
ResourceType3[ResourceType3["Character"] = 4005] = "Character";
|
|
348
|
+
ResourceType3[ResourceType3["Concept"] = 4015] = "Concept";
|
|
349
|
+
ResourceType3[ResourceType3["Episode"] = 4070] = "Episode";
|
|
350
|
+
ResourceType3[ResourceType3["Issue"] = 4e3] = "Issue";
|
|
351
|
+
ResourceType3[ResourceType3["Location"] = 4020] = "Location";
|
|
352
|
+
ResourceType3[ResourceType3["Movie"] = 4025] = "Movie";
|
|
353
|
+
ResourceType3[ResourceType3["Origin"] = 4030] = "Origin";
|
|
354
|
+
ResourceType3[ResourceType3["Person"] = 4040] = "Person";
|
|
355
|
+
ResourceType3[ResourceType3["Power"] = 4035] = "Power";
|
|
356
|
+
ResourceType3[ResourceType3["Promo"] = 1700] = "Promo";
|
|
357
|
+
ResourceType3[ResourceType3["Publisher"] = 4010] = "Publisher";
|
|
358
|
+
ResourceType3[ResourceType3["Series"] = 4075] = "Series";
|
|
359
|
+
ResourceType3[ResourceType3["StoryArc"] = 4045] = "StoryArc";
|
|
360
|
+
ResourceType3[ResourceType3["Team"] = 4060] = "Team";
|
|
361
|
+
ResourceType3[ResourceType3["Thing"] = 4055] = "Thing";
|
|
362
|
+
ResourceType3[ResourceType3["Video"] = 2300] = "Video";
|
|
363
|
+
ResourceType3[ResourceType3["VideoCategory"] = 2320] = "VideoCategory";
|
|
364
|
+
ResourceType3[ResourceType3["VideoType"] = 2320] = "VideoType";
|
|
365
|
+
ResourceType3[ResourceType3["Volume"] = 4050] = "Volume";
|
|
366
|
+
return ResourceType3;
|
|
367
|
+
})(ResourceType || {});
|
|
368
|
+
|
|
369
|
+
// src/resources/character/character.ts
|
|
370
|
+
var Character = class extends BaseResource {
|
|
371
|
+
constructor() {
|
|
372
|
+
super(...arguments);
|
|
373
|
+
this.resourceType = 4005 /* Character */;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
// src/resources/concept/concept.ts
|
|
378
|
+
var Concept = class extends BaseResource {
|
|
379
|
+
constructor() {
|
|
380
|
+
super(...arguments);
|
|
381
|
+
this.resourceType = 4015 /* Concept */;
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/resources/episode/episode.ts
|
|
386
|
+
var Episode = class extends BaseResource {
|
|
387
|
+
constructor() {
|
|
388
|
+
super(...arguments);
|
|
389
|
+
this.resourceType = 4070 /* Episode */;
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// src/resources/issue/issue.ts
|
|
394
|
+
var Issue = class extends BaseResource {
|
|
395
|
+
constructor() {
|
|
396
|
+
super(...arguments);
|
|
397
|
+
this.resourceType = 4e3 /* Issue */;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
// src/resources/location/location.ts
|
|
402
|
+
var Location = class extends BaseResource {
|
|
403
|
+
constructor() {
|
|
404
|
+
super(...arguments);
|
|
405
|
+
this.resourceType = 4020 /* Location */;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
// src/resources/movie/movie.ts
|
|
410
|
+
var Movie = class extends BaseResource {
|
|
411
|
+
constructor() {
|
|
412
|
+
super(...arguments);
|
|
413
|
+
this.resourceType = 4025 /* Movie */;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/resources/origin/origin.ts
|
|
418
|
+
var Origin = class extends BaseResource {
|
|
419
|
+
constructor() {
|
|
420
|
+
super(...arguments);
|
|
421
|
+
this.resourceType = 4030 /* Origin */;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// src/resources/person/person.ts
|
|
426
|
+
var Person = class extends BaseResource {
|
|
427
|
+
constructor() {
|
|
428
|
+
super(...arguments);
|
|
429
|
+
this.resourceType = 4040 /* Person */;
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// src/resources/power/power.ts
|
|
434
|
+
var Power = class extends BaseResource {
|
|
435
|
+
constructor() {
|
|
436
|
+
super(...arguments);
|
|
437
|
+
this.resourceType = 4035 /* Power */;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// src/resources/promo/promo.ts
|
|
442
|
+
var Promo = class extends BaseResource {
|
|
443
|
+
constructor() {
|
|
444
|
+
super(...arguments);
|
|
445
|
+
this.resourceType = 1700 /* Promo */;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/resources/publisher/publisher.ts
|
|
450
|
+
var Publisher = class extends BaseResource {
|
|
451
|
+
constructor() {
|
|
452
|
+
super(...arguments);
|
|
453
|
+
this.resourceType = 4010 /* Publisher */;
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// src/resources/series/series.ts
|
|
458
|
+
var Series = class extends BaseResource {
|
|
459
|
+
constructor() {
|
|
460
|
+
super(...arguments);
|
|
461
|
+
this.resourceType = 4075 /* Series */;
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// src/resources/story-arc/story-arc.ts
|
|
466
|
+
var StoryArc = class extends BaseResource {
|
|
467
|
+
constructor() {
|
|
468
|
+
super(...arguments);
|
|
469
|
+
this.resourceType = 4045 /* StoryArc */;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
// src/resources/team/team.ts
|
|
474
|
+
var Team = class extends BaseResource {
|
|
475
|
+
constructor() {
|
|
476
|
+
super(...arguments);
|
|
477
|
+
this.resourceType = 4060 /* Team */;
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// src/resources/thing/thing.ts
|
|
482
|
+
var Thing = class extends BaseResource {
|
|
483
|
+
constructor() {
|
|
484
|
+
super(...arguments);
|
|
485
|
+
this.resourceType = 4055 /* Thing */;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// src/resources/video/video.ts
|
|
490
|
+
var Video = class extends BaseResource {
|
|
491
|
+
constructor() {
|
|
492
|
+
super(...arguments);
|
|
493
|
+
this.resourceType = 2300 /* Video */;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
// src/resources/video-category/video-category.ts
|
|
498
|
+
var VideoCategory = class extends BaseResource {
|
|
499
|
+
constructor() {
|
|
500
|
+
super(...arguments);
|
|
501
|
+
this.resourceType = 2320 /* VideoCategory */;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
// src/resources/video-type/video-type.ts
|
|
506
|
+
var VideoType = class extends BaseResource {
|
|
507
|
+
constructor() {
|
|
508
|
+
super(...arguments);
|
|
509
|
+
this.resourceType = 2320 /* VideoType */;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// src/resources/volume/volume.ts
|
|
514
|
+
var Volume = class extends BaseResource {
|
|
515
|
+
constructor() {
|
|
516
|
+
super(...arguments);
|
|
517
|
+
this.resourceType = 4050 /* Volume */;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// src/resources/resource-factory.ts
|
|
522
|
+
var ResourceFactory = class {
|
|
523
|
+
constructor(httpClient, urlBuilder) {
|
|
524
|
+
this.httpClient = httpClient;
|
|
525
|
+
this.urlBuilder = urlBuilder;
|
|
526
|
+
this._resources = __spreadValues({}, resource_list_exports);
|
|
527
|
+
}
|
|
528
|
+
create(name) {
|
|
529
|
+
if (!this._resources[name]) {
|
|
530
|
+
throw new Error(`${name} resource not implemented`);
|
|
531
|
+
}
|
|
532
|
+
const ResourceClass = this._resources[name];
|
|
533
|
+
return new ResourceClass(this.httpClient, this.urlBuilder);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
// src/resources/resource-map.ts
|
|
538
|
+
var resourceMap = /* @__PURE__ */ new Map([
|
|
539
|
+
[4005 /* Character */, { detailName: "character", listName: "characters" }],
|
|
540
|
+
[4015 /* Concept */, { detailName: "concept", listName: "concepts" }],
|
|
541
|
+
[4070 /* Episode */, { detailName: "episode", listName: "episodes" }],
|
|
542
|
+
[4e3 /* Issue */, { detailName: "issue", listName: "issues" }],
|
|
543
|
+
[4020 /* Location */, { detailName: "location", listName: "locations" }],
|
|
544
|
+
[4025 /* Movie */, { detailName: "movie", listName: "movies" }],
|
|
545
|
+
[4030 /* Origin */, { detailName: "origin", listName: "origins" }],
|
|
546
|
+
[4040 /* Person */, { detailName: "person", listName: "people" }],
|
|
547
|
+
[4035 /* Power */, { detailName: "power", listName: "powers" }],
|
|
548
|
+
[1700 /* Promo */, { detailName: "promo", listName: "promos" }],
|
|
549
|
+
[4010 /* Publisher */, { detailName: "publisher", listName: "publishers" }],
|
|
550
|
+
[4075 /* Series */, { detailName: "series", listName: "series_list" }],
|
|
551
|
+
[4045 /* StoryArc */, { detailName: "story_arc", listName: "story_arcs" }],
|
|
552
|
+
[4060 /* Team */, { detailName: "team", listName: "teams" }],
|
|
553
|
+
[4055 /* Thing */, { detailName: "object", listName: "objects" }],
|
|
554
|
+
[2300 /* Video */, { detailName: "video", listName: "videos" }],
|
|
555
|
+
[
|
|
556
|
+
2320 /* VideoCategory */,
|
|
557
|
+
{ detailName: "video_category", listName: "video_categories" }
|
|
558
|
+
],
|
|
559
|
+
[
|
|
560
|
+
2320 /* VideoType */,
|
|
561
|
+
{ detailName: "video_type", listName: "video_types" }
|
|
562
|
+
],
|
|
563
|
+
[4050 /* Volume */, { detailName: "volume", listName: "volumes" }]
|
|
564
|
+
]);
|
|
565
|
+
var getResource = (resourceType) => {
|
|
566
|
+
const resource = resourceMap.get(resourceType);
|
|
567
|
+
if (!resource) {
|
|
568
|
+
throw new Error(`Resource type (${resourceType}) not found`);
|
|
569
|
+
}
|
|
570
|
+
return resource;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// src/http-client/url-builder.ts
|
|
574
|
+
var isDefined = (value) => {
|
|
575
|
+
return value != null;
|
|
576
|
+
};
|
|
577
|
+
var UrlBuilder = class {
|
|
578
|
+
constructor(apiKey, baseUrl) {
|
|
579
|
+
this.apiKey = apiKey;
|
|
580
|
+
this.baseUrl = baseUrl;
|
|
581
|
+
}
|
|
582
|
+
getParam(key, value) {
|
|
583
|
+
if (value) {
|
|
584
|
+
return { name: toSnakeCase(key), value };
|
|
585
|
+
}
|
|
586
|
+
return void 0;
|
|
587
|
+
}
|
|
588
|
+
getFormatParm() {
|
|
589
|
+
return { name: "format", value: `json` };
|
|
590
|
+
}
|
|
591
|
+
getApiKeyParm() {
|
|
592
|
+
return { name: "api_key", value: this.apiKey };
|
|
593
|
+
}
|
|
594
|
+
getSortParam(sort) {
|
|
595
|
+
if (sort) {
|
|
596
|
+
return { name: "sort", value: `${sort.field}:${sort.direction}` };
|
|
597
|
+
}
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
getLimitParam(limit) {
|
|
601
|
+
if (limit) {
|
|
602
|
+
return this.getParam("limit", limit);
|
|
603
|
+
}
|
|
604
|
+
return void 0;
|
|
605
|
+
}
|
|
606
|
+
getOffsetParam(offset) {
|
|
607
|
+
if (offset) {
|
|
608
|
+
return this.getParam("offset", offset);
|
|
609
|
+
}
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
612
|
+
getFieldListParams(fieldList) {
|
|
613
|
+
if (fieldList) {
|
|
614
|
+
return {
|
|
615
|
+
name: "field_list",
|
|
616
|
+
value: fieldList.map((field) => toSnakeCase(String(field))).join(",")
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
return void 0;
|
|
620
|
+
}
|
|
621
|
+
getFilterParams(filter) {
|
|
622
|
+
if (filter) {
|
|
623
|
+
const snakeCaseFilter = convertCamelCaseToSnakeCase(filter);
|
|
624
|
+
const filterParams = Object.entries(snakeCaseFilter).map(
|
|
625
|
+
([key, value]) => `${key}:${value}`
|
|
626
|
+
);
|
|
627
|
+
return { name: "filter", value: filterParams.join(",") };
|
|
628
|
+
}
|
|
629
|
+
return void 0;
|
|
630
|
+
}
|
|
631
|
+
buildUrl(urlInput, queryParams) {
|
|
632
|
+
const url = new URL(urlInput, this.baseUrl);
|
|
633
|
+
const urlSearchParams = new URLSearchParams(
|
|
634
|
+
queryParams.filter(isDefined).map((param) => [param.name, param.value.toString()])
|
|
635
|
+
);
|
|
636
|
+
url.search = urlSearchParams.toString();
|
|
637
|
+
return url.toString();
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* @param resourceType A unique identifier for the resource type
|
|
641
|
+
* @param id A unique identifier for the resource
|
|
642
|
+
* @returns A url for requesting the resource
|
|
643
|
+
* @example https://comicvine.gamespot.com/api/issue/4000-719442?format=json&api_key=123abc
|
|
644
|
+
*/
|
|
645
|
+
retrieve(resourceType, id, options2) {
|
|
646
|
+
const resource = getResource(resourceType);
|
|
647
|
+
const urlInput = `${resource.detailName}/${resourceType}-${id}`;
|
|
648
|
+
const queryParams = [
|
|
649
|
+
this.getFormatParm(),
|
|
650
|
+
this.getApiKeyParm(),
|
|
651
|
+
this.getFieldListParams(options2 == null ? void 0 : options2.fieldList)
|
|
652
|
+
];
|
|
653
|
+
return this.buildUrl(urlInput, queryParams);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* @param resourceType A unique identifier for the resource type
|
|
657
|
+
* @returns A url for requesting a list of resources
|
|
658
|
+
* @example https://comicvine.gamespot.com/api/issues?format=json&api_key=123abc
|
|
659
|
+
*/
|
|
660
|
+
list(resourceType, options2) {
|
|
661
|
+
const urlInput = getResource(resourceType).listName;
|
|
662
|
+
const queryParams = [
|
|
663
|
+
this.getFormatParm(),
|
|
664
|
+
this.getApiKeyParm(),
|
|
665
|
+
this.getLimitParam(options2 == null ? void 0 : options2.limit),
|
|
666
|
+
this.getOffsetParam(options2 == null ? void 0 : options2.offset),
|
|
667
|
+
this.getSortParam(options2 == null ? void 0 : options2.sort),
|
|
668
|
+
this.getFieldListParams(options2 == null ? void 0 : options2.fieldList),
|
|
669
|
+
this.getFilterParams(options2 == null ? void 0 : options2.filter)
|
|
670
|
+
];
|
|
671
|
+
return this.buildUrl(urlInput, queryParams);
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
var options = z.object({
|
|
675
|
+
/**
|
|
676
|
+
* The base url for the Comic Vine API.
|
|
677
|
+
* This could be used to set a proxy when using the library in a browser.
|
|
678
|
+
* It also ensures that if the comic vine url was to change it wouldn't be a breaking change to the library.
|
|
679
|
+
* @default https://comicvine.gamespot.com/api/
|
|
680
|
+
*/
|
|
681
|
+
baseUrl: z.string().url().optional().default("https://comicvine.gamespot.com/api/")
|
|
682
|
+
});
|
|
683
|
+
var loadOptions = (userOptions) => {
|
|
684
|
+
try {
|
|
685
|
+
return options.parse(userOptions != null ? userOptions : {});
|
|
686
|
+
} catch (error) {
|
|
687
|
+
if (error instanceof ZodError) {
|
|
688
|
+
const validationError = error.issues[0];
|
|
689
|
+
if (validationError) {
|
|
690
|
+
throw new OptionsValidationError(
|
|
691
|
+
validationError.path,
|
|
692
|
+
validationError.message
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
throw new OptionsValidationError([], "Unknown validation error");
|
|
696
|
+
}
|
|
697
|
+
throw customError(error);
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
// src/comic-vine.ts
|
|
702
|
+
function classNameToPropertyName(className) {
|
|
703
|
+
if (!className) {
|
|
704
|
+
return "";
|
|
705
|
+
}
|
|
706
|
+
return className.charAt(0).toLowerCase() + className.slice(1);
|
|
707
|
+
}
|
|
708
|
+
var resourceMappings = Object.values(ResourceType).filter((value) => typeof value === "number").map((resourceType) => getResource(resourceType));
|
|
709
|
+
var canonicalRateLimitResourceNames = /* @__PURE__ */ new Map();
|
|
710
|
+
for (const { detailName, listName } of resourceMappings) {
|
|
711
|
+
canonicalRateLimitResourceNames.set(detailName, listName);
|
|
712
|
+
canonicalRateLimitResourceNames.set(listName, listName);
|
|
713
|
+
canonicalRateLimitResourceNames.set(toSnakeCase(detailName), listName);
|
|
714
|
+
canonicalRateLimitResourceNames.set(toSnakeCase(listName), listName);
|
|
715
|
+
}
|
|
716
|
+
function normalizeRateLimitResourceName(resourceName) {
|
|
717
|
+
var _a;
|
|
718
|
+
return (_a = canonicalRateLimitResourceNames.get(toSnakeCase(resourceName))) != null ? _a : resourceName;
|
|
719
|
+
}
|
|
720
|
+
function inferComicVineRateLimitResource(url) {
|
|
721
|
+
try {
|
|
722
|
+
const pathname = new URL(url).pathname;
|
|
723
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
724
|
+
const apiIndex = segments.indexOf("api");
|
|
725
|
+
const endpoint = apiIndex >= 0 ? segments[apiIndex + 1] : segments[0];
|
|
726
|
+
if (!endpoint) {
|
|
727
|
+
return "unknown";
|
|
728
|
+
}
|
|
729
|
+
return normalizeRateLimitResourceName(endpoint);
|
|
730
|
+
} catch (e) {
|
|
731
|
+
return "unknown";
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
var ComicVine = class {
|
|
735
|
+
/**
|
|
736
|
+
* Create a new ComicVine client
|
|
737
|
+
* @param options - Configuration options for the client
|
|
738
|
+
*/
|
|
739
|
+
constructor(options2) {
|
|
740
|
+
this.resourceCache = /* @__PURE__ */ new Map();
|
|
741
|
+
const { apiKey, baseUrl, stores = {}, client = {} } = options2;
|
|
742
|
+
const _options = loadOptions({ baseUrl });
|
|
743
|
+
const httpClient = new HttpClient({
|
|
744
|
+
name: "comic-vine-sdk",
|
|
745
|
+
cache: stores.cache ? {
|
|
746
|
+
store: stores.cache,
|
|
747
|
+
ttl: client.defaultCacheTTL
|
|
748
|
+
} : void 0,
|
|
749
|
+
dedupe: stores.dedupe,
|
|
750
|
+
rateLimit: stores.rateLimit ? {
|
|
751
|
+
store: stores.rateLimit,
|
|
752
|
+
throw: client.throwOnRateLimit,
|
|
753
|
+
maxWaitTime: client.maxWaitTime
|
|
754
|
+
} : void 0,
|
|
755
|
+
responseTransformer: comicVineResponseTransformer,
|
|
756
|
+
responseHandler: comicVineResponseHandler,
|
|
757
|
+
errorHandler: comicVineErrorHandler,
|
|
758
|
+
resourceKeyResolver: inferComicVineRateLimitResource
|
|
759
|
+
});
|
|
760
|
+
const urlBuilder = new UrlBuilder(apiKey, _options.baseUrl);
|
|
761
|
+
this.resourceFactory = new ResourceFactory(httpClient, urlBuilder);
|
|
762
|
+
this.stores = stores;
|
|
763
|
+
this.resourceNames = Object.keys(resource_list_exports);
|
|
764
|
+
return new Proxy(this, {
|
|
765
|
+
get(target, prop) {
|
|
766
|
+
if (typeof prop === "string" && target.isResourceProperty(prop)) {
|
|
767
|
+
return target.getResource(prop);
|
|
768
|
+
}
|
|
769
|
+
return Reflect.get(target, prop);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
isResourceProperty(prop) {
|
|
774
|
+
const className = prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
775
|
+
return this.resourceNames.includes(className);
|
|
776
|
+
}
|
|
777
|
+
getResource(propertyName) {
|
|
778
|
+
if (!this.resourceCache.has(propertyName)) {
|
|
779
|
+
const className = propertyName.charAt(0).toUpperCase() + propertyName.slice(1);
|
|
780
|
+
try {
|
|
781
|
+
const resource = this.resourceFactory.create(
|
|
782
|
+
className
|
|
783
|
+
);
|
|
784
|
+
this.resourceCache.set(propertyName, resource);
|
|
785
|
+
} catch (error) {
|
|
786
|
+
throw new Error(`Failed to create resource '${className}': ${error}`);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return this.resourceCache.get(propertyName);
|
|
790
|
+
}
|
|
791
|
+
getAvailableResources() {
|
|
792
|
+
return this.resourceNames.map((name) => classNameToPropertyName(name));
|
|
793
|
+
}
|
|
794
|
+
hasResource(resourceName) {
|
|
795
|
+
return this.isResourceProperty(resourceName);
|
|
796
|
+
}
|
|
797
|
+
getResourceByName(resourceName) {
|
|
798
|
+
if (!this.isResourceProperty(resourceName)) {
|
|
799
|
+
return void 0;
|
|
800
|
+
}
|
|
801
|
+
return this.getResource(resourceName);
|
|
802
|
+
}
|
|
803
|
+
isResourceLoaded(resourceName) {
|
|
804
|
+
return this.resourceCache.has(resourceName);
|
|
805
|
+
}
|
|
806
|
+
getCacheStats() {
|
|
807
|
+
const total = this.resourceNames.length;
|
|
808
|
+
const loaded = this.resourceCache.size;
|
|
809
|
+
const loadedResources = Array.from(this.resourceCache.keys());
|
|
810
|
+
return { total, loaded, loadedResources };
|
|
811
|
+
}
|
|
812
|
+
clearCache() {
|
|
813
|
+
return __async(this, null, function* () {
|
|
814
|
+
if (this.stores.cache) {
|
|
815
|
+
yield this.stores.cache.clear();
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
getRateLimitStatus(resourceName) {
|
|
820
|
+
return __async(this, null, function* () {
|
|
821
|
+
if (this.stores.rateLimit) {
|
|
822
|
+
return this.stores.rateLimit.getStatus(
|
|
823
|
+
normalizeRateLimitResourceName(resourceName)
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
return null;
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
resetRateLimit(resourceName) {
|
|
830
|
+
return __async(this, null, function* () {
|
|
831
|
+
if (this.stores.rateLimit) {
|
|
832
|
+
yield this.stores.rateLimit.reset(
|
|
833
|
+
normalizeRateLimitResourceName(resourceName)
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
// src/index.ts
|
|
841
|
+
var src_default = ComicVine;
|
|
842
|
+
|
|
843
|
+
export { ComicJsonpCallbackMissingError, ComicVine, ComicVineFilterError, ComicVineGenericError, ComicVineGenericRequestError, ComicVineObjectNotFoundError, ComicVineSubscriberOnlyError, ComicVineUnauthorizedError, ComicVineUrlFormatError, GenericError, OptionsValidationError, StatusCode, customError, src_default as default };
|
|
844
|
+
//# sourceMappingURL=index.js.map
|
|
845
|
+
//# sourceMappingURL=index.js.map
|