@sanoma-ai/connector-github 0.6.0 → 0.7.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/fake.js CHANGED
@@ -1,5 +1,9 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { tfFake } from "@sanoma-ai/bridge/fake";
2
- import { githubTf } from "./connector.js";
3
+ import { DriverError } from "@sanoma-ai/workflows";
4
+ import { defineFake } from "@sanoma-ai/workflows/fake";
5
+ import { githubApp, githubTf } from "./connector.js";
6
+ import { branchPath, failed } from "./rest.js";
3
7
  import { owned } from "./owner.js";
4
8
  /**
5
9
  * What the provider answers an import of an object that is not there: for a branch protection
@@ -16,6 +20,125 @@ function missingReply(type, id) {
16
20
  diagnostics: [{ severity: "SEVERITY_ERROR", summary }],
17
21
  };
18
22
  }
23
+ /** A SHA of `parts`, as a commit's: the same for the same parts. */
24
+ const shaOf = (...parts) => createHash("sha1").update(JSON.stringify(parts)).digest("hex");
25
+ /** The `DriverError` the driver makes of GitHub's answer `status` to `<method> <path>`. */
26
+ const fail = (where, status, message, errors = []) => {
27
+ const [method = "", path = ""] = where.split(" ");
28
+ const body = { message, ...(errors.length && { errors: errors.map((e) => ({ message: e })) }) };
29
+ return failed(method, path, { status, headers: new Headers(), body });
30
+ };
31
+ /** The fake's template, which `repository.generate` copies. */
32
+ export const FAKE_TEMPLATE = "Sanoma-AI/company-template";
33
+ /**
34
+ * The operations through the App, over an in-memory GitHub: installation 7 on the organization
35
+ * `acme`, and the public template `Sanoma-AI/company-template` (`main`, a README). An installation
36
+ * reaches the repositories of its own account; a commit's SHA is the same for the same parent,
37
+ * message and files.
38
+ */
39
+ export function fakeGithubApp(options = {}) {
40
+ return defineFake(githubApp, {
41
+ initial: () => ({
42
+ seq: 1,
43
+ installations: { 7: { account: { login: "acme", type: "Organization" }, repositorySelection: "all" } },
44
+ repositories: {
45
+ [FAKE_TEMPLATE]: {
46
+ id: 1,
47
+ private: false,
48
+ defaultBranch: "main",
49
+ branches: { main: { sha: shaOf("template"), files: { "README.md": "# Company\n" } } },
50
+ keys: [],
51
+ },
52
+ },
53
+ }),
54
+ ops: (state) => {
55
+ /** The installation, as its JWT reads it (`where`), else its token is minted. */
56
+ const installed = (id, where = `POST /app/installations/${id}/access_tokens`) => {
57
+ const found = state.installations[id];
58
+ if (!found)
59
+ throw fail(where, 404, "Not Found");
60
+ return found;
61
+ };
62
+ /** Whether `owner` is the installation's account. */
63
+ const owns = (installation, owner) => owner.toLowerCase() === installed(installation).account.login.toLowerCase();
64
+ /** A repository the installation reaches (one of its own account's), as `<method> <path under it>` asks. */
65
+ const reached = (installation, repository, where) => {
66
+ const found = state.repositories[repository];
67
+ if (!found || !owns(installation, repository.split("/")[0])) {
68
+ const [method, path] = where.split(" ");
69
+ throw fail(`${method} /repos/${repository}${path}`, 404, "Not Found");
70
+ }
71
+ return found;
72
+ };
73
+ return {
74
+ installation: {
75
+ get: async ({ id }) => ({ id, ...installed(id, `GET /app/installations/${id}`) }),
76
+ },
77
+ repository: {
78
+ generate: async ({ installation, template, owner, name, private: isPrivate, description }) => {
79
+ const mine = owns(installation, owner);
80
+ const where = `POST /repos/${template.owner}/${template.repository}/generate`;
81
+ const from = state.repositories[`${template.owner}/${template.repository}`];
82
+ if (!from)
83
+ throw fail(where, 404, "Not Found");
84
+ if (!mine)
85
+ throw fail(where, 403, "Resource not accessible by integration");
86
+ const fullName = `${owner}/${name}`;
87
+ if (state.repositories[fullName]) {
88
+ throw fail(where, 422, "Validation Failed", ["name already exists on this account"]);
89
+ }
90
+ const files = structuredClone(from.branches[from.defaultBranch]?.files ?? {});
91
+ const id = ++state.seq;
92
+ state.repositories[fullName] = {
93
+ id,
94
+ private: isPrivate,
95
+ ...(description !== undefined && { description }),
96
+ defaultBranch: from.defaultBranch,
97
+ branches: { [from.defaultBranch]: { sha: shaOf(fullName, files), files } },
98
+ keys: [],
99
+ };
100
+ return {
101
+ id,
102
+ fullName,
103
+ cloneUrl: `https://github.com/${fullName}.git`,
104
+ sshUrl: `git@github.com:${fullName}.git`,
105
+ defaultBranch: from.defaultBranch,
106
+ };
107
+ },
108
+ commit: async ({ installation, repository, branch, message, files }) => {
109
+ const repo = reached(installation, repository, `GET /branches/${branchPath(branch)}`);
110
+ const head = repo.branches[branch] ?? repo.branches[repo.defaultBranch];
111
+ if (!head)
112
+ throw new DriverError(`github: ${repository} has no ${repo.defaultBranch}`, {
113
+ retryable: false,
114
+ vendorCode: "no_branch",
115
+ });
116
+ const sha = shaOf(head.sha, message, files);
117
+ repo.branches[branch] = { sha, files: { ...head.files, ...files } };
118
+ return { sha };
119
+ },
120
+ head: async ({ installation, repository, branch }) => {
121
+ const repo = reached(installation, repository, `GET /branches/${branchPath(branch)}`);
122
+ const head = repo.branches[branch];
123
+ if (!head)
124
+ throw fail(`GET /repos/${repository}/branches/${branchPath(branch)}`, 404, "Branch not found");
125
+ return { sha: head.sha };
126
+ },
127
+ addDeployKey: async ({ installation, repository, title, key, readOnly }) => {
128
+ const repo = reached(installation, repository, "POST /keys");
129
+ // GitHub takes a key once across all of GitHub, not once per repository.
130
+ if (Object.values(state.repositories).some((r) => r.keys.some((k) => k.key === key))) {
131
+ throw fail(`POST /repos/${repository}/keys`, 422, "Validation Failed", ["key is already in use"]);
132
+ }
133
+ const id = ++state.seq;
134
+ repo.keys.push({ id, title, key, readOnly });
135
+ return { id };
136
+ },
137
+ },
138
+ };
139
+ },
140
+ }, options);
141
+ }
19
142
  /**
20
143
  * A GitHub that answers as the provider did when its replies were recorded (`@sanoma-ai/bridge`'s
21
144
  * `testdata/replies`), through the real driver over a bridge of those replies: `import` and
@@ -27,12 +150,29 @@ function missingReply(type, id) {
27
150
  * `put` makes an object, `override` changes what the next read returns, as if someone edited
28
151
  * the object at GitHub, and `remove` deletes it, so the next read says it is gone and an import
29
152
  * answers as the provider does.
153
+ *
154
+ * The operations through the App answer from `app` (`fakeGithubApp`), with its own state,
155
+ * logging into the same `calls`; the faults (`failNext` and the others) reach either by its id.
30
156
  */
31
157
  export function fakeGithub(options = {}) {
32
158
  const fake = tfFake(githubTf, { missingReply, ...options });
159
+ const app = fakeGithubApp({ calls: fake.calls });
33
160
  // Named by owner as the driver's calls are; the fake's own objects are held by the provider's
34
161
  // import ids (`sanoma`, `sanoma:main`), what `put`, `override` and `remove` take.
35
- const { driver } = fake;
36
- return Object.assign(fake, { driver: owned(() => driver) });
162
+ const { driver, reset, failNext, loseReply, rateLimit, hold } = fake;
163
+ /** Whether `opId` is one of the operations through the App, whose faults are `app`'s. */
164
+ const ofApp = (opId) => Object.hasOwn(app.driver.ops, opId.slice("github.".length));
165
+ return Object.assign(fake, {
166
+ driver: { vendor: driver.vendor, ops: { ...owned(() => driver).ops, ...app.driver.ops } },
167
+ app,
168
+ reset() {
169
+ reset();
170
+ app.reset();
171
+ },
172
+ failNext: (opId, err) => ofApp(opId) ? app.failNext(opId, err) : failNext(opId, err),
173
+ loseReply: (opId) => (ofApp(opId) ? app.loseReply(opId) : loseReply(opId)),
174
+ rateLimit: (opId) => (ofApp(opId) ? app.rateLimit(opId) : rateLimit(opId)),
175
+ hold: (opId) => (ofApp(opId) ? app.hold(opId) : hold(opId)),
176
+ });
37
177
  }
38
178
  //# sourceMappingURL=fake.js.map
package/dist/fake.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fake.js","sourceRoot":"","sources":["../src/fake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAwC,MAAM,wBAAwB,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,EAAU;IAC5C,IAAI,IAAI,KAAK,mBAAmB;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,OAAO,GAAG,6DAA6D,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,GA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