@skuba-lib/api 2.2.0 → 3.0.0-add-cdk-NodejsFunction-20260620003026

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 (47) hide show
  1. package/buildkite/package.json +1 -2
  2. package/cdk/nodejsFunction/package.json +5 -0
  3. package/cdk/package.json +1 -2
  4. package/git/package.json +1 -2
  5. package/github/package.json +1 -2
  6. package/lib/buildkite/index.mjs +1 -1
  7. package/lib/{buildkite-DdGh6ljO.mjs → buildkite-DCSmKf_B.mjs} +1 -1
  8. package/lib/cdk/bridges/rolldown.mjs +50 -0
  9. package/lib/cdk/index.d.mts +13 -5
  10. package/lib/cdk/index.mjs +18 -4
  11. package/lib/cdk/nodejsFunction/index.d.mts +2 -0
  12. package/lib/cdk/nodejsFunction/index.mjs +334 -0
  13. package/lib/git/index.mjs +1 -1
  14. package/lib/{git-CmP3a9Z9.mjs → git-BHbneN9r.mjs} +1 -1
  15. package/lib/github/index.mjs +2 -2
  16. package/lib/{github-BUEZ_y2Y.mjs → github-Buehx6Xt.mjs} +2 -2
  17. package/lib/index-DnMMX6Ji.d.mts +32 -0
  18. package/lib/index.d.mts +4 -5
  19. package/lib/index.mjs +5 -6
  20. package/lib/net/index.mjs +1 -1
  21. package/lib/{net-Bi0PXcTy.mjs → net-CbEVAvJj.mjs} +1 -1
  22. package/lib/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
  23. package/net/package.json +1 -2
  24. package/package.json +28 -29
  25. package/lib/buildkite/index.cjs +0 -4
  26. package/lib/buildkite/index.d.cts +0 -2
  27. package/lib/buildkite-_FU8d_a-.cjs +0 -62
  28. package/lib/cdk/index.cjs +0 -13
  29. package/lib/cdk/index.d.cts +0 -6
  30. package/lib/error-BnrwrJEG.cjs +0 -62
  31. package/lib/exec-Da3EoDZ1.cjs +0 -82
  32. package/lib/git/index.cjs +0 -14
  33. package/lib/git/index.d.cts +0 -2
  34. package/lib/git-D98vomnD.cjs +0 -460
  35. package/lib/github/index.cjs +0 -12
  36. package/lib/github/index.d.cts +0 -2
  37. package/lib/github-D12IboDc.cjs +0 -296
  38. package/lib/index-C9WMO_Y9.d.cts +0 -278
  39. package/lib/index-CNxgBJm_.d.cts +0 -39
  40. package/lib/index-D4JUiy2k.d.cts +0 -259
  41. package/lib/index-Kyp8ZCwF.d.cts +0 -38
  42. package/lib/index.cjs +0 -36
  43. package/lib/index.d.cts +0 -6
  44. package/lib/net/index.cjs +0 -3
  45. package/lib/net/index.d.cts +0 -2
  46. package/lib/net-4Ly1AB2r.cjs +0 -79
  47. package/lib/rolldown-runtime-DakpK96I.cjs +0 -43
@@ -1,259 +0,0 @@
1
- import { f as ChangedFile } from "./index-C9WMO_Y9.cjs";
2
- import { Endpoints } from "@octokit/types";
3
- import { Octokit } from "@octokit/rest";
4
-
5
- //#region src/github/checkRun.d.ts
6
- type Output = NonNullable<Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']>;
7
- type Annotation = NonNullable<Output['annotations']>[number];
8
- /**
9
- * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}
10
- */
11
- interface CreateCheckRunParameters {
12
- /**
13
- * Adds information from your analysis to specific lines of code.
14
- * Annotations are visible on GitHub in the **Checks** and **Files changed**
15
- * tab of the pull request.
16
- */
17
- annotations: Annotation[];
18
- /**
19
- * The final conclusion of the check.
20
- */
21
- conclusion: 'failure' | 'success';
22
- /**
23
- * The name of the check. For example, "code-coverage".
24
- */
25
- name: string;
26
- /**
27
- * The summary of the check run. This parameter supports Markdown.
28
- */
29
- summary: string;
30
- /**
31
- * The details of the check run. This parameter supports Markdown.
32
- */
33
- text?: string;
34
- /**
35
- * The title of the check run.
36
- */
37
- title: string;
38
- }
39
- /**
40
- * Asynchronously creates a GitHub check run with annotations.
41
- *
42
- * The first 50 `annotations` are written in full to GitHub.
43
- *
44
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
45
- * must be present on the environment.
46
- */
47
- declare const createCheckRun: ({
48
- annotations,
49
- conclusion,
50
- name,
51
- summary,
52
- text,
53
- title
54
- }: CreateCheckRunParameters) => Promise<void>;
55
- //#endregion
56
- //#region src/github/environment.d.ts
57
- /**
58
- * Returns the name of the build as seen in GitHub status checks.
59
- *
60
- * This is driven off of environment variables and falls back to `Build`.
61
- */
62
- declare const buildNameFromEnvironment: (env?: NodeJS.ProcessEnv) => string;
63
- /**
64
- * Whether GitHub API interactions should be enabled.
65
- *
66
- * This checks environment variables to see if the code is executing in a CI
67
- * environment and has access to a GitHub API token.
68
- */
69
- declare const enabledFromEnvironment: (env?: NodeJS.ProcessEnv) => boolean;
70
- /**
71
- * Tries to return a GitHub API token from the environment.
72
- */
73
- declare const apiTokenFromEnvironment: (env?: NodeJS.ProcessEnv) => string | undefined;
74
- //#endregion
75
- //#region src/github/pullRequest.d.ts
76
- interface GetPullRequestParameters {
77
- /**
78
- * A preconstructed Octokit client to interact with GitHub's APIs.
79
- *
80
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be
81
- * present on the environment if this is not provided.
82
- */
83
- client?: Octokit;
84
- env?: Record<string, string | undefined>;
85
- }
86
- /**
87
- * Gets the number of the current pull request.
88
- *
89
- * This tries to extract the pull request from common CI environment variables,
90
- * and falls back to querying the GitHub Repos API for the latest pull request
91
- * associated with the head commit. An error is thrown if there are no
92
- * associated pull requests, or if they are all closed or locked.
93
- */
94
- declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise<number>;
95
- //#endregion
96
- //#region src/github/issueComment.d.ts
97
- /**
98
- * https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
99
- */
100
- interface PutIssueCommentParameters {
101
- /**
102
- * The body of the issue comment.
103
- *
104
- * An explicit `null` value will remove the comment, if `internalId` is provided.
105
- */
106
- body: string | null;
107
- /**
108
- * An internal identifier for the issue comment.
109
- *
110
- * This can be used to scope a given `put` to a particular comment, preventing
111
- * it from clobbering other comments from the same bot or user.
112
- *
113
- * The identifier is embedded as hidden content in the comment body.
114
- */
115
- internalId?: string;
116
- env?: Record<string, string | undefined>;
117
- /**
118
- * The number that identifies the GitHub issue.
119
- *
120
- * If this is not provided, the number will be inferred from the GitHub Repos
121
- * API by finding the latest pull request associated with the head commit.
122
- *
123
- * https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit
124
- */
125
- issueNumber?: number;
126
- /**
127
- * The ID of authenticated bot or user that is putting the issue comment.
128
- *
129
- * This drives our `put` behaviour, which tries to locate and edit an existing
130
- * comment before creating a new one. If this is not provided, the ID will be
131
- * inferred from the GitHub Users API.
132
- *
133
- * https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
134
- *
135
- * If you're at SEEK and using BuildAgency's GitHub API integration, you may
136
- * use `'seek-build-agency'` as an optimisation to skip the user lookup.
137
- *
138
- * https://api.github.com/users/buildagencygitapitoken[bot]
139
- */
140
- userId?: number | 'seek-build-agency';
141
- }
142
- interface IssueComment {
143
- id: number;
144
- }
145
- /**
146
- * Asynchronously creates or updates a GitHub issue comment.
147
- *
148
- * This emulates `put` behaviour by overwriting the first existing comment by
149
- * the same author on the issue, enabling use cases like a persistent bot
150
- * comment at the top of the pull request that reflects the current status of a
151
- * CI check.
152
- *
153
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present
154
- * on the environment.
155
- */
156
- declare const putIssueComment: (params: PutIssueCommentParameters) => Promise<IssueComment | null>;
157
- //#endregion
158
- //#region src/github/push.d.ts
159
- interface UploadAllFileChangesParams {
160
- dir: string;
161
- /**
162
- * The branch name
163
- */
164
- branch: string;
165
- /**
166
- * The headline of the commit message
167
- */
168
- messageHeadline: string;
169
- /**
170
- * File changes to exclude from the upload.
171
- *
172
- * Defaults to `[]` (no exclusions).
173
- */
174
- ignore?: ChangedFile[];
175
- /**
176
- * The body of the commit message
177
- */
178
- messageBody?: string;
179
- /**
180
- * Updates the local Git repository to match the new remote branch state
181
- */
182
- updateLocal?: boolean;
183
- }
184
- /**
185
- * Retrieves all file changes from the local Git repository using
186
- * `getChangedFiles`, then uploads the changes to a specified GitHub branch
187
- * using `uploadFileChanges`.
188
- *
189
- * Returns the commit ID, or `undefined` if there are no changes to commit.
190
- *
191
- * The file changes will appear as verified commits on GitHub.
192
- *
193
- * This will not update the local Git repository unless `updateLocal` is
194
- * specified.
195
- */
196
- declare const uploadAllFileChanges: ({
197
- branch,
198
- dir,
199
- messageHeadline,
200
- ignore,
201
- messageBody,
202
- updateLocal
203
- }: UploadAllFileChangesParams) => Promise<string | undefined>;
204
- interface FileAddition {
205
- contents: unknown;
206
- path: string;
207
- }
208
- interface FileDeletion {
209
- path: string;
210
- }
211
- interface FileChanges {
212
- additions: FileAddition[];
213
- deletions: FileDeletion[];
214
- }
215
- /**
216
- * Takes a list of `ChangedFiles`, reads them from the file system, and maps
217
- * them to GitHub GraphQL `FileChanges`.
218
- *
219
- * https://docs.github.com/en/graphql/reference/input-objects#filechanges
220
- */
221
- declare const readFileChanges: (dir: string, changedFiles: ChangedFile[]) => Promise<FileChanges>;
222
- interface UploadFileChangesParams {
223
- dir: string;
224
- /**
225
- * The branch name
226
- */
227
- branch: string;
228
- /**
229
- * The headline of the commit message
230
- */
231
- messageHeadline: string;
232
- /**
233
- * The body of the commit message
234
- */
235
- messageBody?: string;
236
- /**
237
- * File additions and deletions
238
- */
239
- fileChanges: FileChanges;
240
- }
241
- /**
242
- * Uploads file changes from the local workspace to a specified GitHub branch.
243
- *
244
- * The file changes will appear as verified commits on GitHub.
245
- *
246
- * This will not update the local Git repository.
247
- */
248
- declare const uploadFileChanges: ({
249
- dir,
250
- branch,
251
- messageHeadline,
252
- messageBody,
253
- fileChanges
254
- }: UploadFileChangesParams) => Promise<string>;
255
- declare namespace index_d_exports {
256
- export { Annotation, apiTokenFromEnvironment, buildNameFromEnvironment, createCheckRun, enabledFromEnvironment, getPullRequestNumber, putIssueComment, readFileChanges, uploadAllFileChanges, uploadFileChanges };
257
- }
258
- //#endregion
259
- export { putIssueComment as a, buildNameFromEnvironment as c, createCheckRun as d, uploadFileChanges as i, enabledFromEnvironment as l, readFileChanges as n, getPullRequestNumber as o, uploadAllFileChanges as r, apiTokenFromEnvironment as s, index_d_exports as t, Annotation as u };
@@ -1,38 +0,0 @@
1
- //#region src/net/socket.d.ts
2
- interface SocketAddress {
3
- host: string;
4
- port: number;
5
- }
6
- //#endregion
7
- //#region src/net/waitFor.d.ts
8
- /**
9
- * Wait for a resource to start listening on a socket address.
10
- *
11
- * The socket is polled on an interval until it accepts a connection or the
12
- * `timeout` is reached.
13
- */
14
- declare const waitFor: ({
15
- host,
16
- port,
17
- resolveCompose,
18
- timeout
19
- }: {
20
- host?: string;
21
- port: number;
22
- /**
23
- * Whether to treat the `host` and `port` arguments as a private Docker
24
- * Compose network address and to resolve them to a public local address.
25
- *
26
- * This is typically:
27
- *
28
- * - Enabled locally, when the application is running directly on the machine
29
- * - Disabled in CI, when running in a container on the Docker Compose network
30
- */
31
- resolveCompose?: boolean;
32
- timeout?: number;
33
- }) => Promise<SocketAddress>;
34
- declare namespace index_d_exports {
35
- export { waitFor };
36
- }
37
- //#endregion
38
- export { waitFor as n, index_d_exports as t };
package/lib/index.cjs DELETED
@@ -1,36 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_buildkite = require("./buildkite-_FU8d_a-.cjs");
3
- const require_cdk_index = require("./cdk/index.cjs");
4
- const require_git = require("./git-D98vomnD.cjs");
5
- const require_github = require("./github-D12IboDc.cjs");
6
- const require_net = require("./net-4Ly1AB2r.cjs");
7
- Object.defineProperty(exports, "Buildkite", {
8
- enumerable: true,
9
- get: function() {
10
- return require_buildkite.buildkite_exports;
11
- }
12
- });
13
- Object.defineProperty(exports, "Cdk", {
14
- enumerable: true,
15
- get: function() {
16
- return require_cdk_index.cdk_exports;
17
- }
18
- });
19
- Object.defineProperty(exports, "Git", {
20
- enumerable: true,
21
- get: function() {
22
- return require_git.git_exports;
23
- }
24
- });
25
- Object.defineProperty(exports, "GitHub", {
26
- enumerable: true,
27
- get: function() {
28
- return require_github.github_exports;
29
- }
30
- });
31
- Object.defineProperty(exports, "Net", {
32
- enumerable: true,
33
- get: function() {
34
- return require_net.net_exports;
35
- }
36
- });
package/lib/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import { t as index_d_exports } from "./index-CNxgBJm_.cjs";
2
- import { t as index_d_exports$1 } from "./cdk/index.cjs";
3
- import { t as index_d_exports$2 } from "./index-C9WMO_Y9.cjs";
4
- import { t as index_d_exports$3 } from "./index-D4JUiy2k.cjs";
5
- import { t as index_d_exports$4 } from "./index-Kyp8ZCwF.cjs";
6
- export { index_d_exports as Buildkite, index_d_exports$1 as Cdk, index_d_exports$2 as Git, index_d_exports$3 as GitHub, index_d_exports$4 as Net };
package/lib/net/index.cjs DELETED
@@ -1,3 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_net = require("../net-4Ly1AB2r.cjs");
3
- exports.waitFor = require_net.waitFor;
@@ -1,2 +0,0 @@
1
- import { n as waitFor } from "../index-Kyp8ZCwF.cjs";
2
- export { waitFor };
@@ -1,79 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_exec = require("./exec-Da3EoDZ1.cjs");
3
- let net = require("net");
4
- net = require_rolldown_runtime.__toESM(net, 1);
5
- //#region src/net/compose.ts
6
- const portStringToNumber = (portString) => {
7
- const port = Number(portString);
8
- if (!Number.isSafeInteger(port)) throw Error(`received non-integer port: '${portString}'`);
9
- return port;
10
- };
11
- const resolveComposeAddress = async (privateHost, privatePort) => {
12
- const { stdout } = await require_exec.createExec({ stdio: "pipe" })("docker", "compose", "port", privateHost, String(privatePort));
13
- const [host, portString] = stdout.trim().split(":");
14
- if (!host || !portString) throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);
15
- return {
16
- host,
17
- port: portStringToNumber(portString)
18
- };
19
- };
20
- //#endregion
21
- //#region src/net/socket.ts
22
- const trySocket = async (host, port) => new Promise((resolve) => {
23
- const socket = new net.default.Socket();
24
- const onFailure = () => {
25
- socket.destroy();
26
- resolve(false);
27
- };
28
- const onSuccess = () => socket.end(() => resolve(true));
29
- socket.connect(port, host, onSuccess).once("error", onFailure).once("timeout", onFailure).setTimeout(1e3);
30
- });
31
- const pollSocket = async (host, port, timeout) => new Promise((resolve, reject) => {
32
- const callPort = async () => {
33
- if (!await trySocket(host, port)) return;
34
- clearTimeout(intervalId);
35
- clearTimeout(timeoutId);
36
- resolve();
37
- };
38
- const intervalId = setInterval(() => {
39
- callPort().catch(() => void 0);
40
- }, 250);
41
- const timeoutId = setTimeout(() => {
42
- clearTimeout(intervalId);
43
- clearTimeout(timeoutId);
44
- reject(Error(`could not reach ${host}:${port} within ${timeout}ms`));
45
- }, timeout);
46
- callPort().catch(() => void 0);
47
- });
48
- //#endregion
49
- //#region src/net/waitFor.ts
50
- /**
51
- * Wait for a resource to start listening on a socket address.
52
- *
53
- * The socket is polled on an interval until it accepts a connection or the
54
- * `timeout` is reached.
55
- */
56
- const waitFor = async ({ host = "localhost", port, resolveCompose = false, timeout = 15e3 }) => {
57
- const resolvedAddress = resolveCompose ? await resolveComposeAddress(host, port) : {
58
- host,
59
- port
60
- };
61
- await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);
62
- return resolvedAddress;
63
- };
64
- //#endregion
65
- //#region src/net/index.ts
66
- var net_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ waitFor: () => waitFor });
67
- //#endregion
68
- Object.defineProperty(exports, "net_exports", {
69
- enumerable: true,
70
- get: function() {
71
- return net_exports;
72
- }
73
- });
74
- Object.defineProperty(exports, "waitFor", {
75
- enumerable: true,
76
- get: function() {
77
- return waitFor;
78
- }
79
- });
@@ -1,43 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- return target;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
20
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: ((k) => from[k]).bind(null, key),
22
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
- });
24
- }
25
- return to;
26
- };
27
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
30
- }) : target, mod));
31
- //#endregion
32
- Object.defineProperty(exports, "__exportAll", {
33
- enumerable: true,
34
- get: function() {
35
- return __exportAll;
36
- }
37
- });
38
- Object.defineProperty(exports, "__toESM", {
39
- enumerable: true,
40
- get: function() {
41
- return __toESM;
42
- }
43
- });