git-dlp 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +290 -0
  2. package/dist/git-dl.js +43 -0
  3. package/dist/git-dl.js.map +1 -0
  4. package/dist/package.json +138 -0
  5. package/dist/src/TaggedErrorVerifyingCause.js +27 -0
  6. package/dist/src/TaggedErrorVerifyingCause.js.map +1 -0
  7. package/dist/src/castToReadableStream.js +28 -0
  8. package/dist/src/castToReadableStream.js.map +1 -0
  9. package/dist/src/cli.js +8 -0
  10. package/dist/src/cli.js.map +1 -0
  11. package/dist/src/commandLineParams.js +172 -0
  12. package/dist/src/commandLineParams.js.map +1 -0
  13. package/dist/src/commonErrors.js +60 -0
  14. package/dist/src/commonErrors.js.map +1 -0
  15. package/dist/src/configContext.js +12 -0
  16. package/dist/src/configContext.js.map +1 -0
  17. package/dist/src/downloadEntityFromRepo.js +21 -0
  18. package/dist/src/downloadEntityFromRepo.js.map +1 -0
  19. package/dist/src/errors.js +10 -0
  20. package/dist/src/errors.js.map +1 -0
  21. package/dist/src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.js +43 -0
  22. package/dist/src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.js.map +1 -0
  23. package/dist/src/getPathContents/PathContentsMetaInfo.js +71 -0
  24. package/dist/src/getPathContents/PathContentsMetaInfo.js.map +1 -0
  25. package/dist/src/getPathContents/RawStreamOfRepoPathContentsFromGitHubAPI.js +4 -0
  26. package/dist/src/getPathContents/RawStreamOfRepoPathContentsFromGitHubAPI.js.map +1 -0
  27. package/dist/src/getPathContents/RepoPathContentsFromGitHubAPI.js +51 -0
  28. package/dist/src/getPathContents/RepoPathContentsFromGitHubAPI.js.map +1 -0
  29. package/dist/src/getPathContents/index.js +5 -0
  30. package/dist/src/getPathContents/index.js.map +1 -0
  31. package/dist/src/getPathContents/parseGitLFSObjectEither.js +70 -0
  32. package/dist/src/getPathContents/parseGitLFSObjectEither.js.map +1 -0
  33. package/dist/src/getReadableTarGzStreamOfRepoDirectory.js +39 -0
  34. package/dist/src/getReadableTarGzStreamOfRepoDirectory.js.map +1 -0
  35. package/dist/src/index.js +8 -0
  36. package/dist/src/index.js.map +1 -0
  37. package/dist/src/octokit.js +6 -0
  38. package/dist/src/octokit.js.map +1 -0
  39. package/dist/src/unpackRepoFolderTarGzStreamToFs.js +31 -0
  40. package/dist/src/unpackRepoFolderTarGzStreamToFs.js.map +1 -0
  41. package/dist/src/writeFileStreamToDestinationPath.js +22 -0
  42. package/dist/src/writeFileStreamToDestinationPath.js.map +1 -0
  43. package/dist-types/git-dl.d.ts +3 -0
  44. package/dist-types/git-dl.d.ts.map +1 -0
  45. package/dist-types/src/TaggedErrorVerifyingCause.d.ts +38 -0
  46. package/dist-types/src/TaggedErrorVerifyingCause.d.ts.map +1 -0
  47. package/dist-types/src/castToReadableStream.d.ts +11 -0
  48. package/dist-types/src/castToReadableStream.d.ts.map +1 -0
  49. package/dist-types/src/cli.d.ts +8 -0
  50. package/dist-types/src/cli.d.ts.map +1 -0
  51. package/dist-types/src/commandLineParams.d.ts +108 -0
  52. package/dist-types/src/commandLineParams.d.ts.map +1 -0
  53. package/dist-types/src/commonErrors.d.ts +60 -0
  54. package/dist-types/src/commonErrors.d.ts.map +1 -0
  55. package/dist-types/src/configContext.d.ts +44 -0
  56. package/dist-types/src/configContext.d.ts.map +1 -0
  57. package/dist-types/src/downloadEntityFromRepo.d.ts +11 -0
  58. package/dist-types/src/downloadEntityFromRepo.d.ts.map +1 -0
  59. package/dist-types/src/errors.d.ts +10 -0
  60. package/dist-types/src/errors.d.ts.map +1 -0
  61. package/dist-types/src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.d.ts +141 -0
  62. package/dist-types/src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.d.ts.map +1 -0
  63. package/dist-types/src/getPathContents/PathContentsMetaInfo.d.ts +66 -0
  64. package/dist-types/src/getPathContents/PathContentsMetaInfo.d.ts.map +1 -0
  65. package/dist-types/src/getPathContents/RawStreamOfRepoPathContentsFromGitHubAPI.d.ts +9 -0
  66. package/dist-types/src/getPathContents/RawStreamOfRepoPathContentsFromGitHubAPI.d.ts.map +1 -0
  67. package/dist-types/src/getPathContents/RepoPathContentsFromGitHubAPI.d.ts +81 -0
  68. package/dist-types/src/getPathContents/RepoPathContentsFromGitHubAPI.d.ts.map +1 -0
  69. package/dist-types/src/getPathContents/index.d.ts +5 -0
  70. package/dist-types/src/getPathContents/index.d.ts.map +1 -0
  71. package/dist-types/src/getPathContents/parseGitLFSObjectEither.d.ts +40 -0
  72. package/dist-types/src/getPathContents/parseGitLFSObjectEither.d.ts.map +1 -0
  73. package/dist-types/src/getReadableTarGzStreamOfRepoDirectory.d.ts +13 -0
  74. package/dist-types/src/getReadableTarGzStreamOfRepoDirectory.d.ts.map +1 -0
  75. package/dist-types/src/index.d.ts +9 -0
  76. package/dist-types/src/index.d.ts.map +1 -0
  77. package/dist-types/src/octokit.d.ts +8 -0
  78. package/dist-types/src/octokit.d.ts.map +1 -0
  79. package/dist-types/src/unpackRepoFolderTarGzStreamToFs.d.ts +16 -0
  80. package/dist-types/src/unpackRepoFolderTarGzStreamToFs.d.ts.map +1 -0
  81. package/dist-types/src/writeFileStreamToDestinationPath.d.ts +16 -0
  82. package/dist-types/src/writeFileStreamToDestinationPath.d.ts.map +1 -0
  83. package/package.json +139 -0
  84. package/src/TaggedErrorVerifyingCause.ts +142 -0
  85. package/src/castToReadableStream.ts +44 -0
  86. package/src/cli.ts +14 -0
  87. package/src/commandLineParams.ts +257 -0
  88. package/src/commonErrors.ts +139 -0
  89. package/src/configContext.ts +46 -0
  90. package/src/downloadEntityFromRepo.ts +86 -0
  91. package/src/errors.ts +24 -0
  92. package/src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.ts +76 -0
  93. package/src/getPathContents/PathContentsMetaInfo.ts +85 -0
  94. package/src/getPathContents/RawStreamOfRepoPathContentsFromGitHubAPI.ts +6 -0
  95. package/src/getPathContents/RepoPathContentsFromGitHubAPI.ts +82 -0
  96. package/src/getPathContents/index.ts +7 -0
  97. package/src/getPathContents/parseGitLFSObjectEither.ts +143 -0
  98. package/src/getReadableTarGzStreamOfRepoDirectory.ts +65 -0
  99. package/src/index.ts +13 -0
  100. package/src/octokit.ts +15 -0
  101. package/src/unpackRepoFolderTarGzStreamToFs.ts +61 -0
  102. package/src/writeFileStreamToDestinationPath.ts +45 -0
  103. package/template.env +13 -0
@@ -0,0 +1,39 @@
1
+ import { RequestError } from '@octokit/request-error';
2
+ import * as Cause from 'effect/Cause';
3
+ import * as Effect from 'effect/Effect';
4
+ import * as EFunction from 'effect/Function';
5
+ import { CastToReadableStream } from "./castToReadableStream.js";
6
+ import { GitHubApiGeneralUserError, parseCommonGitHubApiErrors, } from "./commonErrors.js";
7
+ import { InputConfigTag } from "./configContext.js";
8
+ import { OctokitTag } from "./octokit.js";
9
+ export const getReadableTarGzStreamOfRepoDirectory = (gitRefWhichWillBeUsedToIdentifyGitTree) => EFunction.pipe(requestTarballFromGitHubAPI(gitRefWhichWillBeUsedToIdentifyGitTree), Effect.map(({ data }) => data), CastToReadableStream);
10
+ // TODO: better return type signature so that we actually show what's returned
11
+ // buffer, stream or something else. Octokit sucks
12
+ const requestTarballFromGitHubAPI = (gitRefWhichWillBeUsedToIdentifyGitTree = '') => Effect.gen(function* () {
13
+ const octokit = yield* OctokitTag;
14
+ const { repo: { owner, name }, } = yield* InputConfigTag;
15
+ return yield* Effect.tryPromise({
16
+ try: signal => octokit.request('GET /repos/{owner}/{repo}/tarball/{ref}', {
17
+ owner,
18
+ repo: name,
19
+ ref: gitRefWhichWillBeUsedToIdentifyGitTree,
20
+ request: {
21
+ signal,
22
+ parseSuccessResponseBody: false,
23
+ },
24
+ headers: {
25
+ 'X-GitHub-Api-Version': '2022-11-28',
26
+ },
27
+ }),
28
+ catch: error => {
29
+ if (!(error instanceof RequestError))
30
+ return new Cause.UnknownException(error, 'Failed to request .tar.gz file from GitHub API');
31
+ if (error.status === 400)
32
+ return new GitHubApiGeneralUserError(error, {
33
+ notes: 'Error happened probably because you asked for empty repo',
34
+ });
35
+ return parseCommonGitHubApiErrors(error);
36
+ },
37
+ });
38
+ });
39
+ //# sourceMappingURL=getReadableTarGzStreamOfRepoDirectory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getReadableTarGzStreamOfRepoDirectory.js","sourceRoot":"","sources":["../../src/getReadableTarGzStreamOfRepoDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,sCAA+C,EAC/C,EAAE,CACF,SAAS,CAAC,IAAI,CACZ,2BAA2B,CAAC,sCAAsC,CAAC,EACnE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAC9B,oBAAoB,CACrB,CAAA;AAEH,8EAA8E;AAC9E,kDAAkD;AAClD,MAAM,2BAA2B,GAAG,CAClC,sCAAsC,GAAG,EAAE,EAC3C,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,UAAU,CAAA;IAEjC,MAAM,EACJ,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GACtB,GAAG,KAAK,CAAC,CAAC,cAAc,CAAA;IAEzB,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QAC9B,GAAG,EAAE,MAAM,CAAC,EAAE,CACZ,OAAO,CAAC,OAAO,CAAC,yCAAyC,EAAE;YACzD,KAAK;YACL,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,sCAAsC;YAC3C,OAAO,EAAE;gBACP,MAAM;gBACN,wBAAwB,EAAE,KAAK;aAChC;YACD,OAAO,EAAE;gBACP,sBAAsB,EAAE,YAAY;aACrC;SACF,CAAC;QACJ,KAAK,EAAE,KAAK,CAAC,EAAE;YACb,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC;gBAClC,OAAO,IAAI,KAAK,CAAC,gBAAgB,CAC/B,KAAK,EACL,gDAAgD,CACjD,CAAA;YAEH,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG;gBACtB,OAAO,IAAI,yBAAyB,CAAC,KAAK,EAAE;oBAC1C,KAAK,EAAE,0DAA0D;iBAClE,CAAC,CAAA;YAEJ,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAA;QAC1C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module
3
+ */
4
+ export * from "./cli.js";
5
+ export { downloadEntityFromRepo } from "./downloadEntityFromRepo.js";
6
+ export * from "./errors.js";
7
+ export { OctokitLayer } from "./octokit.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAA;AAMxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Octokit } from '@octokit/core';
2
+ import * as Context from 'effect/Context';
3
+ import * as Layer from 'effect/Layer';
4
+ export const OctokitTag = Context.GenericTag('OctokitTag');
5
+ export const OctokitLayer = (options) => Layer.succeed(OctokitTag, OctokitTag.of(new Octokit(options)));
6
+ //# sourceMappingURL=octokit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"octokit.js","sourceRoot":"","sources":["../../src/octokit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,eAAe,CAAA;AAE5D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAMrC,MAAM,CAAC,MAAM,UAAU,GAAe,OAAO,CAAC,UAAU,CAAU,YAAY,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,YAAY,GAEiB,CAAC,OAAwB,EAAE,EAAE,CACrE,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { pipeline } from 'node:stream/promises';
2
+ import { createGunzip } from 'node:zlib';
3
+ import { extract } from 'tar-fs';
4
+ import * as Effect from 'effect/Effect';
5
+ import { OutputConfigTag } from "./configContext.js";
6
+ import { buildTaggedErrorClassVerifyingCause, } from "./TaggedErrorVerifyingCause.js";
7
+ // TODO: Use this maybe for tar.gz unpacking?
8
+ // https://github.com/leonitousconforti/eftar
9
+ // TODO: Or implement my own wrapper around node:zlib?
10
+ export const unpackRepoFolderTarGzStreamToFs = (self) => Effect.gen(function* () {
11
+ const tarGzStream = yield* self;
12
+ const { localPathAtWhichEntityFromRepoWillBeAvailable: pathToLocalDirWhichWillHaveContentsOfRepoDir, } = yield* OutputConfigTag;
13
+ yield* Effect.tryPromise({
14
+ try: signal => pipeline(tarGzStream, createGunzip(), extract(pathToLocalDirWhichWillHaveContentsOfRepoDir, {
15
+ map: header => {
16
+ // GitHub creates archive with nested dir inside which has all
17
+ // the files we need, so we remove this dir's name from the
18
+ // beginning
19
+ header.name = header.name.replace(/^[^/]*\/(.*)/, '$1');
20
+ return header;
21
+ },
22
+ }), { signal }),
23
+ catch: cause => new FailedToUnpackRepoFolderTarGzStreamToFsError({ cause }),
24
+ });
25
+ });
26
+ // Extracting to a separate type is required by JSR, so that consumers of the
27
+ // library will have much faster type inference
28
+ const _1 = buildTaggedErrorClassVerifyingCause()('FailedToUnpackRepoFolderTarGzStreamToFsError', 'Error: Failed to unpack to fs received from GitHub .tar.gz stream of repo folder contents');
29
+ export class FailedToUnpackRepoFolderTarGzStreamToFsError extends _1 {
30
+ }
31
+ //# sourceMappingURL=unpackRepoFolderTarGzStreamToFs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpackRepoFolderTarGzStreamToFs.js","sourceRoot":"","sources":["../../src/unpackRepoFolderTarGzStreamToFs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,mCAAmC,GAEpC,MAAM,gCAAgC,CAAA;AAEvC,6CAA6C;AAC7C,6CAA6C;AAC7C,sDAAsD;AAEtD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,IAAmC,EACnC,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,IAAI,CAAA;IAE/B,MAAM,EACJ,6CAA6C,EAC3C,4CAA4C,GAC/C,GAAG,KAAK,CAAC,CAAC,eAAe,CAAA;IAE1B,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACvB,GAAG,EAAE,MAAM,CAAC,EAAE,CACZ,QAAQ,CACN,WAAW,EACX,YAAY,EAAE,EACd,OAAO,CAAC,4CAA4C,EAAE;YACpD,GAAG,EAAE,MAAM,CAAC,EAAE;gBACZ,8DAA8D;gBAC9D,2DAA2D;gBAC3D,YAAY;gBACZ,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAA;gBACvD,OAAO,MAAM,CAAA;YACf,CAAC;SACF,CAAC,EACF,EAAE,MAAM,EAAE,CACX;QACH,KAAK,EAAE,KAAK,CAAC,EAAE,CACb,IAAI,4CAA4C,CAAC,EAAE,KAAK,EAAE,CAAC;KAC9D,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEJ,6EAA6E;AAC7E,+CAA+C;AAC/C,MAAM,EAAE,GAGH,mCAAmC,EAAsB,CAC5D,8CAA8C,EAC9C,2FAA2F,CAC5F,CAAA;AAED,MAAM,OAAO,4CAA6C,SAAQ,EAAE;CAAG"}
@@ -0,0 +1,22 @@
1
+ import { createWriteStream } from 'node:fs';
2
+ import { pipeline } from 'node:stream/promises';
3
+ import * as Effect from 'effect/Effect';
4
+ import { OutputConfigTag } from "./configContext.js";
5
+ import { buildTaggedErrorClassVerifyingCause, } from "./TaggedErrorVerifyingCause.js";
6
+ // TODO: use effect platform streams
7
+ export const writeFileStreamToDestinationPath = (self) => Effect.gen(function* () {
8
+ const fileStream = yield* self;
9
+ const { localPathAtWhichEntityFromRepoWillBeAvailable: localDownloadedFilePath, } = yield* OutputConfigTag;
10
+ yield* Effect.tryPromise({
11
+ try: signal => pipeline(fileStream, createWriteStream(localDownloadedFilePath), {
12
+ signal,
13
+ }),
14
+ catch: cause => new FailedToWriteFileStreamToDestinationPathError({ cause }),
15
+ });
16
+ });
17
+ // Extracting to a separate type is required by JSR, so that consumers of the
18
+ // library will have much faster type inference
19
+ const _1 = buildTaggedErrorClassVerifyingCause()('FailedToWriteFileStreamToDestinationPathError', 'Error: Failed to write file stream to destination path');
20
+ export class FailedToWriteFileStreamToDestinationPathError extends _1 {
21
+ }
22
+ //# sourceMappingURL=writeFileStreamToDestinationPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeFileStreamToDestinationPath.js","sourceRoot":"","sources":["../../src/writeFileStreamToDestinationPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,mCAAmC,GAEpC,MAAM,gCAAgC,CAAA;AAEvC,oCAAoC;AAEpC,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,IAAmC,EACnC,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,IAAI,CAAA;IAE9B,MAAM,EACJ,6CAA6C,EAAE,uBAAuB,GACvE,GAAG,KAAK,CAAC,CAAC,eAAe,CAAA;IAE1B,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACvB,GAAG,EAAE,MAAM,CAAC,EAAE,CACZ,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,EAAE;YAC/D,MAAM;SACP,CAAC;QACJ,KAAK,EAAE,KAAK,CAAC,EAAE,CACb,IAAI,6CAA6C,CAAC,EAAE,KAAK,EAAE,CAAC;KAC/D,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEJ,6EAA6E;AAC7E,+CAA+C;AAC/C,MAAM,EAAE,GAGH,mCAAmC,EAAsB,CAC5D,+CAA+C,EAC/C,wDAAwD,CACzD,CAAA;AAED,MAAM,OAAO,6CAA8C,SAAQ,EAAE;CAAG"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=git-dl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-dl.d.ts","sourceRoot":"","sources":["../git-dl.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import type { Equals } from 'tsafe';
2
+ import type * as Cause from 'effect/Cause';
3
+ export declare const buildTaggedErrorClassVerifyingCause: <const DynamicContext extends Record<string, unknown> = {}>() => <const ErrorName extends string, Config extends {
4
+ ErrorName: ErrorName;
5
+ ExpectedCauseClass: ExpectedCauseClass;
6
+ StaticContext: StaticContext;
7
+ DynamicContext: DynamicContext;
8
+ }, const StaticContext extends Record<string, unknown> = {}, ExpectedCauseClass extends WideErrorConstructor | undefined = undefined>(errorName: ErrorName, customMessage: string | ((...args: MessageRendererArgs<Config>) => string), expectedCauseClass?: ExpectedCauseClass, staticContext?: StaticContext) => TaggedErrorClass<Config>;
9
+ export type TaggedErrorClass<Config extends ConfigTemplate> = [string] extends [
10
+ Config['ErrorName']
11
+ ] ? 'ErrorName should be a string literal' : new (...args: ConstructorArgs<Config>) => Cause.YieldableError & Readonly<{
12
+ message: string;
13
+ _tag: Config['ErrorName'];
14
+ name: Config['ErrorName'];
15
+ } & GetValueByKey<Config, 'DynamicContext', {}> & GetValueByKey<Config, 'StaticContext', {}> & IsExpectedCauseClassManuallySpecified<Config, {
16
+ cause: GetCauseInstance<Config>;
17
+ }, {}>>;
18
+ type ConstructorArgs<Config extends ConfigTemplate> = CauseArgTuple<Config, GetValueByKey<Config, 'DynamicContext', {}>>;
19
+ type MessageRendererArgs<Config extends ConfigTemplate> = CauseArgTuple<Config, GetValueByKey<Config, 'DynamicContext', {}> & GetValueByKey<Config, 'StaticContext', {}>>;
20
+ type ConfigTemplate = {
21
+ ErrorName: string;
22
+ ExpectedCauseClass?: WideErrorConstructor | undefined;
23
+ StaticContext?: Record<string, unknown> | undefined;
24
+ DynamicContext?: Record<string, unknown> | undefined;
25
+ };
26
+ type CauseArgTuple<Config extends ConfigTemplate, Context> = [
27
+ ...IsExpectedCauseClassManuallySpecified<Config, [
28
+ cause: GetCauseInstance<Config>
29
+ ], [
30
+ ]>,
31
+ ...(Equals<Context, {}> extends true ? [] : [context: Readonly<Context>])
32
+ ];
33
+ type IsExpectedCauseClassManuallySpecified<Config extends ConfigTemplate, IfTrue, IfFalse> = GetValueByKey<Config, 'ExpectedCauseClass', WideErrorConstructor | undefined> extends infer ExpectedCauseClass ? [ExpectedCauseClass] extends [WideErrorConstructor] ? IfTrue : IfFalse : never;
34
+ type GetCauseInstance<Config extends ConfigTemplate> = InstanceType<Exclude<Config['ExpectedCauseClass'], undefined>>;
35
+ export type GetValueByKey<Config extends Record<string, unknown>, Key extends string, Default> = [Key] extends [keyof Config] ? Exclude<Config[Key], undefined> extends infer TargetValue ? [TargetValue] extends [never] ? Default : TargetValue : Default : Default;
36
+ type WideErrorConstructor = new (...args: any[]) => Error;
37
+ export {};
38
+ //# sourceMappingURL=TaggedErrorVerifyingCause.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaggedErrorVerifyingCause.d.ts","sourceRoot":"","sources":["../../src/TaggedErrorVerifyingCause.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAO1C,eAAO,MAAM,mCAAmC,GAC7C,KAAK,CAAC,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAExD,KAAK,CAAC,SAAS,SAAS,MAAM,EAC9B,MAAM,SAAS;IACb,SAAS,EAAE,SAAS,CAAA;IACpB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;CAC/B,EACD,KAAK,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAA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OAAO,GACP,WAAW,GACb,OAAO,GACT,OAAO,CAAA;AAEX,KAAK,oBAAoB,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { Readable } from 'node:stream';
2
+ import * as Effect from 'effect/Effect';
3
+ import { type TaggedErrorClass } from './TaggedErrorVerifyingCause.ts';
4
+ export declare const CastToReadableStream: <E, R>(self: Effect.Effect<unknown, E, R>) => Effect.Effect<Readable, E | FailedToCastDataToReadableStreamError, R>;
5
+ declare const _1: TaggedErrorClass<{
6
+ ErrorName: 'FailedToCastDataToReadableStreamError';
7
+ }>;
8
+ export declare class FailedToCastDataToReadableStreamError extends _1 {
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=castToReadableStream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"castToReadableStream.d.ts","sourceRoot":"","sources":["../../src/castToReadableStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAA;AAKvC,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,EACvC,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,0EAkBhC,CAAA;AAIJ,QAAA,MAAM,EAAE,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,uCAAuC,CAAA;CACnD,CAGA,CAAA;AAED,qBAAa,qCAAsC,SAAQ,EAAE;CAAG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Reusable in {@link https://effect.website/ Effect} applications CLI Options
3
+ * backed by ENV variables
4
+ *
5
+ * @module
6
+ */
7
+ export { destinationPathCLIOptionBackedByEnv, gitRefCLIOptionBackedByEnv, pathToEntityInRepoCLIOptionBackedByEnv, repoNameCLIOptionBackedByEnv, repoOwnerCLIOptionBackedByEnv, } from './commandLineParams.ts';
8
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,mCAAmC,EACnC,0BAA0B,EAC1B,sCAAsC,EACtC,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,108 @@
1
+ import * as CLIOptions from '@effect/cli/Options';
2
+ /**
3
+ * Text parameter containing path to a directory or a file inside target repo.
4
+ *
5
+ * Can be passed in two ways:
6
+ * 1. As CLI option `gdl --pathToEntityInRepo nestedFolder/Readme.md`
7
+ * 2. As env variable `PATH_TO_ENTITY_IN_REPO="nestedFolder/Readme.md" gdl`
8
+ *
9
+ * Has default: `.`, which means that if not specified, script will download
10
+ * entire repository (download root directory of the repository)
11
+ *
12
+ * Parameter is automatically validated to not point higher than the root of the
13
+ * repository.
14
+ *
15
+ * @since 0.1.7
16
+ * @category CLI options
17
+ * @constant
18
+ */
19
+ export declare const pathToEntityInRepoCLIOptionBackedByEnv: CLIOptions.Options<string>;
20
+ /**
21
+ * Text parameter containing URL slug of the user which owns the repo.
22
+ *
23
+ * Examples:
24
+ * 1. `apache`
25
+ * 2. `nikelborm`
26
+ *
27
+ * Can be passed in two ways:
28
+ * 1. As CLI option `gdl --repoOwner apache`
29
+ * 2. As env variable `REPO_OWNER="apache" gdl`
30
+ *
31
+ * Doesn`t have defaults and will fail if not specified.
32
+ *
33
+ * Parameter is automatically validated so it can consist of only ASCII letters,
34
+ * digits, and the characters `.`, `-`, and `_`.
35
+ *
36
+ * @since 0.1.7
37
+ * @category CLI options
38
+ * @constant
39
+ */
40
+ export declare const repoOwnerCLIOptionBackedByEnv: CLIOptions.Options<string>;
41
+ /**
42
+ * Text parameter containing URL slug of the repo itself.
43
+ *
44
+ * Examples:
45
+ * 1. `superset`
46
+ * 2. `git-dl`
47
+ *
48
+ * Can be passed in two ways:
49
+ * 1. As CLI option `gdl --repoName superset`
50
+ * 2. As env variable `REPO_NAME="superset" gdl`
51
+ *
52
+ * Doesn`t have defaults and will fail if not specified.
53
+ *
54
+ * Parameter is automatically validated so it can consist of only ASCII letters,
55
+ * digits, and the characters `.`, `-`, and `_`.
56
+ *
57
+ * @since 0.1.7
58
+ * @category CLI options
59
+ * @constant
60
+ */
61
+ export declare const repoNameCLIOptionBackedByEnv: CLIOptions.Options<string>;
62
+ /**
63
+ * Text parameter containing path inside your local file system, your new
64
+ * file/directory will be placed at. Last element of the path will be the name
65
+ * of the new file/directory.
66
+ *
67
+ * Examples:
68
+ * 1. `../docker`
69
+ * 2. `/tmp/Readme.md`
70
+ *
71
+ * Can be passed in two ways:
72
+ * 1. As CLI option `gdl --destinationPath docker`
73
+ * 2. As env variable `DESTINATION_PATH="docker" gdl`
74
+ *
75
+ * Has default: `./destination`, which means that if not specified, script will
76
+ * either create a file or a directory named `destination` inside your current PWD
77
+ * depending on the type of remote target.
78
+ *
79
+ * @since 0.1.7
80
+ * @category CLI options
81
+ * @constant
82
+ * @readonly
83
+ */
84
+ export declare const destinationPathCLIOptionBackedByEnv: CLIOptions.Options<string>;
85
+ /**
86
+ * Text parameter containing commit SHA hash, branch name, or tag name you want
87
+ * to download from.
88
+ *
89
+ * Examples:
90
+ * 1. `HEAD`
91
+ * 2. `main`
92
+ * 3. `4.1.1`
93
+ * 4. `dca3efb3dd2a2a75aea32e3561c4104a53f02808`
94
+ * 5. `dca3efb`
95
+ *
96
+ * Can be passed in two ways:
97
+ * 1. As CLI option `gdl --gitRef 4.1.1`
98
+ * 2. As env variable `GIT_REF="4.1.1" gdl`
99
+ *
100
+ * Has default: `HEAD`, which means that if not specified, the default branch in
101
+ * the repository will be used.
102
+ *
103
+ * @since 0.1.7
104
+ * @category CLI options
105
+ * @constant
106
+ */
107
+ export declare const gitRefCLIOptionBackedByEnv: CLIOptions.Options<string>;
108
+ //# sourceMappingURL=commandLineParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandLineParams.d.ts","sourceRoot":"","sources":["../../src/commandLineParams.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AAqHjD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sCAAsC,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAM3E,CAAA;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAMlE,CAAA;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,4BAA4B,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAMjE,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mCAAmC,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAKxE,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,0BAA0B,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAK/D,CAAA"}
@@ -0,0 +1,60 @@
1
+ import { RequestError } from '@octokit/request-error';
2
+ import { type TaggedErrorClass } from './TaggedErrorVerifyingCause.ts';
3
+ declare const _1: TaggedErrorClass<{
4
+ ErrorName: 'GitHubApiGeneralServerError';
5
+ ExpectedCauseClass: typeof RequestError;
6
+ }>;
7
+ export declare class GitHubApiGeneralServerError extends _1 {
8
+ }
9
+ declare const _2: TaggedErrorClass<{
10
+ ErrorName: 'GitHubApiGeneralUserError';
11
+ ExpectedCauseClass: typeof RequestError;
12
+ DynamicContext: {
13
+ readonly notes?: string;
14
+ };
15
+ }>;
16
+ export declare class GitHubApiGeneralUserError extends _2 {
17
+ }
18
+ declare const _3: TaggedErrorClass<{
19
+ ErrorName: 'GitHubApiThingNotExistsOrYouDontHaveAccessError';
20
+ ExpectedCauseClass: typeof RequestError;
21
+ }>;
22
+ export declare class GitHubApiThingNotExistsOrYouDontHaveAccessError extends _3 {
23
+ }
24
+ declare const _4: TaggedErrorClass<{
25
+ ErrorName: 'GitHubApiRepoIsEmptyError';
26
+ ExpectedCauseClass: typeof RequestError;
27
+ }>;
28
+ export declare class GitHubApiRepoIsEmptyError extends _4 {
29
+ }
30
+ declare const _5: TaggedErrorClass<{
31
+ ErrorName: 'GitHubApiNoCommitFoundForGitRefError';
32
+ ExpectedCauseClass: typeof RequestError;
33
+ DynamicContext: {
34
+ gitRef: string;
35
+ };
36
+ }>;
37
+ export declare class GitHubApiNoCommitFoundForGitRefError extends _5 {
38
+ }
39
+ declare const _6: TaggedErrorClass<{
40
+ ErrorName: 'GitHubApiBadCredentialsError';
41
+ ExpectedCauseClass: typeof RequestError;
42
+ }>;
43
+ export declare class GitHubApiBadCredentialsError extends _6 {
44
+ }
45
+ declare const _7: TaggedErrorClass<{
46
+ ErrorName: 'GitHubApiAuthRatelimitedError';
47
+ ExpectedCauseClass: typeof RequestError;
48
+ }>;
49
+ export declare class GitHubApiAuthRatelimitedError extends _7 {
50
+ }
51
+ declare const _8: TaggedErrorClass<{
52
+ ErrorName: 'GitHubApiRatelimitedError';
53
+ ExpectedCauseClass: typeof RequestError;
54
+ }>;
55
+ export declare class GitHubApiRatelimitedError extends _8 {
56
+ }
57
+ export declare const parseCommonGitHubApiErrors: (error: RequestError) => RequestError | GitHubApiGeneralServerError | GitHubApiGeneralUserError | GitHubApiThingNotExistsOrYouDontHaveAccessError | GitHubApiBadCredentialsError | GitHubApiAuthRatelimitedError | GitHubApiRatelimitedError;
58
+ export type GitHubApiCommonErrors = RequestError | GitHubApiGeneralServerError | GitHubApiGeneralUserError | GitHubApiBadCredentialsError | GitHubApiAuthRatelimitedError | GitHubApiRatelimitedError;
59
+ export {};
60
+ //# sourceMappingURL=commonErrors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonErrors.d.ts","sourceRoot":"","sources":["../../src/common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AAkB,EAAE,OAAO,YAAY,CAAA;CACxC,CAIA,CAAA;AAED,qBAAa,4BAA6B,SAAQ,EAAE;CAAG;AAIvD,QAAA,MAAM,EAAE,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,+BAA+B,CAAA;IAC1C,kBAAkB,EAAE,OAAO,YAAY,CAAA;CACxC,CAIA,CAAA;AAED,qBAAa,6BAA8B,SAAQ,EAAE;CAAG;AAIxD,QAAA,MAAM,EAAE,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,2BAA2B,CAAA;IACtC,kBAAkB,EAAE,OAAO,YAAY,CAAA;CACxC,CAIA,CAAA;AAED,qBAAa,yBAA0B,SAAQ,EAAE;CAAG;AAEpD,eAAO,MAAM,0BAA0B,GAAI,OAAO,YAAY,wNAiB7D,CAAA;AAED,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,2BAA2B,GAC3B,yBAAyB,GACzB,4BAA4B,GAC5B,6BAA6B,GAC7B,yBAAyB,CAAA"}
@@ -0,0 +1,44 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ export type InputConfig = Readonly<{
4
+ repo: Readonly<{
5
+ owner: string;
6
+ name: string;
7
+ }>;
8
+ pathToEntityInRepo: string;
9
+ gitRef: string;
10
+ }>;
11
+ export declare const InputConfigTag: Context.Tag<Readonly<{
12
+ repo: Readonly<{
13
+ owner: string;
14
+ name: string;
15
+ }>;
16
+ pathToEntityInRepo: string;
17
+ gitRef: string;
18
+ }>, Readonly<{
19
+ repo: Readonly<{
20
+ owner: string;
21
+ name: string;
22
+ }>;
23
+ pathToEntityInRepo: string;
24
+ gitRef: string;
25
+ }>>;
26
+ export type OutputConfig = Readonly<{
27
+ localPathAtWhichEntityFromRepoWillBeAvailable: string;
28
+ }>;
29
+ export declare const OutputConfigTag: Context.Tag<Readonly<{
30
+ localPathAtWhichEntityFromRepoWillBeAvailable: string;
31
+ }>, Readonly<{
32
+ localPathAtWhichEntityFromRepoWillBeAvailable: string;
33
+ }>>;
34
+ export declare const provideInputConfig: (inputConfig: InputConfig) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Readonly<{
35
+ repo: Readonly<{
36
+ owner: string;
37
+ name: string;
38
+ }>;
39
+ pathToEntityInRepo: string;
40
+ gitRef: string;
41
+ }>>>;
42
+ export type SingleTargetConfig = InputConfig & OutputConfig;
43
+ export declare const provideSingleDownloadTargetConfig: ({ localPathAtWhichEntityFromRepoWillBeAvailable, ...inputConfig }: SingleTargetConfig) => (<A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, InputConfig | OutputConfig>>);
44
+ //# sourceMappingURL=configContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configContext.d.ts","sourceRoot":"","sources":["../../src/configContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,eAAO,MAAM,cAAc;UARnB,QAAQ,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;KACb,CAAC;wBACkB,MAAM;YAClB,MAAM;;UALR,QAAQ,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;KACb,CAAC;wBACkB,MAAM;YAClB,MAAM;GAG4D,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,6CAA6C,EAAE,MAAM,CAAA;CACtD,CAAC,CAAA;AAEF,eAAO,MAAM,eAAe;mDAHqB,MAAM;;mDAAN,MAAM;GAGwB,CAAA;AAK/E,eAAO,MAAM,kBAAkB,GAAI,aAAa,WAAW;UAnBnD,QAAQ,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;KACb,CAAC;wBACkB,MAAM;YAClB,MAAM;IAe8B,CAAA;AAK9C,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,YAAY,CAAA;AAE3D,eAAO,MAAM,iCAAiC,GAAI,mEAG/C,kBAAkB,KAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KACzB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC,CAQ7D,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { Octokit } from '@octokit/core';
2
+ import type * as Cause from 'effect/Cause';
3
+ import * as Effect from 'effect/Effect';
4
+ import type { FailedToCastDataToReadableStreamError } from './castToReadableStream.ts';
5
+ import type { GitHubApiAuthRatelimitedError, GitHubApiBadCredentialsError, GitHubApiGeneralServerError, GitHubApiGeneralUserError, GitHubApiNoCommitFoundForGitRefError, GitHubApiRatelimitedError, GitHubApiRepoIsEmptyError, GitHubApiThingNotExistsOrYouDontHaveAccessError } from './commonErrors.ts';
6
+ import { type SingleTargetConfig } from './configContext.ts';
7
+ import { type FailedToParseResponseFromRepoPathContentsMetaInfoAPIError, type InconsistentExpectedAndRealContentSizeError } from './getPathContents/index.ts';
8
+ import { type FailedToUnpackRepoFolderTarGzStreamToFsError } from './unpackRepoFolderTarGzStreamToFs.ts';
9
+ import { type FailedToWriteFileStreamToDestinationPathError } from './writeFileStreamToDestinationPath.ts';
10
+ export declare const downloadEntityFromRepo: (target: SingleTargetConfig) => Effect.Effect<void, Error | InconsistentExpectedAndRealContentSizeError | FailedToWriteFileStreamToDestinationPathError | FailedToUnpackRepoFolderTarGzStreamToFsError | Cause.UnknownException | GitHubApiRepoIsEmptyError | GitHubApiNoCommitFoundForGitRefError | GitHubApiThingNotExistsOrYouDontHaveAccessError | GitHubApiBadCredentialsError | GitHubApiAuthRatelimitedError | GitHubApiRatelimitedError | GitHubApiGeneralServerError | GitHubApiGeneralUserError | FailedToParseResponseFromRepoPathContentsMetaInfoAPIError | FailedToCastDataToReadableStreamError, Octokit>;
11
+ //# sourceMappingURL=downloadEntityFromRepo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloadEntityFromRepo.d.ts","sourceRoot":"","sources":["../../src/downloadEntityFromRepo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,oCAAoC,EACpC,yBAAyB,EACzB,yBAAyB,EACzB,+CAA+C,EAChD,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,yDAAyD,EAC9D,KAAK,2CAA2C,EAGjD,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,KAAK,4CAA4C,EAElD,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,KAAK,6CAA6C,EAEnD,MAAM,uCAAuC,CAAA;AA4B9C,eAAO,MAAM,sBAAsB,GACjC,QAAQ,kBAAkB,KACzB,MAAM,CAAC,MAAM,CACd,IAAI,EACF,KAAK,GACL,2CAA2C,GAC3C,6CAA6C,GAC7C,4CAA4C,GAC5C,KAAK,CAAC,gBAAgB,GACtB,yBAAyB,GACzB,oCAAoC,GACpC,+CAA+C,GAC/C,4BAA4B,GAC5B,6BAA6B,GAC7B,yBAAyB,GACzB,2BAA2B,GAC3B,yBAAyB,GACzB,yDAAyD,GACzD,qCAAqC,EACvC,OAAO,CAIN,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module
3
+ */
4
+ export { FailedToCastDataToReadableStreamError } from './castToReadableStream.ts';
5
+ export { GitHubApiAuthRatelimitedError, GitHubApiBadCredentialsError, type GitHubApiCommonErrors, GitHubApiGeneralServerError, GitHubApiGeneralUserError, GitHubApiNoCommitFoundForGitRefError, GitHubApiRatelimitedError, GitHubApiRepoIsEmptyError, GitHubApiThingNotExistsOrYouDontHaveAccessError, } from './commonErrors.ts';
6
+ export { FailedToParseGitLFSInfoError, FailedToParseResponseFromRepoPathContentsMetaInfoAPIError, InconsistentExpectedAndRealContentSizeError, } from './getPathContents/index.ts';
7
+ export * from './TaggedErrorVerifyingCause.ts';
8
+ export { FailedToUnpackRepoFolderTarGzStreamToFsError } from './unpackRepoFolderTarGzStreamToFs.ts';
9
+ export { FailedToWriteFileStreamToDestinationPathError } from './writeFileStreamToDestinationPath.ts';
10
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,oCAAoC,EACpC,yBAAyB,EACzB,yBAAyB,EACzB,+CAA+C,GAChD,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,4BAA4B,EAC5B,yDAAyD,EACzD,2CAA2C,GAC5C,MAAM,4BAA4B,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,OAAO,EAAE,4CAA4C,EAAE,MAAM,sCAAsC,CAAA;AACnG,OAAO,EAAE,6CAA6C,EAAE,MAAM,uCAAuC,CAAA"}
@@ -0,0 +1,141 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as ParseResult from 'effect/ParseResult';
3
+ import * as Schema from 'effect/Schema';
4
+ import { type TaggedErrorClass } from '../TaggedErrorVerifyingCause.ts';
5
+ export declare const UnparsedMetaInfoAboutPathContentsFromGitHubAPI: Effect.Effect<import("@octokit/types").OctokitResponse<{
6
+ type: "dir" | "file" | "submodule" | "symlink";
7
+ size: number;
8
+ name: string;
9
+ path: string;
10
+ content?: string;
11
+ sha: string;
12
+ url: string;
13
+ git_url: string | null;
14
+ html_url: string | null;
15
+ download_url: string | null;
16
+ _links: {
17
+ git: string | null;
18
+ html: string | null;
19
+ self: string;
20
+ };
21
+ }[] | {
22
+ type: "file";
23
+ encoding: string;
24
+ size: number;
25
+ name: string;
26
+ path: string;
27
+ content: string;
28
+ sha: string;
29
+ url: string;
30
+ git_url: string | null;
31
+ html_url: string | null;
32
+ download_url: string | null;
33
+ _links: {
34
+ git: string | null;
35
+ html: string | null;
36
+ self: string;
37
+ };
38
+ target?: string;
39
+ submodule_git_url?: string;
40
+ } | {
41
+ type: "symlink";
42
+ target: string;
43
+ size: number;
44
+ name: string;
45
+ path: string;
46
+ sha: string;
47
+ url: string;
48
+ git_url: string | null;
49
+ html_url: string | null;
50
+ download_url: string | null;
51
+ _links: {
52
+ git: string | null;
53
+ html: string | null;
54
+ self: string;
55
+ };
56
+ } | {
57
+ type: "submodule";
58
+ submodule_git_url: string;
59
+ size: number;
60
+ name: string;
61
+ path: string;
62
+ sha: string;
63
+ url: string;
64
+ git_url: string | null;
65
+ html_url: string | null;
66
+ download_url: string | null;
67
+ _links: {
68
+ git: string | null;
69
+ html: string | null;
70
+ self: string;
71
+ };
72
+ }, 200>, import("@octokit/request-error").RequestError | import("../commonErrors.ts").GitHubApiGeneralServerError | import("../commonErrors.ts").GitHubApiGeneralUserError | import("../commonErrors.ts").GitHubApiThingNotExistsOrYouDontHaveAccessError | import("../commonErrors.ts").GitHubApiRepoIsEmptyError | import("../commonErrors.ts").GitHubApiNoCommitFoundForGitRefError | import("../commonErrors.ts").GitHubApiBadCredentialsError | import("../commonErrors.ts").GitHubApiAuthRatelimitedError | import("../commonErrors.ts").GitHubApiRatelimitedError | import("effect/Cause").UnknownException, Readonly<{
73
+ repo: Readonly<{
74
+ owner: string;
75
+ name: string;
76
+ }>;
77
+ pathToEntityInRepo: string;
78
+ gitRef: string;
79
+ }> | import("@octokit/core").Octokit>;
80
+ export declare const ParsedMetaInfoAboutPathContentsFromGitHubAPI: Effect.Effect<{
81
+ readonly entries: readonly {
82
+ readonly name: string;
83
+ readonly path: string;
84
+ readonly sha: string;
85
+ readonly type: "dir" | "file" | "submodule" | "symlink";
86
+ readonly size: number;
87
+ }[];
88
+ readonly name: string;
89
+ readonly path: string;
90
+ readonly sha: string;
91
+ readonly type: "dir";
92
+ readonly size: number;
93
+ } | {
94
+ readonly name: string;
95
+ readonly content: string;
96
+ readonly path: string;
97
+ readonly sha: string;
98
+ readonly type: "file";
99
+ readonly size: number;
100
+ readonly encoding: "base64" | "none";
101
+ }, import("@octokit/request-error").RequestError | import("../commonErrors.ts").GitHubApiGeneralServerError | import("../commonErrors.ts").GitHubApiGeneralUserError | import("../commonErrors.ts").GitHubApiThingNotExistsOrYouDontHaveAccessError | import("../commonErrors.ts").GitHubApiRepoIsEmptyError | import("../commonErrors.ts").GitHubApiNoCommitFoundForGitRefError | import("../commonErrors.ts").GitHubApiBadCredentialsError | import("../commonErrors.ts").GitHubApiAuthRatelimitedError | import("../commonErrors.ts").GitHubApiRatelimitedError | import("effect/Cause").UnknownException | FailedToParseResponseFromRepoPathContentsMetaInfoAPIError, Readonly<{
102
+ repo: Readonly<{
103
+ owner: string;
104
+ name: string;
105
+ }>;
106
+ pathToEntityInRepo: string;
107
+ gitRef: string;
108
+ }> | import("@octokit/core").Octokit>;
109
+ export declare const ResponseSchema: Schema.Union<[Schema.Struct<{
110
+ size: typeof Schema.Number;
111
+ name: typeof Schema.String;
112
+ path: typeof Schema.String;
113
+ sha: typeof Schema.String;
114
+ type: Schema.Literal<["dir"]>;
115
+ entries: Schema.Array$<Schema.Struct<{
116
+ size: typeof Schema.Number;
117
+ name: typeof Schema.String;
118
+ path: typeof Schema.String;
119
+ sha: typeof Schema.String;
120
+ type: Schema.Union<[Schema.Literal<["dir"]>, Schema.Literal<["file", "submodule", "symlink"]>]>;
121
+ }>>;
122
+ }>, Schema.Struct<{
123
+ size: typeof Schema.Number;
124
+ name: typeof Schema.String;
125
+ path: typeof Schema.String;
126
+ sha: typeof Schema.String;
127
+ type: Schema.Literal<["file"]>;
128
+ encoding: Schema.Literal<["base64", "none"]>;
129
+ content: typeof Schema.String;
130
+ }>]>;
131
+ declare const _1: TaggedErrorClass<{
132
+ ErrorName: 'FailedToParseResponseFromRepoPathContentsMetaInfoAPI';
133
+ ExpectedCauseClass: typeof ParseResult.ParseError;
134
+ DynamicContext: {
135
+ response: unknown;
136
+ };
137
+ }>;
138
+ export declare class FailedToParseResponseFromRepoPathContentsMetaInfoAPIError extends _1 {
139
+ }
140
+ export {};
141
+ //# sourceMappingURL=ParsedMetaInfoAboutPathContentsFromGitHubAPI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParsedMetaInfoAboutPathContentsFromGitHubAPI.d.ts","sourceRoot":"","sources":["../../../src/getPathContents/ParsedMetaInfoAboutPathContentsFromGitHubAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAA;AAGxC,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAClB,CAAA;AAEzC,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAexD,CAAA;AAYD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;IAe1B,CAAA;AASD,QAAA,MAAM,EAAE,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,sDAAsD,CAAA;IACjE,kBAAkB,EAAE,OAAO,WAAW,CAAC,UAAU,CAAA;IACjD,cAAc,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAA;CACtC,CAIA,CAAA;AAED,qBAAa,yDAA0D,SAAQ,EAAE;CAAG"}