@sanoma-ai/connector-github 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-ALv2
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Sanoma-AI
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,95 @@
1
- # Temporary Holding Version
1
+ # @sanoma-ai/connector-github
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ GitHub resources for [`@sanoma-ai/workflows`](https://www.npmjs.com/package/@sanoma-ai/workflows): repositories, branch protection rules and team memberships, read through the [`integrations/github`](https://github.com/integrations/terraform-provider-github) OpenTofu provider (6.13.0) on [provider-bridge](https://github.com/Sanoma-AI/provider-bridge). It reads only: there is no create, update or delete yet.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ npm install @sanoma-ai/connector-github
9
+ ```
10
+
11
+ Each resource type has two operations, both effect `read` and idempotent, with the id as the policy's `target`; a repository is writable, so it has the change operations too, which only apply calls:
12
+
13
+ | Type | Operations | Identity | Binding id |
14
+ | ------------------- | --------------------------------------------------------------------------------- | ----------------------- | --------------------------- |
15
+ | `repository` | `github.repository.read`, `.import`, and `.plan`, `.create`, `.update`, `.delete` | `name` | `node_id` |
16
+ | `branch_protection` | `github.branch_protection.read`, `github.branch_protection.import` | `repository_id:pattern` | `id` (its node id, `BPR_…`) |
17
+ | `team_membership` | `github.team_membership.read`, `github.team_membership.import` | `team_id:username` | `id` (`team_id:username`) |
18
+
19
+ `import` takes `{ id }`, an identity or a binding id (what the [lockfile](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#bindings) keeps, which a rename does not change), and returns the object's `state`. The provider imports a repository by its name and a rule by `repository:pattern`, so the driver resolves a node id (`R_…`, `BPR_…`) to those first, with one GraphQL `node(id)` query, and refuses one in a repository of another owner than `GITHUB_OWNER` (default: the token's user); a node id GitHub does not know is gone. The fake finds an object by its binding id too, with no query; `read` takes a state an earlier call returned (`{ id, state, handle }`), or just `{ id }`, and returns its fresh `state`, or `gone: true` when it no longer exists. See [Resources](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#resources).
20
+
21
+ A repository's `create`, `update` and `delete` plan and apply through the provider (see [`@sanoma-ai/bridge`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/bridge/README.md#connectors-for-opentofu-providers)); a create's `id` is the new repository's node id. Their tests replay synthetic replies of an empty repository (`sanoma-apply-test*` in `@sanoma-ai/bridge`'s `testdata/replies`) until they are recorded in a test organization.
22
+
23
+ A data file declares resources with the constructors in `@sanoma-ai/connector-github/resources`:
24
+
25
+ ```ts
26
+ import { github } from "@sanoma-ai/connector-github/resources";
27
+
28
+ export const site = github.repository({ name: "website", delete_branch_on_merge: true, has_wiki: false });
29
+ export const siteMain = github.branch_protection({ repository_id: site, pattern: "main", enforce_admins: true });
30
+ ```
31
+
32
+ A branch protection rule names its repository by the declared repository itself (`repository_id: site`), which stands for its name: the rule is `website:main`. Only `repository_id` takes a resource, and only a repository; see [Data files](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#data-files).
33
+
34
+ The fields are the provider's attributes, by their names. A list block of at most one item (`pages`, `security_and_analysis`, `template`) is one object. Only declared fields are compared for drift; sets (`topics`, and five lists in a branch protection rule) are compared in any order.
35
+
36
+ The logo is GitHub's mark from [Octicons](https://primer.style/octicons/) (`mark-github`, MIT), there only to identify the service an operation calls.
37
+
38
+ ## Resource types
39
+
40
+ `src/resources.gen.ts` is generated from the provider's schema by `pnpm generate`, which runs [`@sanoma-ai/bridge/tfschema`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/bridge/src/tfschema/AGENTS.md) with `src/resources.config.ts`: the provider (its release, sha256 and recorded schema are `@sanoma-ai/bridge`'s pin and fixture), the types to generate, and the attributes whose change replaces the object (ForceNew in the provider's source, which the schema does not carry). It is checked in and never edited by hand; `pnpm generate` on a clean tree changes nothing. `src/connector.ts` is the rest, one `tfConnector` record from [`@sanoma-ai/bridge/connector`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/bridge/README.md#connectors-for-opentofu-providers): each type's title, identity, `find` and `bindingId`, the field that names another resource (`branch_protection.repository_id`), and GitHub's title, logo and package. The connector, the constructors, the driver and the fake all derive from it.
41
+
42
+ Attributes that are computed and not optional (`html_url`, `repo_id`) are vendor-owned: never drift, and a data file may not declare them. Those the provider marks computed and optional (`etag`, `topics`, `visibility`, `default_branch`) are yours to set, and compared only when declared.
43
+
44
+ ## Driver
45
+
46
+ `@sanoma-ai/connector-github/driver` reads through a provider bridge. The `github` connector the package root exports carries it, made once per resolved config, and its fake (`withSetup` from `@sanoma-ai/workflows`), so a config names the connector alone and workflows never import the driver (the lint refuses that):
47
+
48
+ ```ts
49
+ import { github } from "@sanoma-ai/connector-github";
50
+
51
+ export default defineConfig({ workflows, connectors: [github], policy });
52
+ ```
53
+
54
+ `./driver` (`githubDriver`; `githubDriver({ bridge })` reads through a bridge of your own) and `./fake` (`fakeGithub`) are internal entries, for tests.
55
+
56
+ Without `bridge`, it reads through the process's `defaultBridge()` from `@sanoma-ai/bridge`, started on the first call with the binary `startBridge` finds; `bridge` is any `ProviderClient` (a `Bridge` from `startBridge()`, or `stateBridge` in tests). It configures the provider on the first call with `{ owner, token }` from the environment, and again when either changes (closing it first: the bridge refuses a second config), when the provider has exited, or when the bridge has forgotten it (`ensureConfigured`). `read` without a state (or with one that has no `id`) imports, which reads the object too. States leave the driver in the resource's shape, with sensitive attributes set to `null`; the provider's private data and state version travel in the opaque `handle`.
57
+
58
+ ### Environment
59
+
60
+ Read on every call, never when the config loads:
61
+
62
+ | Variable | What it is |
63
+ | -------------- | ------------------------------------------------------------------------------------------------------------- |
64
+ | `GITHUB_TOKEN` | A GitHub token that can read the repositories, rules and teams named. |
65
+ | `GITHUB_OWNER` | Optional: the organization or user whose repositories the data files describe. Default: the token's own user. |
66
+
67
+ When the token is unset, a call fails, not retryable, naming it; the worker starts regardless, and the app's connector page shows and sets both. The bridge passes the token and the owner to the provider through its config only, never through the provider's environment. The default bridge's binary comes with `@sanoma-ai/bridge` or from `SANOMA_BRIDGE_BIN` (see [the bridge](https://www.npmjs.com/package/@sanoma-ai/bridge#the-binary)), not a credential of the connector.
68
+
69
+ ### Errors and retries
70
+
71
+ The bridge's errors become `DriverError`s whose `vendorCode` is the bridge's code and whose message carries the provider's diagnostics. `unavailable` (the provider process failed or exited) is retryable, and the next try configures the provider again; anything else is not. GitHub's provider reports an object that does not exist as a failed import (`failed_precondition`, "could not find a branch protection rule with the pattern 'main'"), not as `not_found`; the connector's `missing` says so, so `import` answers `{ gone: true }` for it, as for `not_found`.
72
+
73
+ ## Testing
74
+
75
+ `@sanoma-ai/connector-github/fake` is GitHub as it was when the replies in `@sanoma-ai/bridge`'s `testdata/replies` were recorded (the `Sanoma-AI/sanoma` and `Sanoma-AI/provider-bridge` repositories; `provider-bridge:main` has no branch protection), served through the real driver over a `stateBridge` of them (`tfFake`). It needs no token and reaches nothing.
76
+
77
+ ```ts
78
+ import { withSetup } from "@sanoma-ai/workflows";
79
+ import { github } from "@sanoma-ai/connector-github";
80
+ import { fakeGithub } from "@sanoma-ai/connector-github/fake";
81
+
82
+ const fake = fakeGithub();
83
+ const worker = await startWorker({
84
+ connectors: [withSetup(github, { driver: () => fake.driver, fake: () => fake })],
85
+ /* ... */
86
+ });
87
+
88
+ fake.put("repository", "website", { name: "website", has_wiki: false }, { from: "sanoma" }); // a copy of a recorded one
89
+ fake.override("repository", "sanoma", { delete_branch_on_merge: true }); // drift: the next read returns it
90
+ fake.remove("repository", "sanoma"); // the next read and import say it is gone
91
+ ```
92
+
93
+ `put` and `override` take fields in the resource's shape, as a read returns them (a block of one is an object). `remove` answers an import as the provider does: a branch protection rule with the provider's `failed_precondition` diagnostic, anything else `not_found`. It has the faults every fake has (`failNext`, `loseReply`, `rateLimit`, `hold`, `reset`, `update`); see [Fakes for tests](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#fakes-for-tests). Import it from `@sanoma-ai/connector-github/fake`.
94
+
95
+ License: FSL-1.1-ALv2.
@@ -0,0 +1,136 @@
1
+ /**
2
+ * GitHub, through the `integrations/github` OpenTofu provider: the generated resource types,
3
+ * what their schema does not say (how each is found), and who GitHub is. The connector, the
4
+ * data-file constructors, the driver and the fake all come from this one record.
5
+ */
6
+ export declare const githubTf: import("@sanoma-ai/bridge/connector").TfConnector<"github", {
7
+ repository: import("zod").ZodObject<{
8
+ allow_auto_merge: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
9
+ allow_forking: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
10
+ allow_merge_commit: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
11
+ allow_rebase_merge: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
12
+ allow_squash_merge: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
13
+ allow_update_branch: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
14
+ archive_on_destroy: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
15
+ archived: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
16
+ auto_init: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
17
+ default_branch: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
18
+ delete_branch_on_merge: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
19
+ description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
20
+ etag: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
21
+ fork: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
22
+ full_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
23
+ git_clone_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
24
+ gitignore_template: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
25
+ has_discussions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
26
+ has_downloads: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
27
+ has_issues: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
28
+ has_projects: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
29
+ has_wiki: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
30
+ homepage_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
31
+ html_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
32
+ http_clone_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
33
+ id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
34
+ ignore_vulnerability_alerts_during_read: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
35
+ is_template: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
36
+ license_template: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
37
+ merge_commit_message: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
38
+ merge_commit_title: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
39
+ name: import("zod").ZodString;
40
+ node_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
41
+ primary_language: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
42
+ private: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
43
+ repo_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
44
+ source_owner: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
45
+ source_repo: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
46
+ squash_merge_commit_message: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
47
+ squash_merge_commit_title: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
48
+ ssh_clone_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
49
+ svn_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
50
+ topics: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
51
+ visibility: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
52
+ vulnerability_alerts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
53
+ web_commit_signoff_required: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
54
+ pages: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
55
+ build_type: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
56
+ cname: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
57
+ custom_404: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
58
+ html_url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
59
+ status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
60
+ url: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
61
+ source: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
62
+ branch: import("zod").ZodString;
63
+ path: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
64
+ }, import("zod/v4/core").$strip>>>;
65
+ }, import("zod/v4/core").$strip>>>;
66
+ security_and_analysis: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
67
+ advanced_security: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
68
+ status: import("zod").ZodString;
69
+ }, import("zod/v4/core").$strip>>>;
70
+ code_security: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
71
+ status: import("zod").ZodString;
72
+ }, import("zod/v4/core").$strip>>>;
73
+ secret_scanning: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
74
+ status: import("zod").ZodString;
75
+ }, import("zod/v4/core").$strip>>>;
76
+ secret_scanning_ai_detection: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
77
+ status: import("zod").ZodString;
78
+ }, import("zod/v4/core").$strip>>>;
79
+ secret_scanning_non_provider_patterns: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
80
+ status: import("zod").ZodString;
81
+ }, import("zod/v4/core").$strip>>>;
82
+ secret_scanning_push_protection: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
83
+ status: import("zod").ZodString;
84
+ }, import("zod/v4/core").$strip>>>;
85
+ }, import("zod/v4/core").$strip>>>;
86
+ template: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
87
+ include_all_branches: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
88
+ owner: import("zod").ZodString;
89
+ repository: import("zod").ZodString;
90
+ }, import("zod/v4/core").$strip>>>;
91
+ }, import("zod/v4/core").$strip>;
92
+ branch_protection: import("zod").ZodObject<{
93
+ allows_deletions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
94
+ allows_force_pushes: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
95
+ enforce_admins: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
96
+ force_push_bypassers: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
97
+ id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
98
+ lock_branch: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
99
+ pattern: import("zod").ZodString;
100
+ repository_id: import("zod").ZodString;
101
+ require_conversation_resolution: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
102
+ require_signed_commits: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
103
+ required_linear_history: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
104
+ required_pull_request_reviews: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
105
+ dismiss_stale_reviews: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
106
+ dismissal_restrictions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
107
+ pull_request_bypassers: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
108
+ require_code_owner_reviews: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
109
+ require_last_push_approval: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
110
+ required_approving_review_count: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
111
+ restrict_dismissals: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
112
+ }, import("zod/v4/core").$strip>>>>;
113
+ required_status_checks: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
114
+ contexts: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
115
+ strict: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
116
+ }, import("zod/v4/core").$strip>>>>;
117
+ restrict_pushes: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
118
+ blocks_creations: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
119
+ push_allowances: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodString>>>;
120
+ }, import("zod/v4/core").$strip>>>>;
121
+ }, import("zod/v4/core").$strip>;
122
+ team_membership: import("zod").ZodObject<{
123
+ etag: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
124
+ id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
125
+ role: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
126
+ team_id: import("zod").ZodString;
127
+ username: import("zod").ZodString;
128
+ }, import("zod/v4/core").$strip>;
129
+ }, {
130
+ readonly branch_protection: {
131
+ readonly repository_id: {
132
+ readonly type: "github.repository";
133
+ readonly by: readonly ["name", "node_id"];
134
+ };
135
+ };
136
+ }>;
@@ -0,0 +1,54 @@
1
+ import { tfConnector } from "@sanoma-ai/bridge/connector";
2
+ import { github_branch_protection, github_repository, github_team_membership, provider } from "./resources.gen.js";
3
+ /**
4
+ * GitHub's mark (the Invertocat), from GitHub's Octicons (`mark-github`, MIT), in GitHub's
5
+ * near-black, and white on dark backgrounds.
6
+ */
7
+ const mark = (fill) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="${fill}" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"/></svg>`;
8
+ /**
9
+ * GitHub, through the `integrations/github` OpenTofu provider: the generated resource types,
10
+ * what their schema does not say (how each is found), and who GitHub is. The connector, the
11
+ * data-file constructors, the driver and the fake all come from this one record.
12
+ */
13
+ export const githubTf = tfConnector({
14
+ vendor: "github",
15
+ provider,
16
+ types: {
17
+ // Bound by its node id, which a rename keeps, as a rule is by its own (its `id`); the driver
18
+ // resolves either to what the provider imports by.
19
+ repository: {
20
+ tf: github_repository,
21
+ title: "Repository",
22
+ identity: "name",
23
+ find: ({ name }) => name,
24
+ bindingId: ({ node_id }) => String(node_id),
25
+ // Apply creates, changes and deletes repositories.
26
+ writable: true,
27
+ },
28
+ branch_protection: {
29
+ tf: github_branch_protection,
30
+ title: "Branch protection rule",
31
+ identity: "repository_id:pattern",
32
+ find: ({ repository_id, pattern }) => `${repository_id}:${pattern}`,
33
+ },
34
+ team_membership: {
35
+ tf: github_team_membership,
36
+ title: "Team membership",
37
+ identity: "team_id:username",
38
+ find: ({ team_id, username }) => `${team_id}:${username}`,
39
+ },
40
+ },
41
+ // GitHub holds a rule's repository by its node id (`R_…`); a data file names it by its name.
42
+ references: { branch_protection: { repository_id: { type: "github.repository", by: ["name", "node_id"] } } },
43
+ // The provider answers an import of a rule that is not there `failed_precondition`, saying it
44
+ // "could not find" it (recorded: testdata/replies/…/github_branch_protection/provider-bridge_main).
45
+ missing: (e) => e.code === "not_found" ||
46
+ (e.code === "failed_precondition" && e.diagnostics.some((d) => d.summary.startsWith("could not find "))),
47
+ info: {
48
+ title: "GitHub",
49
+ logo: { svg: mark("#1F2328"), dark: mark("#FFFFFF") },
50
+ package: "@sanoma-ai/connector-github",
51
+ homepage: "https://github.com/Sanoma-AI/sanoma/tree/main/connectors/github#readme",
52
+ },
53
+ });
54
+ //# sourceMappingURL=connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnH;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAC5B,2EAA2E,IAAI,2kBAA2kB,CAAC;AAE7pB;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC;IAClC,MAAM,EAAE,QAAQ;IAChB,QAAQ;IACR,KAAK,EA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AE,QAAQ;QACf,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;QACrD,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,wEAAwE;KACnF;CACF,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type ProviderClient } from "@sanoma-ai/bridge";
2
+ import { z } from "zod";
3
+ export interface GithubDriverOptions {
4
+ /**
5
+ * The provider bridge to read through. Default: the process's `defaultBridge()`, started on the
6
+ * first call (`startBridge`'s binary). One per tenant: it holds the token once configured.
7
+ */
8
+ bridge?: ProviderClient;
9
+ }
10
+ /**
11
+ * Reads GitHub resources through the `integrations/github` OpenTofu provider on `bridge` (the
12
+ * default bridge when none is given), with the token in `GITHUB_TOKEN` and the owner in
13
+ * `GITHUB_OWNER`, read on every call. The provider is configured on the first call, and again
14
+ * when the token or the owner changes or the provider has exited. A repository's or a rule's
15
+ * import takes its node id (its binding id) too, resolved first (`importIdOf`).
16
+ */
17
+ export declare function githubDriver({ bridge }?: GithubDriverOptions): Readonly<{
18
+ vendor: string;
19
+ ops: Readonly<Record<string, import("@sanoma-ai/workflows").DriverFn>>;
20
+ env: z.ZodObject<{
21
+ GITHUB_TOKEN: z.ZodString;
22
+ GITHUB_OWNER: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ }>;
package/dist/driver.js ADDED
@@ -0,0 +1,105 @@
1
+ import { defaultBridge } from "@sanoma-ai/bridge";
2
+ import { DriverError, retryableStatus } from "@sanoma-ai/workflows";
3
+ import { z } from "zod";
4
+ import { githubTf } from "./connector.js";
5
+ /** The environment variables the driver reads, on every call. */
6
+ const env = z.object({
7
+ GITHUB_TOKEN: z
8
+ .string()
9
+ .min(1)
10
+ .describe("a fine-grained token with read-only repository permissions, limited to the repositories the data files declare"),
11
+ GITHUB_OWNER: z
12
+ .string()
13
+ .min(1)
14
+ .optional()
15
+ .describe("the organization or user whose repositories the data files describe; default: the token's own user"),
16
+ });
17
+ /**
18
+ * The node ids a binding keeps that the provider cannot import by, by type: a repository's (`R_kgD…`, not `R_` alone, which begins names too,
19
+ * or the legacy base64 of `010:Repository…`) and a branch protection rule's (`BPR_…`).
20
+ */
21
+ const NODE_IDS = {
22
+ repository: /^(R_kgD[\w-]+|MDEwOlJlcG9zaXRvcnk[\w+/=]+)$/,
23
+ branch_protection: /^BPR_[\w-]+$/,
24
+ };
25
+ const NODE_QUERY = `query($id: ID!) {
26
+ node(id: $id) {
27
+ ... on Repository { name owner { login } }
28
+ ... on BranchProtectionRule { pattern repository { name owner { login } } }
29
+ }
30
+ viewer { login }
31
+ }`;
32
+ const Repo = z.object({ name: z.string(), owner: z.object({ login: z.string() }) });
33
+ const NodeReply = z.object({
34
+ data: z
35
+ .object({
36
+ node: Repo.partial().extend({ pattern: z.string().optional(), repository: Repo.optional() }).nullable(),
37
+ viewer: z.object({ login: z.string() }),
38
+ })
39
+ .nullish(),
40
+ errors: z.array(z.object({ type: z.string().optional(), message: z.string() })).optional(),
41
+ message: z.string().optional(),
42
+ });
43
+ /**
44
+ * The provider's import id for a node id, from one GraphQL `node(id)` query: a repository's
45
+ * name, a rule's `repository:pattern`. Refused when the repository is not the provider's owner's
46
+ * (`GITHUB_OWNER`, else the token's user). The id itself when GitHub has no such node, so the
47
+ * import says it is gone.
48
+ */
49
+ async function importIdOf(id, { token, owner }) {
50
+ let status;
51
+ let json;
52
+ try {
53
+ const res = await fetch("https://api.github.com/graphql", {
54
+ method: "POST",
55
+ headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
56
+ body: JSON.stringify({ query: NODE_QUERY, variables: { id } }),
57
+ signal: AbortSignal.timeout(30_000),
58
+ });
59
+ status = res.status;
60
+ json = await res.json().catch(() => undefined);
61
+ }
62
+ catch (cause) {
63
+ throw new DriverError(`github: resolving the node ${id}: the request failed`, { retryable: true, cause });
64
+ }
65
+ const reply = NodeReply.safeParse(json).data;
66
+ // GraphQL answers an id it has no node for with a null node and a NOT_FOUND error.
67
+ const failed = reply?.errors?.find((e) => e.type !== "NOT_FOUND");
68
+ if (status !== 200 || !reply?.data || failed) {
69
+ throw new DriverError(`github: resolving the node ${id}: ${failed?.message ?? reply?.message ?? `HTTP ${status}`}`, {
70
+ retryable: retryableStatus(status) || failed?.type === "RATE_LIMITED",
71
+ status,
72
+ ...(failed?.type && { vendorCode: failed.type }),
73
+ });
74
+ }
75
+ const { node, viewer } = reply.data;
76
+ const repo = node?.repository ?? (node?.name && node.owner ? { name: node.name, owner: node.owner } : undefined);
77
+ if (!repo)
78
+ return id;
79
+ const expected = owner ?? viewer.login;
80
+ if (repo.owner.login.toLowerCase() !== expected.toLowerCase()) {
81
+ throw new DriverError(`github: ${id} is in ${repo.owner.login}/${repo.name}, not a repository of ${expected}`, {
82
+ retryable: false,
83
+ });
84
+ }
85
+ return node?.pattern === undefined ? repo.name : `${repo.name}:${node.pattern}`;
86
+ }
87
+ /** The provider's config, from the environment, read on every call. */
88
+ function config() {
89
+ const token = process.env.GITHUB_TOKEN;
90
+ if (!token)
91
+ throw new DriverError("github: GITHUB_TOKEN is not set", { retryable: false });
92
+ return { owner: process.env.GITHUB_OWNER || null, token };
93
+ }
94
+ /**
95
+ * Reads GitHub resources through the `integrations/github` OpenTofu provider on `bridge` (the
96
+ * default bridge when none is given), with the token in `GITHUB_TOKEN` and the owner in
97
+ * `GITHUB_OWNER`, read on every call. The provider is configured on the first call, and again
98
+ * when the token or the owner changes or the provider has exited. A repository's or a rule's
99
+ * import takes its node id (its binding id) too, resolved first (`importIdOf`).
100
+ */
101
+ export function githubDriver({ bridge = defaultBridge() } = {}) {
102
+ const driver = githubTf.driver(bridge, config, (type, id) => NODE_IDS[type]?.test(id) ? importIdOf(id, config()) : id);
103
+ return Object.freeze({ ...driver, env });
104
+ }
105
+ //# sourceMappingURL=driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":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