comic-vine-sdk 1.3.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -732
- package/lib/index.cjs +1462 -0
- package/lib/index.cjs.map +7 -0
- package/lib/index.d.ts +2716 -0
- package/lib/index.js +851 -0
- package/lib/index.js.map +1 -0
- package/package.json +114 -59
- 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.cjs
ADDED
|
@@ -0,0 +1,1462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 : /* @__PURE__ */ 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 __esm = (fn, res) => function __init() {
|
|
22
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
23
|
+
};
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var __async = (__this, __arguments, generator) => {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
var fulfilled = (value) => {
|
|
40
|
+
try {
|
|
41
|
+
step(generator.next(value));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
reject(e);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var rejected = (value) => {
|
|
47
|
+
try {
|
|
48
|
+
step(generator.throw(value));
|
|
49
|
+
} catch (e) {
|
|
50
|
+
reject(e);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
54
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var __await = function(promise, isYieldStar) {
|
|
58
|
+
this[0] = promise;
|
|
59
|
+
this[1] = isYieldStar;
|
|
60
|
+
};
|
|
61
|
+
var __asyncGenerator = (__this, __arguments, generator) => {
|
|
62
|
+
var resume = (k, v, yes, no) => {
|
|
63
|
+
try {
|
|
64
|
+
var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
|
|
65
|
+
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));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
no(e);
|
|
68
|
+
}
|
|
69
|
+
}, method = (k, call, wait, clear) => it[k] = (x) => (call = new Promise((yes, no, run) => (run = () => resume(k, x, yes, no), q ? q.then(run) : run())), clear = () => q === wait && (q = 0), q = wait = call.then(clear, clear), call), q, it = {};
|
|
70
|
+
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/http-client/status-code.ts
|
|
74
|
+
var StatusCode;
|
|
75
|
+
var init_status_code = __esm({
|
|
76
|
+
"src/http-client/status-code.ts"() {
|
|
77
|
+
"use strict";
|
|
78
|
+
StatusCode = /* @__PURE__ */ ((StatusCode2) => {
|
|
79
|
+
StatusCode2[StatusCode2["OK"] = 1] = "OK";
|
|
80
|
+
StatusCode2[StatusCode2["InvalidApiKey"] = 100] = "InvalidApiKey";
|
|
81
|
+
StatusCode2[StatusCode2["ObjectNotFound"] = 101] = "ObjectNotFound";
|
|
82
|
+
StatusCode2[StatusCode2["UrlFormatError"] = 102] = "UrlFormatError";
|
|
83
|
+
StatusCode2[StatusCode2["JsonpCallbackMissing"] = 103] = "JsonpCallbackMissing";
|
|
84
|
+
StatusCode2[StatusCode2["FilterError"] = 104] = "FilterError";
|
|
85
|
+
StatusCode2[StatusCode2["SubscriberOnlyVideo"] = 105] = "SubscriberOnlyVideo";
|
|
86
|
+
return StatusCode2;
|
|
87
|
+
})(StatusCode || {});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// src/errors/base-error.ts
|
|
92
|
+
function hasCaptureStackTrace(errorConstructor) {
|
|
93
|
+
return "captureStackTrace" in errorConstructor && typeof Reflect.get(errorConstructor, "captureStackTrace") === "function";
|
|
94
|
+
}
|
|
95
|
+
var import_core, BaseError;
|
|
96
|
+
var init_base_error = __esm({
|
|
97
|
+
"src/errors/base-error.ts"() {
|
|
98
|
+
"use strict";
|
|
99
|
+
import_core = require("@http-client-toolkit/core");
|
|
100
|
+
BaseError = class extends import_core.HttpClientError {
|
|
101
|
+
constructor(details) {
|
|
102
|
+
super(details.message);
|
|
103
|
+
this.name = this.constructor.name;
|
|
104
|
+
if (hasCaptureStackTrace(Error)) {
|
|
105
|
+
Error.captureStackTrace(this, new.target);
|
|
106
|
+
}
|
|
107
|
+
this.help = details.help;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// src/errors/generic-error.ts
|
|
114
|
+
var GenericError;
|
|
115
|
+
var init_generic_error = __esm({
|
|
116
|
+
"src/errors/generic-error.ts"() {
|
|
117
|
+
"use strict";
|
|
118
|
+
init_base_error();
|
|
119
|
+
GenericError = class extends BaseError {
|
|
120
|
+
constructor(message) {
|
|
121
|
+
super({
|
|
122
|
+
message: `An unexpected error occurred: ${message || "Unknown Error"}`,
|
|
123
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// src/errors/custom-error.ts
|
|
131
|
+
var customError;
|
|
132
|
+
var init_custom_error = __esm({
|
|
133
|
+
"src/errors/custom-error.ts"() {
|
|
134
|
+
"use strict";
|
|
135
|
+
init_generic_error();
|
|
136
|
+
customError = (error) => {
|
|
137
|
+
if (error instanceof Error) {
|
|
138
|
+
return new GenericError(error.message);
|
|
139
|
+
}
|
|
140
|
+
return new GenericError();
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// src/errors/filter-error.ts
|
|
146
|
+
var ComicVineFilterError;
|
|
147
|
+
var init_filter_error = __esm({
|
|
148
|
+
"src/errors/filter-error.ts"() {
|
|
149
|
+
"use strict";
|
|
150
|
+
init_base_error();
|
|
151
|
+
ComicVineFilterError = class extends BaseError {
|
|
152
|
+
constructor() {
|
|
153
|
+
super({
|
|
154
|
+
message: "There was a problem trying to filter the API results",
|
|
155
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// src/errors/generic-request-error.ts
|
|
163
|
+
var ComicVineGenericError, ComicVineGenericRequestError;
|
|
164
|
+
var init_generic_request_error = __esm({
|
|
165
|
+
"src/errors/generic-request-error.ts"() {
|
|
166
|
+
"use strict";
|
|
167
|
+
init_base_error();
|
|
168
|
+
ComicVineGenericError = class extends BaseError {
|
|
169
|
+
constructor(message) {
|
|
170
|
+
super({
|
|
171
|
+
message: `Request to comic vine failed: ${message != null ? message : "Unknown Error"}`,
|
|
172
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
ComicVineGenericRequestError = class extends ComicVineGenericError {
|
|
177
|
+
constructor(message) {
|
|
178
|
+
super(message);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// src/errors/jsonp-callback-missing-error.ts
|
|
185
|
+
var ComicJsonpCallbackMissingError;
|
|
186
|
+
var init_jsonp_callback_missing_error = __esm({
|
|
187
|
+
"src/errors/jsonp-callback-missing-error.ts"() {
|
|
188
|
+
"use strict";
|
|
189
|
+
init_base_error();
|
|
190
|
+
ComicJsonpCallbackMissingError = class extends BaseError {
|
|
191
|
+
constructor() {
|
|
192
|
+
super({
|
|
193
|
+
message: "JSONP format requires a callback",
|
|
194
|
+
help: "This library does not use JSONP, please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// src/errors/object-not-found-error.ts
|
|
202
|
+
var ComicVineObjectNotFoundError;
|
|
203
|
+
var init_object_not_found_error = __esm({
|
|
204
|
+
"src/errors/object-not-found-error.ts"() {
|
|
205
|
+
"use strict";
|
|
206
|
+
init_base_error();
|
|
207
|
+
ComicVineObjectNotFoundError = class extends BaseError {
|
|
208
|
+
constructor() {
|
|
209
|
+
super({
|
|
210
|
+
message: "The requested resource could not be found in the Comic Vine API",
|
|
211
|
+
help: "Ensure you have used a valid resource Id"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// src/errors/options-validation-error.ts
|
|
219
|
+
var OptionsValidationError;
|
|
220
|
+
var init_options_validation_error = __esm({
|
|
221
|
+
"src/errors/options-validation-error.ts"() {
|
|
222
|
+
"use strict";
|
|
223
|
+
init_base_error();
|
|
224
|
+
OptionsValidationError = class extends BaseError {
|
|
225
|
+
constructor(path, message) {
|
|
226
|
+
super({
|
|
227
|
+
message: `Property: ${path.join(".")}, Problem: ${message}`,
|
|
228
|
+
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"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// src/errors/subscriber-only-error.ts
|
|
236
|
+
var ComicVineSubscriberOnlyError;
|
|
237
|
+
var init_subscriber_only_error = __esm({
|
|
238
|
+
"src/errors/subscriber-only-error.ts"() {
|
|
239
|
+
"use strict";
|
|
240
|
+
init_base_error();
|
|
241
|
+
ComicVineSubscriberOnlyError = class extends BaseError {
|
|
242
|
+
constructor() {
|
|
243
|
+
super({
|
|
244
|
+
message: "The requested video is for subscribers only",
|
|
245
|
+
help: "Subscriber videos are part of a paid service, if you wish to upgrade you can do so here: https://comicvine.gamespot.com/upgrade/"
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// src/errors/unauthorized-error.ts
|
|
253
|
+
var ComicVineUnauthorizedError;
|
|
254
|
+
var init_unauthorized_error = __esm({
|
|
255
|
+
"src/errors/unauthorized-error.ts"() {
|
|
256
|
+
"use strict";
|
|
257
|
+
init_base_error();
|
|
258
|
+
ComicVineUnauthorizedError = class extends BaseError {
|
|
259
|
+
constructor() {
|
|
260
|
+
super({
|
|
261
|
+
message: "Unauthorized response received when calling the Comic Vine API",
|
|
262
|
+
help: "Ensure you have a valid API key, you can get one from: https://comicvine.gamespot.com/api/"
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// src/errors/url-format-error.ts
|
|
270
|
+
var ComicVineUrlFormatError;
|
|
271
|
+
var init_url_format_error = __esm({
|
|
272
|
+
"src/errors/url-format-error.ts"() {
|
|
273
|
+
"use strict";
|
|
274
|
+
init_base_error();
|
|
275
|
+
ComicVineUrlFormatError = class extends BaseError {
|
|
276
|
+
constructor() {
|
|
277
|
+
super({
|
|
278
|
+
message: "The url for the request was not in the correct format",
|
|
279
|
+
help: "Please open a Github issue with steps to reproduce: https://github.com/AllyMurray/comic-vine/issues"
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// src/errors/index.ts
|
|
287
|
+
var init_errors = __esm({
|
|
288
|
+
"src/errors/index.ts"() {
|
|
289
|
+
"use strict";
|
|
290
|
+
init_custom_error();
|
|
291
|
+
init_filter_error();
|
|
292
|
+
init_generic_error();
|
|
293
|
+
init_generic_request_error();
|
|
294
|
+
init_jsonp_callback_missing_error();
|
|
295
|
+
init_object_not_found_error();
|
|
296
|
+
init_options_validation_error();
|
|
297
|
+
init_subscriber_only_error();
|
|
298
|
+
init_unauthorized_error();
|
|
299
|
+
init_url_format_error();
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// src/utils/is-object.ts
|
|
304
|
+
var isObject;
|
|
305
|
+
var init_is_object = __esm({
|
|
306
|
+
"src/utils/is-object.ts"() {
|
|
307
|
+
"use strict";
|
|
308
|
+
isObject = (maybeObject) => maybeObject === Object(maybeObject) && !Array.isArray(maybeObject) && typeof maybeObject !== "function";
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// src/utils/case-converter.ts
|
|
313
|
+
var toCamelCase, toSnakeCase, convertCase, convertSnakeCaseToCamelCase, convertCamelCaseToSnakeCase;
|
|
314
|
+
var init_case_converter = __esm({
|
|
315
|
+
"src/utils/case-converter.ts"() {
|
|
316
|
+
"use strict";
|
|
317
|
+
init_is_object();
|
|
318
|
+
toCamelCase = (str) => {
|
|
319
|
+
return str.replace(/([-_][a-z])/gi, ($1) => {
|
|
320
|
+
return $1.toUpperCase().replace("-", "").replace("_", "");
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
toSnakeCase = (str) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
324
|
+
convertCase = (caseConverter, object) => {
|
|
325
|
+
if (isObject(object)) {
|
|
326
|
+
const newObject = {};
|
|
327
|
+
Object.keys(object).forEach((key) => {
|
|
328
|
+
newObject[caseConverter(key)] = convertCase(
|
|
329
|
+
caseConverter,
|
|
330
|
+
object[key]
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
return newObject;
|
|
334
|
+
} else if (Array.isArray(object)) {
|
|
335
|
+
return object.map(
|
|
336
|
+
(arrayElement) => convertCase(caseConverter, arrayElement)
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
return object;
|
|
340
|
+
};
|
|
341
|
+
convertSnakeCaseToCamelCase = (object) => {
|
|
342
|
+
return convertCase(toCamelCase, object);
|
|
343
|
+
};
|
|
344
|
+
convertCamelCaseToSnakeCase = (object) => {
|
|
345
|
+
return convertCase(toSnakeCase, object);
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// src/http-client/hooks.ts
|
|
351
|
+
function comicVineResponseTransformer(data) {
|
|
352
|
+
return convertSnakeCaseToCamelCase(data);
|
|
353
|
+
}
|
|
354
|
+
function comicVineResponseHandler(data) {
|
|
355
|
+
if (data !== null && typeof data === "object" && "statusCode" in data && typeof data.statusCode === "number") {
|
|
356
|
+
const statusCode = data.statusCode;
|
|
357
|
+
switch (statusCode) {
|
|
358
|
+
case 104 /* FilterError */:
|
|
359
|
+
throw new ComicVineFilterError();
|
|
360
|
+
case 103 /* JsonpCallbackMissing */:
|
|
361
|
+
throw new ComicJsonpCallbackMissingError();
|
|
362
|
+
case 101 /* ObjectNotFound */:
|
|
363
|
+
throw new ComicVineObjectNotFoundError();
|
|
364
|
+
case 105 /* SubscriberOnlyVideo */:
|
|
365
|
+
throw new ComicVineSubscriberOnlyError();
|
|
366
|
+
case 102 /* UrlFormatError */:
|
|
367
|
+
throw new ComicVineUrlFormatError();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return data;
|
|
371
|
+
}
|
|
372
|
+
function comicVineErrorHandler(context) {
|
|
373
|
+
if (context.response.status === 401) {
|
|
374
|
+
return new ComicVineUnauthorizedError();
|
|
375
|
+
}
|
|
376
|
+
const bodyMessage = typeof context.response.data === "object" && context.response.data !== null ? context.response.data.message : void 0;
|
|
377
|
+
const message = bodyMessage ? `${context.message}, ${bodyMessage}` : context.message;
|
|
378
|
+
return new ComicVineGenericRequestError(message);
|
|
379
|
+
}
|
|
380
|
+
var init_hooks = __esm({
|
|
381
|
+
"src/http-client/hooks.ts"() {
|
|
382
|
+
"use strict";
|
|
383
|
+
init_errors();
|
|
384
|
+
init_case_converter();
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// src/resources/base-resource.ts
|
|
389
|
+
var BaseResource;
|
|
390
|
+
var init_base_resource = __esm({
|
|
391
|
+
"src/resources/base-resource.ts"() {
|
|
392
|
+
"use strict";
|
|
393
|
+
BaseResource = class {
|
|
394
|
+
constructor(httpClient, urlBuilder) {
|
|
395
|
+
this.httpClient = httpClient;
|
|
396
|
+
this.urlBuilder = urlBuilder;
|
|
397
|
+
}
|
|
398
|
+
retrieve(id, options2) {
|
|
399
|
+
return __async(this, null, function* () {
|
|
400
|
+
const url = this.urlBuilder.retrieve(this.resourceType, id, options2);
|
|
401
|
+
const _fieldList = options2 == null ? void 0 : options2.fieldList;
|
|
402
|
+
const response = yield this.httpClient.get(url, {
|
|
403
|
+
priority: options2 == null ? void 0 : options2.priority
|
|
404
|
+
});
|
|
405
|
+
return response.results;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
fetchPage(options2) {
|
|
409
|
+
return __async(this, null, function* () {
|
|
410
|
+
const url = this.urlBuilder.list(this.resourceType, options2);
|
|
411
|
+
const _fieldList = options2 == null ? void 0 : options2.fieldList;
|
|
412
|
+
const response = yield this.httpClient.get(
|
|
413
|
+
url,
|
|
414
|
+
{
|
|
415
|
+
priority: options2 == null ? void 0 : options2.priority
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
return {
|
|
419
|
+
limit: response.limit,
|
|
420
|
+
numberOfPageResults: response.numberOfPageResults,
|
|
421
|
+
numberOfTotalResults: response.numberOfTotalResults,
|
|
422
|
+
offset: response.offset,
|
|
423
|
+
data: response.results
|
|
424
|
+
};
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
list(options2) {
|
|
428
|
+
const fetchPage = (opts) => this.fetchPage.call(this, opts);
|
|
429
|
+
const fetchPagePromise = fetchPage(options2);
|
|
430
|
+
const asyncIterator = {
|
|
431
|
+
[Symbol.asyncIterator]() {
|
|
432
|
+
return __asyncGenerator(this, null, function* () {
|
|
433
|
+
var _a2;
|
|
434
|
+
const defaultPageSize = 100;
|
|
435
|
+
const limit = (_a2 = options2 == null ? void 0 : options2.limit) != null ? _a2 : defaultPageSize;
|
|
436
|
+
let page = (options2 == null ? void 0 : options2.offset) ? options2.offset / limit + 1 : 1;
|
|
437
|
+
let response = yield new __await(fetchPagePromise);
|
|
438
|
+
while (true) {
|
|
439
|
+
for (const resource of response.data) {
|
|
440
|
+
yield resource;
|
|
441
|
+
}
|
|
442
|
+
if (response.limit + response.offset >= response.numberOfTotalResults) {
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
response = yield new __await(fetchPage({
|
|
446
|
+
limit,
|
|
447
|
+
offset: response.numberOfPageResults * page++
|
|
448
|
+
}));
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
const promiseWithAsyncIterator = Object.assign(
|
|
454
|
+
fetchPagePromise,
|
|
455
|
+
asyncIterator
|
|
456
|
+
);
|
|
457
|
+
return promiseWithAsyncIterator;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// src/resources/resource-type.ts
|
|
464
|
+
var ResourceType;
|
|
465
|
+
var init_resource_type = __esm({
|
|
466
|
+
"src/resources/resource-type.ts"() {
|
|
467
|
+
"use strict";
|
|
468
|
+
ResourceType = /* @__PURE__ */ ((ResourceType3) => {
|
|
469
|
+
ResourceType3[ResourceType3["Character"] = 4005] = "Character";
|
|
470
|
+
ResourceType3[ResourceType3["Concept"] = 4015] = "Concept";
|
|
471
|
+
ResourceType3[ResourceType3["Episode"] = 4070] = "Episode";
|
|
472
|
+
ResourceType3[ResourceType3["Issue"] = 4e3] = "Issue";
|
|
473
|
+
ResourceType3[ResourceType3["Location"] = 4020] = "Location";
|
|
474
|
+
ResourceType3[ResourceType3["Movie"] = 4025] = "Movie";
|
|
475
|
+
ResourceType3[ResourceType3["Origin"] = 4030] = "Origin";
|
|
476
|
+
ResourceType3[ResourceType3["Person"] = 4040] = "Person";
|
|
477
|
+
ResourceType3[ResourceType3["Power"] = 4035] = "Power";
|
|
478
|
+
ResourceType3[ResourceType3["Promo"] = 1700] = "Promo";
|
|
479
|
+
ResourceType3[ResourceType3["Publisher"] = 4010] = "Publisher";
|
|
480
|
+
ResourceType3[ResourceType3["Series"] = 4075] = "Series";
|
|
481
|
+
ResourceType3[ResourceType3["StoryArc"] = 4045] = "StoryArc";
|
|
482
|
+
ResourceType3[ResourceType3["Team"] = 4060] = "Team";
|
|
483
|
+
ResourceType3[ResourceType3["Thing"] = 4055] = "Thing";
|
|
484
|
+
ResourceType3[ResourceType3["Video"] = 2300] = "Video";
|
|
485
|
+
ResourceType3[ResourceType3["VideoCategory"] = 2320] = "VideoCategory";
|
|
486
|
+
ResourceType3[ResourceType3["VideoType"] = 2320] = "VideoType";
|
|
487
|
+
ResourceType3[ResourceType3["Volume"] = 4050] = "Volume";
|
|
488
|
+
return ResourceType3;
|
|
489
|
+
})(ResourceType || {});
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
// src/resources/character/character.ts
|
|
494
|
+
var Character;
|
|
495
|
+
var init_character = __esm({
|
|
496
|
+
"src/resources/character/character.ts"() {
|
|
497
|
+
"use strict";
|
|
498
|
+
init_base_resource();
|
|
499
|
+
Character = class extends BaseResource {
|
|
500
|
+
constructor() {
|
|
501
|
+
super(...arguments);
|
|
502
|
+
this.resourceType = 4005 /* Character */;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
// src/resources/character/index.ts
|
|
509
|
+
var init_character2 = __esm({
|
|
510
|
+
"src/resources/character/index.ts"() {
|
|
511
|
+
"use strict";
|
|
512
|
+
init_character();
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
// src/resources/concept/concept.ts
|
|
517
|
+
var Concept;
|
|
518
|
+
var init_concept = __esm({
|
|
519
|
+
"src/resources/concept/concept.ts"() {
|
|
520
|
+
"use strict";
|
|
521
|
+
init_base_resource();
|
|
522
|
+
Concept = class extends BaseResource {
|
|
523
|
+
constructor() {
|
|
524
|
+
super(...arguments);
|
|
525
|
+
this.resourceType = 4015 /* Concept */;
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// src/resources/concept/index.ts
|
|
532
|
+
var init_concept2 = __esm({
|
|
533
|
+
"src/resources/concept/index.ts"() {
|
|
534
|
+
"use strict";
|
|
535
|
+
init_concept();
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// src/resources/episode/episode.ts
|
|
540
|
+
var Episode;
|
|
541
|
+
var init_episode = __esm({
|
|
542
|
+
"src/resources/episode/episode.ts"() {
|
|
543
|
+
"use strict";
|
|
544
|
+
init_base_resource();
|
|
545
|
+
Episode = class extends BaseResource {
|
|
546
|
+
constructor() {
|
|
547
|
+
super(...arguments);
|
|
548
|
+
this.resourceType = 4070 /* Episode */;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
// src/resources/episode/index.ts
|
|
555
|
+
var init_episode2 = __esm({
|
|
556
|
+
"src/resources/episode/index.ts"() {
|
|
557
|
+
"use strict";
|
|
558
|
+
init_episode();
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// src/resources/issue/issue.ts
|
|
563
|
+
var Issue;
|
|
564
|
+
var init_issue = __esm({
|
|
565
|
+
"src/resources/issue/issue.ts"() {
|
|
566
|
+
"use strict";
|
|
567
|
+
init_base_resource();
|
|
568
|
+
Issue = class extends BaseResource {
|
|
569
|
+
constructor() {
|
|
570
|
+
super(...arguments);
|
|
571
|
+
this.resourceType = 4e3 /* Issue */;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
// src/resources/issue/index.ts
|
|
578
|
+
var init_issue2 = __esm({
|
|
579
|
+
"src/resources/issue/index.ts"() {
|
|
580
|
+
"use strict";
|
|
581
|
+
init_issue();
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// src/resources/location/location.ts
|
|
586
|
+
var Location;
|
|
587
|
+
var init_location = __esm({
|
|
588
|
+
"src/resources/location/location.ts"() {
|
|
589
|
+
"use strict";
|
|
590
|
+
init_base_resource();
|
|
591
|
+
Location = class extends BaseResource {
|
|
592
|
+
constructor() {
|
|
593
|
+
super(...arguments);
|
|
594
|
+
this.resourceType = 4020 /* Location */;
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
// src/resources/location/index.ts
|
|
601
|
+
var init_location2 = __esm({
|
|
602
|
+
"src/resources/location/index.ts"() {
|
|
603
|
+
"use strict";
|
|
604
|
+
init_location();
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
// src/resources/movie/movie.ts
|
|
609
|
+
var Movie;
|
|
610
|
+
var init_movie = __esm({
|
|
611
|
+
"src/resources/movie/movie.ts"() {
|
|
612
|
+
"use strict";
|
|
613
|
+
init_base_resource();
|
|
614
|
+
Movie = class extends BaseResource {
|
|
615
|
+
constructor() {
|
|
616
|
+
super(...arguments);
|
|
617
|
+
this.resourceType = 4025 /* Movie */;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// src/resources/movie/index.ts
|
|
624
|
+
var init_movie2 = __esm({
|
|
625
|
+
"src/resources/movie/index.ts"() {
|
|
626
|
+
"use strict";
|
|
627
|
+
init_movie();
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// src/resources/origin/origin.ts
|
|
632
|
+
var Origin;
|
|
633
|
+
var init_origin = __esm({
|
|
634
|
+
"src/resources/origin/origin.ts"() {
|
|
635
|
+
"use strict";
|
|
636
|
+
init_base_resource();
|
|
637
|
+
Origin = class extends BaseResource {
|
|
638
|
+
constructor() {
|
|
639
|
+
super(...arguments);
|
|
640
|
+
this.resourceType = 4030 /* Origin */;
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
// src/resources/origin/index.ts
|
|
647
|
+
var init_origin2 = __esm({
|
|
648
|
+
"src/resources/origin/index.ts"() {
|
|
649
|
+
"use strict";
|
|
650
|
+
init_origin();
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
// src/resources/person/person.ts
|
|
655
|
+
var Person;
|
|
656
|
+
var init_person = __esm({
|
|
657
|
+
"src/resources/person/person.ts"() {
|
|
658
|
+
"use strict";
|
|
659
|
+
init_base_resource();
|
|
660
|
+
Person = class extends BaseResource {
|
|
661
|
+
constructor() {
|
|
662
|
+
super(...arguments);
|
|
663
|
+
this.resourceType = 4040 /* Person */;
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
// src/resources/person/index.ts
|
|
670
|
+
var init_person2 = __esm({
|
|
671
|
+
"src/resources/person/index.ts"() {
|
|
672
|
+
"use strict";
|
|
673
|
+
init_person();
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
// src/resources/power/power.ts
|
|
678
|
+
var Power;
|
|
679
|
+
var init_power = __esm({
|
|
680
|
+
"src/resources/power/power.ts"() {
|
|
681
|
+
"use strict";
|
|
682
|
+
init_base_resource();
|
|
683
|
+
Power = class extends BaseResource {
|
|
684
|
+
constructor() {
|
|
685
|
+
super(...arguments);
|
|
686
|
+
this.resourceType = 4035 /* Power */;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
// src/resources/power/index.ts
|
|
693
|
+
var init_power2 = __esm({
|
|
694
|
+
"src/resources/power/index.ts"() {
|
|
695
|
+
"use strict";
|
|
696
|
+
init_power();
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
// src/resources/promo/promo.ts
|
|
701
|
+
var Promo;
|
|
702
|
+
var init_promo = __esm({
|
|
703
|
+
"src/resources/promo/promo.ts"() {
|
|
704
|
+
"use strict";
|
|
705
|
+
init_base_resource();
|
|
706
|
+
Promo = class extends BaseResource {
|
|
707
|
+
constructor() {
|
|
708
|
+
super(...arguments);
|
|
709
|
+
this.resourceType = 1700 /* Promo */;
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
// src/resources/promo/index.ts
|
|
716
|
+
var init_promo2 = __esm({
|
|
717
|
+
"src/resources/promo/index.ts"() {
|
|
718
|
+
"use strict";
|
|
719
|
+
init_promo();
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// src/resources/publisher/publisher.ts
|
|
724
|
+
var Publisher;
|
|
725
|
+
var init_publisher = __esm({
|
|
726
|
+
"src/resources/publisher/publisher.ts"() {
|
|
727
|
+
"use strict";
|
|
728
|
+
init_base_resource();
|
|
729
|
+
Publisher = class extends BaseResource {
|
|
730
|
+
constructor() {
|
|
731
|
+
super(...arguments);
|
|
732
|
+
this.resourceType = 4010 /* Publisher */;
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// src/resources/publisher/index.ts
|
|
739
|
+
var init_publisher2 = __esm({
|
|
740
|
+
"src/resources/publisher/index.ts"() {
|
|
741
|
+
"use strict";
|
|
742
|
+
init_publisher();
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
// src/resources/series/series.ts
|
|
747
|
+
var Series;
|
|
748
|
+
var init_series = __esm({
|
|
749
|
+
"src/resources/series/series.ts"() {
|
|
750
|
+
"use strict";
|
|
751
|
+
init_base_resource();
|
|
752
|
+
Series = class extends BaseResource {
|
|
753
|
+
constructor() {
|
|
754
|
+
super(...arguments);
|
|
755
|
+
this.resourceType = 4075 /* Series */;
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
// src/resources/series/index.ts
|
|
762
|
+
var init_series2 = __esm({
|
|
763
|
+
"src/resources/series/index.ts"() {
|
|
764
|
+
"use strict";
|
|
765
|
+
init_series();
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
// src/resources/story-arc/story-arc.ts
|
|
770
|
+
var StoryArc;
|
|
771
|
+
var init_story_arc = __esm({
|
|
772
|
+
"src/resources/story-arc/story-arc.ts"() {
|
|
773
|
+
"use strict";
|
|
774
|
+
init_base_resource();
|
|
775
|
+
StoryArc = class extends BaseResource {
|
|
776
|
+
constructor() {
|
|
777
|
+
super(...arguments);
|
|
778
|
+
this.resourceType = 4045 /* StoryArc */;
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
// src/resources/story-arc/index.ts
|
|
785
|
+
var init_story_arc2 = __esm({
|
|
786
|
+
"src/resources/story-arc/index.ts"() {
|
|
787
|
+
"use strict";
|
|
788
|
+
init_story_arc();
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
// src/resources/team/team.ts
|
|
793
|
+
var Team;
|
|
794
|
+
var init_team = __esm({
|
|
795
|
+
"src/resources/team/team.ts"() {
|
|
796
|
+
"use strict";
|
|
797
|
+
init_base_resource();
|
|
798
|
+
Team = class extends BaseResource {
|
|
799
|
+
constructor() {
|
|
800
|
+
super(...arguments);
|
|
801
|
+
this.resourceType = 4060 /* Team */;
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// src/resources/team/index.ts
|
|
808
|
+
var init_team2 = __esm({
|
|
809
|
+
"src/resources/team/index.ts"() {
|
|
810
|
+
"use strict";
|
|
811
|
+
init_team();
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// src/resources/thing/thing.ts
|
|
816
|
+
var Thing;
|
|
817
|
+
var init_thing = __esm({
|
|
818
|
+
"src/resources/thing/thing.ts"() {
|
|
819
|
+
"use strict";
|
|
820
|
+
init_base_resource();
|
|
821
|
+
Thing = class extends BaseResource {
|
|
822
|
+
constructor() {
|
|
823
|
+
super(...arguments);
|
|
824
|
+
this.resourceType = 4055 /* Thing */;
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// src/resources/thing/index.ts
|
|
831
|
+
var init_thing2 = __esm({
|
|
832
|
+
"src/resources/thing/index.ts"() {
|
|
833
|
+
"use strict";
|
|
834
|
+
init_thing();
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
// src/resources/video/video.ts
|
|
839
|
+
var Video;
|
|
840
|
+
var init_video = __esm({
|
|
841
|
+
"src/resources/video/video.ts"() {
|
|
842
|
+
"use strict";
|
|
843
|
+
init_base_resource();
|
|
844
|
+
Video = class extends BaseResource {
|
|
845
|
+
constructor() {
|
|
846
|
+
super(...arguments);
|
|
847
|
+
this.resourceType = 2300 /* Video */;
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
// src/resources/video/index.ts
|
|
854
|
+
var init_video2 = __esm({
|
|
855
|
+
"src/resources/video/index.ts"() {
|
|
856
|
+
"use strict";
|
|
857
|
+
init_video();
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
// src/resources/video-category/video-category.ts
|
|
862
|
+
var VideoCategory;
|
|
863
|
+
var init_video_category = __esm({
|
|
864
|
+
"src/resources/video-category/video-category.ts"() {
|
|
865
|
+
"use strict";
|
|
866
|
+
init_base_resource();
|
|
867
|
+
VideoCategory = class extends BaseResource {
|
|
868
|
+
constructor() {
|
|
869
|
+
super(...arguments);
|
|
870
|
+
this.resourceType = 2320 /* VideoCategory */;
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
// src/resources/video-category/index.ts
|
|
877
|
+
var init_video_category2 = __esm({
|
|
878
|
+
"src/resources/video-category/index.ts"() {
|
|
879
|
+
"use strict";
|
|
880
|
+
init_video_category();
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
// src/resources/video-type/video-type.ts
|
|
885
|
+
var VideoType;
|
|
886
|
+
var init_video_type = __esm({
|
|
887
|
+
"src/resources/video-type/video-type.ts"() {
|
|
888
|
+
"use strict";
|
|
889
|
+
init_base_resource();
|
|
890
|
+
VideoType = class extends BaseResource {
|
|
891
|
+
constructor() {
|
|
892
|
+
super(...arguments);
|
|
893
|
+
this.resourceType = 2320 /* VideoType */;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
// src/resources/video-type/index.ts
|
|
900
|
+
var init_video_type2 = __esm({
|
|
901
|
+
"src/resources/video-type/index.ts"() {
|
|
902
|
+
"use strict";
|
|
903
|
+
init_video_type();
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// src/resources/volume/volume.ts
|
|
908
|
+
var Volume;
|
|
909
|
+
var init_volume = __esm({
|
|
910
|
+
"src/resources/volume/volume.ts"() {
|
|
911
|
+
"use strict";
|
|
912
|
+
init_base_resource();
|
|
913
|
+
Volume = class extends BaseResource {
|
|
914
|
+
constructor() {
|
|
915
|
+
super(...arguments);
|
|
916
|
+
this.resourceType = 4050 /* Volume */;
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
// src/resources/volume/index.ts
|
|
923
|
+
var init_volume2 = __esm({
|
|
924
|
+
"src/resources/volume/index.ts"() {
|
|
925
|
+
"use strict";
|
|
926
|
+
init_volume();
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
// src/resources/resource-list.ts
|
|
931
|
+
var resource_list_exports = {};
|
|
932
|
+
__export(resource_list_exports, {
|
|
933
|
+
Character: () => Character,
|
|
934
|
+
Concept: () => Concept,
|
|
935
|
+
Episode: () => Episode,
|
|
936
|
+
Issue: () => Issue,
|
|
937
|
+
Location: () => Location,
|
|
938
|
+
Movie: () => Movie,
|
|
939
|
+
Origin: () => Origin,
|
|
940
|
+
Person: () => Person,
|
|
941
|
+
Power: () => Power,
|
|
942
|
+
Promo: () => Promo,
|
|
943
|
+
Publisher: () => Publisher,
|
|
944
|
+
Series: () => Series,
|
|
945
|
+
StoryArc: () => StoryArc,
|
|
946
|
+
Team: () => Team,
|
|
947
|
+
Thing: () => Thing,
|
|
948
|
+
Video: () => Video,
|
|
949
|
+
VideoCategory: () => VideoCategory,
|
|
950
|
+
VideoType: () => VideoType,
|
|
951
|
+
Volume: () => Volume
|
|
952
|
+
});
|
|
953
|
+
var init_resource_list = __esm({
|
|
954
|
+
"src/resources/resource-list.ts"() {
|
|
955
|
+
"use strict";
|
|
956
|
+
init_character2();
|
|
957
|
+
init_concept2();
|
|
958
|
+
init_episode2();
|
|
959
|
+
init_issue2();
|
|
960
|
+
init_location2();
|
|
961
|
+
init_movie2();
|
|
962
|
+
init_origin2();
|
|
963
|
+
init_person2();
|
|
964
|
+
init_power2();
|
|
965
|
+
init_promo2();
|
|
966
|
+
init_publisher2();
|
|
967
|
+
init_series2();
|
|
968
|
+
init_story_arc2();
|
|
969
|
+
init_team2();
|
|
970
|
+
init_thing2();
|
|
971
|
+
init_video2();
|
|
972
|
+
init_video_category2();
|
|
973
|
+
init_video_type2();
|
|
974
|
+
init_volume2();
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
// src/resources/resource-factory.ts
|
|
979
|
+
var ResourceFactory;
|
|
980
|
+
var init_resource_factory = __esm({
|
|
981
|
+
"src/resources/resource-factory.ts"() {
|
|
982
|
+
"use strict";
|
|
983
|
+
init_resource_list();
|
|
984
|
+
ResourceFactory = class {
|
|
985
|
+
constructor(httpClient, urlBuilder) {
|
|
986
|
+
this.httpClient = httpClient;
|
|
987
|
+
this.urlBuilder = urlBuilder;
|
|
988
|
+
this._resources = __spreadValues({}, resource_list_exports);
|
|
989
|
+
}
|
|
990
|
+
create(name) {
|
|
991
|
+
if (!this._resources[name]) {
|
|
992
|
+
throw new Error(`${name} resource not implemented`);
|
|
993
|
+
}
|
|
994
|
+
const ResourceClass = this._resources[name];
|
|
995
|
+
return new ResourceClass(this.httpClient, this.urlBuilder);
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
// src/resources/resource-map.ts
|
|
1002
|
+
var resourceMap, getResource;
|
|
1003
|
+
var init_resource_map = __esm({
|
|
1004
|
+
"src/resources/resource-map.ts"() {
|
|
1005
|
+
"use strict";
|
|
1006
|
+
resourceMap = /* @__PURE__ */ new Map([
|
|
1007
|
+
[4005 /* Character */, { detailName: "character", listName: "characters" }],
|
|
1008
|
+
[4015 /* Concept */, { detailName: "concept", listName: "concepts" }],
|
|
1009
|
+
[4070 /* Episode */, { detailName: "episode", listName: "episodes" }],
|
|
1010
|
+
[4e3 /* Issue */, { detailName: "issue", listName: "issues" }],
|
|
1011
|
+
[4020 /* Location */, { detailName: "location", listName: "locations" }],
|
|
1012
|
+
[4025 /* Movie */, { detailName: "movie", listName: "movies" }],
|
|
1013
|
+
[4030 /* Origin */, { detailName: "origin", listName: "origins" }],
|
|
1014
|
+
[4040 /* Person */, { detailName: "person", listName: "people" }],
|
|
1015
|
+
[4035 /* Power */, { detailName: "power", listName: "powers" }],
|
|
1016
|
+
[1700 /* Promo */, { detailName: "promo", listName: "promos" }],
|
|
1017
|
+
[4010 /* Publisher */, { detailName: "publisher", listName: "publishers" }],
|
|
1018
|
+
[4075 /* Series */, { detailName: "series", listName: "series_list" }],
|
|
1019
|
+
[4045 /* StoryArc */, { detailName: "story_arc", listName: "story_arcs" }],
|
|
1020
|
+
[4060 /* Team */, { detailName: "team", listName: "teams" }],
|
|
1021
|
+
[4055 /* Thing */, { detailName: "object", listName: "objects" }],
|
|
1022
|
+
[2300 /* Video */, { detailName: "video", listName: "videos" }],
|
|
1023
|
+
[
|
|
1024
|
+
2320 /* VideoCategory */,
|
|
1025
|
+
{ detailName: "video_category", listName: "video_categories" }
|
|
1026
|
+
],
|
|
1027
|
+
[
|
|
1028
|
+
2320 /* VideoType */,
|
|
1029
|
+
{ detailName: "video_type", listName: "video_types" }
|
|
1030
|
+
],
|
|
1031
|
+
[4050 /* Volume */, { detailName: "volume", listName: "volumes" }]
|
|
1032
|
+
]);
|
|
1033
|
+
getResource = (resourceType) => {
|
|
1034
|
+
const resource = resourceMap.get(resourceType);
|
|
1035
|
+
if (!resource) {
|
|
1036
|
+
throw new Error(`Resource type (${resourceType}) not found`);
|
|
1037
|
+
}
|
|
1038
|
+
return resource;
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
// src/resources/index.ts
|
|
1044
|
+
var init_resources = __esm({
|
|
1045
|
+
"src/resources/index.ts"() {
|
|
1046
|
+
"use strict";
|
|
1047
|
+
init_resource_factory();
|
|
1048
|
+
init_resource_map();
|
|
1049
|
+
init_resource_type();
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
// src/utils/index.ts
|
|
1054
|
+
var init_utils = __esm({
|
|
1055
|
+
"src/utils/index.ts"() {
|
|
1056
|
+
"use strict";
|
|
1057
|
+
init_case_converter();
|
|
1058
|
+
init_is_object();
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
// src/http-client/url-builder.ts
|
|
1063
|
+
var isDefined, UrlBuilder;
|
|
1064
|
+
var init_url_builder = __esm({
|
|
1065
|
+
"src/http-client/url-builder.ts"() {
|
|
1066
|
+
"use strict";
|
|
1067
|
+
init_resources();
|
|
1068
|
+
init_utils();
|
|
1069
|
+
isDefined = (value) => {
|
|
1070
|
+
return value != null;
|
|
1071
|
+
};
|
|
1072
|
+
UrlBuilder = class {
|
|
1073
|
+
constructor(apiKey, baseUrl) {
|
|
1074
|
+
this.apiKey = apiKey;
|
|
1075
|
+
this.baseUrl = baseUrl;
|
|
1076
|
+
}
|
|
1077
|
+
getParam(key, value) {
|
|
1078
|
+
if (value) {
|
|
1079
|
+
return { name: toSnakeCase(key), value };
|
|
1080
|
+
}
|
|
1081
|
+
return void 0;
|
|
1082
|
+
}
|
|
1083
|
+
getFormatParm() {
|
|
1084
|
+
return { name: "format", value: `json` };
|
|
1085
|
+
}
|
|
1086
|
+
getApiKeyParm() {
|
|
1087
|
+
return { name: "api_key", value: this.apiKey };
|
|
1088
|
+
}
|
|
1089
|
+
getSortParam(sort) {
|
|
1090
|
+
if (sort) {
|
|
1091
|
+
return { name: "sort", value: `${sort.field}:${sort.direction}` };
|
|
1092
|
+
}
|
|
1093
|
+
return void 0;
|
|
1094
|
+
}
|
|
1095
|
+
getLimitParam(limit) {
|
|
1096
|
+
if (limit) {
|
|
1097
|
+
return this.getParam("limit", limit);
|
|
1098
|
+
}
|
|
1099
|
+
return void 0;
|
|
1100
|
+
}
|
|
1101
|
+
getOffsetParam(offset) {
|
|
1102
|
+
if (offset) {
|
|
1103
|
+
return this.getParam("offset", offset);
|
|
1104
|
+
}
|
|
1105
|
+
return void 0;
|
|
1106
|
+
}
|
|
1107
|
+
getFieldListParams(fieldList) {
|
|
1108
|
+
if (fieldList) {
|
|
1109
|
+
return {
|
|
1110
|
+
name: "field_list",
|
|
1111
|
+
value: fieldList.map((field) => toSnakeCase(String(field))).join(",")
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
return void 0;
|
|
1115
|
+
}
|
|
1116
|
+
getFilterParams(filter) {
|
|
1117
|
+
if (filter) {
|
|
1118
|
+
const snakeCaseFilter = convertCamelCaseToSnakeCase(filter);
|
|
1119
|
+
const filterParams = Object.entries(snakeCaseFilter).map(
|
|
1120
|
+
([key, value]) => `${key}:${value}`
|
|
1121
|
+
);
|
|
1122
|
+
return { name: "filter", value: filterParams.join(",") };
|
|
1123
|
+
}
|
|
1124
|
+
return void 0;
|
|
1125
|
+
}
|
|
1126
|
+
buildUrl(urlInput, queryParams) {
|
|
1127
|
+
const url = new URL(urlInput, this.baseUrl);
|
|
1128
|
+
const urlSearchParams = new URLSearchParams(
|
|
1129
|
+
queryParams.filter(isDefined).map((param) => [param.name, param.value.toString()])
|
|
1130
|
+
);
|
|
1131
|
+
url.search = urlSearchParams.toString();
|
|
1132
|
+
return url.toString();
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* @param resourceType A unique identifier for the resource type
|
|
1136
|
+
* @param id A unique identifier for the resource
|
|
1137
|
+
* @returns A url for requesting the resource
|
|
1138
|
+
* @example https://comicvine.gamespot.com/api/issue/4000-719442?format=json&api_key=123abc
|
|
1139
|
+
*/
|
|
1140
|
+
retrieve(resourceType, id, options2) {
|
|
1141
|
+
const resource = getResource(resourceType);
|
|
1142
|
+
const urlInput = `${resource.detailName}/${resourceType}-${id}`;
|
|
1143
|
+
const queryParams = [
|
|
1144
|
+
this.getFormatParm(),
|
|
1145
|
+
this.getApiKeyParm(),
|
|
1146
|
+
this.getFieldListParams(options2 == null ? void 0 : options2.fieldList)
|
|
1147
|
+
];
|
|
1148
|
+
return this.buildUrl(urlInput, queryParams);
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* @param resourceType A unique identifier for the resource type
|
|
1152
|
+
* @returns A url for requesting a list of resources
|
|
1153
|
+
* @example https://comicvine.gamespot.com/api/issues?format=json&api_key=123abc
|
|
1154
|
+
*/
|
|
1155
|
+
list(resourceType, options2) {
|
|
1156
|
+
const urlInput = getResource(resourceType).listName;
|
|
1157
|
+
const queryParams = [
|
|
1158
|
+
this.getFormatParm(),
|
|
1159
|
+
this.getApiKeyParm(),
|
|
1160
|
+
this.getLimitParam(options2 == null ? void 0 : options2.limit),
|
|
1161
|
+
this.getOffsetParam(options2 == null ? void 0 : options2.offset),
|
|
1162
|
+
this.getSortParam(options2 == null ? void 0 : options2.sort),
|
|
1163
|
+
this.getFieldListParams(options2 == null ? void 0 : options2.fieldList),
|
|
1164
|
+
this.getFilterParams(options2 == null ? void 0 : options2.filter)
|
|
1165
|
+
];
|
|
1166
|
+
return this.buildUrl(urlInput, queryParams);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
// src/options/index.ts
|
|
1173
|
+
var import_zod, options, loadOptions;
|
|
1174
|
+
var init_options = __esm({
|
|
1175
|
+
"src/options/index.ts"() {
|
|
1176
|
+
"use strict";
|
|
1177
|
+
import_zod = require("zod");
|
|
1178
|
+
init_errors();
|
|
1179
|
+
options = import_zod.z.object({
|
|
1180
|
+
/**
|
|
1181
|
+
* The base url for the Comic Vine API.
|
|
1182
|
+
* This could be used to set a proxy when using the library in a browser.
|
|
1183
|
+
* It also ensures that if the comic vine url was to change it wouldn't be a breaking change to the library.
|
|
1184
|
+
* @default https://comicvine.gamespot.com/api/
|
|
1185
|
+
*/
|
|
1186
|
+
baseUrl: import_zod.z.string().url().optional().default("https://comicvine.gamespot.com/api/")
|
|
1187
|
+
});
|
|
1188
|
+
loadOptions = (userOptions) => {
|
|
1189
|
+
try {
|
|
1190
|
+
return options.parse(userOptions != null ? userOptions : {});
|
|
1191
|
+
} catch (error) {
|
|
1192
|
+
if (error instanceof import_zod.ZodError) {
|
|
1193
|
+
const validationError = error.issues[0];
|
|
1194
|
+
if (validationError) {
|
|
1195
|
+
throw new OptionsValidationError(
|
|
1196
|
+
validationError.path.filter(
|
|
1197
|
+
(segment) => typeof segment === "string" || typeof segment === "number"
|
|
1198
|
+
),
|
|
1199
|
+
validationError.message
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
throw new OptionsValidationError([], "Unknown validation error");
|
|
1203
|
+
}
|
|
1204
|
+
throw customError(error);
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
// src/comic-vine.ts
|
|
1211
|
+
function classNameToPropertyName(className) {
|
|
1212
|
+
if (!className) {
|
|
1213
|
+
return "";
|
|
1214
|
+
}
|
|
1215
|
+
return className.charAt(0).toLowerCase() + className.slice(1);
|
|
1216
|
+
}
|
|
1217
|
+
function normalizeRateLimitResourceName(resourceName) {
|
|
1218
|
+
var _a;
|
|
1219
|
+
return (_a = canonicalRateLimitResourceNames.get(toSnakeCase(resourceName))) != null ? _a : resourceName;
|
|
1220
|
+
}
|
|
1221
|
+
function inferComicVineRateLimitResource(url) {
|
|
1222
|
+
try {
|
|
1223
|
+
const pathname = new URL(url).pathname;
|
|
1224
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
1225
|
+
const apiIndex = segments.indexOf("api");
|
|
1226
|
+
const endpoint = apiIndex >= 0 ? segments[apiIndex + 1] : segments[0];
|
|
1227
|
+
if (!endpoint) {
|
|
1228
|
+
return "unknown";
|
|
1229
|
+
}
|
|
1230
|
+
return normalizeRateLimitResourceName(endpoint);
|
|
1231
|
+
} catch (e) {
|
|
1232
|
+
return "unknown";
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
var import_core2, resourceMappings, canonicalRateLimitResourceNames, ComicVine;
|
|
1236
|
+
var init_comic_vine = __esm({
|
|
1237
|
+
"src/comic-vine.ts"() {
|
|
1238
|
+
"use strict";
|
|
1239
|
+
import_core2 = require("@http-client-toolkit/core");
|
|
1240
|
+
init_hooks();
|
|
1241
|
+
init_url_builder();
|
|
1242
|
+
init_options();
|
|
1243
|
+
init_resources();
|
|
1244
|
+
init_resource_list();
|
|
1245
|
+
init_resource_map();
|
|
1246
|
+
init_resource_type();
|
|
1247
|
+
init_utils();
|
|
1248
|
+
resourceMappings = Object.values(ResourceType).filter((value) => typeof value === "number").map((resourceType) => getResource(resourceType));
|
|
1249
|
+
canonicalRateLimitResourceNames = /* @__PURE__ */ new Map();
|
|
1250
|
+
for (const { detailName, listName } of resourceMappings) {
|
|
1251
|
+
canonicalRateLimitResourceNames.set(detailName, listName);
|
|
1252
|
+
canonicalRateLimitResourceNames.set(listName, listName);
|
|
1253
|
+
canonicalRateLimitResourceNames.set(toSnakeCase(detailName), listName);
|
|
1254
|
+
canonicalRateLimitResourceNames.set(toSnakeCase(listName), listName);
|
|
1255
|
+
}
|
|
1256
|
+
ComicVine = class {
|
|
1257
|
+
/**
|
|
1258
|
+
* Create a new ComicVine client
|
|
1259
|
+
* @param options - Configuration options for the client
|
|
1260
|
+
*/
|
|
1261
|
+
constructor(options2) {
|
|
1262
|
+
this.resourceCache = /* @__PURE__ */ new Map();
|
|
1263
|
+
const { apiKey, baseUrl, stores = {}, client = {} } = options2;
|
|
1264
|
+
const _options = loadOptions({ baseUrl });
|
|
1265
|
+
const httpClient = new import_core2.HttpClient({
|
|
1266
|
+
name: "comic-vine-sdk",
|
|
1267
|
+
cache: stores.cache ? {
|
|
1268
|
+
store: stores.cache,
|
|
1269
|
+
ttl: client.defaultCacheTTL
|
|
1270
|
+
} : void 0,
|
|
1271
|
+
dedupe: stores.dedupe,
|
|
1272
|
+
rateLimit: stores.rateLimit ? {
|
|
1273
|
+
store: stores.rateLimit,
|
|
1274
|
+
throw: client.throwOnRateLimit,
|
|
1275
|
+
maxWaitTime: client.maxWaitTime
|
|
1276
|
+
} : void 0,
|
|
1277
|
+
responseTransformer: comicVineResponseTransformer,
|
|
1278
|
+
responseHandler: comicVineResponseHandler,
|
|
1279
|
+
errorHandler: comicVineErrorHandler,
|
|
1280
|
+
resourceKeyResolver: inferComicVineRateLimitResource
|
|
1281
|
+
});
|
|
1282
|
+
const urlBuilder = new UrlBuilder(apiKey, _options.baseUrl);
|
|
1283
|
+
this.resourceFactory = new ResourceFactory(httpClient, urlBuilder);
|
|
1284
|
+
this.stores = stores;
|
|
1285
|
+
this.resourceNames = Object.keys(resource_list_exports);
|
|
1286
|
+
return new Proxy(this, {
|
|
1287
|
+
get(target, prop) {
|
|
1288
|
+
if (typeof prop === "string" && target.isResourceProperty(prop)) {
|
|
1289
|
+
return target.getResource(prop);
|
|
1290
|
+
}
|
|
1291
|
+
return Reflect.get(target, prop);
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
isResourceProperty(prop) {
|
|
1296
|
+
const className = prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
1297
|
+
return this.resourceNames.includes(className);
|
|
1298
|
+
}
|
|
1299
|
+
getResource(propertyName) {
|
|
1300
|
+
if (!this.resourceCache.has(propertyName)) {
|
|
1301
|
+
const className = propertyName.charAt(0).toUpperCase() + propertyName.slice(1);
|
|
1302
|
+
try {
|
|
1303
|
+
const resource = this.resourceFactory.create(
|
|
1304
|
+
className
|
|
1305
|
+
);
|
|
1306
|
+
this.resourceCache.set(propertyName, resource);
|
|
1307
|
+
} catch (error) {
|
|
1308
|
+
throw new Error(`Failed to create resource '${className}': ${error}`, {
|
|
1309
|
+
cause: error
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return this.resourceCache.get(propertyName);
|
|
1314
|
+
}
|
|
1315
|
+
getAvailableResources() {
|
|
1316
|
+
return this.resourceNames.map((name) => classNameToPropertyName(name));
|
|
1317
|
+
}
|
|
1318
|
+
hasResource(resourceName) {
|
|
1319
|
+
return this.isResourceProperty(resourceName);
|
|
1320
|
+
}
|
|
1321
|
+
getResourceByName(resourceName) {
|
|
1322
|
+
if (!this.isResourceProperty(resourceName)) {
|
|
1323
|
+
return void 0;
|
|
1324
|
+
}
|
|
1325
|
+
return this.getResource(resourceName);
|
|
1326
|
+
}
|
|
1327
|
+
isResourceLoaded(resourceName) {
|
|
1328
|
+
return this.resourceCache.has(resourceName);
|
|
1329
|
+
}
|
|
1330
|
+
getCacheStats() {
|
|
1331
|
+
const total = this.resourceNames.length;
|
|
1332
|
+
const loaded = this.resourceCache.size;
|
|
1333
|
+
const loadedResources = Array.from(this.resourceCache.keys());
|
|
1334
|
+
return { total, loaded, loadedResources };
|
|
1335
|
+
}
|
|
1336
|
+
clearCache() {
|
|
1337
|
+
return __async(this, null, function* () {
|
|
1338
|
+
if (this.stores.cache) {
|
|
1339
|
+
yield this.stores.cache.clear();
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
getRateLimitStatus(resourceName) {
|
|
1344
|
+
return __async(this, null, function* () {
|
|
1345
|
+
if (this.stores.rateLimit) {
|
|
1346
|
+
return this.stores.rateLimit.getStatus(
|
|
1347
|
+
normalizeRateLimitResourceName(resourceName)
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
return null;
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
resetRateLimit(resourceName) {
|
|
1354
|
+
return __async(this, null, function* () {
|
|
1355
|
+
if (this.stores.rateLimit) {
|
|
1356
|
+
yield this.stores.rateLimit.reset(
|
|
1357
|
+
normalizeRateLimitResourceName(resourceName)
|
|
1358
|
+
);
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
// src/types/http-client.ts
|
|
1367
|
+
var init_http_client = __esm({
|
|
1368
|
+
"src/types/http-client.ts"() {
|
|
1369
|
+
"use strict";
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
|
|
1373
|
+
// src/types/iso-date.ts
|
|
1374
|
+
var init_iso_date = __esm({
|
|
1375
|
+
"src/types/iso-date.ts"() {
|
|
1376
|
+
"use strict";
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
// src/types/pick-filters.ts
|
|
1381
|
+
var init_pick_filters = __esm({
|
|
1382
|
+
"src/types/pick-filters.ts"() {
|
|
1383
|
+
"use strict";
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
// src/types/request.ts
|
|
1388
|
+
var init_request = __esm({
|
|
1389
|
+
"src/types/request.ts"() {
|
|
1390
|
+
"use strict";
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
// src/types/response.ts
|
|
1395
|
+
var init_response = __esm({
|
|
1396
|
+
"src/types/response.ts"() {
|
|
1397
|
+
"use strict";
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
// src/types/url-builder.ts
|
|
1402
|
+
var init_url_builder2 = __esm({
|
|
1403
|
+
"src/types/url-builder.ts"() {
|
|
1404
|
+
"use strict";
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
// src/types/valueof.ts
|
|
1409
|
+
var init_valueof = __esm({
|
|
1410
|
+
"src/types/valueof.ts"() {
|
|
1411
|
+
"use strict";
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
|
|
1415
|
+
// src/types/index.ts
|
|
1416
|
+
var init_types = __esm({
|
|
1417
|
+
"src/types/index.ts"() {
|
|
1418
|
+
"use strict";
|
|
1419
|
+
init_http_client();
|
|
1420
|
+
init_iso_date();
|
|
1421
|
+
init_pick_filters();
|
|
1422
|
+
init_request();
|
|
1423
|
+
init_response();
|
|
1424
|
+
init_url_builder2();
|
|
1425
|
+
init_valueof();
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
|
|
1429
|
+
// src/index.ts
|
|
1430
|
+
var index_exports = {};
|
|
1431
|
+
__export(index_exports, {
|
|
1432
|
+
ComicJsonpCallbackMissingError: () => ComicJsonpCallbackMissingError,
|
|
1433
|
+
ComicVine: () => ComicVine,
|
|
1434
|
+
ComicVineFilterError: () => ComicVineFilterError,
|
|
1435
|
+
ComicVineGenericError: () => ComicVineGenericError,
|
|
1436
|
+
ComicVineGenericRequestError: () => ComicVineGenericRequestError,
|
|
1437
|
+
ComicVineObjectNotFoundError: () => ComicVineObjectNotFoundError,
|
|
1438
|
+
ComicVineSubscriberOnlyError: () => ComicVineSubscriberOnlyError,
|
|
1439
|
+
ComicVineUnauthorizedError: () => ComicVineUnauthorizedError,
|
|
1440
|
+
ComicVineUrlFormatError: () => ComicVineUrlFormatError,
|
|
1441
|
+
GenericError: () => GenericError,
|
|
1442
|
+
OptionsValidationError: () => OptionsValidationError,
|
|
1443
|
+
StatusCode: () => StatusCode,
|
|
1444
|
+
customError: () => customError,
|
|
1445
|
+
default: () => index_default
|
|
1446
|
+
});
|
|
1447
|
+
var index_default;
|
|
1448
|
+
var init_index = __esm({
|
|
1449
|
+
"src/index.ts"() {
|
|
1450
|
+
"use strict";
|
|
1451
|
+
init_comic_vine();
|
|
1452
|
+
init_status_code();
|
|
1453
|
+
init_errors();
|
|
1454
|
+
init_types();
|
|
1455
|
+
index_default = ComicVine;
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
|
|
1459
|
+
// src/index-wrapper.cjs
|
|
1460
|
+
var esm = (init_index(), __toCommonJS(index_exports));
|
|
1461
|
+
module.exports = Object.assign(esm.default, esm);
|
|
1462
|
+
//# sourceMappingURL=index.cjs.map
|