@storyshelf/notify-git 0.6.2 → 0.8.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.
package/dist/describe.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/describe.ts
4
+ // src/describe.ts
5
5
  /** Short description shown beside a commit status. */
6
6
  function describeState(state) {
7
7
  switch (state) {
@@ -15,7 +15,6 @@ function describeState(state) {
15
15
  function commentMarker(url) {
16
16
  return `<!-- storyshelf:${url} -->`;
17
17
  }
18
- //#endregion
19
18
  export { commentMarker, describeState };
20
19
 
21
20
  //# sourceMappingURL=describe.mjs.map
@@ -1,7 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/github-api.ts
4
+ // src/github-api.ts
5
5
  /** GitHub REST API helpers (base URL + auth headers). */
6
6
  function apiBase() {
7
7
  return "https://api.github.com";
@@ -19,7 +19,6 @@ function githubHeaders(token) {
19
19
  "x-github-api-version": "2022-11-28"
20
20
  };
21
21
  }
22
- //#endregion
23
22
  export { apiBase, githubHeaders, repoPath };
24
23
 
25
24
  //# sourceMappingURL=github-api.mjs.map
@@ -4,7 +4,7 @@ import.meta.url;
4
4
  import { apiBase, githubHeaders } from "./github-api.mjs";
5
5
  import { httpJson } from "@storyshelf/core/utils";
6
6
  import { createHash, createSign } from "node:crypto";
7
- //#region src/github-app.ts
7
+ // src/github-app.ts
8
8
  /**
9
9
  * GitHub App authentication without dependencies: an RS256 JWT signed with `node:crypto`, traded
10
10
  * for an installation token that is cached per channel until shortly before it expires.
@@ -61,7 +61,6 @@ function signAppJwt(creds, now) {
61
61
  function base64url(value) {
62
62
  return Buffer.from(value).toString("base64url");
63
63
  }
64
- //#endregion
65
64
  export { TOKEN_REFRESH_MARGIN_MS, installationToken, signAppJwt };
66
65
 
67
66
  //# sourceMappingURL=github-app.mjs.map
@@ -63,7 +63,6 @@ function annotationOf(annotation) {
63
63
  raw_details: annotation.url
64
64
  };
65
65
  }
66
- //#endregion
67
66
  export { annotationBatches, checkRunBody, externalIdOf, phaseOf, summaryOf };
68
67
 
69
68
  //# sourceMappingURL=github-check-mapper.mjs.map
@@ -4,7 +4,7 @@ import.meta.url;
4
4
  import { githubHeaders, repoPath } from "./github-api.mjs";
5
5
  import { annotationBatches, checkRunBody, externalIdOf } from "./github-check-mapper.mjs";
6
6
  import { httpJson } from "@storyshelf/core/utils";
7
- //#region src/github-check.ts
7
+ // src/github-check.ts
8
8
  /**
9
9
  * Show a status as a check run of the commit `sha`: update the run that carries the status's
10
10
  * `external_id`, or create it, so a build has one run per name and its lifecycle (queued,
@@ -80,7 +80,6 @@ async function appendBatches(repo, id, rest) {
80
80
  batches: later
81
81
  });
82
82
  }
83
- //#endregion
84
83
  export { postCheckRun };
85
84
 
86
85
  //# sourceMappingURL=github-check.mjs.map
@@ -5,7 +5,7 @@ import { githubHeaders, repoPath } from "./github-api.mjs";
5
5
  import { findPrNumber } from "./github-pr.mjs";
6
6
  import { upsertReviewComment } from "./review-comment.mjs";
7
7
  import { httpJson } from "@storyshelf/core/utils";
8
- //#region src/github-comment.ts
8
+ // src/github-comment.ts
9
9
  /** Fetch-backed review thread (comments) for a pull request. */
10
10
  function createThread(repo, prNumber) {
11
11
  const threadUrl = repoPath(repo.owner, repo.repo, `/issues/${prNumber}/comments`);
@@ -52,7 +52,6 @@ async function upsertPrComment(repo, input) {
52
52
  thread: (prNumber) => createThread(repo, prNumber)
53
53
  });
54
54
  }
55
- //#endregion
56
55
  export { upsertPrComment };
57
56
 
58
57
  //# sourceMappingURL=github-comment.mjs.map
@@ -1,7 +1,6 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { z } from "zod";
4
- //#region src/github-config.d.ts
5
4
  /**
6
5
  * Validation schema for a GitHub channel config: `owner` + `repo`, an optional status `prefix` and
7
6
  * how the build is shown. `statuses` (default) posts commit statuses with a token; `checks` posts
@@ -19,6 +18,5 @@ declare const githubConfigSchema: z.ZodObject<{
19
18
  appId: z.ZodOptional<z.ZodString>;
20
19
  installationId: z.ZodOptional<z.ZodString>;
21
20
  }, z.core.$strip>;
22
- //#endregion
23
21
  export { githubConfigSchema };
24
22
  //# sourceMappingURL=github-config.d.mts.map
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { statusPrefixSchema } from "./prefix.mjs";
5
5
  import { z } from "zod";
6
- //#region src/github-config.ts
6
+ // src/github-config.ts
7
7
  /**
8
8
  * Validation schema for a GitHub channel config: `owner` + `repo`, an optional status `prefix` and
9
9
  * how the build is shown. `statuses` (default) posts commit statuses with a token; `checks` posts
@@ -25,7 +25,6 @@ const githubConfigSchema = z.object({
25
25
  message: `Checks mode needs ${field}`
26
26
  });
27
27
  });
28
- //#endregion
29
28
  export { githubConfigSchema };
30
29
 
31
30
  //# sourceMappingURL=github-config.mjs.map
@@ -1,7 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/github-mapper.ts
4
+ // src/github-mapper.ts
5
5
  /**
6
6
  * GitHub's commit states. It has no cancelled state, so a cancelled build shows `error`, its
7
7
  * "did not complete" state.
@@ -16,7 +16,6 @@ const STATES = {
16
16
  function mapState(state) {
17
17
  return STATES[state] ?? "error";
18
18
  }
19
- //#endregion
20
19
  export { mapState };
21
20
 
22
21
  //# sourceMappingURL=github-mapper.mjs.map
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { githubHeaders, repoPath } from "./github-api.mjs";
5
5
  import { httpJson } from "@storyshelf/core/utils";
6
- //#region src/github-pr.ts
6
+ // src/github-pr.ts
7
7
  /** Find the pull request number associated with a commit SHA, if any. */
8
8
  async function findPrNumber(opts) {
9
9
  try {
@@ -14,7 +14,6 @@ async function findPrNumber(opts) {
14
14
  return;
15
15
  }
16
16
  }
17
- //#endregion
18
17
  export { findPrNumber };
19
18
 
20
19
  //# sourceMappingURL=github-pr.mjs.map
@@ -4,7 +4,7 @@ import.meta.url;
4
4
  import { githubHeaders, repoPath } from "./github-api.mjs";
5
5
  import { mapState } from "./github-mapper.mjs";
6
6
  import { httpJson } from "@storyshelf/core/utils";
7
- //#region src/github-status.ts
7
+ // src/github-status.ts
8
8
  /**
9
9
  * Post a commit status to GitHub under the full `context` name the caller chose
10
10
  * (`<prefix>/testing`); the provider adds no prefix of its own. Posting the same
@@ -38,7 +38,6 @@ async function postCommitStatus(repo, input) {
38
38
  throw error;
39
39
  }
40
40
  }
41
- //#endregion
42
41
  export { postCommitStatus };
43
42
 
44
43
  //# sourceMappingURL=github-status.mjs.map
package/dist/github.d.mts CHANGED
@@ -1,13 +1,11 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { StateNotifierProvider } from "@storyshelf/core/adapter/notifier";
4
- //#region src/github.d.ts
5
4
  /**
6
5
  * GitHub provider (`state` delivery). In `statuses` mode (default) it posts commit statuses with
7
6
  * the channel's token; in `checks` mode it posts check runs as the channel's GitHub App. Either
8
7
  * way it also keeps the pull-request comment.
9
8
  */
10
9
  declare const gitHubNotifier: StateNotifierProvider;
11
- //#endregion
12
10
  export { gitHubNotifier };
13
11
  //# sourceMappingURL=github.d.mts.map
package/dist/github.mjs CHANGED
@@ -8,7 +8,7 @@ import { githubConfigSchema } from "./github-config.mjs";
8
8
  import { postCommitStatus } from "./github-status.mjs";
9
9
  import { createStateAdapter, requireToken } from "./state-adapter.mjs";
10
10
  import { packageVersion } from "./version.mjs";
11
- //#region src/github.ts
11
+ // src/github.ts
12
12
  /**
13
13
  * GitHub provider (`state` delivery). In `statuses` mode (default) it posts commit statuses with
14
14
  * the channel's token; in `checks` mode it posts check runs as the channel's GitHub App. Either
@@ -60,7 +60,6 @@ function getMetadata() {
60
60
  schema: githubConfigSchema
61
61
  };
62
62
  }
63
- //#endregion
64
63
  export { getMetadata, gitHubNotifier };
65
64
 
66
65
  //# sourceMappingURL=github.mjs.map
@@ -1,7 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/gitlab-api.ts
4
+ // src/gitlab-api.ts
5
5
  /** URL-encode an `owner/repo` pair as a GitLab project ID. */
6
6
  function projectId(owner, repo) {
7
7
  return encodeURIComponent(`${owner}/${repo}`);
@@ -17,7 +17,6 @@ function gitlabHeaders(token) {
17
17
  "content-type": "application/json"
18
18
  };
19
19
  }
20
- //#endregion
21
20
  export { apiBase, gitlabHeaders, projectId };
22
21
 
23
22
  //# sourceMappingURL=gitlab-api.mjs.map
@@ -5,7 +5,7 @@ import { upsertReviewComment } from "./review-comment.mjs";
5
5
  import { apiBase, gitlabHeaders, projectId } from "./gitlab-api.mjs";
6
6
  import { findMrIid } from "./gitlab-pr.mjs";
7
7
  import { httpJson } from "@storyshelf/core/utils";
8
- //#region src/gitlab-comment.ts
8
+ // src/gitlab-comment.ts
9
9
  /** Fetch-backed review thread (notes) for a merge request. */
10
10
  function createThread(base, pid, iid, headers) {
11
11
  const threadUrl = `${base}/api/v4/projects/${pid}/merge_requests/${iid}/notes`;
@@ -59,7 +59,6 @@ async function upsertMrNote(project, input) {
59
59
  thread: (iid) => createThread(base, pid, iid, headers)
60
60
  });
61
61
  }
62
- //#endregion
63
62
  export { upsertMrNote };
64
63
 
65
64
  //# sourceMappingURL=gitlab-comment.mjs.map
@@ -1,7 +1,6 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { z } from "zod";
4
- //#region src/gitlab-config.d.ts
5
4
  /** Validation schema for a GitLab channel config (`owner` + `repo`, optional `host` and status `prefix`). */
6
5
  declare const gitlabConfigSchema: z.ZodObject<{
7
6
  owner: z.ZodString;
@@ -9,6 +8,5 @@ declare const gitlabConfigSchema: z.ZodObject<{
9
8
  host: z.ZodOptional<z.ZodString>;
10
9
  prefix: z.ZodOptional<z.ZodString>;
11
10
  }, z.core.$strip>;
12
- //#endregion
13
11
  export { gitlabConfigSchema };
14
12
  //# sourceMappingURL=gitlab-config.d.mts.map
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { statusPrefixSchema } from "./prefix.mjs";
5
5
  import { z } from "zod";
6
- //#region src/gitlab-config.ts
6
+ // src/gitlab-config.ts
7
7
  /** Validation schema for a GitLab channel config (`owner` + `repo`, optional `host` and status `prefix`). */
8
8
  const gitlabConfigSchema = z.object({
9
9
  owner: z.string().min(1),
@@ -11,7 +11,6 @@ const gitlabConfigSchema = z.object({
11
11
  host: z.string().url().optional(),
12
12
  prefix: statusPrefixSchema.optional()
13
13
  });
14
- //#endregion
15
14
  export { gitlabConfigSchema };
16
15
 
17
16
  //# sourceMappingURL=gitlab-config.mjs.map
@@ -1,7 +1,7 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/gitlab-mapper.ts
4
+ // src/gitlab-mapper.ts
5
5
  /** GitLab's pipeline statuses; a cancelled build is GitLab's own `canceled`. */
6
6
  const STATES = {
7
7
  pending: "pending",
@@ -13,7 +13,6 @@ const STATES = {
13
13
  function mapState(state) {
14
14
  return STATES[state] ?? "failed";
15
15
  }
16
- //#endregion
17
16
  export { mapState };
18
17
 
19
18
  //# sourceMappingURL=gitlab-mapper.mjs.map
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { apiBase, gitlabHeaders, projectId } from "./gitlab-api.mjs";
5
5
  import { httpJson } from "@storyshelf/core/utils";
6
- //#region src/gitlab-pr.ts
6
+ // src/gitlab-pr.ts
7
7
  /** Find the merge request IID associated with a commit SHA, if any. */
8
8
  async function findMrIid(opts) {
9
9
  try {
@@ -13,7 +13,6 @@ async function findMrIid(opts) {
13
13
  return;
14
14
  }
15
15
  }
16
- //#endregion
17
16
  export { findMrIid };
18
17
 
19
18
  //# sourceMappingURL=gitlab-pr.mjs.map
@@ -4,7 +4,7 @@ import.meta.url;
4
4
  import { apiBase, gitlabHeaders, projectId } from "./gitlab-api.mjs";
5
5
  import { mapState } from "./gitlab-mapper.mjs";
6
6
  import { httpJson } from "@storyshelf/core/utils";
7
- //#region src/gitlab-status.ts
7
+ // src/gitlab-status.ts
8
8
  /**
9
9
  * Post a commit status to GitLab under the full `context` name the caller chose
10
10
  * (`<prefix>/testing`); the provider adds no prefix of its own. Posting the same
@@ -41,7 +41,6 @@ async function postCommitStatus(project, input) {
41
41
  throw error;
42
42
  }
43
43
  }
44
- //#endregion
45
44
  export { postCommitStatus };
46
45
 
47
46
  //# sourceMappingURL=gitlab-status.mjs.map
package/dist/gitlab.d.mts CHANGED
@@ -1,9 +1,7 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { StateNotifierProvider } from "@storyshelf/core/adapter/notifier";
4
- //#region src/gitlab.d.ts
5
4
  /** GitLab commit status and merge-request note provider (`state` delivery). */
6
5
  declare const gitLabNotifier: StateNotifierProvider;
7
- //#endregion
8
6
  export { gitLabNotifier };
9
7
  //# sourceMappingURL=gitlab.d.mts.map
package/dist/gitlab.mjs CHANGED
@@ -6,7 +6,7 @@ import { packageVersion } from "./version.mjs";
6
6
  import { upsertMrNote } from "./gitlab-comment.mjs";
7
7
  import { gitlabConfigSchema } from "./gitlab-config.mjs";
8
8
  import { postCommitStatus } from "./gitlab-status.mjs";
9
- //#region src/gitlab.ts
9
+ // src/gitlab.ts
10
10
  /** GitLab commit status and merge-request note provider (`state` delivery). */
11
11
  const gitLabNotifier = {
12
12
  metadata: getMetadata(),
@@ -44,7 +44,6 @@ function getMetadata() {
44
44
  schema: gitlabConfigSchema
45
45
  };
46
46
  }
47
- //#endregion
48
47
  export { getMetadata, gitLabNotifier };
49
48
 
50
49
  //# sourceMappingURL=gitlab.mjs.map
package/dist/index.d.mts CHANGED
@@ -5,9 +5,7 @@ import { gitLabNotifier } from "./gitlab.mjs";
5
5
  import { gitLogNotifier, logConfigSchema } from "./log.mjs";
6
6
  import { githubConfigSchema } from "./github-config.mjs";
7
7
  import { gitlabConfigSchema } from "./gitlab-config.mjs";
8
- //#region src/index.d.ts
9
8
  /** All git providers in one list for `ShelfOptions.notifications.notifiers`. */
10
9
  declare const gitNotifiers: import("@storyshelf/core/adapter/notifier").StateNotifierProvider[];
11
- //#endregion
12
10
  export { gitHubNotifier, gitLabNotifier, gitLogNotifier, gitNotifiers, githubConfigSchema, gitlabConfigSchema, logConfigSchema };
13
11
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { gitHubNotifier } from "./github.mjs";
6
6
  import { gitlabConfigSchema } from "./gitlab-config.mjs";
7
7
  import { gitLabNotifier } from "./gitlab.mjs";
8
8
  import { gitLogNotifier, logConfigSchema } from "./log.mjs";
9
- //#region src/index.ts
9
+ // src/index.ts
10
10
  /**
11
11
  * Git notification providers: `state` channels that make GitHub or GitLab show a build's
12
12
  * current commit status and pull-request comment (plus a log provider for tests/dev).
@@ -17,7 +17,6 @@ const gitNotifiers = [
17
17
  gitLabNotifier,
18
18
  gitLogNotifier
19
19
  ];
20
- //#endregion
21
20
  export { gitHubNotifier, gitLabNotifier, gitLogNotifier, gitNotifiers, githubConfigSchema, gitlabConfigSchema, logConfigSchema };
22
21
 
23
22
  //# sourceMappingURL=index.mjs.map
package/dist/log.d.mts CHANGED
@@ -2,11 +2,9 @@ import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { z } from "zod";
4
4
  import { StateNotifierProvider } from "@storyshelf/core/adapter/notifier";
5
- //#region src/log.d.ts
6
5
  /** Validation schema for the log provider config (accepts anything). */
7
6
  declare const logConfigSchema: z.ZodObject<{}, z.core.$loose>;
8
7
  /** Log-only git provider for tests, dev, and unconfigured servers (`git-log`). */
9
8
  declare const gitLogNotifier: StateNotifierProvider;
10
- //#endregion
11
9
  export { gitLogNotifier, logConfigSchema };
12
10
  //# sourceMappingURL=log.d.mts.map
package/dist/log.mjs CHANGED
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { packageVersion } from "./version.mjs";
5
5
  import { z } from "zod";
6
- //#region src/log.ts
6
+ // src/log.ts
7
7
  /** Validation schema for the log provider config (accepts anything). */
8
8
  const logConfigSchema = z.object({}).loose();
9
9
  /** Log-only git provider for tests, dev, and unconfigured servers (`git-log`). */
@@ -36,7 +36,6 @@ function getMetadata() {
36
36
  schema: logConfigSchema
37
37
  };
38
38
  }
39
- //#endregion
40
39
  export { getMetadata, gitLogNotifier, logConfigSchema };
41
40
 
42
41
  //# sourceMappingURL=log.mjs.map
package/dist/prefix.mjs CHANGED
@@ -2,13 +2,12 @@ import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
4
  import { z } from "zod";
5
- //#region src/prefix.ts
5
+ // src/prefix.ts
6
6
  /**
7
7
  * Status-name prefix of a git channel (`<prefix>/testing`). It forms part of the status
8
8
  * context on the host, so it is limited to characters both hosts accept in a name.
9
9
  */
10
10
  const statusPrefixSchema = z.string().min(1).max(64).regex(/^[\w.-]+$/u, "Use letters, digits, dots, dashes and underscores");
11
- //#endregion
12
11
  export { statusPrefixSchema };
13
12
 
14
13
  //# sourceMappingURL=prefix.mjs.map
@@ -2,7 +2,7 @@ import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
4
  import { commentMarker } from "./describe.mjs";
5
- //#region src/review-comment.ts
5
+ // src/review-comment.ts
6
6
  /** Resolve the thread number, preferring the explicit value. */
7
7
  async function resolveThreadNumber(opts) {
8
8
  return opts.prNumber ?? await opts.resolveNumber();
@@ -48,7 +48,6 @@ async function upsertReviewComment(opts) {
48
48
  throw error;
49
49
  }
50
50
  }
51
- //#endregion
52
51
  export { upsertReviewComment };
53
52
 
54
53
  //# sourceMappingURL=review-comment.mjs.map
@@ -2,7 +2,7 @@ import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
4
  import { describeState } from "./describe.mjs";
5
- //#region src/state-adapter.ts
5
+ // src/state-adapter.ts
6
6
  /** Build the runtime adapter that routes a target kind to the writer. */
7
7
  function createStateAdapter(metadata, writer, logger) {
8
8
  return {
@@ -37,7 +37,6 @@ function requireToken(secret, provider, what = "a token") {
37
37
  if (!secret) throw new Error(`${provider} channel needs ${what}`);
38
38
  return secret;
39
39
  }
40
- //#endregion
41
40
  export { createStateAdapter, requireToken };
42
41
 
43
42
  //# sourceMappingURL=state-adapter.mjs.map
package/dist/version.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- //#region src/version.ts
4
+ // src/version.ts
5
5
  /** The package version injected at build time (tsdown `define`), `0.0.0` in tests. */
6
6
  function packageVersion() {
7
- return "0.6.2";
7
+ return "0.8.0";
8
8
  }
9
- //#endregion
10
9
  export { packageVersion };
11
10
 
12
11
  //# sourceMappingURL=version.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyshelf/notify-git",
3
- "version": "0.6.2",
3
+ "version": "0.8.0",
4
4
  "description": "Git notification providers for StoryShelf: commit statuses and pull-request comments on GitHub and GitLab.",
5
5
  "keywords": [
6
6
  "ci",
@@ -54,8 +54,8 @@
54
54
  "prepublishOnly": "nub run build"
55
55
  },
56
56
  "dependencies": {
57
- "@storyshelf/core": "0.6.2",
58
- "zod": "^4.2.0"
57
+ "@storyshelf/core": "0.8.0",
58
+ "zod": "^4.6.7"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^26.0.0",
@@ -65,7 +65,7 @@
65
65
  "oxlint-tsgolint": "^7.0.2001",
66
66
  "tsdown": "^0.22.14",
67
67
  "typescript": "^7.0.2",
68
- "vitest": "^5.0.0"
68
+ "vitest": "^5.0.5"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=24"