@fragno-dev/github-app-fragment 0.0.1

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 (104) hide show
  1. package/LICENSE.md +16 -0
  2. package/README.md +163 -0
  3. package/bin/run.js +5 -0
  4. package/dist/browser/client/react.d.ts +37 -0
  5. package/dist/browser/client/react.d.ts.map +1 -0
  6. package/dist/browser/client/react.js +166 -0
  7. package/dist/browser/client/react.js.map +1 -0
  8. package/dist/browser/client/solid.d.ts +35 -0
  9. package/dist/browser/client/solid.d.ts.map +1 -0
  10. package/dist/browser/client/solid.js +136 -0
  11. package/dist/browser/client/solid.js.map +1 -0
  12. package/dist/browser/client/svelte.d.ts +30 -0
  13. package/dist/browser/client/svelte.d.ts.map +1 -0
  14. package/dist/browser/client/svelte.js +134 -0
  15. package/dist/browser/client/svelte.js.map +1 -0
  16. package/dist/browser/client/vanilla.d.ts +16 -0
  17. package/dist/browser/client/vanilla.d.ts.map +1 -0
  18. package/dist/browser/client/vanilla.js +11 -0
  19. package/dist/browser/client/vanilla.js.map +1 -0
  20. package/dist/browser/client/vue.d.ts +33 -0
  21. package/dist/browser/client/vue.d.ts.map +1 -0
  22. package/dist/browser/client/vue.js +133 -0
  23. package/dist/browser/client/vue.js.map +1 -0
  24. package/dist/browser/factory-BIj4C6PD.js +2210 -0
  25. package/dist/browser/factory-BIj4C6PD.js.map +1 -0
  26. package/dist/browser/index.d.ts +343 -0
  27. package/dist/browser/index.d.ts.map +1 -0
  28. package/dist/browser/index.js +3 -0
  29. package/dist/browser/types-BzeSSOQU.d.ts +660 -0
  30. package/dist/browser/types-BzeSSOQU.d.ts.map +1 -0
  31. package/dist/cli/commands/installations.js +92 -0
  32. package/dist/cli/commands/installations.js.map +1 -0
  33. package/dist/cli/commands/pulls.js +123 -0
  34. package/dist/cli/commands/pulls.js.map +1 -0
  35. package/dist/cli/commands/repositories.js +105 -0
  36. package/dist/cli/commands/repositories.js.map +1 -0
  37. package/dist/cli/commands/serve.js +187 -0
  38. package/dist/cli/commands/serve.js.map +1 -0
  39. package/dist/cli/commands/webhooks.js +122 -0
  40. package/dist/cli/commands/webhooks.js.map +1 -0
  41. package/dist/cli/github/api.js +94 -0
  42. package/dist/cli/github/api.js.map +1 -0
  43. package/dist/cli/github/definition.js +15 -0
  44. package/dist/cli/github/definition.js.map +1 -0
  45. package/dist/cli/github/factory.js +12 -0
  46. package/dist/cli/github/factory.js.map +1 -0
  47. package/dist/cli/github/repo-sync.js +33 -0
  48. package/dist/cli/github/repo-sync.js.map +1 -0
  49. package/dist/cli/github/utils.js +23 -0
  50. package/dist/cli/github/utils.js.map +1 -0
  51. package/dist/cli/github/webhook-processing.js +247 -0
  52. package/dist/cli/github/webhook-processing.js.map +1 -0
  53. package/dist/cli/index.d.ts +5 -0
  54. package/dist/cli/index.d.ts.map +1 -0
  55. package/dist/cli/index.js +263 -0
  56. package/dist/cli/index.js.map +1 -0
  57. package/dist/cli/routes.js +718 -0
  58. package/dist/cli/routes.js.map +1 -0
  59. package/dist/cli/schema.js +47 -0
  60. package/dist/cli/schema.js.map +1 -0
  61. package/dist/cli/utils/client.js +120 -0
  62. package/dist/cli/utils/client.js.map +1 -0
  63. package/dist/cli/utils/config.js +113 -0
  64. package/dist/cli/utils/config.js.map +1 -0
  65. package/dist/cli/utils/options.js +90 -0
  66. package/dist/cli/utils/options.js.map +1 -0
  67. package/dist/cli/utils/output.js +12 -0
  68. package/dist/cli/utils/output.js.map +1 -0
  69. package/dist/node/github/api.d.ts +52 -0
  70. package/dist/node/github/api.d.ts.map +1 -0
  71. package/dist/node/github/api.js +94 -0
  72. package/dist/node/github/api.js.map +1 -0
  73. package/dist/node/github/clients.d.ts +19 -0
  74. package/dist/node/github/clients.d.ts.map +1 -0
  75. package/dist/node/github/clients.js +12 -0
  76. package/dist/node/github/clients.js.map +1 -0
  77. package/dist/node/github/definition.d.ts +33 -0
  78. package/dist/node/github/definition.d.ts.map +1 -0
  79. package/dist/node/github/definition.js +15 -0
  80. package/dist/node/github/definition.js.map +1 -0
  81. package/dist/node/github/factory.d.ts +139 -0
  82. package/dist/node/github/factory.d.ts.map +1 -0
  83. package/dist/node/github/factory.js +18 -0
  84. package/dist/node/github/factory.js.map +1 -0
  85. package/dist/node/github/repo-sync.js +33 -0
  86. package/dist/node/github/repo-sync.js.map +1 -0
  87. package/dist/node/github/types.d.ts +24 -0
  88. package/dist/node/github/types.d.ts.map +1 -0
  89. package/dist/node/github/utils.js +23 -0
  90. package/dist/node/github/utils.js.map +1 -0
  91. package/dist/node/github/webhook-processing.d.ts +15 -0
  92. package/dist/node/github/webhook-processing.d.ts.map +1 -0
  93. package/dist/node/github/webhook-processing.js +247 -0
  94. package/dist/node/github/webhook-processing.js.map +1 -0
  95. package/dist/node/index.d.ts +7 -0
  96. package/dist/node/index.js +6 -0
  97. package/dist/node/routes.d.ts +127 -0
  98. package/dist/node/routes.d.ts.map +1 -0
  99. package/dist/node/routes.js +718 -0
  100. package/dist/node/routes.js.map +1 -0
  101. package/dist/node/schema.js +47 -0
  102. package/dist/node/schema.js.map +1 -0
  103. package/dist/tsconfig.tsbuildinfo +1 -0
  104. package/package.json +114 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","names":[],"sources":["../../../src/github/api.ts"],"mappings":";;;;KAIK,sBAAA;EACH,KAAA,UAAe,KAAA;AAAA;AAAA,KAGZ,kBAAA,GAAqB,YAAA,QAAoB,GAAA;AAAA,KACzC,aAAA,GAAgB,kBAAA;AAAA,KAET,iBAAA;EACV,OAAA,EAAS,aAAA;EACT,QAAA,EAAU,kBAAA;EACV,sBAAA,GAAyB,cAAA,aAA2B,OAAA,CAAQ,aAAA;AAAA;AAAA,KAGlD,4BAAA;EACV,EAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA,IAAA;EACA,cAAA;EACA,KAAA;IAAS,KAAA;EAAA;AAAA;AAAA,KAGC,yBAAA;EACV,EAAA;EACA,SAAA;EACA,YAAA;EACA,WAAA;EACA,MAAA;EACA,WAAA,EAAa,MAAA;EACb,MAAA;AAAA;AAAA,KAGG,sCAAA;EACH,YAAA,EAAc,4BAAA;AAAA;AAAA,KAGJ,eAAA;EACV,GAAA,EAAK,iBAAA;EACL,UAAA;EACA,qBAAA,GAAwB,cAAA;EACxB,eAAA,GAAkB,cAAA,aAA2B,OAAA,CAAQ,yBAAA;EACrD,qBAAA,GACE,cAAA,aACG,OAAA,CAAQ,sCAAA;EACb,sBAAA,GAAyB,OAAA;IACvB,OAAA;IACA,eAAA;EAAA,MACI,OAAA;AAAA;AAAA,cAMK,qBAAA,GACX,MAAA,EAAQ,uBAAA,EACR,OAAA,GAAS,sBAAA,KACR,eAAA"}
@@ -0,0 +1,94 @@
1
+ import { App, Octokit } from "octokit";
2
+
3
+ //#region src/github/api.ts
4
+ const DEFAULT_API_BASE_URL = "https://api.github.com";
5
+ const DEFAULT_API_VERSION = "2022-11-28";
6
+ const createGitHubApiClient = (config, options = {}) => {
7
+ const fetchImpl = options.fetch ?? globalThis.fetch ?? void 0;
8
+ const apiBaseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
9
+ const apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
10
+ const OctokitForApp = Octokit.defaults({
11
+ baseUrl: apiBaseUrl,
12
+ request: {
13
+ ...fetchImpl ? { fetch: fetchImpl } : {},
14
+ retries: 0
15
+ },
16
+ headers: { "x-github-api-version": apiVersion }
17
+ });
18
+ const octokitApp = new App({
19
+ appId: config.appId,
20
+ privateKey: config.privateKeyPem,
21
+ webhooks: { secret: config.webhookSecret },
22
+ Octokit: OctokitForApp
23
+ });
24
+ const app = {
25
+ octokit: octokitApp.octokit,
26
+ webhooks: octokitApp.webhooks,
27
+ getInstallationOctokit: async (installationId) => await octokitApp.getInstallationOctokit(installationId)
28
+ };
29
+ const resolveInstallationId = (installationId) => {
30
+ const numeric = Number.parseInt(installationId, 10);
31
+ if (!Number.isSafeInteger(numeric)) throw new Error(`Invalid installation id: ${installationId}`);
32
+ return numeric;
33
+ };
34
+ const getInstallationOctokit = async (installationId) => {
35
+ return await octokitApp.getInstallationOctokit(resolveInstallationId(installationId));
36
+ };
37
+ const listInstallationRepos = async (installationId) => {
38
+ const installationOctokit = await getInstallationOctokit(installationId);
39
+ const repositories = [];
40
+ const perPage = 100;
41
+ let page = 1;
42
+ while (true) {
43
+ const response = await installationOctokit.request("GET /installation/repositories", {
44
+ page,
45
+ per_page: perPage
46
+ });
47
+ const pageRepositories = response.data.repositories;
48
+ repositories.push(...pageRepositories);
49
+ const totalCount = response.data.total_count;
50
+ if (pageRepositories.length === 0) break;
51
+ if (typeof totalCount === "number" && repositories.length >= totalCount) break;
52
+ if (pageRepositories.length < perPage) break;
53
+ page += 1;
54
+ }
55
+ return { repositories };
56
+ };
57
+ const getInstallation = async (installationId) => {
58
+ const data = (await octokitApp.octokit.request("GET /app/installations/{installation_id}", { installation_id: resolveInstallationId(installationId) })).data;
59
+ const account = data.account;
60
+ if (!account || typeof account.id !== "number") throw new Error("GitHub installation response is missing account information.");
61
+ const accountLogin = "login" in account && typeof account.login === "string" && account.login.length > 0 ? account.login : "slug" in account && typeof account.slug === "string" && account.slug.length > 0 ? account.slug : String(account.id);
62
+ const accountType = "type" in account && typeof account.type === "string" && account.type.length > 0 ? account.type : "login" in account ? "User" : "Enterprise";
63
+ const status = typeof data.suspended_at === "string" && data.suspended_at.length > 0 ? "suspended" : "active";
64
+ return {
65
+ id: typeof data.id === "number" ? String(data.id) : installationId,
66
+ accountId: String(account.id),
67
+ accountLogin,
68
+ accountType,
69
+ status,
70
+ permissions: data.permissions ?? {},
71
+ events: data.events ?? []
72
+ };
73
+ };
74
+ const verifyWebhookSignature = async (options) => {
75
+ if (!options.signatureHeader) return false;
76
+ try {
77
+ return await octokitApp.webhooks.verify(options.payload, options.signatureHeader);
78
+ } catch {
79
+ return false;
80
+ }
81
+ };
82
+ return {
83
+ app,
84
+ apiVersion,
85
+ resolveInstallationId,
86
+ getInstallation,
87
+ listInstallationRepos,
88
+ verifyWebhookSignature
89
+ };
90
+ };
91
+
92
+ //#endregion
93
+ export { createGitHubApiClient };
94
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../src/github/api.ts"],"sourcesContent":["import { App, Octokit } from \"octokit\";\n\nimport type { GitHubAppFragmentConfig } from \"./types\";\n\ntype GitHubApiClientOptions = {\n fetch?: typeof fetch;\n};\n\ntype OctokitAppInstance = InstanceType<typeof App>;\ntype GitHubOctokit = OctokitAppInstance[\"octokit\"];\n\nexport type GitHubAppInstance = {\n octokit: GitHubOctokit;\n webhooks: OctokitAppInstance[\"webhooks\"];\n getInstallationOctokit: (installationId: number) => Promise<GitHubOctokit>;\n};\n\nexport type GitHubInstallationRepository = {\n id: number;\n name: string;\n full_name: string;\n private: boolean;\n fork?: boolean;\n default_branch?: string | null;\n owner: { login: string };\n};\n\nexport type GitHubInstallationDetails = {\n id: string;\n accountId: string;\n accountLogin: string;\n accountType: string;\n status: \"active\" | \"suspended\";\n permissions: Record<string, unknown>;\n events: unknown[];\n};\n\ntype GitHubInstallationRepositoriesResponse = {\n repositories: GitHubInstallationRepository[];\n};\n\nexport type GitHubApiClient = {\n app: GitHubAppInstance;\n apiVersion: string;\n resolveInstallationId: (installationId: string) => number;\n getInstallation: (installationId: string) => Promise<GitHubInstallationDetails>;\n listInstallationRepos: (\n installationId: string,\n ) => Promise<GitHubInstallationRepositoriesResponse>;\n verifyWebhookSignature: (options: {\n payload: string;\n signatureHeader: string | null;\n }) => Promise<boolean>;\n};\n\nconst DEFAULT_API_BASE_URL = \"https://api.github.com\";\nconst DEFAULT_API_VERSION = \"2022-11-28\";\n\nexport const createGitHubApiClient = (\n config: GitHubAppFragmentConfig,\n options: GitHubApiClientOptions = {},\n): GitHubApiClient => {\n const fetchImpl = options.fetch ?? globalThis.fetch ?? undefined;\n const apiBaseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;\n const apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;\n\n const OctokitForApp = Octokit.defaults({\n baseUrl: apiBaseUrl,\n request: {\n ...(fetchImpl ? { fetch: fetchImpl } : {}),\n retries: 0,\n },\n headers: {\n \"x-github-api-version\": apiVersion,\n },\n });\n\n const octokitApp = new App({\n appId: config.appId,\n privateKey: config.privateKeyPem,\n webhooks: { secret: config.webhookSecret },\n Octokit: OctokitForApp,\n });\n const app: GitHubAppInstance = {\n octokit: octokitApp.octokit,\n webhooks: octokitApp.webhooks,\n getInstallationOctokit: async (installationId) =>\n await octokitApp.getInstallationOctokit(installationId),\n };\n\n const resolveInstallationId = (installationId: string) => {\n const numeric = Number.parseInt(installationId, 10);\n if (!Number.isSafeInteger(numeric)) {\n throw new Error(`Invalid installation id: ${installationId}`);\n }\n return numeric;\n };\n\n const getInstallationOctokit = async (installationId: string) => {\n return await octokitApp.getInstallationOctokit(resolveInstallationId(installationId));\n };\n\n const listInstallationRepos = async (installationId: string) => {\n const installationOctokit = await getInstallationOctokit(installationId);\n\n const repositories: GitHubInstallationRepository[] = [];\n const perPage = 100;\n let page = 1;\n\n while (true) {\n const response = await installationOctokit.request(\"GET /installation/repositories\", {\n page,\n per_page: perPage,\n });\n const pageRepositories = response.data.repositories;\n repositories.push(...pageRepositories);\n\n const totalCount = response.data.total_count;\n if (pageRepositories.length === 0) {\n break;\n }\n if (typeof totalCount === \"number\" && repositories.length >= totalCount) {\n break;\n }\n if (pageRepositories.length < perPage) {\n break;\n }\n page += 1;\n }\n\n return {\n repositories,\n } satisfies GitHubInstallationRepositoriesResponse;\n };\n\n const getInstallation = async (installationId: string): Promise<GitHubInstallationDetails> => {\n const response = await octokitApp.octokit.request(\"GET /app/installations/{installation_id}\", {\n installation_id: resolveInstallationId(installationId),\n });\n\n const data = response.data;\n const account = data.account;\n if (!account || typeof account.id !== \"number\") {\n throw new Error(\"GitHub installation response is missing account information.\");\n }\n\n const accountLogin =\n \"login\" in account && typeof account.login === \"string\" && account.login.length > 0\n ? account.login\n : \"slug\" in account && typeof account.slug === \"string\" && account.slug.length > 0\n ? account.slug\n : String(account.id);\n\n const accountType =\n \"type\" in account && typeof account.type === \"string\" && account.type.length > 0\n ? account.type\n : \"login\" in account\n ? \"User\"\n : \"Enterprise\";\n\n const status: GitHubInstallationDetails[\"status\"] =\n typeof data.suspended_at === \"string\" && data.suspended_at.length > 0\n ? \"suspended\"\n : \"active\";\n\n return {\n id: typeof data.id === \"number\" ? String(data.id) : installationId,\n accountId: String(account.id),\n accountLogin,\n accountType,\n status,\n permissions: data.permissions ?? {},\n events: data.events ?? [],\n };\n };\n\n const verifyWebhookSignature = async (options: {\n payload: string;\n signatureHeader: string | null;\n }) => {\n if (!options.signatureHeader) {\n return false;\n }\n try {\n return await octokitApp.webhooks.verify(options.payload, options.signatureHeader);\n } catch {\n return false;\n }\n };\n\n return {\n app,\n apiVersion,\n resolveInstallationId,\n getInstallation,\n listInstallationRepos,\n verifyWebhookSignature,\n };\n};\n"],"mappings":";;;AAuDA,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAE5B,MAAa,yBACX,QACA,UAAkC,EAAE,KAChB;CACpB,MAAM,YAAY,QAAQ,SAAS,WAAW,SAAS;CACvD,MAAM,aAAa,OAAO,cAAc;CACxC,MAAM,aAAa,OAAO,cAAc;CAExC,MAAM,gBAAgB,QAAQ,SAAS;EACrC,SAAS;EACT,SAAS;GACP,GAAI,YAAY,EAAE,OAAO,WAAW,GAAG,EAAE;GACzC,SAAS;GACV;EACD,SAAS,EACP,wBAAwB,YACzB;EACF,CAAC;CAEF,MAAM,aAAa,IAAI,IAAI;EACzB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,UAAU,EAAE,QAAQ,OAAO,eAAe;EAC1C,SAAS;EACV,CAAC;CACF,MAAM,MAAyB;EAC7B,SAAS,WAAW;EACpB,UAAU,WAAW;EACrB,wBAAwB,OAAO,mBAC7B,MAAM,WAAW,uBAAuB,eAAe;EAC1D;CAED,MAAM,yBAAyB,mBAA2B;EACxD,MAAM,UAAU,OAAO,SAAS,gBAAgB,GAAG;AACnD,MAAI,CAAC,OAAO,cAAc,QAAQ,CAChC,OAAM,IAAI,MAAM,4BAA4B,iBAAiB;AAE/D,SAAO;;CAGT,MAAM,yBAAyB,OAAO,mBAA2B;AAC/D,SAAO,MAAM,WAAW,uBAAuB,sBAAsB,eAAe,CAAC;;CAGvF,MAAM,wBAAwB,OAAO,mBAA2B;EAC9D,MAAM,sBAAsB,MAAM,uBAAuB,eAAe;EAExE,MAAM,eAA+C,EAAE;EACvD,MAAM,UAAU;EAChB,IAAI,OAAO;AAEX,SAAO,MAAM;GACX,MAAM,WAAW,MAAM,oBAAoB,QAAQ,kCAAkC;IACnF;IACA,UAAU;IACX,CAAC;GACF,MAAM,mBAAmB,SAAS,KAAK;AACvC,gBAAa,KAAK,GAAG,iBAAiB;GAEtC,MAAM,aAAa,SAAS,KAAK;AACjC,OAAI,iBAAiB,WAAW,EAC9B;AAEF,OAAI,OAAO,eAAe,YAAY,aAAa,UAAU,WAC3D;AAEF,OAAI,iBAAiB,SAAS,QAC5B;AAEF,WAAQ;;AAGV,SAAO,EACL,cACD;;CAGH,MAAM,kBAAkB,OAAO,mBAA+D;EAK5F,MAAM,QAJW,MAAM,WAAW,QAAQ,QAAQ,4CAA4C,EAC5F,iBAAiB,sBAAsB,eAAe,EACvD,CAAC,EAEoB;EACtB,MAAM,UAAU,KAAK;AACrB,MAAI,CAAC,WAAW,OAAO,QAAQ,OAAO,SACpC,OAAM,IAAI,MAAM,+DAA+D;EAGjF,MAAM,eACJ,WAAW,WAAW,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAAM,SAAS,IAC9E,QAAQ,QACR,UAAU,WAAW,OAAO,QAAQ,SAAS,YAAY,QAAQ,KAAK,SAAS,IAC7E,QAAQ,OACR,OAAO,QAAQ,GAAG;EAE1B,MAAM,cACJ,UAAU,WAAW,OAAO,QAAQ,SAAS,YAAY,QAAQ,KAAK,SAAS,IAC3E,QAAQ,OACR,WAAW,UACT,SACA;EAER,MAAM,SACJ,OAAO,KAAK,iBAAiB,YAAY,KAAK,aAAa,SAAS,IAChE,cACA;AAEN,SAAO;GACL,IAAI,OAAO,KAAK,OAAO,WAAW,OAAO,KAAK,GAAG,GAAG;GACpD,WAAW,OAAO,QAAQ,GAAG;GAC7B;GACA;GACA;GACA,aAAa,KAAK,eAAe,EAAE;GACnC,QAAQ,KAAK,UAAU,EAAE;GAC1B;;CAGH,MAAM,yBAAyB,OAAO,YAGhC;AACJ,MAAI,CAAC,QAAQ,gBACX,QAAO;AAET,MAAI;AACF,UAAO,MAAM,WAAW,SAAS,OAAO,QAAQ,SAAS,QAAQ,gBAAgB;UAC3E;AACN,UAAO;;;AAIX,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,19 @@
1
+ import { GitHubAppFragmentPublicClientConfig } from "./types.js";
2
+ import * as _fragno_dev_core_client0 from "@fragno-dev/core/client";
3
+ import { FragnoPublicClientConfig } from "@fragno-dev/core/client";
4
+ import * as zod from "zod";
5
+ import * as _fragno_dev_core_api0 from "@fragno-dev/core/api";
6
+ import * as _standard_schema_spec0 from "@standard-schema/spec";
7
+ import * as zod_v4_core0 from "zod/v4/core";
8
+
9
+ //#region src/github/clients.d.ts
10
+ declare function createGitHubAppFragmentClients(fragnoConfig: FragnoPublicClientConfig): {
11
+ useSyncInstallation: _fragno_dev_core_client0.FragnoClientMutatorData<_fragno_dev_core_api0.NonGetHTTPMethod, "/installations/:installationId/sync", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
12
+ added: zod.ZodNumber;
13
+ removed: zod.ZodNumber;
14
+ updated: zod.ZodNumber;
15
+ }, zod_v4_core0.$strip> | undefined, "INSTALLATION_NOT_FOUND" | "GITHUB_API_ERROR", string>;
16
+ };
17
+ //#endregion
18
+ export { createGitHubAppFragmentClients };
19
+ //# sourceMappingURL=clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.d.ts","names":[],"sources":["../../../src/github/clients.ts"],"mappings":";;;;;;;;;iBAOgB,8BAAA,CAA+B,YAAA,EAAc,wBAAA;wEAAwB,qBAAA,CAAA,gBAAA"}
@@ -0,0 +1,12 @@
1
+ import { githubAppFragmentDefinition } from "./definition.js";
2
+ import { githubAppRoutesFactory } from "../routes.js";
3
+ import { createClientBuilder } from "@fragno-dev/core/client";
4
+
5
+ //#region src/github/clients.ts
6
+ function createGitHubAppFragmentClients(fragnoConfig) {
7
+ return { useSyncInstallation: createClientBuilder(githubAppFragmentDefinition, fragnoConfig, [githubAppRoutesFactory]).createMutator("POST", "/installations/:installationId/sync") };
8
+ }
9
+
10
+ //#endregion
11
+ export { createGitHubAppFragmentClients };
12
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.js","names":[],"sources":["../../../src/github/clients.ts"],"sourcesContent":["import { createClientBuilder, type FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\n\nimport { githubAppRoutesFactory } from \"../routes\";\nimport { githubAppFragmentDefinition } from \"./definition\";\n\nexport type { GitHubAppFragmentPublicClientConfig } from \"./types\";\n\nexport function createGitHubAppFragmentClients(fragnoConfig: FragnoPublicClientConfig) {\n const b = createClientBuilder(githubAppFragmentDefinition, fragnoConfig, [\n githubAppRoutesFactory,\n ]);\n\n return {\n useSyncInstallation: b.createMutator(\"POST\", \"/installations/:installationId/sync\"),\n };\n}\n"],"mappings":";;;;;AAOA,SAAgB,+BAA+B,cAAwC;AAKrF,QAAO,EACL,qBALQ,oBAAoB,6BAA6B,cAAc,CACvE,uBACD,CAAC,CAGuB,cAAc,QAAQ,sCAAsC,EACpF"}
@@ -0,0 +1,33 @@
1
+ import { GitHubAppFragmentConfig } from "./types.js";
2
+ import { GitHubApiClient, GitHubAppInstance, createGitHubApiClient } from "./api.js";
3
+ import { WebhookProcessingPayload } from "./webhook-processing.js";
4
+ import * as _fragno_dev_db_schema0 from "@fragno-dev/db/schema";
5
+ import * as _fragno_dev_core0 from "@fragno-dev/core";
6
+ import * as _fragno_dev_db0 from "@fragno-dev/db";
7
+ import * as _fragno_dev_db_fragment_definition_builder0 from "@fragno-dev/db/fragment-definition-builder";
8
+
9
+ //#region src/github/definition.d.ts
10
+ type GitHubAppFragmentDependencies = {
11
+ githubApiClient: ReturnType<typeof createGitHubApiClient>;
12
+ };
13
+ type GitHubAppFragmentServices = {
14
+ app: ReturnType<typeof createGitHubApiClient>["app"];
15
+ githubApiClient: ReturnType<typeof createGitHubApiClient>;
16
+ };
17
+ declare const githubAppFragmentDefinition: _fragno_dev_core0.FragmentDefinition<GitHubAppFragmentConfig, _fragno_dev_db0.FragnoPublicConfigWithDatabase, {
18
+ githubApiClient: GitHubApiClient;
19
+ } & _fragno_dev_db0.ImplicitDatabaseDependencies<_fragno_dev_db_schema0.Schema<{
20
+ installation: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>;
21
+ installation_repo: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"installationId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"ownerLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"fullName", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"isPrivate", _fragno_dev_db_schema0.Column<"bool", boolean, boolean>> & Record<"isFork", _fragno_dev_db_schema0.Column<"bool", boolean | null, boolean | null>> & Record<"defaultBranch", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"removedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"installation", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>>> & Record<"links", _fragno_dev_db_schema0.Relation<"many", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_repo_installation", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["installationId"]>> & Record<"idx_installation_repo_full_name", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["fullName"]>>>;
22
+ repo_link: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"repo", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"installationId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"ownerLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"fullName", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"isPrivate", _fragno_dev_db_schema0.Column<"bool", boolean, boolean>> & Record<"isFork", _fragno_dev_db_schema0.Column<"bool", boolean | null, boolean | null>> & Record<"defaultBranch", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"removedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"installation", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>>> & Record<"links", _fragno_dev_db_schema0.Relation<"many", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_repo_installation", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["installationId"]>> & Record<"idx_installation_repo_full_name", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["fullName"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>;
23
+ }>>, {
24
+ app: GitHubAppInstance;
25
+ githubApiClient: GitHubApiClient;
26
+ }, {}, {}, {}, _fragno_dev_db0.DatabaseServiceContext<{
27
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
28
+ }>, _fragno_dev_db0.DatabaseRequestContext<{
29
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
30
+ }>, _fragno_dev_db_fragment_definition_builder0.DatabaseRequestStorage, []>;
31
+ //#endregion
32
+ export { GitHubAppFragmentDependencies, GitHubAppFragmentServices, githubAppFragmentDefinition };
33
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","names":[],"sources":["../../../src/github/definition.ts"],"mappings":";;;;;;;;;KAQY,6BAAA;EACV,eAAA,EAAiB,UAAA,QAAkB,qBAAA;AAAA;AAAA,KAEzB,yBAAA;EACV,GAAA,EAAK,UAAA,QAAkB,qBAAA;EACvB,eAAA,EAAiB,UAAA,QAAkB,qBAAA;AAAA;AAAA,cAGxB,2BAAA,oBAA2B,kBAAA,CAAA,uBAAA,EAAA,eAAA,CAAA,8BAAA;mBAAA,eAAA;AAAA"}
@@ -0,0 +1,15 @@
1
+ import { githubAppSchema } from "../schema.js";
2
+ import { createGitHubApiClient } from "./api.js";
3
+ import { createWebhookProcessor } from "./webhook-processing.js";
4
+ import { defineFragment } from "@fragno-dev/core";
5
+ import { withDatabase } from "@fragno-dev/db";
6
+
7
+ //#region src/github/definition.ts
8
+ const githubAppFragmentDefinition = defineFragment("github-app-fragment").extend(withDatabase(githubAppSchema)).withDependencies(({ config }) => ({ githubApiClient: createGitHubApiClient(config) })).providesBaseService(({ deps, defineService }) => defineService({
9
+ app: deps.githubApiClient.app,
10
+ githubApiClient: deps.githubApiClient
11
+ })).provideHooks(({ defineHook, config }) => ({ processWebhook: defineHook(createWebhookProcessor({ webhook: config.webhook })) })).build();
12
+
13
+ //#endregion
14
+ export { githubAppFragmentDefinition };
15
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","names":[],"sources":["../../../src/github/definition.ts"],"sourcesContent":["import { defineFragment } from \"@fragno-dev/core\";\nimport { withDatabase } from \"@fragno-dev/db\";\n\nimport { githubAppSchema } from \"../schema\";\nimport { createGitHubApiClient } from \"./api\";\nimport type { GitHubAppFragmentConfig } from \"./types\";\nimport { createWebhookProcessor } from \"./webhook-processing\";\n\nexport type GitHubAppFragmentDependencies = {\n githubApiClient: ReturnType<typeof createGitHubApiClient>;\n};\nexport type GitHubAppFragmentServices = {\n app: ReturnType<typeof createGitHubApiClient>[\"app\"];\n githubApiClient: ReturnType<typeof createGitHubApiClient>;\n};\n\nexport const githubAppFragmentDefinition = defineFragment<GitHubAppFragmentConfig>(\n \"github-app-fragment\",\n)\n .extend(withDatabase(githubAppSchema))\n .withDependencies(({ config }) => ({\n githubApiClient: createGitHubApiClient(config),\n }))\n .providesBaseService(({ deps, defineService }) =>\n defineService({\n app: deps.githubApiClient.app,\n githubApiClient: deps.githubApiClient,\n }),\n )\n .provideHooks(({ defineHook, config }) => ({\n processWebhook: defineHook(\n createWebhookProcessor({\n webhook: config.webhook,\n }),\n ),\n }))\n .build();\n"],"mappings":";;;;;;;AAgBA,MAAa,8BAA8B,eACzC,sBACD,CACE,OAAO,aAAa,gBAAgB,CAAC,CACrC,kBAAkB,EAAE,cAAc,EACjC,iBAAiB,sBAAsB,OAAO,EAC/C,EAAE,CACF,qBAAqB,EAAE,MAAM,oBAC5B,cAAc;CACZ,KAAK,KAAK,gBAAgB;CAC1B,iBAAiB,KAAK;CACvB,CAAC,CACH,CACA,cAAc,EAAE,YAAY,cAAc,EACzC,gBAAgB,WACd,uBAAuB,EACrB,SAAS,OAAO,SACjB,CAAC,CACH,EACF,EAAE,CACF,OAAO"}
@@ -0,0 +1,139 @@
1
+ import { GitHubAppFragmentConfig } from "./types.js";
2
+ import { GitHubApiClient, GitHubAppInstance } from "./api.js";
3
+ import { WebhookProcessingPayload } from "./webhook-processing.js";
4
+ import { GitHubAppFragmentServices } from "./definition.js";
5
+ import * as _fragno_dev_db_schema0 from "@fragno-dev/db/schema";
6
+ import * as zod from "zod";
7
+ import * as _fragno_dev_core0 from "@fragno-dev/core";
8
+ import * as _fragno_dev_db0 from "@fragno-dev/db";
9
+ import { FragnoPublicConfigWithDatabase } from "@fragno-dev/db";
10
+ import * as _standard_schema_spec0 from "@standard-schema/spec";
11
+ import * as zod_v4_core0 from "zod/v4/core";
12
+ import * as _fragno_dev_db_fragment_definition_builder0 from "@fragno-dev/db/fragment-definition-builder";
13
+
14
+ //#region src/github/factory.d.ts
15
+ declare function createGitHubAppFragment(config: GitHubAppFragmentConfig, options: FragnoPublicConfigWithDatabase): _fragno_dev_core0.FragnoInstantiatedFragment<readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/webhooks", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, "WEBHOOK_SIGNATURE_INVALID" | "WEBHOOK_DELIVERY_MISSING" | "WEBHOOK_PAYLOAD_INVALID", string, _fragno_dev_db0.DatabaseRequestContext<{
16
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
17
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/installations", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodArray<zod.ZodObject<{
18
+ id: zod.ZodString;
19
+ accountId: zod.ZodString;
20
+ accountLogin: zod.ZodString;
21
+ accountType: zod.ZodString;
22
+ status: zod.ZodString;
23
+ permissions: zod.ZodAny;
24
+ events: zod.ZodAny;
25
+ createdAt: zod.ZodDate;
26
+ updatedAt: zod.ZodDate;
27
+ lastWebhookAt: zod.ZodNullable<zod.ZodDate>;
28
+ }, zod_v4_core0.$strip>>, "INVALID_STATUS", "status", _fragno_dev_db0.DatabaseRequestContext<{
29
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
30
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/installations/:installationId/repos", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodArray<zod.ZodObject<{
31
+ id: zod.ZodString;
32
+ installationId: zod.ZodString;
33
+ ownerLogin: zod.ZodString;
34
+ name: zod.ZodString;
35
+ fullName: zod.ZodString;
36
+ isPrivate: zod.ZodBoolean;
37
+ isFork: zod.ZodNullable<zod.ZodBoolean>;
38
+ defaultBranch: zod.ZodNullable<zod.ZodString>;
39
+ removedAt: zod.ZodNullable<zod.ZodDate>;
40
+ updatedAt: zod.ZodDate;
41
+ linkKeys: zod.ZodArray<zod.ZodString>;
42
+ }, zod_v4_core0.$strip>>, "INSTALLATION_NOT_FOUND", "linkKey" | "linkedOnly", _fragno_dev_db0.DatabaseRequestContext<{
43
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
44
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/repositories/linked", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodArray<zod.ZodObject<{
45
+ id: zod.ZodString;
46
+ installationId: zod.ZodString;
47
+ ownerLogin: zod.ZodString;
48
+ name: zod.ZodString;
49
+ fullName: zod.ZodString;
50
+ isPrivate: zod.ZodBoolean;
51
+ isFork: zod.ZodNullable<zod.ZodBoolean>;
52
+ defaultBranch: zod.ZodNullable<zod.ZodString>;
53
+ removedAt: zod.ZodNullable<zod.ZodDate>;
54
+ updatedAt: zod.ZodDate;
55
+ linkKeys: zod.ZodArray<zod.ZodString>;
56
+ }, zod_v4_core0.$strip>>, string, "linkKey", _fragno_dev_db0.DatabaseRequestContext<{
57
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
58
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/repositories/link", zod.ZodObject<{
59
+ installationId: zod.ZodString;
60
+ repoId: zod.ZodString;
61
+ linkKey: zod.ZodOptional<zod.ZodString>;
62
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
63
+ link: zod.ZodObject<{
64
+ id: zod.ZodString;
65
+ repoId: zod.ZodString;
66
+ linkKey: zod.ZodString;
67
+ linkedAt: zod.ZodDate;
68
+ }, zod_v4_core0.$strip>;
69
+ repo: zod.ZodObject<{
70
+ id: zod.ZodString;
71
+ installationId: zod.ZodString;
72
+ ownerLogin: zod.ZodString;
73
+ name: zod.ZodString;
74
+ fullName: zod.ZodString;
75
+ isPrivate: zod.ZodBoolean;
76
+ isFork: zod.ZodNullable<zod.ZodBoolean>;
77
+ defaultBranch: zod.ZodNullable<zod.ZodString>;
78
+ removedAt: zod.ZodNullable<zod.ZodDate>;
79
+ updatedAt: zod.ZodDate;
80
+ }, zod_v4_core0.$strip>;
81
+ }, zod_v4_core0.$strip>, "INSTALLATION_NOT_FOUND" | "INSTALLATION_INACTIVE" | "REPO_NOT_FOUND" | "REPO_REMOVED", string, _fragno_dev_db0.DatabaseRequestContext<{
82
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
83
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/repositories/unlink", zod.ZodObject<{
84
+ repoId: zod.ZodString;
85
+ linkKey: zod.ZodOptional<zod.ZodString>;
86
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
87
+ ok: zod.ZodLiteral<true>;
88
+ }, zod_v4_core0.$strip>, "INSTALLATION_NOT_FOUND" | "INSTALLATION_INACTIVE" | "REPO_NOT_FOUND" | "LINK_NOT_FOUND", string, _fragno_dev_db0.DatabaseRequestContext<{
89
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
90
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/repositories/:owner/:repo/pulls", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
91
+ pulls: zod.ZodArray<zod.ZodAny>;
92
+ pageInfo: zod.ZodObject<{
93
+ page: zod.ZodNumber;
94
+ perPage: zod.ZodNumber;
95
+ }, zod_v4_core0.$strip>;
96
+ }, zod_v4_core0.$strip>, "INSTALLATION_NOT_FOUND" | "INSTALLATION_INACTIVE" | "REPO_NOT_FOUND" | "REPO_REMOVED" | "INVALID_STATE" | "INVALID_PER_PAGE" | "INVALID_PAGE" | "REPO_NOT_LINKED" | "GITHUB_API_ERROR", "state" | "perPage" | "page", _fragno_dev_db0.DatabaseRequestContext<{
97
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
98
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/repositories/:owner/:repo/pulls/:number/reviews", zod.ZodObject<{
99
+ event: zod.ZodOptional<zod.ZodEnum<{
100
+ APPROVE: "APPROVE";
101
+ REQUEST_CHANGES: "REQUEST_CHANGES";
102
+ COMMENT: "COMMENT";
103
+ }>>;
104
+ body: zod.ZodOptional<zod.ZodString>;
105
+ comments: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
106
+ commitId: zod.ZodOptional<zod.ZodString>;
107
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
108
+ review: zod.ZodAny;
109
+ }, zod_v4_core0.$strip>, "INSTALLATION_NOT_FOUND" | "INSTALLATION_INACTIVE" | "REPO_NOT_FOUND" | "REPO_REMOVED" | "REPO_NOT_LINKED" | "GITHUB_API_ERROR" | "INVALID_PULL_NUMBER", string, _fragno_dev_db0.DatabaseRequestContext<{
110
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
111
+ }>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/installations/:installationId/sync", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
112
+ added: zod.ZodNumber;
113
+ removed: zod.ZodNumber;
114
+ updated: zod.ZodNumber;
115
+ }, zod_v4_core0.$strip>, "INSTALLATION_NOT_FOUND" | "GITHUB_API_ERROR", string, _fragno_dev_db0.DatabaseRequestContext<{
116
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
117
+ }>>], {
118
+ githubApiClient: GitHubApiClient;
119
+ } & _fragno_dev_db0.ImplicitDatabaseDependencies<_fragno_dev_db_schema0.Schema<{
120
+ installation: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>;
121
+ installation_repo: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"installationId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"ownerLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"fullName", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"isPrivate", _fragno_dev_db_schema0.Column<"bool", boolean, boolean>> & Record<"isFork", _fragno_dev_db_schema0.Column<"bool", boolean | null, boolean | null>> & Record<"defaultBranch", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"removedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"installation", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>>> & Record<"links", _fragno_dev_db_schema0.Relation<"many", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_repo_installation", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["installationId"]>> & Record<"idx_installation_repo_full_name", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["fullName"]>>>;
122
+ repo_link: _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"repo", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"installationId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"ownerLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"fullName", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"isPrivate", _fragno_dev_db_schema0.Column<"bool", boolean, boolean>> & Record<"isFork", _fragno_dev_db_schema0.Column<"bool", boolean | null, boolean | null>> & Record<"defaultBranch", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"removedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation> & Record<"installation", _fragno_dev_db_schema0.Relation<"one", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"accountId", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountLogin", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"accountType", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"permissions", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"events", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>> & Record<"lastWebhookAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date | null>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_account_login", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["accountLogin"]>> & Record<"idx_installation_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"uniq_installation_id", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["id"]>>>>> & Record<"links", _fragno_dev_db_schema0.Relation<"many", _fragno_dev_db_schema0.Table<Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"repoId", _fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>> & Record<"linkKey", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"linkedAt", _fragno_dev_db_schema0.Column<"timestamp", (Date | _fragno_dev_db0.DbNow) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_installation_repo_installation", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["installationId"]>> & Record<"idx_installation_repo_full_name", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["fullName"]>>>>>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"uniq_repo_link_repo_id_link_key", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"bigint", string | bigint | _fragno_dev_db_schema0.FragnoId | _fragno_dev_db_schema0.FragnoReference, _fragno_dev_db_schema0.FragnoReference>, _fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["repoId", "linkKey"]>>>;
123
+ }>>, _fragno_dev_core0.BoundServices<{
124
+ app: GitHubAppInstance;
125
+ githubApiClient: GitHubApiClient;
126
+ }>, _fragno_dev_db0.DatabaseServiceContext<{
127
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
128
+ }>, _fragno_dev_db0.DatabaseRequestContext<{
129
+ processWebhook: _fragno_dev_db0.HookFn<WebhookProcessingPayload>;
130
+ }>, _fragno_dev_db_fragment_definition_builder0.DatabaseRequestStorage, FragnoPublicConfigWithDatabase>;
131
+ declare function getGitHubApiClientFromFragment(fragment: {
132
+ services: GitHubAppFragmentServices;
133
+ }): GitHubApiClient;
134
+ declare function getGitHubAppFromFragment(fragment: {
135
+ services: GitHubAppFragmentServices;
136
+ }): GitHubAppInstance;
137
+ //#endregion
138
+ export { createGitHubAppFragment, getGitHubApiClientFromFragment, getGitHubAppFromFragment };
139
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","names":[],"sources":["../../../src/github/factory.ts"],"mappings":";;;;;;;;;;;;;;iBAOgB,uBAAA,CACd,MAAA,EAAQ,uBAAA,EACR,OAAA,EAAS,8BAAA,qBAA8B,0BAAA,WAAA,iBAAA,CAAA,iBAAA,sBAAA,sBAAA,CAAA,gBAAA,gCAAA,sBAAA,CAAA,gBAAA,8IAAA,sBAAA;yCAAA,wBAAA;AAAA,kEAAA,sBAAA,CAAA,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASzB,8BAAA,CAA+B,QAAA;EAAY,QAAA,EAAU,yBAAA;AAAA,IAAyB,eAAA;AAAA,iBAI9E,wBAAA,CAAyB,QAAA;EAAY,QAAA,EAAU,yBAAA;AAAA,IAAyB,iBAAA"}
@@ -0,0 +1,18 @@
1
+ import { githubAppFragmentDefinition } from "./definition.js";
2
+ import { githubAppRoutesFactory } from "../routes.js";
3
+ import { instantiate } from "@fragno-dev/core";
4
+
5
+ //#region src/github/factory.ts
6
+ function createGitHubAppFragment(config, options) {
7
+ return instantiate(githubAppFragmentDefinition).withConfig(config).withRoutes([githubAppRoutesFactory]).withOptions(options).build();
8
+ }
9
+ function getGitHubApiClientFromFragment(fragment) {
10
+ return fragment.services.githubApiClient;
11
+ }
12
+ function getGitHubAppFromFragment(fragment) {
13
+ return fragment.services.app;
14
+ }
15
+
16
+ //#endregion
17
+ export { createGitHubAppFragment, getGitHubApiClientFromFragment, getGitHubAppFromFragment };
18
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","names":[],"sources":["../../../src/github/factory.ts"],"sourcesContent":["import { instantiate } from \"@fragno-dev/core\";\nimport type { FragnoPublicConfigWithDatabase } from \"@fragno-dev/db\";\n\nimport { githubAppRoutesFactory } from \"../routes\";\nimport { githubAppFragmentDefinition, type GitHubAppFragmentServices } from \"./definition\";\nimport type { GitHubAppFragmentConfig } from \"./types\";\n\nexport function createGitHubAppFragment(\n config: GitHubAppFragmentConfig,\n options: FragnoPublicConfigWithDatabase,\n) {\n return instantiate(githubAppFragmentDefinition)\n .withConfig(config)\n .withRoutes([githubAppRoutesFactory])\n .withOptions(options)\n .build();\n}\n\nexport function getGitHubApiClientFromFragment(fragment: { services: GitHubAppFragmentServices }) {\n return fragment.services.githubApiClient;\n}\n\nexport function getGitHubAppFromFragment(fragment: { services: GitHubAppFragmentServices }) {\n return fragment.services.app;\n}\n"],"mappings":";;;;;AAOA,SAAgB,wBACd,QACA,SACA;AACA,QAAO,YAAY,4BAA4B,CAC5C,WAAW,OAAO,CAClB,WAAW,CAAC,uBAAuB,CAAC,CACpC,YAAY,QAAQ,CACpB,OAAO;;AAGZ,SAAgB,+BAA+B,UAAmD;AAChG,QAAO,SAAS,SAAS;;AAG3B,SAAgB,yBAAyB,UAAmD;AAC1F,QAAO,SAAS,SAAS"}
@@ -0,0 +1,33 @@
1
+ import "../schema.js";
2
+
3
+ //#region src/github/repo-sync.ts
4
+ const toRepoRecord = (installationId, repo, now) => {
5
+ const ownerLogin = repo.owner?.login ?? "";
6
+ const record = {
7
+ id: `${repo.id}`,
8
+ installationId,
9
+ ownerLogin,
10
+ name: repo.name,
11
+ fullName: repo.full_name ?? `${ownerLogin}/${repo.name}`,
12
+ isPrivate: Boolean(repo.private),
13
+ removedAt: null,
14
+ updatedAt: now
15
+ };
16
+ if (repo.fork !== void 0) record.isFork = Boolean(repo.fork);
17
+ if (repo.default_branch !== void 0) record.defaultBranch = repo.default_branch ?? null;
18
+ return record;
19
+ };
20
+ const toRepoCreateRecord = (record) => ({
21
+ ...record,
22
+ isFork: record.isFork ?? null,
23
+ defaultBranch: record.defaultBranch ?? null
24
+ });
25
+ const hasRepoChanges = (existing, record) => {
26
+ const forkChanged = typeof record.isFork === "boolean" && existing.isFork !== record.isFork;
27
+ const defaultBranchChanged = record.defaultBranch !== void 0 && (existing.defaultBranch ?? null) !== record.defaultBranch;
28
+ return existing.ownerLogin !== record.ownerLogin || existing.name !== record.name || existing.fullName !== record.fullName || existing.isPrivate !== record.isPrivate || forkChanged || defaultBranchChanged || existing.installationId == null || existing.removedAt !== null;
29
+ };
30
+
31
+ //#endregion
32
+ export { hasRepoChanges, toRepoCreateRecord, toRepoRecord };
33
+ //# sourceMappingURL=repo-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-sync.js","names":[],"sources":["../../../src/github/repo-sync.ts"],"sourcesContent":["import type { TableToColumnValues } from \"@fragno-dev/db/query\";\n\nimport { githubAppSchema } from \"../schema\";\nimport type { GitHubInstallationRepository } from \"./api\";\n\nexport type InstallationRepoRow = TableToColumnValues<\n (typeof githubAppSchema)[\"tables\"][\"installation_repo\"]\n>;\n\nexport type RepoRecord = {\n id: string;\n installationId: string;\n ownerLogin: string;\n name: string;\n fullName: string;\n isPrivate: boolean;\n isFork?: boolean;\n defaultBranch?: string | null;\n removedAt: null;\n updatedAt: Date;\n};\n\nexport type RepoCreateRecord = Omit<RepoRecord, \"isFork\" | \"defaultBranch\"> & {\n isFork: boolean | null;\n defaultBranch: string | null;\n};\n\nexport const toRepoRecord = (\n installationId: string,\n repo: GitHubInstallationRepository,\n now: Date,\n): RepoRecord => {\n const ownerLogin = repo.owner?.login ?? \"\";\n const record: RepoRecord = {\n id: `${repo.id}`,\n installationId,\n ownerLogin,\n name: repo.name,\n fullName: repo.full_name ?? `${ownerLogin}/${repo.name}`,\n isPrivate: Boolean(repo.private),\n removedAt: null,\n updatedAt: now,\n };\n\n if (repo.fork !== undefined) {\n record.isFork = Boolean(repo.fork);\n }\n if (repo.default_branch !== undefined) {\n record.defaultBranch = repo.default_branch ?? null;\n }\n\n return record;\n};\n\nexport const toRepoCreateRecord = (record: RepoRecord): RepoCreateRecord => ({\n ...record,\n isFork: record.isFork ?? null,\n defaultBranch: record.defaultBranch ?? null,\n});\n\nexport const hasRepoChanges = (existing: InstallationRepoRow, record: RepoRecord) => {\n const forkChanged = typeof record.isFork === \"boolean\" && existing.isFork !== record.isFork;\n const defaultBranchChanged =\n record.defaultBranch !== undefined && (existing.defaultBranch ?? null) !== record.defaultBranch;\n\n return (\n existing.ownerLogin !== record.ownerLogin ||\n existing.name !== record.name ||\n existing.fullName !== record.fullName ||\n existing.isPrivate !== record.isPrivate ||\n forkChanged ||\n defaultBranchChanged ||\n existing.installationId == null ||\n existing.removedAt !== null\n );\n};\n"],"mappings":";;;AA2BA,MAAa,gBACX,gBACA,MACA,QACe;CACf,MAAM,aAAa,KAAK,OAAO,SAAS;CACxC,MAAM,SAAqB;EACzB,IAAI,GAAG,KAAK;EACZ;EACA;EACA,MAAM,KAAK;EACX,UAAU,KAAK,aAAa,GAAG,WAAW,GAAG,KAAK;EAClD,WAAW,QAAQ,KAAK,QAAQ;EAChC,WAAW;EACX,WAAW;EACZ;AAED,KAAI,KAAK,SAAS,OAChB,QAAO,SAAS,QAAQ,KAAK,KAAK;AAEpC,KAAI,KAAK,mBAAmB,OAC1B,QAAO,gBAAgB,KAAK,kBAAkB;AAGhD,QAAO;;AAGT,MAAa,sBAAsB,YAA0C;CAC3E,GAAG;CACH,QAAQ,OAAO,UAAU;CACzB,eAAe,OAAO,iBAAiB;CACxC;AAED,MAAa,kBAAkB,UAA+B,WAAuB;CACnF,MAAM,cAAc,OAAO,OAAO,WAAW,aAAa,SAAS,WAAW,OAAO;CACrF,MAAM,uBACJ,OAAO,kBAAkB,WAAc,SAAS,iBAAiB,UAAU,OAAO;AAEpF,QACE,SAAS,eAAe,OAAO,cAC/B,SAAS,SAAS,OAAO,QACzB,SAAS,aAAa,OAAO,YAC7B,SAAS,cAAc,OAAO,aAC9B,eACA,wBACA,SAAS,kBAAkB,QAC3B,SAAS,cAAc"}
@@ -0,0 +1,24 @@
1
+ import { FragnoPublicClientConfig } from "@fragno-dev/core/client";
2
+ import { EmitterWebhookEvent, EmitterWebhookEventName } from "@octokit/webhooks";
3
+
4
+ //#region src/github/types.d.ts
5
+ type GitHubAppWebhookHandler<TEventName extends EmitterWebhookEventName> = (event: EmitterWebhookEvent<TEventName>, idempotencyKey: string) => void | Promise<void>;
6
+ type GitHubAppWebhookOn = <TEventName extends EmitterWebhookEventName>(event: TEventName | TEventName[], handler: GitHubAppWebhookHandler<TEventName>) => void;
7
+ type GitHubAppWebhookConfig = (register: GitHubAppWebhookOn) => void;
8
+ type GitHubAppFragmentConfig = {
9
+ appId: string;
10
+ appSlug: string;
11
+ privateKeyPem: string;
12
+ webhookSecret: string;
13
+ webhookDebug?: boolean;
14
+ apiBaseUrl?: string;
15
+ apiVersion?: string;
16
+ webBaseUrl?: string;
17
+ defaultLinkKey?: string;
18
+ tokenCacheTtlSeconds?: number;
19
+ webhook?: GitHubAppWebhookConfig;
20
+ };
21
+ type GitHubAppFragmentPublicClientConfig = FragnoPublicClientConfig;
22
+ //#endregion
23
+ export { GitHubAppFragmentConfig, GitHubAppFragmentPublicClientConfig, GitHubAppWebhookConfig, GitHubAppWebhookHandler, GitHubAppWebhookOn };
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/github/types.ts"],"mappings":";;;;KAIY,uBAAA,oBAA2C,uBAAA,KACrD,KAAA,EAAO,mBAAA,CAAoB,UAAA,GAC3B,cAAA,oBACU,OAAA;AAAA,KAEA,kBAAA,uBAAyC,uBAAA,EACnD,KAAA,EAAO,UAAA,GAAa,UAAA,IACpB,OAAA,EAAS,uBAAA,CAAwB,UAAA;AAAA,KAGvB,sBAAA,IAA0B,QAAA,EAAU,kBAAA;AAAA,KAEpC,uBAAA;EACV,KAAA;EACA,OAAA;EACA,aAAA;EACA,aAAA;EACA,YAAA;EACA,UAAA;EACA,UAAA;EACA,UAAA;EACA,cAAA;EACA,oBAAA;EACA,OAAA,GAAU,sBAAA;AAAA;AAAA,KAGA,mCAAA,GAAsC,wBAAA"}
@@ -0,0 +1,23 @@
1
+ import { FragnoId } from "@fragno-dev/db/schema";
2
+
3
+ //#region src/github/utils.ts
4
+ const isRecord = (value) => typeof value === "object" && value !== null;
5
+ const toExternalId = (value) => {
6
+ if (value === null || value === void 0) return "";
7
+ if (typeof value === "string") return value;
8
+ if (typeof value === "number") return `${value}`;
9
+ if (value instanceof FragnoId) return value.externalId;
10
+ throw new Error("Expected external id to be a string, number, or FragnoId.");
11
+ };
12
+ const toStringValue = (value) => toExternalId(value);
13
+ const normalizeJoinedLinks = (links) => {
14
+ return (Array.isArray(links) ? links : links ? [links] : []).filter((link) => typeof link.linkKey === "string" && link.linkKey.length > 0);
15
+ };
16
+ const normalizeJoinedInstallation = (installation) => {
17
+ if (!installation) return null;
18
+ return toExternalId(installation.id) ? installation : null;
19
+ };
20
+
21
+ //#endregion
22
+ export { isRecord, normalizeJoinedInstallation, normalizeJoinedLinks, toExternalId, toStringValue };
23
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/github/utils.ts"],"sourcesContent":["import { FragnoId } from \"@fragno-dev/db/schema\";\n\nexport const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nexport const toExternalId = (value: unknown) => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\") {\n return `${value}`;\n }\n if (value instanceof FragnoId) {\n return value.externalId;\n }\n throw new Error(\"Expected external id to be a string, number, or FragnoId.\");\n};\n\nexport const toStringValue = (value: unknown) => toExternalId(value);\n\nexport const normalizeJoinedLinks = <T extends { linkKey?: string | null }>(\n links: T | T[] | null | undefined,\n) => {\n const entries = Array.isArray(links) ? links : links ? [links] : [];\n return entries.filter((link) => typeof link.linkKey === \"string\" && link.linkKey.length > 0);\n};\n\nexport const normalizeJoinedInstallation = <T extends { id?: unknown }>(\n installation: T | null | undefined,\n) => {\n if (!installation) {\n return null;\n }\n return toExternalId(installation.id) ? installation : null;\n};\n"],"mappings":";;;AAEA,MAAa,YAAY,UACvB,OAAO,UAAU,YAAY,UAAU;AAEzC,MAAa,gBAAgB,UAAmB;AAC9C,KAAI,UAAU,QAAQ,UAAU,OAC9B,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO,GAAG;AAEZ,KAAI,iBAAiB,SACnB,QAAO,MAAM;AAEf,OAAM,IAAI,MAAM,4DAA4D;;AAG9E,MAAa,iBAAiB,UAAmB,aAAa,MAAM;AAEpE,MAAa,wBACX,UACG;AAEH,SADgB,MAAM,QAAQ,MAAM,GAAG,QAAQ,QAAQ,CAAC,MAAM,GAAG,EAAE,EACpD,QAAQ,SAAS,OAAO,KAAK,YAAY,YAAY,KAAK,QAAQ,SAAS,EAAE;;AAG9F,MAAa,+BACX,iBACG;AACH,KAAI,CAAC,aACH,QAAO;AAET,QAAO,aAAa,aAAa,GAAG,GAAG,eAAe"}
@@ -0,0 +1,15 @@
1
+ import "./types.js";
2
+ import "@fragno-dev/db";
3
+
4
+ //#region src/github/webhook-processing.d.ts
5
+ type WebhookProcessingPayload = {
6
+ deliveryId: string;
7
+ event: string;
8
+ action: string | null;
9
+ installationId: string;
10
+ payload: Record<string, unknown>;
11
+ receivedAt?: string | null;
12
+ };
13
+ //#endregion
14
+ export { WebhookProcessingPayload };
15
+ //# sourceMappingURL=webhook-processing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-processing.d.ts","names":[],"sources":["../../../src/github/webhook-processing.ts"],"mappings":";;;;KAuCY,wBAAA;EACV,UAAA;EACA,KAAA;EACA,MAAA;EACA,cAAA;EACA,OAAA,EAAS,MAAA;EACT,UAAA;AAAA"}