@sparted/shared-library 1.9.5 → 1.9.6
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/package.json +3 -6
- package/.circleci/config.yml +0 -40
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -25
- package/.gitignore +0 -37
- package/.prettierrc.json +0 -6
- package/CHANGELOG.md +0 -457
- package/README.md +0 -26
- package/dist/package.json +0 -25
- package/global.d.ts +0 -2
- package/rollup.config.ts +0 -19
- package/sparted-shared-library-v1.7.93.tgz +0 -0
- package/src/array/__tests__/array-to-map.test.ts +0 -50
- package/src/array/__tests__/get-values-from-keys.test.ts +0 -14
- package/src/array/__tests__/inner-join.test.ts +0 -55
- package/src/array/__tests__/left-outter-join.test.ts +0 -55
- package/src/array/array-to-map.ts +0 -32
- package/src/array/get-values-from-keys.ts +0 -3
- package/src/array/index.ts +0 -4
- package/src/array/inner-join.ts +0 -10
- package/src/array/left-outter-join.ts +0 -10
- package/src/business/campaign/__tests__/compute-current-session.test.ts +0 -189
- package/src/business/campaign/__tests__/compute-intense-calendar.test.ts +0 -134
- package/src/business/campaign/__tests__/find-next-available-date.test.ts +0 -82
- package/src/business/campaign/__tests__/get-calendar-dession-dates-from-campaign.test.ts +0 -123
- package/src/business/campaign/index.ts +0 -1
- package/src/business/campaign/live-campaign.ts +0 -133
- package/src/business/course/index.ts +0 -1
- package/src/business/course/microknowledge-max-lengths.ts +0 -12
- package/src/business/index.ts +0 -4
- package/src/business/picture-spot/index.ts +0 -3
- package/src/business/types/achievement.ts +0 -41
- package/src/business/types/activity.ts +0 -64
- package/src/business/types/audience.ts +0 -23
- package/src/business/types/battle.ts +0 -17
- package/src/business/types/breaking-news.ts +0 -43
- package/src/business/types/campaign.ts +0 -163
- package/src/business/types/content.ts +0 -261
- package/src/business/types/document.ts +0 -17
- package/src/business/types/index.ts +0 -14
- package/src/business/types/media.ts +0 -18
- package/src/business/types/multilingual.ts +0 -47
- package/src/business/types/player.ts +0 -28
- package/src/business/types/score.ts +0 -61
- package/src/business/types/thematic.ts +0 -12
- package/src/business/types/user-engagement.ts +0 -11
- package/src/cdn/__tests__/cdn.factory.test.ts +0 -150
- package/src/cdn/__tests__/utils.test.ts +0 -528
- package/src/cdn/cdn.factory.ts +0 -70
- package/src/cdn/index.ts +0 -2
- package/src/cdn/types/cdn-factory.type.ts +0 -49
- package/src/cdn/types/index.ts +0 -1
- package/src/cdn/utils/extract-info-from-url.util.ts +0 -25
- package/src/cdn/utils/get-cdn-from-s3-url.util.ts +0 -20
- package/src/cdn/utils/get-cdn-url.util.ts +0 -31
- package/src/cdn/utils/twicpics-transformations.util.ts +0 -9
- package/src/chrono/get-approximated-session-time.ts +0 -27
- package/src/chrono/index.ts +0 -1
- package/src/color/__tests__/get-contrast-color.test.ts +0 -22
- package/src/color/get-contrast-color.ts +0 -18
- package/src/color/index.ts +0 -1
- package/src/crypto/__tests__/aes256.test.ts +0 -23
- package/src/crypto/aes256.ts +0 -22
- package/src/crypto/index.ts +0 -1
- package/src/date/__tests__/get-iso-day-number.test.ts +0 -34
- package/src/date/__tests__/get-remaining-time.test.ts +0 -78
- package/src/date/__tests__/get-start-of-day.test.ts +0 -92
- package/src/date/__tests__/is-same-date.test.ts +0 -50
- package/src/date/__tests__/shift-date-by.test.ts +0 -76
- package/src/date/__tests__/to-utc-date-string.test.ts +0 -28
- package/src/date/add-days.ts +0 -5
- package/src/date/difference-in-days.ts +0 -6
- package/src/date/get-iso-day-number.ts +0 -1
- package/src/date/get-next-day.ts +0 -6
- package/src/date/get-remaining-time.ts +0 -24
- package/src/date/get-start-of-day.ts +0 -11
- package/src/date/index.ts +0 -10
- package/src/date/is-same-date.ts +0 -7
- package/src/date/shift-date-by.ts +0 -17
- package/src/date/to-plain-date-string.ts +0 -1
- package/src/date/to-utc-date-string.ts +0 -3
- package/src/formatting/__tests__/format-number.test.ts +0 -11
- package/src/formatting/format-number.ts +0 -14
- package/src/formatting/index.ts +0 -1
- package/src/fp/__tests__/run-while.test.ts +0 -29
- package/src/fp/index.ts +0 -1
- package/src/fp/run-while.ts +0 -54
- package/src/http/__tests__/build-search-params.test.ts +0 -17
- package/src/http/__tests__/encode-search-object.test.ts +0 -34
- package/src/http/__tests__/fetch-with-timeout.test.ts +0 -50
- package/src/http/build-search-params.ts +0 -16
- package/src/http/encode-search-object.ts +0 -42
- package/src/http/fetch-with-timeout.ts +0 -27
- package/src/http/index.ts +0 -3
- package/src/index.ts +0 -19
- package/src/linked-list/__tests__/apply-diff-linked-list.test.ts +0 -103
- package/src/linked-list/__tests__/create-linked-list.test.ts +0 -204
- package/src/linked-list/__tests__/find-linked-list.test.ts +0 -40
- package/src/linked-list/__tests__/get-linked-list.test.ts +0 -28
- package/src/linked-list/__tests__/insert-linked-list.test.ts +0 -186
- package/src/linked-list/__tests__/linked-list-utils.test.ts +0 -252
- package/src/linked-list/__tests__/reduce-linked-list.test.ts +0 -31
- package/src/linked-list/__tests__/remove-linked-list.test.ts +0 -129
- package/src/linked-list/__tests__/update-linked-list.test.ts +0 -53
- package/src/linked-list/__tests__/while-linked-list.test.ts +0 -58
- package/src/linked-list/apply-diff-linked-list.ts +0 -35
- package/src/linked-list/create-linked-list.ts +0 -79
- package/src/linked-list/find-linked-list.ts +0 -26
- package/src/linked-list/get-linked-list.ts +0 -9
- package/src/linked-list/index.ts +0 -2
- package/src/linked-list/insert-linked-list.ts +0 -50
- package/src/linked-list/linked-list-utils.ts +0 -143
- package/src/linked-list/reduce-linked-list.ts +0 -18
- package/src/linked-list/remove-linked-list.ts +0 -36
- package/src/linked-list/type.ts +0 -38
- package/src/linked-list/update-linked-list.ts +0 -30
- package/src/linked-list/while-linked-list.ts +0 -33
- package/src/math/__tests__/clamp-number.test.ts +0 -30
- package/src/math/__tests__/interpolate.test.ts +0 -28
- package/src/math/__tests__/median.test.ts +0 -27
- package/src/math/__tests__/number-range.test.ts +0 -59
- package/src/math/__tests__/random-number.test.ts +0 -11
- package/src/math/clamp-number.ts +0 -8
- package/src/math/index.ts +0 -5
- package/src/math/interpolate.ts +0 -18
- package/src/math/median.ts +0 -21
- package/src/math/number-range.ts +0 -16
- package/src/math/random-number.ts +0 -10
- package/src/object/__tests__/merge-deep.test.ts +0 -56
- package/src/object/__tests__/strip-properties-from-object.test.ts +0 -65
- package/src/object/index.ts +0 -2
- package/src/object/merge-deep.ts +0 -26
- package/src/object/strip-properties-from-object.ts +0 -26
- package/src/parsing/__tests__/parse-boolean.test.ts +0 -15
- package/src/parsing/__tests__/parse-enum.test.ts +0 -19
- package/src/parsing/__tests__/parse-number.test.ts +0 -20
- package/src/parsing/index.ts +0 -3
- package/src/parsing/parse-boolean.ts +0 -10
- package/src/parsing/parse-enum.ts +0 -16
- package/src/parsing/parse-number.ts +0 -12
- package/src/predicates/__tests__/is-function.test.ts +0 -11
- package/src/predicates/__tests__/is-null.test.ts +0 -11
- package/src/predicates/__tests__/is-object.test.ts +0 -11
- package/src/predicates/__tests__/is-primitive.test.ts +0 -42
- package/src/predicates/__tests__/is-undefined.test.ts +0 -11
- package/src/predicates/__tests__/is-uuid.test.ts +0 -13
- package/src/predicates/index.ts +0 -5
- package/src/predicates/is-function.ts +0 -3
- package/src/predicates/is-null.ts +0 -1
- package/src/predicates/is-object.ts +0 -3
- package/src/predicates/is-primitive.ts +0 -19
- package/src/predicates/is-undefined.ts +0 -3
- package/src/predicates/is-uuid.ts +0 -3
- package/src/promise/__tests__/delay.test.ts +0 -13
- package/src/promise/__tests__/execute-or-resolve-default.test.ts +0 -25
- package/src/promise/__tests__/execute-with-delay.test.ts +0 -24
- package/src/promise/delay.ts +0 -3
- package/src/promise/execute-or-resolve-default.ts +0 -14
- package/src/promise/execute-with-delay.ts +0 -6
- package/src/promise/index.ts +0 -3
- package/src/string/__tests__/is-string-length-within-range.test.ts +0 -23
- package/src/string/__tests__/replace-in-template.test.ts +0 -52
- package/src/string/index.ts +0 -2
- package/src/string/is-string-length-within-range.ts +0 -10
- package/src/string/replace-in-template.ts +0 -45
- package/src/time/__tests__/convert.test.ts +0 -14
- package/src/time/__tests__/format-minutes.test.ts +0 -10
- package/src/time/__tests__/get-time-diff-as-string.test.ts +0 -128
- package/src/time/constants.ts +0 -4
- package/src/time/convert.ts +0 -5
- package/src/time/format-minutes.ts +0 -9
- package/src/time/get-time-diff-as-string.ts +0 -196
- package/src/time/index.ts +0 -4
- package/src/types/function.ts +0 -1
- package/src/types/general.ts +0 -15
- package/src/types/index.ts +0 -4
- package/src/types/object.ts +0 -33
- package/src/types/search.ts +0 -36
- package/tmp-lib.tgz +0 -0
- package/tsconfig.json +0 -25
- package/yarn.lock +0 -4280
- /package/{dist/_virtual → _virtual}/_tslib.js +0 -0
- /package/{dist/_virtual → _virtual}/_tslib.js.map +0 -0
- /package/{dist/array → array}/array-to-map.d.ts +0 -0
- /package/{dist/array → array}/array-to-map.js +0 -0
- /package/{dist/array → array}/array-to-map.js.map +0 -0
- /package/{dist/array → array}/get-values-from-keys.d.ts +0 -0
- /package/{dist/array → array}/get-values-from-keys.js +0 -0
- /package/{dist/array → array}/get-values-from-keys.js.map +0 -0
- /package/{dist/array → array}/index.d.ts +0 -0
- /package/{dist/array → array}/index.js +0 -0
- /package/{dist/array → array}/index.js.map +0 -0
- /package/{dist/array → array}/inner-join.d.ts +0 -0
- /package/{dist/array → array}/inner-join.js +0 -0
- /package/{dist/array → array}/inner-join.js.map +0 -0
- /package/{dist/array → array}/left-outter-join.d.ts +0 -0
- /package/{dist/array → array}/left-outter-join.js +0 -0
- /package/{dist/array → array}/left-outter-join.js.map +0 -0
- /package/{dist/business → business}/campaign/index.d.ts +0 -0
- /package/{dist/business → business}/campaign/index.js +0 -0
- /package/{dist/business → business}/campaign/index.js.map +0 -0
- /package/{dist/business → business}/campaign/live-campaign.d.ts +0 -0
- /package/{dist/business → business}/campaign/live-campaign.js +0 -0
- /package/{dist/business → business}/campaign/live-campaign.js.map +0 -0
- /package/{dist/business → business}/course/index.d.ts +0 -0
- /package/{dist/business → business}/course/index.js +0 -0
- /package/{dist/business → business}/course/index.js.map +0 -0
- /package/{dist/business → business}/course/microknowledge-max-lengths.d.ts +0 -0
- /package/{dist/business → business}/course/microknowledge-max-lengths.js +0 -0
- /package/{dist/business → business}/course/microknowledge-max-lengths.js.map +0 -0
- /package/{dist/business → business}/index.d.ts +0 -0
- /package/{dist/business → business}/index.js +0 -0
- /package/{dist/business → business}/index.js.map +0 -0
- /package/{dist/business → business}/picture-spot/index.d.ts +0 -0
- /package/{dist/business → business}/picture-spot/index.js +0 -0
- /package/{dist/business → business}/picture-spot/index.js.map +0 -0
- /package/{dist/business → business}/types/achievement.d.ts +0 -0
- /package/{dist/business → business}/types/activity.d.ts +0 -0
- /package/{dist/business → business}/types/activity.js +0 -0
- /package/{dist/business → business}/types/activity.js.map +0 -0
- /package/{dist/business → business}/types/audience.d.ts +0 -0
- /package/{dist/business → business}/types/battle.d.ts +0 -0
- /package/{dist/business → business}/types/breaking-news.d.ts +0 -0
- /package/{dist/business → business}/types/campaign.d.ts +0 -0
- /package/{dist/business → business}/types/campaign.js +0 -0
- /package/{dist/business → business}/types/campaign.js.map +0 -0
- /package/{dist/business → business}/types/content.d.ts +0 -0
- /package/{dist/business → business}/types/content.js +0 -0
- /package/{dist/business → business}/types/content.js.map +0 -0
- /package/{dist/business → business}/types/document.d.ts +0 -0
- /package/{dist/business → business}/types/index.d.ts +0 -0
- /package/{dist/business → business}/types/index.js +0 -0
- /package/{dist/business → business}/types/index.js.map +0 -0
- /package/{dist/business → business}/types/media.d.ts +0 -0
- /package/{dist/business → business}/types/multilingual.d.ts +0 -0
- /package/{dist/business → business}/types/multilingual.js +0 -0
- /package/{dist/business → business}/types/multilingual.js.map +0 -0
- /package/{dist/business → business}/types/player.d.ts +0 -0
- /package/{dist/business → business}/types/score.d.ts +0 -0
- /package/{dist/business → business}/types/score.js +0 -0
- /package/{dist/business → business}/types/score.js.map +0 -0
- /package/{dist/business → business}/types/thematic.d.ts +0 -0
- /package/{dist/business → business}/types/user-engagement.d.ts +0 -0
- /package/{dist/cdn → cdn}/cdn.factory.d.ts +0 -0
- /package/{dist/cdn → cdn}/cdn.factory.js +0 -0
- /package/{dist/cdn → cdn}/cdn.factory.js.map +0 -0
- /package/{dist/cdn → cdn}/index.d.ts +0 -0
- /package/{dist/cdn → cdn}/index.js +0 -0
- /package/{dist/cdn → cdn}/index.js.map +0 -0
- /package/{dist/cdn → cdn}/types/cdn-factory.type.d.ts +0 -0
- /package/{dist/cdn → cdn}/types/index.d.ts +0 -0
- /package/{dist/cdn → cdn}/types/index.js +0 -0
- /package/{dist/cdn → cdn}/types/index.js.map +0 -0
- /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.d.ts +0 -0
- /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js +0 -0
- /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js.map +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.d.ts +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js.map +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-url.util.d.ts +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js +0 -0
- /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js.map +0 -0
- /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.d.ts +0 -0
- /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.js +0 -0
- /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.js.map +0 -0
- /package/{dist/chrono → chrono}/get-approximated-session-time.d.ts +0 -0
- /package/{dist/chrono → chrono}/get-approximated-session-time.js +0 -0
- /package/{dist/chrono → chrono}/get-approximated-session-time.js.map +0 -0
- /package/{dist/chrono → chrono}/index.d.ts +0 -0
- /package/{dist/chrono → chrono}/index.js +0 -0
- /package/{dist/chrono → chrono}/index.js.map +0 -0
- /package/{dist/color → color}/get-contrast-color.d.ts +0 -0
- /package/{dist/color → color}/get-contrast-color.js +0 -0
- /package/{dist/color → color}/get-contrast-color.js.map +0 -0
- /package/{dist/color → color}/index.d.ts +0 -0
- /package/{dist/color → color}/index.js +0 -0
- /package/{dist/color → color}/index.js.map +0 -0
- /package/{dist/crypto → crypto}/aes256.d.ts +0 -0
- /package/{dist/crypto → crypto}/aes256.js +0 -0
- /package/{dist/crypto → crypto}/aes256.js.map +0 -0
- /package/{dist/crypto → crypto}/index.d.ts +0 -0
- /package/{dist/crypto → crypto}/index.js +0 -0
- /package/{dist/crypto → crypto}/index.js.map +0 -0
- /package/{dist/date → date}/add-days.d.ts +0 -0
- /package/{dist/date → date}/add-days.js +0 -0
- /package/{dist/date → date}/add-days.js.map +0 -0
- /package/{dist/date → date}/difference-in-days.d.ts +0 -0
- /package/{dist/date → date}/difference-in-days.js +0 -0
- /package/{dist/date → date}/difference-in-days.js.map +0 -0
- /package/{dist/date → date}/get-iso-day-number.d.ts +0 -0
- /package/{dist/date → date}/get-iso-day-number.js +0 -0
- /package/{dist/date → date}/get-iso-day-number.js.map +0 -0
- /package/{dist/date → date}/get-next-day.d.ts +0 -0
- /package/{dist/date → date}/get-next-day.js +0 -0
- /package/{dist/date → date}/get-next-day.js.map +0 -0
- /package/{dist/date → date}/get-remaining-time.d.ts +0 -0
- /package/{dist/date → date}/get-remaining-time.js +0 -0
- /package/{dist/date → date}/get-remaining-time.js.map +0 -0
- /package/{dist/date → date}/get-start-of-day.d.ts +0 -0
- /package/{dist/date → date}/get-start-of-day.js +0 -0
- /package/{dist/date → date}/get-start-of-day.js.map +0 -0
- /package/{dist/date → date}/index.d.ts +0 -0
- /package/{dist/date → date}/index.js +0 -0
- /package/{dist/date → date}/index.js.map +0 -0
- /package/{dist/date → date}/is-same-date.d.ts +0 -0
- /package/{dist/date → date}/is-same-date.js +0 -0
- /package/{dist/date → date}/is-same-date.js.map +0 -0
- /package/{dist/date → date}/shift-date-by.d.ts +0 -0
- /package/{dist/date → date}/shift-date-by.js +0 -0
- /package/{dist/date → date}/shift-date-by.js.map +0 -0
- /package/{dist/date → date}/to-plain-date-string.d.ts +0 -0
- /package/{dist/date → date}/to-plain-date-string.js +0 -0
- /package/{dist/date → date}/to-plain-date-string.js.map +0 -0
- /package/{dist/date → date}/to-utc-date-string.d.ts +0 -0
- /package/{dist/date → date}/to-utc-date-string.js +0 -0
- /package/{dist/date → date}/to-utc-date-string.js.map +0 -0
- /package/{dist/formatting → formatting}/format-number.d.ts +0 -0
- /package/{dist/formatting → formatting}/format-number.js +0 -0
- /package/{dist/formatting → formatting}/format-number.js.map +0 -0
- /package/{dist/formatting → formatting}/index.d.ts +0 -0
- /package/{dist/formatting → formatting}/index.js +0 -0
- /package/{dist/formatting → formatting}/index.js.map +0 -0
- /package/{dist/fp → fp}/index.d.ts +0 -0
- /package/{dist/fp → fp}/index.js +0 -0
- /package/{dist/fp → fp}/index.js.map +0 -0
- /package/{dist/fp → fp}/run-while.d.ts +0 -0
- /package/{dist/fp → fp}/run-while.js +0 -0
- /package/{dist/fp → fp}/run-while.js.map +0 -0
- /package/{dist/http → http}/build-search-params.d.ts +0 -0
- /package/{dist/http → http}/build-search-params.js +0 -0
- /package/{dist/http → http}/build-search-params.js.map +0 -0
- /package/{dist/http → http}/encode-search-object.d.ts +0 -0
- /package/{dist/http → http}/encode-search-object.js +0 -0
- /package/{dist/http → http}/encode-search-object.js.map +0 -0
- /package/{dist/http → http}/fetch-with-timeout.d.ts +0 -0
- /package/{dist/http → http}/fetch-with-timeout.js +0 -0
- /package/{dist/http → http}/fetch-with-timeout.js.map +0 -0
- /package/{dist/http → http}/index.d.ts +0 -0
- /package/{dist/http → http}/index.js +0 -0
- /package/{dist/http → http}/index.js.map +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/index.js.map → index.js.map} +0 -0
- /package/{dist/linked-list → linked-list}/apply-diff-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/create-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/create-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/create-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/find-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/find-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/find-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/get-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/get-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/get-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/index.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/index.js +0 -0
- /package/{dist/linked-list → linked-list}/index.js.map +0 -0
- /package/{dist/linked-list → linked-list}/insert-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/insert-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/insert-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/linked-list-utils.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/linked-list-utils.js +0 -0
- /package/{dist/linked-list → linked-list}/linked-list-utils.js.map +0 -0
- /package/{dist/linked-list → linked-list}/reduce-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/reduce-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/reduce-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/remove-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/remove-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/remove-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/type.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/update-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/update-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/update-linked-list.js.map +0 -0
- /package/{dist/linked-list → linked-list}/while-linked-list.d.ts +0 -0
- /package/{dist/linked-list → linked-list}/while-linked-list.js +0 -0
- /package/{dist/linked-list → linked-list}/while-linked-list.js.map +0 -0
- /package/{dist/math → math}/clamp-number.d.ts +0 -0
- /package/{dist/math → math}/clamp-number.js +0 -0
- /package/{dist/math → math}/clamp-number.js.map +0 -0
- /package/{dist/math → math}/index.d.ts +0 -0
- /package/{dist/math → math}/index.js +0 -0
- /package/{dist/math → math}/index.js.map +0 -0
- /package/{dist/math → math}/interpolate.d.ts +0 -0
- /package/{dist/math → math}/interpolate.js +0 -0
- /package/{dist/math → math}/interpolate.js.map +0 -0
- /package/{dist/math → math}/median.d.ts +0 -0
- /package/{dist/math → math}/median.js +0 -0
- /package/{dist/math → math}/median.js.map +0 -0
- /package/{dist/math → math}/number-range.d.ts +0 -0
- /package/{dist/math → math}/number-range.js +0 -0
- /package/{dist/math → math}/number-range.js.map +0 -0
- /package/{dist/math → math}/random-number.d.ts +0 -0
- /package/{dist/math → math}/random-number.js +0 -0
- /package/{dist/math → math}/random-number.js.map +0 -0
- /package/{dist/object → object}/index.d.ts +0 -0
- /package/{dist/object → object}/index.js +0 -0
- /package/{dist/object → object}/index.js.map +0 -0
- /package/{dist/object → object}/merge-deep.d.ts +0 -0
- /package/{dist/object → object}/merge-deep.js +0 -0
- /package/{dist/object → object}/merge-deep.js.map +0 -0
- /package/{dist/object → object}/strip-properties-from-object.d.ts +0 -0
- /package/{dist/object → object}/strip-properties-from-object.js +0 -0
- /package/{dist/object → object}/strip-properties-from-object.js.map +0 -0
- /package/{dist/parsing → parsing}/index.d.ts +0 -0
- /package/{dist/parsing → parsing}/index.js +0 -0
- /package/{dist/parsing → parsing}/index.js.map +0 -0
- /package/{dist/parsing → parsing}/parse-boolean.d.ts +0 -0
- /package/{dist/parsing → parsing}/parse-boolean.js +0 -0
- /package/{dist/parsing → parsing}/parse-boolean.js.map +0 -0
- /package/{dist/parsing → parsing}/parse-enum.d.ts +0 -0
- /package/{dist/parsing → parsing}/parse-enum.js +0 -0
- /package/{dist/parsing → parsing}/parse-enum.js.map +0 -0
- /package/{dist/parsing → parsing}/parse-number.d.ts +0 -0
- /package/{dist/parsing → parsing}/parse-number.js +0 -0
- /package/{dist/parsing → parsing}/parse-number.js.map +0 -0
- /package/{dist/predicates → predicates}/index.d.ts +0 -0
- /package/{dist/predicates → predicates}/index.js +0 -0
- /package/{dist/predicates → predicates}/index.js.map +0 -0
- /package/{dist/predicates → predicates}/is-function.d.ts +0 -0
- /package/{dist/predicates → predicates}/is-function.js +0 -0
- /package/{dist/predicates → predicates}/is-function.js.map +0 -0
- /package/{dist/predicates → predicates}/is-null.d.ts +0 -0
- /package/{dist/predicates → predicates}/is-null.js +0 -0
- /package/{dist/predicates → predicates}/is-null.js.map +0 -0
- /package/{dist/predicates → predicates}/is-object.d.ts +0 -0
- /package/{dist/predicates → predicates}/is-object.js +0 -0
- /package/{dist/predicates → predicates}/is-object.js.map +0 -0
- /package/{dist/predicates → predicates}/is-primitive.d.ts +0 -0
- /package/{dist/predicates → predicates}/is-primitive.js +0 -0
- /package/{dist/predicates → predicates}/is-primitive.js.map +0 -0
- /package/{dist/predicates → predicates}/is-undefined.d.ts +0 -0
- /package/{dist/predicates → predicates}/is-undefined.js +0 -0
- /package/{dist/predicates → predicates}/is-undefined.js.map +0 -0
- /package/{dist/predicates → predicates}/is-uuid.d.ts +0 -0
- /package/{dist/promise → promise}/delay.d.ts +0 -0
- /package/{dist/promise → promise}/delay.js +0 -0
- /package/{dist/promise → promise}/delay.js.map +0 -0
- /package/{dist/promise → promise}/execute-or-resolve-default.d.ts +0 -0
- /package/{dist/promise → promise}/execute-or-resolve-default.js +0 -0
- /package/{dist/promise → promise}/execute-or-resolve-default.js.map +0 -0
- /package/{dist/promise → promise}/execute-with-delay.d.ts +0 -0
- /package/{dist/promise → promise}/execute-with-delay.js +0 -0
- /package/{dist/promise → promise}/execute-with-delay.js.map +0 -0
- /package/{dist/promise → promise}/index.d.ts +0 -0
- /package/{dist/promise → promise}/index.js +0 -0
- /package/{dist/promise → promise}/index.js.map +0 -0
- /package/{dist/string → string}/index.d.ts +0 -0
- /package/{dist/string → string}/index.js +0 -0
- /package/{dist/string → string}/index.js.map +0 -0
- /package/{dist/string → string}/is-string-length-within-range.d.ts +0 -0
- /package/{dist/string → string}/is-string-length-within-range.js +0 -0
- /package/{dist/string → string}/is-string-length-within-range.js.map +0 -0
- /package/{dist/string → string}/replace-in-template.d.ts +0 -0
- /package/{dist/string → string}/replace-in-template.js +0 -0
- /package/{dist/string → string}/replace-in-template.js.map +0 -0
- /package/{dist/time → time}/constants.d.ts +0 -0
- /package/{dist/time → time}/constants.js +0 -0
- /package/{dist/time → time}/constants.js.map +0 -0
- /package/{dist/time → time}/convert.d.ts +0 -0
- /package/{dist/time → time}/convert.js +0 -0
- /package/{dist/time → time}/convert.js.map +0 -0
- /package/{dist/time → time}/format-minutes.d.ts +0 -0
- /package/{dist/time → time}/format-minutes.js +0 -0
- /package/{dist/time → time}/format-minutes.js.map +0 -0
- /package/{dist/time → time}/get-time-diff-as-string.d.ts +0 -0
- /package/{dist/time → time}/get-time-diff-as-string.js +0 -0
- /package/{dist/time → time}/get-time-diff-as-string.js.map +0 -0
- /package/{dist/time → time}/index.d.ts +0 -0
- /package/{dist/time → time}/index.js +0 -0
- /package/{dist/time → time}/index.js.map +0 -0
- /package/{dist/types → types}/function.d.ts +0 -0
- /package/{dist/types → types}/general.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/index.js +0 -0
- /package/{dist/types → types}/index.js.map +0 -0
- /package/{dist/types → types}/object.d.ts +0 -0
- /package/{dist/types → types}/search.d.ts +0 -0
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { DeepPartial } from 'ts-essentials';
|
|
2
|
-
|
|
3
|
-
import { Image, Media } from './media';
|
|
4
|
-
import { LanguageCode, MultilingualLabel } from './multilingual';
|
|
5
|
-
import { Thematic } from './thematic';
|
|
6
|
-
import { PlayerProfile } from './player';
|
|
7
|
-
|
|
8
|
-
export type ContentStatuses = Partial<{
|
|
9
|
-
[languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';
|
|
10
|
-
}>;
|
|
11
|
-
|
|
12
|
-
export type BOContentCard = {
|
|
13
|
-
id: number;
|
|
14
|
-
customId: string;
|
|
15
|
-
coverImage?: Image;
|
|
16
|
-
title: MultilingualLabel;
|
|
17
|
-
statuses: ContentStatuses;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type ErrorText = {
|
|
21
|
-
id: number;
|
|
22
|
-
type: 'error-text';
|
|
23
|
-
gameMedia: Media;
|
|
24
|
-
wrongText: MultilingualLabel;
|
|
25
|
-
correctText: MultilingualLabel;
|
|
26
|
-
explanationMedia: Media;
|
|
27
|
-
explanation: MultilingualLabel;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type ChoiceQuestion = {
|
|
31
|
-
text: MultilingualLabel;
|
|
32
|
-
correct: boolean;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type MultipleChoiceQuestion = {
|
|
36
|
-
id: number;
|
|
37
|
-
type: 'mcq';
|
|
38
|
-
gameMedia: Media;
|
|
39
|
-
question: MultilingualLabel;
|
|
40
|
-
choices: ChoiceQuestion[];
|
|
41
|
-
explanationMedia: Media;
|
|
42
|
-
explanation: MultilingualLabel;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type NoInteraction = {
|
|
46
|
-
id: number;
|
|
47
|
-
type: 'no-interaction';
|
|
48
|
-
firstMedia: Media;
|
|
49
|
-
title: MultilingualLabel;
|
|
50
|
-
text: MultilingualLabel;
|
|
51
|
-
secondMedia: Media;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type OpenQuestion = {
|
|
55
|
-
id: number;
|
|
56
|
-
type: 'open-question';
|
|
57
|
-
gameMedia: Media;
|
|
58
|
-
question: MultilingualLabel;
|
|
59
|
-
answer: MultilingualLabel;
|
|
60
|
-
levenshteinDistance: number;
|
|
61
|
-
explanationMedia: Media;
|
|
62
|
-
explanation: MultilingualLabel;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type OrderingCards = {
|
|
66
|
-
id: number;
|
|
67
|
-
type: 'ordering-cards';
|
|
68
|
-
question: MultilingualLabel;
|
|
69
|
-
topLabel: MultilingualLabel;
|
|
70
|
-
cards: MultilingualLabel[];
|
|
71
|
-
bottomLabel: MultilingualLabel;
|
|
72
|
-
explanation: MultilingualLabel;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type Spot = {
|
|
76
|
-
id: number;
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
r: number;
|
|
80
|
-
question: MultilingualLabel;
|
|
81
|
-
description: MultilingualLabel;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export type PictureSpot = {
|
|
85
|
-
id: number;
|
|
86
|
-
type: 'picture-spot';
|
|
87
|
-
image: Image;
|
|
88
|
-
items: Spot[];
|
|
89
|
-
explanation: MultilingualLabel;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export type SwipingCardPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
93
|
-
|
|
94
|
-
export type SwipingCardZone = {
|
|
95
|
-
position: SwipingCardPosition;
|
|
96
|
-
text: MultilingualLabel;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export type SwipingCard = {
|
|
100
|
-
image?: Image;
|
|
101
|
-
text?: MultilingualLabel;
|
|
102
|
-
answer: SwipingCardPosition;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export type SwipingCards = {
|
|
106
|
-
id: number;
|
|
107
|
-
type: 'swiping-cards';
|
|
108
|
-
question: MultilingualLabel;
|
|
109
|
-
zones: SwipingCardZone[];
|
|
110
|
-
cards: SwipingCard[];
|
|
111
|
-
explanation: MultilingualLabel;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export type Game =
|
|
115
|
-
| ErrorText
|
|
116
|
-
| MultipleChoiceQuestion
|
|
117
|
-
| NoInteraction
|
|
118
|
-
| OpenQuestion
|
|
119
|
-
| OrderingCards
|
|
120
|
-
| PictureSpot
|
|
121
|
-
| SwipingCards;
|
|
122
|
-
|
|
123
|
-
export type GameType =
|
|
124
|
-
| 'error-text'
|
|
125
|
-
| 'mcq'
|
|
126
|
-
| 'open-question'
|
|
127
|
-
| 'no-interaction'
|
|
128
|
-
| 'picture-spot'
|
|
129
|
-
| 'swiping-cards'
|
|
130
|
-
| 'ordering-cards';
|
|
131
|
-
|
|
132
|
-
export const GAME_TYPE: Record<string, GameType> = {
|
|
133
|
-
MCQ: 'mcq',
|
|
134
|
-
ERROR_TEXT: 'error-text',
|
|
135
|
-
OPEN_QUESTION: 'open-question',
|
|
136
|
-
NO_INTERACTION: 'no-interaction',
|
|
137
|
-
PICTURE_SPOT: 'picture-spot',
|
|
138
|
-
ORDERING_CARDS: 'ordering-cards',
|
|
139
|
-
SWIPING_CARDS: 'swiping-cards',
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export type ContentMetadata = {
|
|
143
|
-
identifier: string;
|
|
144
|
-
coverImage?: Image;
|
|
145
|
-
name: MultilingualLabel;
|
|
146
|
-
knowMore: MultilingualLabel;
|
|
147
|
-
thematic: Thematic;
|
|
148
|
-
type: GameType;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export type ContributionType =
|
|
152
|
-
| 'validated'
|
|
153
|
-
| 'created'
|
|
154
|
-
| 'edited'
|
|
155
|
-
| 'deleted'
|
|
156
|
-
| 'translation-requested'
|
|
157
|
-
| 'translation-validated'
|
|
158
|
-
| 'translation-unvalidated'
|
|
159
|
-
| 'validation-requested'
|
|
160
|
-
| 'archived'
|
|
161
|
-
| 'unarchived';
|
|
162
|
-
|
|
163
|
-
export type ContentContribution = {
|
|
164
|
-
id: number;
|
|
165
|
-
contributor: PlayerProfile;
|
|
166
|
-
type: ContributionType;
|
|
167
|
-
date: Date;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export type Content = {
|
|
171
|
-
id: number;
|
|
172
|
-
legacyKnowledgeId: number;
|
|
173
|
-
legacyContentIds: number[];
|
|
174
|
-
metadata: ContentMetadata;
|
|
175
|
-
game?: Game;
|
|
176
|
-
statuses: ContentStatuses;
|
|
177
|
-
contributions: ContentContribution[];
|
|
178
|
-
archived: boolean;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const isGameMultipleChoiceQuestion = (game: Game): game is MultipleChoiceQuestion => game.type === GAME_TYPE.MCQ;
|
|
182
|
-
export const isGameErrorText = (game: Game): game is ErrorText => game.type === GAME_TYPE.ERROR_TEXT;
|
|
183
|
-
export const isGameOpenQuestion = (game: Game): game is OpenQuestion => game.type === GAME_TYPE.OPEN_QUESTION;
|
|
184
|
-
export const isGameNoInteraction = (game: Game): game is NoInteraction => game.type === GAME_TYPE.NO_INTERACTION;
|
|
185
|
-
export const isGamePictureSpot = (game: Game): game is PictureSpot => game.type === GAME_TYPE.PICTURE_SPOT;
|
|
186
|
-
export const isGameOrderingCards = (game: Game): game is OrderingCards => game.type === GAME_TYPE.ORDERING_CARDS;
|
|
187
|
-
export const isGameSwipingCards = (game: Game): game is SwipingCards => game.type === GAME_TYPE.SWIPING_CARDS;
|
|
188
|
-
|
|
189
|
-
export const isPartialGameMultipleChoiceQuestion = (
|
|
190
|
-
game: DeepPartial<Game>,
|
|
191
|
-
): game is DeepPartial<MultipleChoiceQuestion> => game.type === GAME_TYPE.MCQ;
|
|
192
|
-
export const isPartialGameErrorText = (game: DeepPartial<Game>): game is DeepPartial<ErrorText> =>
|
|
193
|
-
game.type === GAME_TYPE.ERROR_TEXT;
|
|
194
|
-
export const isPartialGameOpenQuestion = (game: DeepPartial<Game>): game is DeepPartial<OpenQuestion> =>
|
|
195
|
-
game.type === GAME_TYPE.OPEN_QUESTION;
|
|
196
|
-
export const isPartialGameNoInteraction = (game: DeepPartial<Game>): game is DeepPartial<NoInteraction> =>
|
|
197
|
-
game.type === GAME_TYPE.NO_INTERACTION;
|
|
198
|
-
export const isPartialGamePictureSpot = (game: DeepPartial<Game>): game is DeepPartial<PictureSpot> =>
|
|
199
|
-
game.type === GAME_TYPE.PICTURE_SPOT;
|
|
200
|
-
export const isPartialGameOrderingCards = (game: DeepPartial<Game>): game is DeepPartial<OrderingCards> =>
|
|
201
|
-
game.type === GAME_TYPE.ORDERING_CARDS;
|
|
202
|
-
export const isPartialGameSwipingCards = (game: DeepPartial<Game>): game is DeepPartial<SwipingCards> =>
|
|
203
|
-
game.type === GAME_TYPE.SWIPING_CARDS;
|
|
204
|
-
|
|
205
|
-
export const extractGameExplanation = (game?: Game) => {
|
|
206
|
-
if (!game || game.type === 'no-interaction') {
|
|
207
|
-
return undefined;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return game.explanation;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const extractExplanation = (content: Content) => {
|
|
214
|
-
return extractGameExplanation(content.game);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
export const extractImages = (game: Game) => {
|
|
218
|
-
if (isGameOrderingCards(game)) {
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (isGameNoInteraction(game)) {
|
|
223
|
-
const images = [];
|
|
224
|
-
|
|
225
|
-
if (game.firstMedia.image?.url) {
|
|
226
|
-
images.push(game.firstMedia.image.url);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (game.secondMedia?.image?.url) {
|
|
230
|
-
images.push(game.secondMedia.image.url);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return images;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (isGamePictureSpot(game)) {
|
|
237
|
-
return [game.image.url];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (isGameSwipingCards(game)) {
|
|
241
|
-
return game.cards.reduce<string[]>((acc, card) => {
|
|
242
|
-
if (card.image?.url) {
|
|
243
|
-
acc.push(card.image.url);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return acc;
|
|
247
|
-
}, []);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const images = [];
|
|
251
|
-
|
|
252
|
-
if (game.gameMedia.image?.url) {
|
|
253
|
-
images.push(game.gameMedia.image.url);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (game.explanationMedia.image?.url) {
|
|
257
|
-
images.push(game.explanationMedia.image.url);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return images;
|
|
261
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type Document = {
|
|
2
|
-
archived: boolean;
|
|
3
|
-
available: boolean;
|
|
4
|
-
categoryId: number;
|
|
5
|
-
createdAt: string;
|
|
6
|
-
id: number;
|
|
7
|
-
path: string;
|
|
8
|
-
size: number;
|
|
9
|
-
title: string;
|
|
10
|
-
type: string;
|
|
11
|
-
updatedAt: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type Category = {
|
|
15
|
-
id: number;
|
|
16
|
-
label: string;
|
|
17
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './achievement';
|
|
2
|
-
export * from './activity';
|
|
3
|
-
export * from './audience';
|
|
4
|
-
export * from './battle';
|
|
5
|
-
export * from './breaking-news';
|
|
6
|
-
export * from './campaign';
|
|
7
|
-
export * from './content';
|
|
8
|
-
export * from './document';
|
|
9
|
-
export * from './media';
|
|
10
|
-
export * from './multilingual';
|
|
11
|
-
export * from './player';
|
|
12
|
-
export * from './score';
|
|
13
|
-
export * from './thematic';
|
|
14
|
-
export * from './user-engagement';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type Image = {
|
|
2
|
-
id: number;
|
|
3
|
-
url: string;
|
|
4
|
-
filename: string;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type Video = {
|
|
10
|
-
id: number;
|
|
11
|
-
url: string;
|
|
12
|
-
type: 'Youtube' | 'api.video' | 'Kumullus';
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type Media = {
|
|
16
|
-
image?: Image;
|
|
17
|
-
video?: Video;
|
|
18
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export const Languages = {
|
|
2
|
-
'en-US': 'us',
|
|
3
|
-
'fr-FR': 'fr',
|
|
4
|
-
'es-ES': 'es',
|
|
5
|
-
'it-IT': 'it',
|
|
6
|
-
'de-DE': 'de',
|
|
7
|
-
'ru-RU': 'ru',
|
|
8
|
-
'nl-NL': 'nl',
|
|
9
|
-
'pt-BR': 'br',
|
|
10
|
-
'zh-CN': 'cn',
|
|
11
|
-
'he-IL': 'il',
|
|
12
|
-
'cs-CZ': 'cz',
|
|
13
|
-
'ko-KR': 'kr',
|
|
14
|
-
'ja-JP': 'jp',
|
|
15
|
-
'zh-TW': 'tw',
|
|
16
|
-
'bg-BG': 'bg',
|
|
17
|
-
'hr-HR': 'hr',
|
|
18
|
-
'da-DK': 'dk',
|
|
19
|
-
'fi-FI': 'fi',
|
|
20
|
-
'el-GR': 'gr',
|
|
21
|
-
'hu-HU': 'hu',
|
|
22
|
-
'nb-NO': 'no',
|
|
23
|
-
'pl-PL': 'pl',
|
|
24
|
-
'pt-PT': 'pt',
|
|
25
|
-
'ro-RO': 'ro',
|
|
26
|
-
'sv-SE': 'se',
|
|
27
|
-
'tr-TR': 'tr',
|
|
28
|
-
sk: 'sk',
|
|
29
|
-
sl: 'sl',
|
|
30
|
-
'et-EE': 'ee',
|
|
31
|
-
'id-ID': 'id',
|
|
32
|
-
ar: 'ar',
|
|
33
|
-
lt: 'lt',
|
|
34
|
-
'lv-LV': 'lv',
|
|
35
|
-
'th-TH': 'th',
|
|
36
|
-
'vi-VN': 'vn',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type LanguageCode = keyof typeof Languages;
|
|
40
|
-
|
|
41
|
-
export type MultilingualLabel = { id: number } & Partial<{
|
|
42
|
-
[languageCode in LanguageCode]: string;
|
|
43
|
-
}>;
|
|
44
|
-
|
|
45
|
-
export function isLanguageCode(lang: string): lang is LanguageCode {
|
|
46
|
-
return !!Object.keys(Languages).includes(lang);
|
|
47
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Calendar } from './campaign';
|
|
2
|
-
|
|
3
|
-
export type PlayerProfile = {
|
|
4
|
-
id: number;
|
|
5
|
-
firstName: string;
|
|
6
|
-
lastName: string;
|
|
7
|
-
pseudo?: string;
|
|
8
|
-
profilePicture: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type PlayerWithParticipation = PlayerProfile & {
|
|
12
|
-
calendar: Calendar[];
|
|
13
|
-
hasPlayedToday: boolean;
|
|
14
|
-
hasFinished: boolean;
|
|
15
|
-
lastPlayedDate?: Date;
|
|
16
|
-
nbPlayedSessions: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type Opponent = {
|
|
20
|
-
id: number;
|
|
21
|
-
profile: PlayerProfile;
|
|
22
|
-
favorite: boolean;
|
|
23
|
-
scores: {
|
|
24
|
-
nbBattlesAgainstPlayer: number;
|
|
25
|
-
battleWonByPlayer: number;
|
|
26
|
-
};
|
|
27
|
-
challengeStatus: 'ready' | 'pending' | 'finished';
|
|
28
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export type Points = {
|
|
2
|
-
question: number;
|
|
3
|
-
chrono: number;
|
|
4
|
-
bonus: number;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type LiveCampaignPoints = {
|
|
8
|
-
question: number;
|
|
9
|
-
chrono: number;
|
|
10
|
-
bonus: number;
|
|
11
|
-
adaptive: number | null;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type Stars = {
|
|
15
|
-
question: number;
|
|
16
|
-
chrono: number;
|
|
17
|
-
bonus: number;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type Streaks = {
|
|
21
|
-
totalPoints: number;
|
|
22
|
-
streaksCount: number;
|
|
23
|
-
streaksCountHistory: number[];
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type Timer = {
|
|
27
|
-
timespent: number;
|
|
28
|
-
timeout: boolean;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type BaseScore = {
|
|
32
|
-
id?: number;
|
|
33
|
-
playerId: number;
|
|
34
|
-
contentId: number;
|
|
35
|
-
points: Points;
|
|
36
|
-
timer: Timer;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type CampaignScore = BaseScore & {
|
|
41
|
-
points: LiveCampaignPoints;
|
|
42
|
-
campaignId: number;
|
|
43
|
-
campaignContentId: number;
|
|
44
|
-
sessionNumber?: number; // TODO: should be required after conversion
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type WikiScore = BaseScore & {
|
|
48
|
-
wikiId: number;
|
|
49
|
-
campaignContentId: number;
|
|
50
|
-
sessionNumber?: number;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type BattleScore = BaseScore & {
|
|
54
|
-
battleId: number;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type Score = CampaignScore | WikiScore | BattleScore;
|
|
58
|
-
|
|
59
|
-
export const isCampaignScore = (score: Score): score is CampaignScore => 'campaignId' in score;
|
|
60
|
-
export const isWikiScore = (score: Score): score is WikiScore => 'wikiId' in score;
|
|
61
|
-
export const isBattleScore = (score: Score): score is BattleScore => 'battleId' in score;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCdn,
|
|
3
|
-
imgixTransformationQueries,
|
|
4
|
-
twicpicsTransformationQueries,
|
|
5
|
-
} from '../cdn.factory';
|
|
6
|
-
import type { InstanceMapper } from '../types';
|
|
7
|
-
import { getCdnFromS3UrlFactory } from '../utils/get-cdn-from-s3-url.util';
|
|
8
|
-
import { getCdnUrlFactory } from '../utils/get-cdn-url.util';
|
|
9
|
-
|
|
10
|
-
describe('TransformationQueries', () => {
|
|
11
|
-
it('Imgix - should handle imgix transformation', () => {
|
|
12
|
-
expect(
|
|
13
|
-
imgixTransformationQueries({
|
|
14
|
-
fit: 'crop',
|
|
15
|
-
width: 1,
|
|
16
|
-
height: 1,
|
|
17
|
-
}),
|
|
18
|
-
).toBe('auto=compress%2Cformat&fit=crop&h=1&w=1');
|
|
19
|
-
|
|
20
|
-
expect(imgixTransformationQueries({ fit: 'crop', width: 1 })).toBe(
|
|
21
|
-
'auto=compress%2Cformat&fit=crop&w=1',
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(imgixTransformationQueries({ fit: 'crop', height: 1 })).toBe(
|
|
25
|
-
'auto=compress%2Cformat&fit=crop&h=1',
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
expect(imgixTransformationQueries({ width: 1 })).toBe(
|
|
29
|
-
'auto=compress%2Cformat&w=1',
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
expect(imgixTransformationQueries({ height: 1 })).toBe(
|
|
33
|
-
'auto=compress%2Cformat&h=1',
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
expect(imgixTransformationQueries({ width: 1, height: 1 })).toBe(
|
|
37
|
-
'auto=compress%2Cformat&h=1&w=1',
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(imgixTransformationQueries({ devicePixelRatio: 2 })).toBe(
|
|
41
|
-
'auto=compress%2Cformat&dpr=2',
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
expect(imgixTransformationQueries({ quality: 75 })).toBe(
|
|
45
|
-
'auto=compress%2Cformat&q=75',
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
expect(imgixTransformationQueries({ quality: 75, compress: false })).toBe(
|
|
49
|
-
'q=75',
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
expect(imgixTransformationQueries({ compress: false })).toStrictEqual('');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should handle twicpics transformation', () => {
|
|
56
|
-
const crop = twicpicsTransformationQueries({
|
|
57
|
-
fit: 'crop',
|
|
58
|
-
width: 1,
|
|
59
|
-
height: 1,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
expect(crop).toBe('twic=v1/quality=70/crop=1x1');
|
|
63
|
-
|
|
64
|
-
const contain = twicpicsTransformationQueries({
|
|
65
|
-
fit: 'contain',
|
|
66
|
-
width: 1,
|
|
67
|
-
height: 1,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
expect(contain).toBe('twic=v1/quality=70/contain=1x1');
|
|
71
|
-
|
|
72
|
-
const coverOnlyWidth = twicpicsTransformationQueries({ width: 1 });
|
|
73
|
-
|
|
74
|
-
expect(coverOnlyWidth).toBe('twic=v1/quality=70/cover=1x-');
|
|
75
|
-
|
|
76
|
-
const coverOnlyHeight = twicpicsTransformationQueries({ height: 1 });
|
|
77
|
-
|
|
78
|
-
expect(coverOnlyHeight).toBe('twic=v1/quality=70/cover=-x1');
|
|
79
|
-
|
|
80
|
-
const noSize = twicpicsTransformationQueries({
|
|
81
|
-
fit: 'contain',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
expect(noSize).toBe('twic=v1/quality=70');
|
|
85
|
-
|
|
86
|
-
const quality = twicpicsTransformationQueries({
|
|
87
|
-
quality: 75,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
expect(quality).toBe('twic=v1/quality=75');
|
|
91
|
-
|
|
92
|
-
const devicePixelRatio = twicpicsTransformationQueries({
|
|
93
|
-
height: 100,
|
|
94
|
-
width: 45,
|
|
95
|
-
devicePixelRatio: 2,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
expect(devicePixelRatio).toBe('twic=v1/quality=70/cover=90x200');
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe('cdnFactory', () => {
|
|
103
|
-
it('Imgix - should instanciate the right cdn', () => {
|
|
104
|
-
const domain = 'https://sparted.imgix.fr';
|
|
105
|
-
const instanceMapper: InstanceMapper = (instanceId) => `/prod/${instanceId}`;
|
|
106
|
-
const getCdnUrl = getCdnUrlFactory({
|
|
107
|
-
domain,
|
|
108
|
-
instanceMapper,
|
|
109
|
-
transformationQueries: imgixTransformationQueries,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const getCdnFromS3Url = getCdnFromS3UrlFactory({
|
|
113
|
-
getCdnUrl,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const cdn = createCdn({
|
|
117
|
-
type: 'imgix',
|
|
118
|
-
domain: 'https://sparted.imgix.fr/',
|
|
119
|
-
instanceMapper,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
expect(cdn.getCdnUrl.toString()).toBe(getCdnUrl.toString());
|
|
123
|
-
|
|
124
|
-
expect(cdn.getCdnFromS3Url.toString()).toBe(getCdnFromS3Url.toString());
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('Twicpics - should instanciate the right cdn', () => {
|
|
128
|
-
const domain = 'https://sparted.twicpics.fr';
|
|
129
|
-
const instanceMapper: InstanceMapper = (instanceId) => `/prod/${instanceId}`;
|
|
130
|
-
const getCdnUrl = getCdnUrlFactory({
|
|
131
|
-
domain,
|
|
132
|
-
instanceMapper,
|
|
133
|
-
transformationQueries: twicpicsTransformationQueries,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const getCdnFromS3Url = getCdnFromS3UrlFactory({
|
|
137
|
-
getCdnUrl,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const cdn = createCdn({
|
|
141
|
-
type: 'twicpics',
|
|
142
|
-
domain: 'https://sparted.twicpics.fr/',
|
|
143
|
-
instanceMapper: (instanceId) => instanceId,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
expect(cdn.getCdnUrl.toString()).toBe(getCdnUrl.toString());
|
|
147
|
-
|
|
148
|
-
expect(cdn.getCdnFromS3Url.toString()).toBe(getCdnFromS3Url.toString());
|
|
149
|
-
});
|
|
150
|
-
});
|