@sparted/shared-library 1.0.29 → 1.1.0-rc0
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/.circleci/config.yml +40 -0
- package/.eslintignore +1 -0
- package/.eslintrc.json +25 -0
- package/.gitignore +37 -0
- package/.idea/.gitignore +8 -0
- package/.idea/codeStyles/Project.xml +35 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/shared-library.iml +11 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +100 -0
- package/.prettierrc.json +6 -0
- package/CHANGELOG.md +97 -0
- package/README.md +26 -0
- package/{_virtual → dist/_virtual}/_tslib.js +6 -1
- package/{_virtual → dist/_virtual}/_tslib.js.map +1 -1
- package/{array → dist/array}/array-to-map.d.ts +1 -1
- package/dist/business/picture-spot/index.d.ts +2 -0
- package/dist/business/picture-spot/index.js +8 -0
- package/dist/business/picture-spot/index.js.map +1 -0
- package/dist/business/types/content.d.ts +84 -0
- package/dist/business/types/index.d.ts +4 -0
- package/dist/business/types/media.d.ts +16 -0
- package/dist/business/types/multilingual.d.ts +3 -0
- package/dist/business/types/thematic.d.ts +9 -0
- package/dist/cdn/types/cdn-factory.type.d.ts +37 -0
- package/{cdn → dist/cdn}/utils/extract-info-from-url.util.d.ts +1 -1
- package/{cdn → dist/cdn}/utils/get-cdn-from-s3-url.util.d.ts +1 -1
- package/{cdn → dist/cdn}/utils/get-cdn-url.util.d.ts +1 -1
- package/{fp → dist/fp}/run-while.d.ts +2 -2
- package/{http → dist/http}/encode-search-object.d.ts +1 -1
- package/{http → dist/http}/fetch-with-timeout.d.ts +1 -1
- package/{index.d.ts → dist/index.d.ts} +0 -1
- package/{index.js → dist/index.js} +0 -2
- package/{index.js.map → dist/index.js.map} +1 -1
- package/{linked-list → dist/linked-list}/linked-list-utils.d.ts +4 -4
- package/{linked-list → dist/linked-list}/type.d.ts +7 -7
- package/{math → dist/math}/interpolate.d.ts +1 -1
- package/{math → dist/math}/number-range.d.ts +1 -1
- package/dist/package.json +65 -0
- package/{promise → dist/promise}/execute-or-resolve-default.d.ts +1 -1
- package/{string → dist/string}/replace-in-template.d.ts +1 -1
- package/{time → dist/time}/get-time-diff-as-string.d.ts +2 -2
- package/dist/types/function.d.ts +1 -0
- package/dist/types/general.d.ts +8 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/{types → dist/types}/object.d.ts +11 -11
- package/dist/types/search.d.ts +24 -0
- package/global.d.ts +2 -0
- package/package.json +2 -3
- package/rollup.config.ts +19 -0
- package/src/array/__tests__/array-to-map.test.ts +50 -0
- package/src/array/__tests__/get-values-from-keys.test.ts +14 -0
- package/src/array/__tests__/inner-join.test.ts +55 -0
- package/src/array/__tests__/left-outter-join.test.ts +55 -0
- package/src/array/array-to-map.ts +32 -0
- package/src/array/get-values-from-keys.ts +3 -0
- package/src/array/index.ts +4 -0
- package/src/array/inner-join.ts +10 -0
- package/src/array/left-outter-join.ts +10 -0
- package/src/business/picture-spot/index.ts +3 -0
- package/src/business/types/content.ts +110 -0
- package/src/business/types/index.ts +4 -0
- package/src/business/types/media.ts +18 -0
- package/src/business/types/multilingual.ts +3 -0
- package/src/business/types/thematic.ts +10 -0
- package/src/cdn/__tests__/cdn.factory.test.ts +150 -0
- package/src/cdn/__tests__/utils.test.ts +528 -0
- package/src/cdn/cdn.factory.ts +70 -0
- package/src/cdn/index.ts +2 -0
- package/src/cdn/types/cdn-factory.type.ts +49 -0
- package/src/cdn/types/index.ts +1 -0
- package/src/cdn/utils/extract-info-from-url.util.ts +25 -0
- package/src/cdn/utils/get-cdn-from-s3-url.util.ts +20 -0
- package/src/cdn/utils/get-cdn-url.util.ts +31 -0
- package/src/cdn/utils/twicpics-transformations.util.ts +9 -0
- package/src/formatting/__tests__/format-number.test.ts +11 -0
- package/src/formatting/format-number.ts +14 -0
- package/src/formatting/index.ts +1 -0
- package/src/fp/__tests__/run-while.test.ts +29 -0
- package/src/fp/index.ts +1 -0
- package/src/fp/run-while.ts +54 -0
- package/src/http/__tests__/build-search-params.test.ts +17 -0
- package/src/http/__tests__/encode-search-object.test.ts +34 -0
- package/src/http/__tests__/fetch-with-timeout.test.ts +50 -0
- package/src/http/build-search-params.ts +18 -0
- package/src/http/encode-search-object.ts +39 -0
- package/src/http/fetch-with-timeout.ts +24 -0
- package/src/http/index.ts +3 -0
- package/src/index.ts +14 -0
- package/src/linked-list/__tests__/apply-diff-linked-list.test.ts +103 -0
- package/src/linked-list/__tests__/create-linked-list.test.ts +204 -0
- package/src/linked-list/__tests__/find-linked-list.test.ts +40 -0
- package/src/linked-list/__tests__/get-linked-list.test.ts +28 -0
- package/src/linked-list/__tests__/insert-linked-list.test.ts +186 -0
- package/src/linked-list/__tests__/linked-list-utils.test.ts +252 -0
- package/src/linked-list/__tests__/reduce-linked-list.test.ts +31 -0
- package/src/linked-list/__tests__/remove-linked-list.test.ts +129 -0
- package/src/linked-list/__tests__/update-linked-list.test.ts +53 -0
- package/src/linked-list/__tests__/while-linked-list.test.ts +58 -0
- package/src/linked-list/apply-diff-linked-list.ts +35 -0
- package/src/linked-list/create-linked-list.ts +79 -0
- package/src/linked-list/find-linked-list.ts +26 -0
- package/src/linked-list/get-linked-list.ts +9 -0
- package/src/linked-list/index.ts +2 -0
- package/src/linked-list/insert-linked-list.ts +50 -0
- package/src/linked-list/linked-list-utils.ts +143 -0
- package/src/linked-list/reduce-linked-list.ts +18 -0
- package/src/linked-list/remove-linked-list.ts +36 -0
- package/src/linked-list/type.ts +38 -0
- package/src/linked-list/update-linked-list.ts +30 -0
- package/src/linked-list/while-linked-list.ts +33 -0
- package/src/math/__tests__/clamp-number.test.ts +30 -0
- package/src/math/__tests__/interpolate.test.ts +28 -0
- package/src/math/__tests__/median.test.ts +27 -0
- package/src/math/__tests__/number-range.test.ts +59 -0
- package/src/math/__tests__/random-number.test.ts +11 -0
- package/src/math/clamp-number.ts +8 -0
- package/src/math/index.ts +5 -0
- package/src/math/interpolate.ts +18 -0
- package/src/math/median.ts +21 -0
- package/src/math/number-range.ts +16 -0
- package/src/math/random-number.ts +10 -0
- package/src/object/__tests__/merge-deep.test.ts +56 -0
- package/src/object/__tests__/strip-properties-from-object.test.ts +65 -0
- package/src/object/index.ts +2 -0
- package/src/object/merge-deep.ts +26 -0
- package/src/object/strip-properties-from-object.ts +26 -0
- package/src/parsing/__tests__/parse-boolean.test.ts +15 -0
- package/src/parsing/__tests__/parse-enum.test.ts +19 -0
- package/src/parsing/__tests__/parse-number.test.ts +20 -0
- package/src/parsing/index.ts +3 -0
- package/src/parsing/parse-boolean.ts +10 -0
- package/src/parsing/parse-enum.ts +16 -0
- package/src/parsing/parse-number.ts +12 -0
- package/src/predicates/__tests__/is-function.test.ts +11 -0
- package/src/predicates/__tests__/is-null.test.ts +11 -0
- package/src/predicates/__tests__/is-object.test.ts +11 -0
- package/src/predicates/__tests__/is-primitive.test.ts +42 -0
- package/src/predicates/__tests__/is-undefined.test.ts +11 -0
- package/src/predicates/__tests__/is-uuid.test.ts +13 -0
- package/src/predicates/index.ts +5 -0
- package/src/predicates/is-function.ts +3 -0
- package/src/predicates/is-null.ts +1 -0
- package/src/predicates/is-object.ts +3 -0
- package/src/predicates/is-primitive.ts +19 -0
- package/src/predicates/is-undefined.ts +3 -0
- package/src/predicates/is-uuid.ts +3 -0
- package/src/promise/__tests__/delay.test.ts +13 -0
- package/src/promise/__tests__/execute-or-resolve-default.test.ts +25 -0
- package/src/promise/__tests__/execute-with-delay.test.ts +24 -0
- package/src/promise/delay.ts +3 -0
- package/src/promise/execute-or-resolve-default.ts +14 -0
- package/src/promise/execute-with-delay.ts +6 -0
- package/src/promise/index.ts +3 -0
- package/src/string/__tests__/is-string-length-within-range.test.ts +23 -0
- package/src/string/__tests__/replace-in-template.test.ts +52 -0
- package/src/string/index.ts +2 -0
- package/src/string/is-string-length-within-range.ts +10 -0
- package/src/string/replace-in-template.ts +45 -0
- package/src/time/__tests__/convert.test.ts +14 -0
- package/src/time/__tests__/format-minutes.test.ts +10 -0
- package/src/time/__tests__/get-time-diff-as-string.test.ts +128 -0
- package/src/time/constants.ts +4 -0
- package/src/time/convert.ts +5 -0
- package/src/time/format-minutes.ts +9 -0
- package/src/time/get-time-diff-as-string.ts +196 -0
- package/src/time/index.ts +4 -0
- package/src/types/function.ts +1 -0
- package/src/types/general.ts +15 -0
- package/src/types/index.ts +4 -0
- package/src/types/object.ts +33 -0
- package/src/types/search.ts +29 -0
- package/tsconfig.json +25 -0
- package/yarn.lock +4040 -0
- package/cdn/types/cdn-factory.type.d.ts +0 -37
- package/color/get-contrast-color.d.ts +0 -1
- package/color/get-contrast-color.js +0 -21
- package/color/get-contrast-color.js.map +0 -1
- package/color/index.d.ts +0 -1
- package/color/index.js +0 -10
- package/linked-list/index.js.map +0 -1
- package/types/function.d.ts +0 -1
- package/types/general.d.ts +0 -8
- package/types/search.d.ts +0 -24
- /package/{array → dist/array}/array-to-map.js +0 -0
- /package/{array → dist/array}/array-to-map.js.map +0 -0
- /package/{array → dist/array}/get-values-from-keys.d.ts +0 -0
- /package/{array → dist/array}/get-values-from-keys.js +0 -0
- /package/{array → dist/array}/get-values-from-keys.js.map +0 -0
- /package/{array → dist/array}/index.d.ts +0 -0
- /package/{array → dist/array}/index.js +0 -0
- /package/{array → dist/array}/index.js.map +0 -0
- /package/{array → dist/array}/inner-join.d.ts +0 -0
- /package/{array → dist/array}/inner-join.js +0 -0
- /package/{array → dist/array}/inner-join.js.map +0 -0
- /package/{array → dist/array}/left-outter-join.d.ts +0 -0
- /package/{array → dist/array}/left-outter-join.js +0 -0
- /package/{array → dist/array}/left-outter-join.js.map +0 -0
- /package/{cdn → dist/business}/types/index.js +0 -0
- /package/{cdn → dist/business}/types/index.js.map +0 -0
- /package/{cdn → dist/cdn}/cdn.factory.d.ts +0 -0
- /package/{cdn → dist/cdn}/cdn.factory.js +0 -0
- /package/{cdn → dist/cdn}/cdn.factory.js.map +0 -0
- /package/{cdn → dist/cdn}/index.d.ts +0 -0
- /package/{cdn → dist/cdn}/index.js +0 -0
- /package/{cdn → dist/cdn}/index.js.map +0 -0
- /package/{cdn → dist/cdn}/types/index.d.ts +0 -0
- /package/{types → dist/cdn/types}/index.js +0 -0
- /package/{types → dist/cdn/types}/index.js.map +0 -0
- /package/{cdn → dist/cdn}/utils/extract-info-from-url.util.js +0 -0
- /package/{cdn → dist/cdn}/utils/extract-info-from-url.util.js.map +0 -0
- /package/{cdn → dist/cdn}/utils/get-cdn-from-s3-url.util.js +0 -0
- /package/{cdn → dist/cdn}/utils/get-cdn-from-s3-url.util.js.map +0 -0
- /package/{cdn → dist/cdn}/utils/get-cdn-url.util.js +0 -0
- /package/{cdn → dist/cdn}/utils/get-cdn-url.util.js.map +0 -0
- /package/{cdn → dist/cdn}/utils/twicpics-transformations.util.d.ts +0 -0
- /package/{cdn → dist/cdn}/utils/twicpics-transformations.util.js +0 -0
- /package/{cdn → dist/cdn}/utils/twicpics-transformations.util.js.map +0 -0
- /package/{formatting → dist/formatting}/format-number.d.ts +0 -0
- /package/{formatting → dist/formatting}/format-number.js +0 -0
- /package/{formatting → dist/formatting}/format-number.js.map +0 -0
- /package/{formatting → dist/formatting}/index.d.ts +0 -0
- /package/{formatting → dist/formatting}/index.js +0 -0
- /package/{color → dist/formatting}/index.js.map +0 -0
- /package/{fp → dist/fp}/index.d.ts +0 -0
- /package/{fp → dist/fp}/index.js +0 -0
- /package/{formatting → dist/fp}/index.js.map +0 -0
- /package/{fp → dist/fp}/run-while.js +0 -0
- /package/{fp → dist/fp}/run-while.js.map +0 -0
- /package/{http → dist/http}/build-search-params.d.ts +0 -0
- /package/{http → dist/http}/build-search-params.js +0 -0
- /package/{http → dist/http}/build-search-params.js.map +0 -0
- /package/{http → dist/http}/encode-search-object.js +0 -0
- /package/{http → dist/http}/encode-search-object.js.map +0 -0
- /package/{http → dist/http}/fetch-with-timeout.js +0 -0
- /package/{http → dist/http}/fetch-with-timeout.js.map +0 -0
- /package/{http → dist/http}/index.d.ts +0 -0
- /package/{http → dist/http}/index.js +0 -0
- /package/{http → dist/http}/index.js.map +0 -0
- /package/{linked-list → dist/linked-list}/apply-diff-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/apply-diff-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/apply-diff-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/create-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/create-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/create-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/find-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/find-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/find-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/get-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/get-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/get-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/index.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/index.js +0 -0
- /package/{fp → dist/linked-list}/index.js.map +0 -0
- /package/{linked-list → dist/linked-list}/insert-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/insert-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/insert-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/linked-list-utils.js +0 -0
- /package/{linked-list → dist/linked-list}/linked-list-utils.js.map +0 -0
- /package/{linked-list → dist/linked-list}/reduce-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/reduce-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/reduce-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/remove-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/remove-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/remove-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/update-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/update-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/update-linked-list.js.map +0 -0
- /package/{linked-list → dist/linked-list}/while-linked-list.d.ts +0 -0
- /package/{linked-list → dist/linked-list}/while-linked-list.js +0 -0
- /package/{linked-list → dist/linked-list}/while-linked-list.js.map +0 -0
- /package/{math → dist/math}/clamp-number.d.ts +0 -0
- /package/{math → dist/math}/clamp-number.js +0 -0
- /package/{math → dist/math}/clamp-number.js.map +0 -0
- /package/{math → dist/math}/index.d.ts +0 -0
- /package/{math → dist/math}/index.js +0 -0
- /package/{math → dist/math}/index.js.map +0 -0
- /package/{math → dist/math}/interpolate.js +0 -0
- /package/{math → dist/math}/interpolate.js.map +0 -0
- /package/{math → dist/math}/median.d.ts +0 -0
- /package/{math → dist/math}/median.js +0 -0
- /package/{math → dist/math}/median.js.map +0 -0
- /package/{math → dist/math}/number-range.js +0 -0
- /package/{math → dist/math}/number-range.js.map +0 -0
- /package/{math → dist/math}/random-number.d.ts +0 -0
- /package/{math → dist/math}/random-number.js +0 -0
- /package/{math → dist/math}/random-number.js.map +0 -0
- /package/{object → dist/object}/index.d.ts +0 -0
- /package/{object → dist/object}/index.js +0 -0
- /package/{object → dist/object}/index.js.map +0 -0
- /package/{object → dist/object}/merge-deep.d.ts +0 -0
- /package/{object → dist/object}/merge-deep.js +0 -0
- /package/{object → dist/object}/merge-deep.js.map +0 -0
- /package/{object → dist/object}/strip-properties-from-object.d.ts +0 -0
- /package/{object → dist/object}/strip-properties-from-object.js +0 -0
- /package/{object → dist/object}/strip-properties-from-object.js.map +0 -0
- /package/{parsing → dist/parsing}/index.d.ts +0 -0
- /package/{parsing → dist/parsing}/index.js +0 -0
- /package/{parsing → dist/parsing}/index.js.map +0 -0
- /package/{parsing → dist/parsing}/parse-boolean.d.ts +0 -0
- /package/{parsing → dist/parsing}/parse-boolean.js +0 -0
- /package/{parsing → dist/parsing}/parse-boolean.js.map +0 -0
- /package/{parsing → dist/parsing}/parse-enum.d.ts +0 -0
- /package/{parsing → dist/parsing}/parse-enum.js +0 -0
- /package/{parsing → dist/parsing}/parse-enum.js.map +0 -0
- /package/{parsing → dist/parsing}/parse-number.d.ts +0 -0
- /package/{parsing → dist/parsing}/parse-number.js +0 -0
- /package/{parsing → dist/parsing}/parse-number.js.map +0 -0
- /package/{predicates → dist/predicates}/index.d.ts +0 -0
- /package/{predicates → dist/predicates}/index.js +0 -0
- /package/{predicates → dist/predicates}/index.js.map +0 -0
- /package/{predicates → dist/predicates}/is-function.d.ts +0 -0
- /package/{predicates → dist/predicates}/is-function.js +0 -0
- /package/{predicates → dist/predicates}/is-function.js.map +0 -0
- /package/{predicates → dist/predicates}/is-null.d.ts +0 -0
- /package/{predicates → dist/predicates}/is-null.js +0 -0
- /package/{predicates → dist/predicates}/is-null.js.map +0 -0
- /package/{predicates → dist/predicates}/is-object.d.ts +0 -0
- /package/{predicates → dist/predicates}/is-object.js +0 -0
- /package/{predicates → dist/predicates}/is-object.js.map +0 -0
- /package/{predicates → dist/predicates}/is-primitive.d.ts +0 -0
- /package/{predicates → dist/predicates}/is-primitive.js +0 -0
- /package/{predicates → dist/predicates}/is-primitive.js.map +0 -0
- /package/{predicates → dist/predicates}/is-undefined.d.ts +0 -0
- /package/{predicates → dist/predicates}/is-undefined.js +0 -0
- /package/{predicates → dist/predicates}/is-undefined.js.map +0 -0
- /package/{predicates → dist/predicates}/is-uuid.d.ts +0 -0
- /package/{promise → dist/promise}/delay.d.ts +0 -0
- /package/{promise → dist/promise}/delay.js +0 -0
- /package/{promise → dist/promise}/delay.js.map +0 -0
- /package/{promise → dist/promise}/execute-or-resolve-default.js +0 -0
- /package/{promise → dist/promise}/execute-or-resolve-default.js.map +0 -0
- /package/{promise → dist/promise}/execute-with-delay.d.ts +0 -0
- /package/{promise → dist/promise}/execute-with-delay.js +0 -0
- /package/{promise → dist/promise}/execute-with-delay.js.map +0 -0
- /package/{promise → dist/promise}/index.d.ts +0 -0
- /package/{promise → dist/promise}/index.js +0 -0
- /package/{promise → dist/promise}/index.js.map +0 -0
- /package/{string → dist/string}/index.d.ts +0 -0
- /package/{string → dist/string}/index.js +0 -0
- /package/{string → dist/string}/index.js.map +0 -0
- /package/{string → dist/string}/is-string-length-within-range.d.ts +0 -0
- /package/{string → dist/string}/is-string-length-within-range.js +0 -0
- /package/{string → dist/string}/is-string-length-within-range.js.map +0 -0
- /package/{string → dist/string}/replace-in-template.js +0 -0
- /package/{string → dist/string}/replace-in-template.js.map +0 -0
- /package/{time → dist/time}/constants.d.ts +0 -0
- /package/{time → dist/time}/constants.js +0 -0
- /package/{time → dist/time}/constants.js.map +0 -0
- /package/{time → dist/time}/convert.d.ts +0 -0
- /package/{time → dist/time}/convert.js +0 -0
- /package/{time → dist/time}/convert.js.map +0 -0
- /package/{time → dist/time}/format-minutes.d.ts +0 -0
- /package/{time → dist/time}/format-minutes.js +0 -0
- /package/{time → dist/time}/format-minutes.js.map +0 -0
- /package/{time → dist/time}/get-time-diff-as-string.js +0 -0
- /package/{time → dist/time}/get-time-diff-as-string.js.map +0 -0
- /package/{time → dist/time}/index.d.ts +0 -0
- /package/{time → dist/time}/index.js +0 -0
- /package/{time → dist/time}/index.js.map +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Javascript Node CircleCI 2.0 configuration file
|
|
2
|
+
#
|
|
3
|
+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
|
|
4
|
+
#
|
|
5
|
+
version: 2.1
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
docker:
|
|
9
|
+
- image: cimg/node:18.10.0
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- checkout
|
|
13
|
+
|
|
14
|
+
- run:
|
|
15
|
+
name: Set npm token
|
|
16
|
+
command: 'echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc'
|
|
17
|
+
|
|
18
|
+
- run:
|
|
19
|
+
name: Install node modules
|
|
20
|
+
command: yarn
|
|
21
|
+
|
|
22
|
+
- run:
|
|
23
|
+
name: Check lint
|
|
24
|
+
command: yarn lint
|
|
25
|
+
|
|
26
|
+
- run:
|
|
27
|
+
name: Run tests
|
|
28
|
+
# Limit resources as the default parameters overload the CPU of the machine and makes tests hang
|
|
29
|
+
command: yarn test --maxWorkers=50%
|
|
30
|
+
|
|
31
|
+
- run:
|
|
32
|
+
name: Build
|
|
33
|
+
command: yarn build
|
|
34
|
+
|
|
35
|
+
workflows:
|
|
36
|
+
version: 2
|
|
37
|
+
|
|
38
|
+
autodeploy:
|
|
39
|
+
jobs:
|
|
40
|
+
- test
|
package/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist/
|
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2021": true,
|
|
4
|
+
"node": true
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
"@typescript-eslint",
|
|
8
|
+
"prettier",
|
|
9
|
+
"import"
|
|
10
|
+
],
|
|
11
|
+
"extends": [
|
|
12
|
+
"eslint:recommended",
|
|
13
|
+
"plugin:@typescript-eslint/recommended",
|
|
14
|
+
"plugin:import/recommended",
|
|
15
|
+
"plugin:import/typescript",
|
|
16
|
+
"prettier"
|
|
17
|
+
],
|
|
18
|
+
"parser": "@typescript-eslint/parser",
|
|
19
|
+
"rules": {
|
|
20
|
+
"prettier/prettier": "warn",
|
|
21
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
22
|
+
"@typescript-eslint/ban-types": "warn",
|
|
23
|
+
"@typescript-eslint/ban-ts-comment": "warn"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/.gitignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
*.dat
|
|
2
|
+
*.iml
|
|
3
|
+
*.log
|
|
4
|
+
*.out
|
|
5
|
+
*.pid
|
|
6
|
+
*.seed
|
|
7
|
+
*.sublime-*
|
|
8
|
+
*.swo
|
|
9
|
+
*.swp
|
|
10
|
+
*.tgz
|
|
11
|
+
*.xml
|
|
12
|
+
.tmp
|
|
13
|
+
.env
|
|
14
|
+
doc/*.json
|
|
15
|
+
|
|
16
|
+
# Mac Related files
|
|
17
|
+
.DS_Store
|
|
18
|
+
|
|
19
|
+
# IDE Related Files
|
|
20
|
+
.idea
|
|
21
|
+
.project
|
|
22
|
+
|
|
23
|
+
# eslint
|
|
24
|
+
.eslintcache
|
|
25
|
+
|
|
26
|
+
# jest
|
|
27
|
+
jest-stare
|
|
28
|
+
|
|
29
|
+
# JS Related files
|
|
30
|
+
bower_components
|
|
31
|
+
npm-debug.log
|
|
32
|
+
node_modules
|
|
33
|
+
nestjs/node_modules
|
|
34
|
+
.npmrc
|
|
35
|
+
|
|
36
|
+
# Build
|
|
37
|
+
dist
|
package/.idea/.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<JSCodeStyleSettings version="0">
|
|
4
|
+
<option name="VAR_DECLARATION_WRAP" value="2" />
|
|
5
|
+
<option name="OBJECT_LITERAL_WRAP" value="2" />
|
|
6
|
+
</JSCodeStyleSettings>
|
|
7
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
8
|
+
<option name="VAR_DECLARATION_WRAP" value="2" />
|
|
9
|
+
<option name="OBJECT_LITERAL_WRAP" value="2" />
|
|
10
|
+
</TypeScriptCodeStyleSettings>
|
|
11
|
+
<codeStyleSettings language="JavaScript">
|
|
12
|
+
<option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
|
|
13
|
+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
|
14
|
+
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
|
|
15
|
+
<option name="IF_BRACE_FORCE" value="1" />
|
|
16
|
+
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
|
17
|
+
<option name="WHILE_BRACE_FORCE" value="1" />
|
|
18
|
+
<option name="FOR_BRACE_FORCE" value="1" />
|
|
19
|
+
</codeStyleSettings>
|
|
20
|
+
<codeStyleSettings language="TypeScript">
|
|
21
|
+
<option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
|
|
22
|
+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
|
23
|
+
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
|
|
24
|
+
<option name="IF_BRACE_FORCE" value="1" />
|
|
25
|
+
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
|
26
|
+
<option name="WHILE_BRACE_FORCE" value="1" />
|
|
27
|
+
<option name="FOR_BRACE_FORCE" value="1" />
|
|
28
|
+
<indentOptions>
|
|
29
|
+
<option name="INDENT_SIZE" value="2" />
|
|
30
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
31
|
+
<option name="TAB_SIZE" value="2" />
|
|
32
|
+
</indentOptions>
|
|
33
|
+
</codeStyleSettings>
|
|
34
|
+
</code_scheme>
|
|
35
|
+
</component>
|
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/shared-library.iml" filepath="$PROJECT_DIR$/.idea/shared-library.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="9c51afc7-3a2a-462c-a7b1-b3e0ca474b0c" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="Git.Settings">
|
|
14
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
15
|
+
</component>
|
|
16
|
+
<component name="GoLibraries">
|
|
17
|
+
<option name="indexEntireGoPath" value="true" />
|
|
18
|
+
</component>
|
|
19
|
+
<component name="MarkdownSettingsMigration">
|
|
20
|
+
<option name="stateVersion" value="1" />
|
|
21
|
+
</component>
|
|
22
|
+
<component name="ProjectId" id="2LBBaAUnkGvlewEioyoXgDTb3Rx" />
|
|
23
|
+
<component name="ProjectLevelVcsManager">
|
|
24
|
+
<ConfirmationsSetting value="2" id="Add" />
|
|
25
|
+
</component>
|
|
26
|
+
<component name="ProjectViewState">
|
|
27
|
+
<option name="autoscrollFromSource" value="true" />
|
|
28
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
29
|
+
<option name="showLibraryContents" value="true" />
|
|
30
|
+
</component>
|
|
31
|
+
<component name="PropertiesComponent">{
|
|
32
|
+
"keyToString": {
|
|
33
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
34
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
35
|
+
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
|
36
|
+
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
|
37
|
+
"WebServerToolWindowFactoryState": "false",
|
|
38
|
+
"dart.analysis.tool.window.visible": "false",
|
|
39
|
+
"git-widget-placeholder": "master",
|
|
40
|
+
"go.import.settings.migrated": "true",
|
|
41
|
+
"last_opened_file_path": "/Users/cchampou/dev/shared-library",
|
|
42
|
+
"node.js.detected.package.eslint": "true",
|
|
43
|
+
"node.js.detected.package.standard": "true",
|
|
44
|
+
"node.js.detected.package.tslint": "true",
|
|
45
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
46
|
+
"node.js.selected.package.standard": "",
|
|
47
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
48
|
+
"nodejs_package_manager_path": "yarn",
|
|
49
|
+
"settings.editor.selected.configurable": "settings.javascript.linters.eslint",
|
|
50
|
+
"show.migrate.to.gradle.popup": "false",
|
|
51
|
+
"ts.external.directory.path": "/Users/cchampou/dev/shared-library/node_modules/typescript/lib",
|
|
52
|
+
"vue.rearranger.settings.migration": "true"
|
|
53
|
+
}
|
|
54
|
+
}</component>
|
|
55
|
+
<component name="RecentsManager">
|
|
56
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
57
|
+
<recent name="$PROJECT_DIR$/src/business/types" />
|
|
58
|
+
<recent name="$PROJECT_DIR$/src/types/business" />
|
|
59
|
+
<recent name="$PROJECT_DIR$/src/business" />
|
|
60
|
+
<recent name="$PROJECT_DIR$/src/types" />
|
|
61
|
+
</key>
|
|
62
|
+
</component>
|
|
63
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
64
|
+
<component name="TaskManager">
|
|
65
|
+
<task active="true" id="Default" summary="Default task">
|
|
66
|
+
<changelist id="9c51afc7-3a2a-462c-a7b1-b3e0ca474b0c" name="Changes" comment="" />
|
|
67
|
+
<created>1675334656680</created>
|
|
68
|
+
<option name="number" value="Default" />
|
|
69
|
+
<option name="presentableId" value="Default" />
|
|
70
|
+
<updated>1675334656680</updated>
|
|
71
|
+
<workItem from="1675334657881" duration="9370000" />
|
|
72
|
+
<workItem from="1675413502042" duration="3448000" />
|
|
73
|
+
<workItem from="1675777811478" duration="2023000" />
|
|
74
|
+
<workItem from="1676048809145" duration="1369000" />
|
|
75
|
+
<workItem from="1676285644197" duration="9643000" />
|
|
76
|
+
<workItem from="1676390431531" duration="720000" />
|
|
77
|
+
<workItem from="1677080847564" duration="1233000" />
|
|
78
|
+
<workItem from="1679044878990" duration="2004000" />
|
|
79
|
+
<workItem from="1689058230559" duration="5032000" />
|
|
80
|
+
<workItem from="1692285159365" duration="2040000" />
|
|
81
|
+
<workItem from="1692345932803" duration="2572000" />
|
|
82
|
+
<workItem from="1692883384801" duration="809000" />
|
|
83
|
+
<workItem from="1704897952885" duration="6308000" />
|
|
84
|
+
<workItem from="1704980905659" duration="3963000" />
|
|
85
|
+
<workItem from="1705481044854" duration="756000" />
|
|
86
|
+
</task>
|
|
87
|
+
<servers />
|
|
88
|
+
</component>
|
|
89
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
90
|
+
<option name="version" value="3" />
|
|
91
|
+
</component>
|
|
92
|
+
<component name="VgoProject">
|
|
93
|
+
<integration-enabled>false</integration-enabled>
|
|
94
|
+
<settings-migrated>true</settings-migrated>
|
|
95
|
+
</component>
|
|
96
|
+
<component name="XSLT-Support.FileAssociations.UIState">
|
|
97
|
+
<expand />
|
|
98
|
+
<select />
|
|
99
|
+
</component>
|
|
100
|
+
</project>
|
package/.prettierrc.json
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
## 1.0.28
|
|
2
|
+
- Fix `twicpicsTransformationQueries` function to have integer values
|
|
3
|
+
|
|
4
|
+
## 1.0.27
|
|
5
|
+
- Add `isStringLengthWithinRange` function
|
|
6
|
+
|
|
7
|
+
## 1.0.26
|
|
8
|
+
- Add `innerJoin` to `index.ts`
|
|
9
|
+
|
|
10
|
+
## 1.0.25
|
|
11
|
+
- Add `innerJoin` function for arrays
|
|
12
|
+
- Modify `leftOutterJoin` function implementation
|
|
13
|
+
|
|
14
|
+
## 1.0.24
|
|
15
|
+
- Add `leftOutterJoin` function for arrays
|
|
16
|
+
|
|
17
|
+
## 1.0.23
|
|
18
|
+
- Add ability to define constructor params in `ClassType`
|
|
19
|
+
|
|
20
|
+
## 1.0.22
|
|
21
|
+
- Fix `stripPropertiesFromObject` issue with null values
|
|
22
|
+
|
|
23
|
+
## 1.0.21
|
|
24
|
+
- Fix exports from `object` directory
|
|
25
|
+
|
|
26
|
+
## 1.0.20
|
|
27
|
+
- Add `stripPropertiesFromObject` function
|
|
28
|
+
|
|
29
|
+
## 1.0.19
|
|
30
|
+
- Fix export `median` function
|
|
31
|
+
|
|
32
|
+
## 1.0.18
|
|
33
|
+
- Add math `median` function
|
|
34
|
+
|
|
35
|
+
## 1.0.17
|
|
36
|
+
- Handle device pixel ratio (DPR) in Twicpics transformations
|
|
37
|
+
|
|
38
|
+
## 1.0.16
|
|
39
|
+
- Set twicpics image quality to 90
|
|
40
|
+
|
|
41
|
+
## 1.0.15
|
|
42
|
+
- Handle only width or only height in twicpics transformations
|
|
43
|
+
|
|
44
|
+
## 1.0.14
|
|
45
|
+
- Fix: bad tarball published
|
|
46
|
+
|
|
47
|
+
## 1.0.13
|
|
48
|
+
- Add output format query param
|
|
49
|
+
|
|
50
|
+
## 1.0.12
|
|
51
|
+
- Add cache version query param
|
|
52
|
+
|
|
53
|
+
## 1.0.11
|
|
54
|
+
- Add valueOf type
|
|
55
|
+
|
|
56
|
+
## 1.0.10
|
|
57
|
+
|
|
58
|
+
## 1.0.9
|
|
59
|
+
- Add option to remove image compression
|
|
60
|
+
|
|
61
|
+
## 1.0.8
|
|
62
|
+
- Fix crash when passing undefined to extractInfoFromUrl function
|
|
63
|
+
|
|
64
|
+
## 1.0.7
|
|
65
|
+
- Fix Twicpics resizing
|
|
66
|
+
|
|
67
|
+
## 1.0.6
|
|
68
|
+
- Add current map to `dataModifier` function on `arrayToMap`
|
|
69
|
+
|
|
70
|
+
## 1.0.5
|
|
71
|
+
- CDN abstraction for Imgix and Twicpics
|
|
72
|
+
|
|
73
|
+
## 1.0.0
|
|
74
|
+
- Breaking change: rename date folder into time
|
|
75
|
+
- Export convertion functions from time
|
|
76
|
+
|
|
77
|
+
## 0.0.18
|
|
78
|
+
- Change update behavior to fully replace updated items
|
|
79
|
+
|
|
80
|
+
## 0.0.17
|
|
81
|
+
- Remove error thrown when not every items have been visisted
|
|
82
|
+
|
|
83
|
+
## 0.0.16
|
|
84
|
+
- Fix an issue when initializing an empty linked list
|
|
85
|
+
|
|
86
|
+
## 0.0.15
|
|
87
|
+
- Rollback target version, change output format
|
|
88
|
+
|
|
89
|
+
## 0.0.14
|
|
90
|
+
- Bump target version in tsconfig
|
|
91
|
+
|
|
92
|
+
## 0.0.13
|
|
93
|
+
- Bring most utilities from the back-office, mobile-app and nest to this package (#32q6ude)
|
|
94
|
+
|
|
95
|
+
## 0.0.1
|
|
96
|
+
- Library initialisation (#2ykhvcg)
|
|
97
|
+
- Fix files taken as packaged
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Shared-library
|
|
2
|
+
|
|
3
|
+
Regroup low levels utils to share across Sparted's projects. Nothing should be platform specific and it should ideally not depend on any external library.
|
|
4
|
+
|
|
5
|
+
# Publishing
|
|
6
|
+
|
|
7
|
+
Since we want to be able to do the following sub imports when using the library:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { function1, function2 } from '@sparted/shared-library/array';
|
|
11
|
+
import { function3, function4 } from '@sparted/shared-library/strings';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
While also being able to import everything from the root.
|
|
15
|
+
|
|
16
|
+
We'll need to do some rollup/npm trickery to keep everything tree-shakable and intuitive.
|
|
17
|
+
|
|
18
|
+
To do so, we copy the package.json inside the generated dist folder when building the library. Then we run `npm publish` from inside the dist folder.
|
|
19
|
+
|
|
20
|
+
What this do, is take everything inside the dist folder and publish as its standalone package. This enables us to import directly from `@sparted/shared-library/array` without adding `dist` since `dist/array` becomes a root folder. If we do not do this and instead run `npm publish` in the root directory, the package would keep the folder structure and we would need to add `dist` in imports. eg: `@sparted/shared-library/dist/array`.
|
|
21
|
+
|
|
22
|
+
## How to publish
|
|
23
|
+
|
|
24
|
+
1. Update the `package.json` version
|
|
25
|
+
2. Run `yarn build-and-publish` (this command assumes the `package.json` version was not already published)
|
|
26
|
+
3. The new version should be commited and pushed
|
|
@@ -37,7 +37,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
37
37
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
38
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
39
|
});
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
43
|
+
var e = new Error(message);
|
|
44
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
45
|
+
};
|
|
41
46
|
|
|
42
47
|
exports.__awaiter = __awaiter;
|
|
43
48
|
exports.__rest = __rest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const getQuestions = (content) => { var _a; return (_a = content.items) === null || _a === void 0 ? void 0 : _a.map(({ question }) => question); };
|
|
6
|
+
|
|
7
|
+
exports.getQuestions = getQuestions;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/business/picture-spot/index.ts"],"sourcesContent":["import { PictureSpot } from '../types';\n\nexport const getQuestions = (content: PictureSpot) => content.items?.map(({ question }) => question);\n"],"names":[],"mappings":";;;;AAEO,MAAM,YAAY,GAAG,CAAC,OAAoB,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA,GAAA,OAAO,CAAC,KAAK,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,QAAQ,CAAC,CAAA;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { MultilingualLabel } from './multilingual';
|
|
2
|
+
import { Image, Media } from './media';
|
|
3
|
+
import { Thematic } from './thematic';
|
|
4
|
+
export type ErrorText = {
|
|
5
|
+
type: 'error-text';
|
|
6
|
+
gameMedia?: Media;
|
|
7
|
+
explanationMedia?: Media;
|
|
8
|
+
explanation?: MultilingualLabel;
|
|
9
|
+
wrongText?: MultilingualLabel;
|
|
10
|
+
correctText?: MultilingualLabel;
|
|
11
|
+
};
|
|
12
|
+
export type MultipleChoiceQuestion = {
|
|
13
|
+
type: 'mcq';
|
|
14
|
+
gameMedia?: Media;
|
|
15
|
+
question?: MultilingualLabel;
|
|
16
|
+
explanation?: MultilingualLabel;
|
|
17
|
+
explanationMedia?: Media;
|
|
18
|
+
multiselect?: boolean;
|
|
19
|
+
choices?: {
|
|
20
|
+
correct: boolean;
|
|
21
|
+
text: MultilingualLabel;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export type NoInteraction = {
|
|
25
|
+
type: 'no-interaction';
|
|
26
|
+
firstMedia?: Media;
|
|
27
|
+
secondMedia?: Media;
|
|
28
|
+
title?: MultilingualLabel;
|
|
29
|
+
text?: MultilingualLabel;
|
|
30
|
+
};
|
|
31
|
+
export type OpenQuestion = {
|
|
32
|
+
type: 'open-question';
|
|
33
|
+
gameMedia?: Media;
|
|
34
|
+
question?: MultilingualLabel;
|
|
35
|
+
answer?: MultilingualLabel;
|
|
36
|
+
explanation?: MultilingualLabel;
|
|
37
|
+
explanationMedia?: Media;
|
|
38
|
+
levenshteinDistance?: number;
|
|
39
|
+
};
|
|
40
|
+
export type OrderingCards = {
|
|
41
|
+
type: 'ordering-cards';
|
|
42
|
+
explanation?: MultilingualLabel;
|
|
43
|
+
question?: MultilingualLabel;
|
|
44
|
+
topLabel?: MultilingualLabel;
|
|
45
|
+
bottomLabel?: MultilingualLabel;
|
|
46
|
+
cards: MultilingualLabel[];
|
|
47
|
+
};
|
|
48
|
+
export type PictureSpot = {
|
|
49
|
+
type: 'picture-spot';
|
|
50
|
+
image?: Image;
|
|
51
|
+
explanation?: MultilingualLabel;
|
|
52
|
+
items?: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
r: number;
|
|
56
|
+
question: MultilingualLabel;
|
|
57
|
+
description: MultilingualLabel;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
export type SwipingCards = {
|
|
61
|
+
type: 'swiping-cards';
|
|
62
|
+
explanation?: MultilingualLabel;
|
|
63
|
+
question?: MultilingualLabel;
|
|
64
|
+
zones?: {
|
|
65
|
+
position: 'left' | 'right' | 'top' | 'bottom';
|
|
66
|
+
text: MultilingualLabel;
|
|
67
|
+
}[];
|
|
68
|
+
cards?: {
|
|
69
|
+
image?: Image;
|
|
70
|
+
text?: MultilingualLabel;
|
|
71
|
+
answer: 'left' | 'right' | 'top' | 'bottom';
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
export type Game = ErrorText | MultipleChoiceQuestion | NoInteraction | OpenQuestion | OrderingCards | PictureSpot | SwipingCards;
|
|
75
|
+
export type GameType = 'error-text' | 'mcq' | 'open-question' | 'no-interaction' | 'picture-spot' | 'swiping-cards' | 'ordering-cards';
|
|
76
|
+
export type BaseContent = {
|
|
77
|
+
id: number;
|
|
78
|
+
identifier: string;
|
|
79
|
+
name: MultilingualLabel;
|
|
80
|
+
thematic: Thematic;
|
|
81
|
+
coverImage?: Image;
|
|
82
|
+
status: string;
|
|
83
|
+
};
|
|
84
|
+
export type Content = BaseContent & (ErrorText | MultipleChoiceQuestion | NoInteraction | OpenQuestion | OrderingCards | PictureSpot | SwipingCards);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Image = {
|
|
2
|
+
id: number;
|
|
3
|
+
url: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
export type Video = {
|
|
9
|
+
id: number;
|
|
10
|
+
url: string;
|
|
11
|
+
type: 'Youtube' | 'api.video' | 'Kumullus';
|
|
12
|
+
};
|
|
13
|
+
export type Media = {
|
|
14
|
+
image?: Image;
|
|
15
|
+
video?: Video;
|
|
16
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type BaseUrlMapperFunc = (instanceId: string) => string;
|
|
2
|
+
export type Transformation = {
|
|
3
|
+
fit?: 'crop' | 'contain';
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
devicePixelRatio?: number;
|
|
7
|
+
quality?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Only for imgix transformations. Default is true.
|
|
10
|
+
*/
|
|
11
|
+
compress?: boolean;
|
|
12
|
+
output?: 'jpeg' | 'png' | 'webp' | 'image';
|
|
13
|
+
};
|
|
14
|
+
export type CdnParams = {
|
|
15
|
+
asThumbnail?: boolean;
|
|
16
|
+
transformation?: Transformation;
|
|
17
|
+
};
|
|
18
|
+
export type TransformationQueries = (params: Transformation) => string;
|
|
19
|
+
type TwicpicsOutputTransformation = ['output', Transformation['output']];
|
|
20
|
+
type TwicpicsFitTransformation = ['cover' | 'crop' | 'contain', string] | ['quality', number];
|
|
21
|
+
export type TwicpicsTransformation = TwicpicsOutputTransformation | TwicpicsFitTransformation;
|
|
22
|
+
export type TwicpicsTransformationChain = TwicpicsTransformation[];
|
|
23
|
+
export type GetCdnUrl = (instanceId: string, path: `/${string}`, params?: CdnParams) => string;
|
|
24
|
+
export type GetCdnFromS3Url = (url: string, params?: CdnParams) => string;
|
|
25
|
+
export type InstanceMapper = (instanceId: string) => string;
|
|
26
|
+
export type CdnType = 'twicpics' | 'imgix';
|
|
27
|
+
export type CdnConfig<T extends CdnType> = {
|
|
28
|
+
type: T;
|
|
29
|
+
domain: `https://${string}`;
|
|
30
|
+
instanceMapper: InstanceMapper;
|
|
31
|
+
cacheVersion?: T extends 'twicpics' ? number : undefined;
|
|
32
|
+
};
|
|
33
|
+
export type Cdn = {
|
|
34
|
+
getCdnUrl: GetCdnUrl;
|
|
35
|
+
getCdnFromS3Url: GetCdnFromS3Url;
|
|
36
|
+
};
|
|
37
|
+
export {};
|