@skuba-lib/api 0.0.0 → 0.1.0-skuba-lib-api-20250925050503

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -0
  3. package/buildkite/package.json +5 -0
  4. package/git/package.json +5 -0
  5. package/github/package.json +5 -0
  6. package/lib/buildkite/index.d.mts +2 -0
  7. package/lib/buildkite/index.d.ts +2 -0
  8. package/lib/buildkite/index.js +6 -0
  9. package/lib/buildkite/index.mjs +5 -0
  10. package/lib/buildkite-BXHjSY0I.js +67 -0
  11. package/lib/buildkite-DSHpKA4z.mjs +50 -0
  12. package/lib/chunk-CZCtuq8p.mjs +37 -0
  13. package/lib/chunk-odGzh3W-.js +58 -0
  14. package/lib/exec-B2akdw0z.js +17597 -0
  15. package/lib/exec-p0gJ30UO.mjs +17580 -0
  16. package/lib/git/index.d.mts +2 -0
  17. package/lib/git/index.d.ts +2 -0
  18. package/lib/git/index.js +14 -0
  19. package/lib/git/index.mjs +3 -0
  20. package/lib/git-DDfcZdbm.mjs +379 -0
  21. package/lib/git-DVG_dHiI.js +474 -0
  22. package/lib/github/index.d.mts +3 -0
  23. package/lib/github/index.d.ts +3 -0
  24. package/lib/github/index.js +12 -0
  25. package/lib/github/index.mjs +5 -0
  26. package/lib/github-B4auwKt7.js +310 -0
  27. package/lib/github-vycKoVtK.mjs +269 -0
  28. package/lib/index-1eEu26nG.d.ts +255 -0
  29. package/lib/index-9i8gHTGu.d.mts +38 -0
  30. package/lib/index-B91wXiwr.d.ts +278 -0
  31. package/lib/index-CfnlMf_4.d.ts +39 -0
  32. package/lib/index-Cl--YMPq.d.mts +255 -0
  33. package/lib/index-DNXQKEza.d.mts +278 -0
  34. package/lib/index-DiqTDK1U.d.mts +39 -0
  35. package/lib/index-MmnRaakr.d.ts +38 -0
  36. package/lib/index.d.mts +5 -0
  37. package/lib/index.d.ts +5 -0
  38. package/lib/index.js +31 -0
  39. package/lib/index.mjs +8 -0
  40. package/lib/logging-6TTEX4U4.js +2217 -0
  41. package/lib/logging-Dr8kuQ_p.mjs +2194 -0
  42. package/lib/net/index.d.mts +2 -0
  43. package/lib/net/index.d.ts +2 -0
  44. package/lib/net/index.js +5 -0
  45. package/lib/net/index.mjs +5 -0
  46. package/lib/net-BteSPzmU.js +86 -0
  47. package/lib/net-ByUFe0qv.mjs +75 -0
  48. package/net/package.json +5 -0
  49. package/package.json +58 -8
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ ### MIT License
2
+
3
+ Copyright (c) 2020 SEEK
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # @skuba-lib/api
2
+
3
+ [![npm package](https://img.shields.io/npm/v/@skuba-lib/api?labelColor=cb0000&color=5b5b5b)](https://www.npmjs.com/package/@skuba-lib/api)
4
+ [![Node.js version](https://img.shields.io/node/v/@skuba-lib/api?labelColor=5fa04e&color=5b5b5b)](https://www.npmjs.com/package/@skuba-lib/api)
5
+
6
+ Shared apis for **[skuba]**.
7
+
8
+ [skuba]: https://github.com/seek-oss/skuba
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../lib/buildkite/index.js",
3
+ "module": "../lib/buildkite/index.mjs",
4
+ "types": "../lib/buildkite/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../lib/git/index.js",
3
+ "module": "../lib/git/index.mjs",
4
+ "types": "../lib/git/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../lib/github/index.js",
3
+ "module": "../lib/github/index.mjs",
4
+ "types": "../lib/github/index.d.ts"
5
+ }
@@ -0,0 +1,2 @@
1
+ import { AnnotationStyle, annotate$1 as annotate, md$1 as md } from "../index-DiqTDK1U.mjs";
2
+ export { AnnotationStyle, annotate, md };
@@ -0,0 +1,2 @@
1
+ import { AnnotationStyle, annotate, md } from "../index-CfnlMf_4.js";
2
+ export { AnnotationStyle, annotate, md };
@@ -0,0 +1,6 @@
1
+ require('../exec-B2akdw0z.js');
2
+ require('../logging-6TTEX4U4.js');
3
+ const require_buildkite = require('../buildkite-BXHjSY0I.js');
4
+
5
+ exports.annotate = require_buildkite.annotate;
6
+ exports.md = require_buildkite.md;
@@ -0,0 +1,5 @@
1
+ import "../exec-p0gJ30UO.mjs";
2
+ import "../logging-Dr8kuQ_p.mjs";
3
+ import { annotate, md } from "../buildkite-DSHpKA4z.mjs";
4
+
5
+ export { annotate, md };
@@ -0,0 +1,67 @@
1
+ const require_chunk = require('./chunk-odGzh3W-.js');
2
+ const require_exec = require('./exec-B2akdw0z.js');
3
+ const require_logging = require('./logging-6TTEX4U4.js');
4
+
5
+ //#region src/buildkite/annotate.ts
6
+ const isAnnotationEnabled = async () => Boolean(process.env.BUILDKITE && process.env.BUILDKITE_AGENT_ACCESS_TOKEN && process.env.BUILDKITE_JOB_ID && await require_exec.hasCommand("buildkite-agent"));
7
+ const MAX_SIZE = 1024 * 1024;
8
+ const TRUNCATION_WARNING = "... [Truncated due to size limit]";
9
+ /**
10
+ * Asynchronously uploads a Buildkite annotation.
11
+ *
12
+ * If the following environment variables are not present,
13
+ * the function will silently return without attempting to annotate:
14
+ *
15
+ * - `BUILDKITE`
16
+ * - `BUILDKITE_AGENT_ACCESS_TOKEN`
17
+ * - `BUILDKITE_JOB_ID`
18
+ *
19
+ * The `buildkite-agent` binary must also be on your `PATH`.
20
+ */
21
+ const annotate = async (markdown, opts = {}) => {
22
+ if (!await isAnnotationEnabled()) return;
23
+ let truncatedMarkdown = markdown;
24
+ if (markdown.length > MAX_SIZE) {
25
+ const remainingSpace = MAX_SIZE - TRUNCATION_WARNING.length;
26
+ truncatedMarkdown = markdown.slice(0, remainingSpace) + TRUNCATION_WARNING;
27
+ require_logging.log.warn(`Annotation truncated, full message is: ${markdown}`);
28
+ }
29
+ const context = [opts.scopeContextToStep && process.env.BUILDKITE_STEP_ID, opts.context].filter(Boolean).join("|");
30
+ const { style } = opts;
31
+ await require_exec.exec("buildkite-agent", "annotate", ...context ? ["--context", context] : [], ...style ? ["--style", style] : [], truncatedMarkdown);
32
+ };
33
+
34
+ //#endregion
35
+ //#region src/buildkite/md.ts
36
+ /**
37
+ * @internal
38
+ */
39
+ const md = { terminal: (code) => `\`\`\`term\n${code.replace(/```/g, "\\`\\`\\`")}\n\`\`\`` };
40
+
41
+ //#endregion
42
+ //#region src/buildkite/index.ts
43
+ var buildkite_exports = {};
44
+ require_chunk.__export(buildkite_exports, {
45
+ annotate: () => annotate,
46
+ md: () => md
47
+ });
48
+
49
+ //#endregion
50
+ Object.defineProperty(exports, 'annotate', {
51
+ enumerable: true,
52
+ get: function () {
53
+ return annotate;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, 'buildkite_exports', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return buildkite_exports;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, 'md', {
63
+ enumerable: true,
64
+ get: function () {
65
+ return md;
66
+ }
67
+ });
@@ -0,0 +1,50 @@
1
+ import { __export } from "./chunk-CZCtuq8p.mjs";
2
+ import { exec, hasCommand } from "./exec-p0gJ30UO.mjs";
3
+ import { log } from "./logging-Dr8kuQ_p.mjs";
4
+
5
+ //#region src/buildkite/annotate.ts
6
+ const isAnnotationEnabled = async () => Boolean(process.env.BUILDKITE && process.env.BUILDKITE_AGENT_ACCESS_TOKEN && process.env.BUILDKITE_JOB_ID && await hasCommand("buildkite-agent"));
7
+ const MAX_SIZE = 1024 * 1024;
8
+ const TRUNCATION_WARNING = "... [Truncated due to size limit]";
9
+ /**
10
+ * Asynchronously uploads a Buildkite annotation.
11
+ *
12
+ * If the following environment variables are not present,
13
+ * the function will silently return without attempting to annotate:
14
+ *
15
+ * - `BUILDKITE`
16
+ * - `BUILDKITE_AGENT_ACCESS_TOKEN`
17
+ * - `BUILDKITE_JOB_ID`
18
+ *
19
+ * The `buildkite-agent` binary must also be on your `PATH`.
20
+ */
21
+ const annotate = async (markdown, opts = {}) => {
22
+ if (!await isAnnotationEnabled()) return;
23
+ let truncatedMarkdown = markdown;
24
+ if (markdown.length > MAX_SIZE) {
25
+ const remainingSpace = MAX_SIZE - TRUNCATION_WARNING.length;
26
+ truncatedMarkdown = markdown.slice(0, remainingSpace) + TRUNCATION_WARNING;
27
+ log.warn(`Annotation truncated, full message is: ${markdown}`);
28
+ }
29
+ const context = [opts.scopeContextToStep && process.env.BUILDKITE_STEP_ID, opts.context].filter(Boolean).join("|");
30
+ const { style } = opts;
31
+ await exec("buildkite-agent", "annotate", ...context ? ["--context", context] : [], ...style ? ["--style", style] : [], truncatedMarkdown);
32
+ };
33
+
34
+ //#endregion
35
+ //#region src/buildkite/md.ts
36
+ /**
37
+ * @internal
38
+ */
39
+ const md = { terminal: (code) => `\`\`\`term\n${code.replace(/```/g, "\\`\\`\\`")}\n\`\`\`` };
40
+
41
+ //#endregion
42
+ //#region src/buildkite/index.ts
43
+ var buildkite_exports = {};
44
+ __export(buildkite_exports, {
45
+ annotate: () => annotate,
46
+ md: () => md
47
+ });
48
+
49
+ //#endregion
50
+ export { annotate, buildkite_exports, md };
@@ -0,0 +1,37 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __commonJS = (cb, mod) => function() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all) __defProp(target, name, {
15
+ get: all[name],
16
+ enumerable: true
17
+ });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
+
36
+ //#endregion
37
+ export { __commonJS, __export, __reExport, __require, __toESM };
@@ -0,0 +1,58 @@
1
+ //#region rolldown:runtime
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 __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+
33
+ //#endregion
34
+
35
+ Object.defineProperty(exports, '__commonJS', {
36
+ enumerable: true,
37
+ get: function () {
38
+ return __commonJS;
39
+ }
40
+ });
41
+ Object.defineProperty(exports, '__export', {
42
+ enumerable: true,
43
+ get: function () {
44
+ return __export;
45
+ }
46
+ });
47
+ Object.defineProperty(exports, '__reExport', {
48
+ enumerable: true,
49
+ get: function () {
50
+ return __reExport;
51
+ }
52
+ });
53
+ Object.defineProperty(exports, '__toESM', {
54
+ enumerable: true,
55
+ get: function () {
56
+ return __toESM;
57
+ }
58
+ });