@sparted/shared-library 1.0.8-alpha.6 → 1.0.9
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/{dist/cdn → cdn}/cdn.factory.js +16 -11
- package/cdn/cdn.factory.js.map +1 -0
- package/{dist/cdn → cdn}/types/cdn-factory.type.d.ts +4 -0
- package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js +3 -0
- package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js.map +1 -1
- package/http/build-search-params.d.ts +2 -0
- package/http/build-search-params.js +18 -0
- package/http/build-search-params.js.map +1 -0
- package/{dist/http → http}/index.d.ts +1 -0
- package/{dist/http → http}/index.js +2 -0
- package/http/index.js.map +1 -0
- package/{src/index.ts → index.d.ts} +14 -15
- package/{dist/index.js → index.js} +2 -2
- package/package.json +3 -7
- package/.circleci/config.yml +0 -40
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.gitignore +0 -37
- package/CHANGELOG.md +0 -34
- package/README.md +0 -26
- package/dist/cdn/cdn.factory.js.map +0 -1
- package/dist/github/branch/create-branch.d.ts +0 -11
- package/dist/github/branch/create-branch.js +0 -27
- package/dist/github/branch/create-branch.js.map +0 -1
- package/dist/github/branch/index.d.ts +0 -2
- package/dist/github/branch/index.js +0 -12
- package/dist/github/branch/index.js.map +0 -1
- package/dist/github/branch/update-branch.d.ts +0 -11
- package/dist/github/branch/update-branch.js +0 -26
- package/dist/github/branch/update-branch.js.map +0 -1
- package/dist/github/commit/create-git-blob.d.ts +0 -26
- package/dist/github/commit/create-git-blob.js +0 -42
- package/dist/github/commit/create-git-blob.js.map +0 -1
- package/dist/github/commit/create-git-commit.d.ts +0 -23
- package/dist/github/commit/create-git-commit.js +0 -39
- package/dist/github/commit/create-git-commit.js.map +0 -1
- package/dist/github/commit/create-git-tree.d.ts +0 -29
- package/dist/github/commit/create-git-tree.js +0 -47
- package/dist/github/commit/create-git-tree.js.map +0 -1
- package/dist/github/commit/get-sha-last-commit-of-branch.d.ts +0 -21
- package/dist/github/commit/get-sha-last-commit-of-branch.js +0 -35
- package/dist/github/commit/get-sha-last-commit-of-branch.js.map +0 -1
- package/dist/github/commit/get-tree-by-commit-sha.d.ts +0 -23
- package/dist/github/commit/get-tree-by-commit-sha.js +0 -37
- package/dist/github/commit/get-tree-by-commit-sha.js.map +0 -1
- package/dist/github/commit/index.d.ts +0 -6
- package/dist/github/commit/index.js +0 -20
- package/dist/github/commit/run-new-commit-process.d.ts +0 -27
- package/dist/github/commit/run-new-commit-process.js +0 -49
- package/dist/github/commit/run-new-commit-process.js.map +0 -1
- package/dist/github/commit/utils.d.ts +0 -1
- package/dist/github/commit/utils.js +0 -29
- package/dist/github/commit/utils.js.map +0 -1
- package/dist/github/content/get-file-content.d.ts +0 -20
- package/dist/github/content/get-file-content.js +0 -38
- package/dist/github/content/get-file-content.js.map +0 -1
- package/dist/github/github.d.ts +0 -25
- package/dist/github/github.js +0 -65
- package/dist/github/github.js.map +0 -1
- package/dist/github/index.d.ts +0 -1
- package/dist/github/index.js +0 -10
- package/dist/github/merge/create-pull-request.d.ts +0 -14
- package/dist/github/merge/create-pull-request.js +0 -30
- package/dist/github/merge/create-pull-request.js.map +0 -1
- package/dist/github/merge/index.d.ts +0 -2
- package/dist/github/merge/index.js +0 -12
- package/dist/github/merge/index.js.map +0 -1
- package/dist/github/merge/merge-pull-request.d.ts +0 -13
- package/dist/github/merge/merge-pull-request.js +0 -28
- package/dist/github/merge/merge-pull-request.js.map +0 -1
- package/dist/http/index.js.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/package.json +0 -65
- package/dist/string/index.js.map +0 -1
- package/dist/time/index.js.map +0 -1
- package/global.d.ts +0 -2
- package/rollup.config.ts +0 -15
- 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/array-to-map.ts +0 -32
- package/src/array/get-values-from-keys.ts +0 -3
- package/src/array/index.ts +0 -2
- package/src/cdn/__tests__/cdn.factory.test.ts +0 -120
- package/src/cdn/__tests__/utils.test.ts +0 -456
- package/src/cdn/cdn.factory.ts +0 -63
- package/src/cdn/index.ts +0 -2
- package/src/cdn/types/cdn-factory.type.ts +0 -35
- package/src/cdn/types/index.ts +0 -1
- package/src/cdn/utils/extract-info-from-url.util.ts +0 -21
- package/src/cdn/utils/get-cdn-from-s3-url.util.ts +0 -20
- package/src/cdn/utils/get-cdn-url.util.ts +0 -26
- 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/github/branch/create-branch.ts +0 -36
- package/src/github/branch/index.ts +0 -2
- package/src/github/branch/update-branch.ts +0 -35
- package/src/github/commit/create-git-blob.ts +0 -57
- package/src/github/commit/create-git-commit.ts +0 -57
- package/src/github/commit/create-git-tree.ts +0 -68
- package/src/github/commit/get-sha-last-commit-of-branch.ts +0 -50
- package/src/github/commit/get-tree-by-commit-sha.ts +0 -52
- package/src/github/commit/index.ts +0 -6
- package/src/github/commit/run-new-commit-process.ts +0 -88
- package/src/github/commit/utils.ts +0 -31
- package/src/github/content/get-file-content.ts +0 -50
- package/src/github/github.ts +0 -93
- package/src/github/index.ts +0 -1
- package/src/github/merge/create-pull-request.ts +0 -42
- package/src/github/merge/index.ts +0 -2
- package/src/github/merge/merge-pull-request.ts +0 -39
- 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/encode-search-object.ts +0 -39
- package/src/http/fetch-with-timeout.ts +0 -24
- package/src/http/index.ts +0 -2
- 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 -29
- 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__/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 -4
- package/src/math/interpolate.ts +0 -18
- 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/index.ts +0 -1
- package/src/object/merge-deep.ts +0 -27
- 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 -3
- 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__/replace-in-template.test.ts +0 -52
- package/src/string/index.ts +0 -1
- 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 -8
- package/src/types/index.ts +0 -4
- package/src/types/object.ts +0 -33
- package/src/types/search.ts +0 -29
- package/tsconfig.eslint.json +0 -8
- package/tsconfig.json +0 -25
- /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/cdn → cdn}/cdn.factory.d.ts +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/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/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/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}/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/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/github → 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}/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/linked-list → 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/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/object → string}/index.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/github/commit → 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
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var buildSearchParams = require('../http/build-search-params.js');
|
|
5
6
|
var getCdnFromS3Url_util = require('./utils/get-cdn-from-s3-url.util.js');
|
|
6
7
|
var getCdnUrl_util = require('./utils/get-cdn-url.util.js');
|
|
7
8
|
|
|
8
|
-
const imgixTransformationQueries = ({ fit,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
?
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const imgixTransformationQueries = ({ fit, width, height, quality, compress = true, devicePixelRatio, }) => {
|
|
10
|
+
const params = {
|
|
11
|
+
auto: compress ? 'compress,format' : undefined,
|
|
12
|
+
fit: fit === 'crop' ? 'crop' : undefined,
|
|
13
|
+
dpr: Number.isFinite(devicePixelRatio) ? devicePixelRatio : undefined,
|
|
14
|
+
h: Number.isFinite(height) ? height : undefined,
|
|
15
|
+
w: Number.isFinite(width) ? width : undefined,
|
|
16
|
+
q: quality !== undefined && quality >= 0 && quality <= 100 ? quality : undefined,
|
|
17
|
+
};
|
|
18
|
+
const searchParams = buildSearchParams.buildSearchParams(params).toString();
|
|
19
|
+
return searchParams ? `?${searchParams}` : '';
|
|
20
|
+
};
|
|
18
21
|
const twicpicsTransformationQueries = (params) => {
|
|
19
22
|
if (params.fit !== undefined) {
|
|
20
23
|
if (params.width === undefined || params.height === undefined) {
|
|
@@ -25,7 +28,9 @@ const twicpicsTransformationQueries = (params) => {
|
|
|
25
28
|
return `?twic=v1/${params.fit}=${params.width}x${params.height}`;
|
|
26
29
|
}
|
|
27
30
|
if (params.width !== undefined) {
|
|
28
|
-
const resizeHeight = params.height !== undefined
|
|
31
|
+
const resizeHeight = params.height !== undefined
|
|
32
|
+
? `x${params.height}`
|
|
33
|
+
: '';
|
|
29
34
|
return `?twic=v1/cover=${params.width}${resizeHeight}`;
|
|
30
35
|
}
|
|
31
36
|
return '';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import { buildSearchParams } from '../http/build-search-params';\nimport type { CreateCdn, TransformationQueries } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n width,\n height,\n quality,\n compress = true,\n devicePixelRatio,\n}) => {\n const params = {\n auto: compress ? 'compress,format' : undefined,\n fit: fit === 'crop' ? 'crop' : undefined,\n dpr: Number.isFinite(devicePixelRatio) ? devicePixelRatio : undefined,\n h: Number.isFinite(height) ? height : undefined,\n w: Number.isFinite(width) ? width : undefined,\n q: quality !== undefined && quality >= 0 && quality <= 100 ? quality : undefined,\n };\n const searchParams = buildSearchParams(params).toString();\n\n return searchParams ? `?${searchParams}` : '';\n};\n\nexport const twicpicsTransformationQueries: TransformationQueries = (\n params,\n) => {\n if (params.fit !== undefined) {\n if (params.width === undefined || params.height === undefined) {\n // eslint-disable-next-line no-console\n console.error('⚠️ The Twicpics api needs a width and a height.');\n return '';\n }\n\n return `?twic=v1/${params.fit}=${params.width}x${params.height}`;\n }\n if (params.width !== undefined) {\n const resizeHeight = params.height !== undefined\n ? `x${params.height}`\n : '';\n\n return `?twic=v1/cover=${params.width}${resizeHeight}`;\n }\n\n return '';\n};\n\n/**\n *\n * @param type cdn provider: 'twicpics' | 'imgix'\n * @param domain provider domain\n * @param instanceMapper domain + the result of the instanceMapper will form the base path\n * @returns \\{ getCdnUrl, transformationQueries \\}\n */\nexport const createCdn: CreateCdn = ({ type, domain, instanceMapper }) => {\n const getCdnUrl = getCdnUrlFactory({\n domain,\n instanceMapper,\n transformationQueries:\n type === 'imgix'\n ? imgixTransformationQueries\n : twicpicsTransformationQueries,\n });\n\n return {\n getCdnUrl,\n getCdnFromS3Url: getCdnFromS3UrlFactory({\n getCdnUrl,\n }),\n };\n};\n"],"names":["buildSearchParams","getCdnUrlFactory","getCdnFromS3UrlFactory"],"mappings":";;;;;;;;MAKa,0BAA0B,GAA0B,CAAC,EAChE,GAAG,EACH,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,gBAAgB,GACjB,KAAI;AACH,IAAA,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,SAAS;QAC9C,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS;AACxC,QAAA,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,SAAS;AACrE,QAAA,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS;AAC/C,QAAA,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,SAAS;AAC7C,QAAA,CAAC,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,IAAI,GAAG,GAAG,OAAO,GAAG,SAAS;KACjF,CAAC;IACF,MAAM,YAAY,GAAGA,mCAAiB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE1D,OAAO,YAAY,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE,GAAG,EAAE,CAAC;AAChD,EAAE;AAEW,MAAA,6BAA6B,GAA0B,CAClE,MAAM,KACJ;AACF,IAAA,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;QAC5B,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;;AAE7D,YAAA,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;AAClE,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AAED,QAAA,OAAO,CAAY,SAAA,EAAA,MAAM,CAAC,GAAG,CAAI,CAAA,EAAA,MAAM,CAAC,KAAK,CAAI,CAAA,EAAA,MAAM,CAAC,MAAM,EAAE,CAAC;AAClE,KAAA;AACD,IAAA,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE;AAC9B,QAAA,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,KAAK,SAAS;AAC9C,cAAE,CAAA,CAAA,EAAI,MAAM,CAAC,MAAM,CAAE,CAAA;cACnB,EAAE,CAAC;AAEP,QAAA,OAAO,kBAAkB,MAAM,CAAC,KAAK,CAAG,EAAA,YAAY,EAAE,CAAC;AACxD,KAAA;AAED,IAAA,OAAO,EAAE,CAAC;AACZ,EAAE;AAEF;;;;;;AAMG;AACI,MAAM,SAAS,GAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAI;IACvE,MAAM,SAAS,GAAGC,+BAAgB,CAAC;QACjC,MAAM;QACN,cAAc;QACd,qBAAqB,EACnB,IAAI,KAAK,OAAO;AACd,cAAE,0BAA0B;AAC5B,cAAE,6BAA6B;AACpC,KAAA,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,eAAe,EAAEC,2CAAsB,CAAC;YACtC,SAAS;SACV,CAAC;KACH,CAAC;AACJ;;;;;;"}
|
|
@@ -5,6 +5,10 @@ export declare type Transformation = {
|
|
|
5
5
|
height?: number;
|
|
6
6
|
devicePixelRatio?: number;
|
|
7
7
|
quality?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Only for imgix transformations. Default is true.
|
|
10
|
+
*/
|
|
11
|
+
compress?: boolean;
|
|
8
12
|
};
|
|
9
13
|
export declare type CdnParams = {
|
|
10
14
|
asThumbnail?: boolean;
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const S3_URL_RE = /https:\/\/sparted-prod-([^.]+)\.s3(\.eu-west-1)?(\.amazonaws\.com)?(\.fr-par\.scw\.cloud)?(\/[^?]+)/;
|
|
6
6
|
const extractInfoFromUrl = (url) => {
|
|
7
|
+
if (typeof url !== 'string') {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
7
10
|
const matchS3Url = url.match(S3_URL_RE);
|
|
8
11
|
if (!matchS3Url) {
|
|
9
12
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-info-from-url.util.js","sources":["../../../src/cdn/utils/extract-info-from-url.util.ts"],"sourcesContent":["type ExtractInfoFromUrl = (url: string) =>\n| {\n instanceId: string;\n path: `/${string}`;\n}\n| undefined;\n\nconst S3_URL_RE = /https:\\/\\/sparted-prod-([^.]+)\\.s3(\\.eu-west-1)?(\\.amazonaws\\.com)?(\\.fr-par\\.scw\\.cloud)?(\\/[^?]+)/;\n\nexport const extractInfoFromUrl: ExtractInfoFromUrl = (url) => {\n const matchS3Url = url.match(S3_URL_RE);\n\n if (!matchS3Url) {\n return undefined;\n }\n\n const instanceId = matchS3Url[1];\n const path = matchS3Url[5] as `/${string}`;\n\n return { instanceId, path };\n};\n"],"names":[],"mappings":";;;;AAOA,MAAM,SAAS,GAAG,qGAAqG,CAAC;AAE3G,MAAA,kBAAkB,GAAuB,CAAC,GAAG,KAAI;
|
|
1
|
+
{"version":3,"file":"extract-info-from-url.util.js","sources":["../../../src/cdn/utils/extract-info-from-url.util.ts"],"sourcesContent":["type ExtractInfoFromUrl = (url: string) =>\n| {\n instanceId: string;\n path: `/${string}`;\n}\n| undefined;\n\nconst S3_URL_RE = /https:\\/\\/sparted-prod-([^.]+)\\.s3(\\.eu-west-1)?(\\.amazonaws\\.com)?(\\.fr-par\\.scw\\.cloud)?(\\/[^?]+)/;\n\nexport const extractInfoFromUrl: ExtractInfoFromUrl = (url) => {\n if (typeof url !== 'string') {\n return undefined;\n }\n\n const matchS3Url = url.match(S3_URL_RE);\n\n if (!matchS3Url) {\n return undefined;\n }\n\n const instanceId = matchS3Url[1];\n const path = matchS3Url[5] as `/${string}`;\n\n return { instanceId, path };\n};\n"],"names":[],"mappings":";;;;AAOA,MAAM,SAAS,GAAG,qGAAqG,CAAC;AAE3G,MAAA,kBAAkB,GAAuB,CAAC,GAAG,KAAI;AAC5D,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IAED,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AAED,IAAA,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACjC,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAiB,CAAC;AAE3C,IAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC9B;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const buildSearchParams = (params) => {
|
|
6
|
+
const definedParams = Object
|
|
7
|
+
.entries(params)
|
|
8
|
+
.reduce((acc, [key, value]) => {
|
|
9
|
+
if (value !== undefined) {
|
|
10
|
+
return Object.assign(Object.assign({}, acc), { [key]: String(value) });
|
|
11
|
+
}
|
|
12
|
+
return acc;
|
|
13
|
+
}, {});
|
|
14
|
+
return new URLSearchParams(definedParams);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.buildSearchParams = buildSearchParams;
|
|
18
|
+
//# sourceMappingURL=build-search-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-search-params.js","sources":["../../src/http/build-search-params.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nexport const buildSearchParams = (params: Record<string, Primitive | undefined>): URLSearchParams => {\n const definedParams = Object\n .entries(params)\n .reduce((acc, [key, value]) => {\n if (value !== undefined) {\n return {\n ...acc,\n [key]: String(value),\n };\n }\n\n return acc;\n }, {} as Record<string, string>);\n\n return new URLSearchParams(definedParams);\n};\n"],"names":[],"mappings":";;;;AAEa,MAAA,iBAAiB,GAAG,CAAC,MAA6C,KAAqB;IAClG,MAAM,aAAa,GAAG,MAAM;SACzB,OAAO,CAAC,MAAM,CAAC;SACf,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC5B,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,OACK,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,GAAG,CACN,EAAA,EAAA,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EACpB,CAAA,CAAA;AACH,SAAA;AAED,QAAA,OAAO,GAAG,CAAC;KACZ,EAAE,EAA4B,CAAC,CAAC;AAEnC,IAAA,OAAO,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC;AAC5C;;;;"}
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var encodeSearchObject = require('./encode-search-object.js');
|
|
6
6
|
var fetchWithTimeout = require('./fetch-with-timeout.js');
|
|
7
|
+
var buildSearchParams = require('./build-search-params.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
exports.encodeSearchObject = encodeSearchObject.encodeSearchObject;
|
|
11
12
|
exports.encodeSearchValue = encodeSearchObject.encodeSearchValue;
|
|
12
13
|
exports.fetchWithTimeout = fetchWithTimeout.fetchWithTimeout;
|
|
14
|
+
exports.buildSearchParams = buildSearchParams.buildSearchParams;
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export * from './array';
|
|
2
|
-
export * from './cdn';
|
|
3
|
-
export * from './time';
|
|
4
|
-
export * from './formatting';
|
|
5
|
-
export * from './fp';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './types';
|
|
1
|
+
export * from './array';
|
|
2
|
+
export * from './cdn';
|
|
3
|
+
export * from './time';
|
|
4
|
+
export * from './formatting';
|
|
5
|
+
export * from './fp';
|
|
6
|
+
export * from './http';
|
|
7
|
+
export * from './linked-list';
|
|
8
|
+
export * from './math';
|
|
9
|
+
export * from './object';
|
|
10
|
+
export * from './parsing';
|
|
11
|
+
export * from './predicates';
|
|
12
|
+
export * from './promise';
|
|
13
|
+
export * from './string';
|
|
14
|
+
export * from './types';
|
|
@@ -11,9 +11,9 @@ var formatMinutes = require('./time/format-minutes.js');
|
|
|
11
11
|
var getTimeDiffAsString = require('./time/get-time-diff-as-string.js');
|
|
12
12
|
var formatNumber = require('./formatting/format-number.js');
|
|
13
13
|
var runWhile = require('./fp/run-while.js');
|
|
14
|
-
var github = require('./github/github.js');
|
|
15
14
|
var encodeSearchObject = require('./http/encode-search-object.js');
|
|
16
15
|
var fetchWithTimeout = require('./http/fetch-with-timeout.js');
|
|
16
|
+
var buildSearchParams = require('./http/build-search-params.js');
|
|
17
17
|
var createLinkedList = require('./linked-list/create-linked-list.js');
|
|
18
18
|
var clampNumber = require('./math/clamp-number.js');
|
|
19
19
|
var interpolate = require('./math/interpolate.js');
|
|
@@ -48,10 +48,10 @@ exports.formatMinutes = formatMinutes.formatMinutes;
|
|
|
48
48
|
exports.getTimeDiffAsString = getTimeDiffAsString.getTimeDiffAsString;
|
|
49
49
|
exports.formatNumber = formatNumber.formatNumber;
|
|
50
50
|
exports.runWhile = runWhile.runWhile;
|
|
51
|
-
exports.githubSdk = github.githubSdk;
|
|
52
51
|
exports.encodeSearchObject = encodeSearchObject.encodeSearchObject;
|
|
53
52
|
exports.encodeSearchValue = encodeSearchObject.encodeSearchValue;
|
|
54
53
|
exports.fetchWithTimeout = fetchWithTimeout.fetchWithTimeout;
|
|
54
|
+
exports.buildSearchParams = buildSearchParams.buildSearchParams;
|
|
55
55
|
exports.createLinkedList = createLinkedList.createLinkedList;
|
|
56
56
|
exports.clampNumber = clampNumber.clampNumber;
|
|
57
57
|
exports.interpolate = interpolate.interpolate;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparted/shared-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"repository": "git@github.com:Sparted/shared-library.git",
|
|
5
5
|
"author": "Thomas <duprethomasfr@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffets": false,
|
|
8
|
-
"main": "
|
|
9
|
-
"module": "
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"module": "index.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"**/*",
|
|
12
12
|
"**/**"
|
|
@@ -57,9 +57,5 @@
|
|
|
57
57
|
"transform": {
|
|
58
58
|
"^.+\\.(t|j)s$": "ts-jest"
|
|
59
59
|
}
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"axios": "^1.3.4",
|
|
63
|
-
"zod": "^3.21.4"
|
|
64
60
|
}
|
|
65
61
|
}
|
package/.circleci/config.yml
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dist/
|
package/.eslintrc.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
es2021: true,
|
|
4
|
-
node: true,
|
|
5
|
-
},
|
|
6
|
-
extends: '@sparted',
|
|
7
|
-
parserOptions: {
|
|
8
|
-
project: './tsconfig.eslint.json',
|
|
9
|
-
},
|
|
10
|
-
rules: {
|
|
11
|
-
// Preference for this project
|
|
12
|
-
'import/prefer-default-export': 'off',
|
|
13
|
-
|
|
14
|
-
// Preference for this project
|
|
15
|
-
'object-curly-newline': 'off',
|
|
16
|
-
},
|
|
17
|
-
};
|
package/.gitignore
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
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/CHANGELOG.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
## 1.0.7
|
|
2
|
-
- Fix Twicpics resizing
|
|
3
|
-
|
|
4
|
-
## 1.0.6
|
|
5
|
-
- Add current map to `dataModifier` function on `arrayToMap`
|
|
6
|
-
|
|
7
|
-
## 1.0.5
|
|
8
|
-
- CDN abstraction for Imgix and Twicpics
|
|
9
|
-
|
|
10
|
-
## 1.0.0
|
|
11
|
-
- Breaking change: rename date folder into time
|
|
12
|
-
- Export convertion functions from time
|
|
13
|
-
|
|
14
|
-
## 0.0.18
|
|
15
|
-
- Change update behavior to fully replace updated items
|
|
16
|
-
|
|
17
|
-
## 0.0.17
|
|
18
|
-
- Remove error thrown when not every items have been visisted
|
|
19
|
-
|
|
20
|
-
## 0.0.16
|
|
21
|
-
- Fix an issue when initializing an empty linked list
|
|
22
|
-
|
|
23
|
-
## 0.0.15
|
|
24
|
-
- Rollback target version, change output format
|
|
25
|
-
|
|
26
|
-
## 0.0.14
|
|
27
|
-
- Bump target version in tsconfig
|
|
28
|
-
|
|
29
|
-
## 0.0.13
|
|
30
|
-
- Bring most utilities from the back-office, mobile-app and nest to this package (#32q6ude)
|
|
31
|
-
|
|
32
|
-
## 0.0.1
|
|
33
|
-
- Library initialisation (#2ykhvcg)
|
|
34
|
-
- Fix files taken as packaged
|
package/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import type { CreateCdn, TransformationQueries } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n devicePixelRatio,\n height,\n width,\n quality,\n}) => [\n '?auto=compress,format',\n fit === 'crop' ? '&fit=crop' : '',\n Number.isFinite(devicePixelRatio) ? `&dpr=${devicePixelRatio}` : '',\n Number.isFinite(height) ? `&h=${height}` : '',\n Number.isFinite(width) ? `&w=${width}` : '',\n quality !== undefined && quality >= 0 && quality <= 100\n ? `&q=${quality}`\n : '',\n].join('');\n\nexport const twicpicsTransformationQueries: TransformationQueries = (\n params,\n) => {\n if (params.fit !== undefined) {\n if (params.width === undefined || params.height === undefined) {\n // eslint-disable-next-line no-console\n console.error('⚠️ The Twicpics api needs a width and a height.');\n return '';\n }\n return `?twic=v1/${params.fit}=${params.width}x${params.height}`;\n }\n if (params.width !== undefined) {\n const resizeHeight = params.height !== undefined ? `x${params.height}` : '';\n return `?twic=v1/cover=${params.width}${resizeHeight}`;\n }\n return '';\n};\n\n/**\n *\n * @param type cdn provider: 'twicpics' | 'imgix'\n * @param domain provider domain\n * @param instanceMapper domain + the result of the instanceMapper will form the base path\n * @returns \\{ getCdnUrl, transformationQueries \\}\n */\nexport const createCdn: CreateCdn = ({ type, domain, instanceMapper }) => {\n const getCdnUrl = getCdnUrlFactory({\n domain,\n instanceMapper,\n transformationQueries:\n type === 'imgix'\n ? imgixTransformationQueries\n : twicpicsTransformationQueries,\n });\n\n return {\n getCdnUrl,\n getCdnFromS3Url: getCdnFromS3UrlFactory({\n getCdnUrl,\n }),\n };\n};\n"],"names":["getCdnUrlFactory","getCdnFromS3UrlFactory"],"mappings":";;;;;;;AAIa,MAAA,0BAA0B,GAA0B,CAAC,EAChE,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,OAAO,GACR,KAAK;IACJ,uBAAuB;IACvB,GAAG,KAAK,MAAM,GAAG,WAAW,GAAG,EAAE;AACjC,IAAA,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAA,KAAA,EAAQ,gBAAgB,CAAA,CAAE,GAAG,EAAE;AACnE,IAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAA,GAAA,EAAM,MAAM,CAAA,CAAE,GAAG,EAAE;AAC7C,IAAA,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,EAAE;IAC3C,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,IAAI,GAAG;UACnD,CAAM,GAAA,EAAA,OAAO,CAAE,CAAA;AACjB,UAAE,EAAE;AACP,CAAA,CAAC,IAAI,CAAC,EAAE,EAAE;AAEE,MAAA,6BAA6B,GAA0B,CAClE,MAAM,KACJ;AACF,IAAA,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;QAC5B,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;;AAE7D,YAAA,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;AAClE,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACD,QAAA,OAAO,CAAY,SAAA,EAAA,MAAM,CAAC,GAAG,CAAI,CAAA,EAAA,MAAM,CAAC,KAAK,CAAI,CAAA,EAAA,MAAM,CAAC,MAAM,EAAE,CAAC;AAClE,KAAA;AACD,IAAA,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE;AAC9B,QAAA,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,KAAK,SAAS,GAAG,CAAI,CAAA,EAAA,MAAM,CAAC,MAAM,CAAA,CAAE,GAAG,EAAE,CAAC;AAC5E,QAAA,OAAO,kBAAkB,MAAM,CAAC,KAAK,CAAG,EAAA,YAAY,EAAE,CAAC;AACxD,KAAA;AACD,IAAA,OAAO,EAAE,CAAC;AACZ,EAAE;AAEF;;;;;;AAMG;AACI,MAAM,SAAS,GAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAI;IACvE,MAAM,SAAS,GAAGA,+BAAgB,CAAC;QACjC,MAAM;QACN,cAAc;QACd,qBAAqB,EACnB,IAAI,KAAK,OAAO;AACd,cAAE,0BAA0B;AAC5B,cAAE,6BAA6B;AACpC,KAAA,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,eAAe,EAAEC,2CAAsB,CAAC;YACtC,SAAS;SACV,CAAC;KACH,CAAC;AACJ;;;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare type CreateBranchArgs = {
|
|
3
|
-
branchName: string;
|
|
4
|
-
shaLastCommitOfBranch: string;
|
|
5
|
-
};
|
|
6
|
-
export declare type CreateBranchResponse = {
|
|
7
|
-
ref: string;
|
|
8
|
-
};
|
|
9
|
-
export declare type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;
|
|
10
|
-
export declare type CreateBranchFactory = (instance: AxiosInstance) => CreateBranch;
|
|
11
|
-
export declare const createBranchFactory: CreateBranchFactory;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
-
var zod = require('zod');
|
|
7
|
-
var utils = require('../commit/utils.js');
|
|
8
|
-
|
|
9
|
-
const createBranchResponseSchema = zod.z.object({
|
|
10
|
-
ref: zod.z.string(),
|
|
11
|
-
});
|
|
12
|
-
const createBranchFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
-
const { branchName, shaLastCommitOfBranch } = args;
|
|
14
|
-
try {
|
|
15
|
-
const { data } = yield instance.post('/git/refs', {
|
|
16
|
-
ref: `refs/heads/${branchName}`,
|
|
17
|
-
sha: shaLastCommitOfBranch,
|
|
18
|
-
});
|
|
19
|
-
return createBranchResponseSchema.parse(data);
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
throw utils.handleError(error);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
exports.createBranchFactory = createBranchFactory;
|
|
27
|
-
//# sourceMappingURL=create-branch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-branch.js","sources":["../../../src/github/branch/create-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type CreateBranchArgs = {\n branchName: string;\n shaLastCommitOfBranch: string;\n};\n\nexport type CreateBranchResponse = {\n ref: string;\n};\n\nconst createBranchResponseSchema = z.object({\n ref: z.string(),\n});\n\nexport type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;\n\nexport type CreateBranchFactory = (instance: AxiosInstance) => CreateBranch;\n\nexport const createBranchFactory: CreateBranchFactory = (instance) => async (args) => {\n const { branchName, shaLastCommitOfBranch } = args;\n\n try {\n const { data } = await instance.post<CreateBranchResponse>('/git/refs', {\n ref: `refs/heads/${branchName}`,\n sha: shaLastCommitOfBranch,\n });\n\n return createBranchResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAcA,MAAM,0BAA0B,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC1C,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAMI,MAAM,mBAAmB,GAAwB,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACnF,IAAA,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC;IAEnD,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAuB,WAAW,EAAE;YACtE,GAAG,EAAE,CAAc,WAAA,EAAA,UAAU,CAAE,CAAA;AAC/B,YAAA,GAAG,EAAE,qBAAqB;AAC3B,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var createBranch = require('./create-branch.js');
|
|
6
|
-
var updateBranch = require('./update-branch.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.createBranchFactory = createBranch.createBranchFactory;
|
|
11
|
-
exports.updateBranchFactory = updateBranch.updateBranchFactory;
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare type UpdateBranchArgs = {
|
|
3
|
-
branchName: string;
|
|
4
|
-
shaTree: string;
|
|
5
|
-
};
|
|
6
|
-
export declare type UpdateBranchResponse = {
|
|
7
|
-
ref: string;
|
|
8
|
-
};
|
|
9
|
-
export declare type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;
|
|
10
|
-
export declare type UpdateBranchFactory = (instance: AxiosInstance) => UpdateBranch;
|
|
11
|
-
export declare const updateBranchFactory: UpdateBranchFactory;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
-
var zod = require('zod');
|
|
7
|
-
var utils = require('../commit/utils.js');
|
|
8
|
-
|
|
9
|
-
const updateBranchResponseSchema = zod.z.object({
|
|
10
|
-
ref: zod.z.string(),
|
|
11
|
-
});
|
|
12
|
-
const updateBranchFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
-
const { branchName, shaTree } = args;
|
|
14
|
-
try {
|
|
15
|
-
const { data } = yield instance.patch(`/git/refs/heads/${branchName}`, {
|
|
16
|
-
sha: shaTree,
|
|
17
|
-
});
|
|
18
|
-
return updateBranchResponseSchema.parse(data);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
throw utils.handleError(error);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
exports.updateBranchFactory = updateBranchFactory;
|
|
26
|
-
//# sourceMappingURL=update-branch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-branch.js","sources":["../../../src/github/branch/update-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type UpdateBranchArgs = {\n branchName: string;\n shaTree: string;\n};\n\nexport type UpdateBranchResponse = {\n ref: string;\n};\n\nconst updateBranchResponseSchema = z.object({\n ref: z.string(),\n});\n\nexport type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;\n\nexport type UpdateBranchFactory = (instance: AxiosInstance) => UpdateBranch;\n\nexport const updateBranchFactory: UpdateBranchFactory = (instance) => async (args) => {\n const { branchName, shaTree } = args;\n\n try {\n const { data } = await instance.patch<UpdateBranchResponse>(`/git/refs/heads/${branchName}`, {\n sha: shaTree,\n });\n\n return updateBranchResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAcA,MAAM,0BAA0B,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC1C,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAMI,MAAM,mBAAmB,GAAwB,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACnF,IAAA,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAErC,IAAI;AACF,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAuB,CAAA,gBAAA,EAAmB,UAAU,CAAA,CAAE,EAAE;AAC3F,YAAA,GAAG,EAAE,OAAO;AACb,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { AxiosInstance } from 'axios';
|
|
2
|
-
export declare type CreateGitBlobArgs = {
|
|
3
|
-
content: string;
|
|
4
|
-
encoding: 'utf-8' | 'base64';
|
|
5
|
-
};
|
|
6
|
-
export declare type CreateGitBlobResponse = {
|
|
7
|
-
sha: string;
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
export declare type CreateGitBlob = (args: CreateGitBlobArgs) => Promise<CreateGitBlobResponse>;
|
|
11
|
-
export declare type CreateGitBlobFactory = (instance: AxiosInstance) => CreateGitBlob;
|
|
12
|
-
/**
|
|
13
|
-
* Create a git blob
|
|
14
|
-
*
|
|
15
|
-
* @param owner the owner of the repository
|
|
16
|
-
* @param repo the name of the repository
|
|
17
|
-
* @param token the github token
|
|
18
|
-
* @param content the content of the file
|
|
19
|
-
* @param encoding the encoding of the content. Default: utf-8
|
|
20
|
-
* @returns CreateGitBlobResponse
|
|
21
|
-
* @throws forbidden
|
|
22
|
-
* @throws resource-not-found
|
|
23
|
-
* @throws conflict
|
|
24
|
-
* @throws validation-failed-or-the-endpoint-has-been-spammed
|
|
25
|
-
*/
|
|
26
|
-
export declare const createGitBlobFactory: CreateGitBlobFactory;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
-
var zod = require('zod');
|
|
7
|
-
var utils = require('./utils.js');
|
|
8
|
-
|
|
9
|
-
const createGitBlobResponseSchema = zod.z.object({
|
|
10
|
-
sha: zod.z.string(),
|
|
11
|
-
url: zod.z.string(),
|
|
12
|
-
});
|
|
13
|
-
/**
|
|
14
|
-
* Create a git blob
|
|
15
|
-
*
|
|
16
|
-
* @param owner the owner of the repository
|
|
17
|
-
* @param repo the name of the repository
|
|
18
|
-
* @param token the github token
|
|
19
|
-
* @param content the content of the file
|
|
20
|
-
* @param encoding the encoding of the content. Default: utf-8
|
|
21
|
-
* @returns CreateGitBlobResponse
|
|
22
|
-
* @throws forbidden
|
|
23
|
-
* @throws resource-not-found
|
|
24
|
-
* @throws conflict
|
|
25
|
-
* @throws validation-failed-or-the-endpoint-has-been-spammed
|
|
26
|
-
*/
|
|
27
|
-
const createGitBlobFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
const { content, encoding = 'utf-8' } = args;
|
|
29
|
-
try {
|
|
30
|
-
const { data } = yield instance.post('/git/blobs', {
|
|
31
|
-
content,
|
|
32
|
-
encoding,
|
|
33
|
-
});
|
|
34
|
-
return createGitBlobResponseSchema.parse(data);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
throw utils.handleError(error);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
exports.createGitBlobFactory = createGitBlobFactory;
|
|
42
|
-
//# sourceMappingURL=create-git-blob.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-git-blob.js","sources":["../../../src/github/commit/create-git-blob.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from './utils';\n\nexport type CreateGitBlobArgs = {\n content: string;\n encoding: 'utf-8' | 'base64';\n};\n\nexport type CreateGitBlobResponse = {\n sha: string;\n url: string;\n};\n\nconst createGitBlobResponseSchema = z.object({\n sha: z.string(),\n url: z.string(),\n});\n\nexport type CreateGitBlob = (\n args: CreateGitBlobArgs\n) => Promise<CreateGitBlobResponse>;\n\nexport type CreateGitBlobFactory = (instance: AxiosInstance) => CreateGitBlob;\n\n/**\n * Create a git blob\n *\n * @param owner the owner of the repository\n * @param repo the name of the repository\n * @param token the github token\n * @param content the content of the file\n * @param encoding the encoding of the content. Default: utf-8\n * @returns CreateGitBlobResponse\n * @throws forbidden\n * @throws resource-not-found\n * @throws conflict\n * @throws validation-failed-or-the-endpoint-has-been-spammed\n */\nexport const createGitBlobFactory: CreateGitBlobFactory = (instance) => async (args) => {\n const { content, encoding = 'utf-8' } = args;\n\n try {\n const { data } = await instance.post<CreateGitBlobResponse>(\n '/git/blobs',\n {\n content,\n encoding,\n },\n );\n\n return createGitBlobResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAeA,MAAM,2BAA2B,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC3C,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AACf,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAQH;;;;;;;;;;;;;AAaG;AACI,MAAM,oBAAoB,GAAyB,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;IACrF,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAE7C,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAClC,YAAY,EACZ;YACE,OAAO;YACP,QAAQ;AACT,SAAA,CACF,CAAC;AAEF,QAAA,OAAO,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChD,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { AxiosInstance } from 'axios';
|
|
2
|
-
export declare type CreateGitCommitArgs = {
|
|
3
|
-
message: string;
|
|
4
|
-
treeSha: string;
|
|
5
|
-
parents: string[];
|
|
6
|
-
};
|
|
7
|
-
export declare type CreateGitCommitResponse = {
|
|
8
|
-
sha: string;
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
export declare type CreateGitCommit = (args: CreateGitCommitArgs) => Promise<CreateGitCommitResponse>;
|
|
12
|
-
export declare type CreateGitCommitFactory = (instance: AxiosInstance) => CreateGitCommit;
|
|
13
|
-
/**
|
|
14
|
-
* Create a git commit
|
|
15
|
-
* @param owner the owner of the repository
|
|
16
|
-
* @param repo the name of the repository
|
|
17
|
-
* @param token the github token
|
|
18
|
-
* @param message the commit message
|
|
19
|
-
* @param treeSha the sha of the tree
|
|
20
|
-
* @param parents the parents of the commit
|
|
21
|
-
* @returns CreateGitCommitResponse
|
|
22
|
-
*/
|
|
23
|
-
export declare const createGitCommitFactory: CreateGitCommitFactory;
|