@laikacms/github 0.1.2 → 2.0.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/CHANGELOG.md +129 -0
- package/README.md +162 -18
- package/dist/storage-gh/github-datasource.d.ts +12 -4
- package/dist/storage-gh/github-datasource.d.ts.map +1 -1
- package/dist/storage-gh/github-datasource.js +22 -4
- package/dist/storage-gh/github-datasource.js.map +1 -1
- package/dist/storage-gh/github-storage-repository.d.ts +21 -19
- package/dist/storage-gh/github-storage-repository.d.ts.map +1 -1
- package/dist/storage-gh/github-storage-repository.js +219 -188
- package/dist/storage-gh/github-storage-repository.js.map +1 -1
- package/dist/storage-gh/index.d.ts +3 -2
- package/dist/storage-gh/index.d.ts.map +1 -1
- package/dist/storage-gh/index.js +2 -1
- package/dist/storage-gh/index.js.map +1 -1
- package/dist/storage-gh/testing/index.d.ts +3 -0
- package/dist/storage-gh/testing/index.d.ts.map +1 -0
- package/dist/storage-gh/testing/index.js +142 -0
- package/dist/storage-gh/testing/index.js.map +1 -0
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,134 @@
|
|
|
1
1
|
# @laikacms/github
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 6b918c6: Rename `AuthorizationError` to `UpstreamUnAuthorizedError`, and stop using it for
|
|
8
|
+
authorization denials.
|
|
9
|
+
|
|
10
|
+
The old name promised the wrong thing. `AuthorizationError` reads as "authorization failed", but
|
|
11
|
+
the class is HTTP 401 and its actual job is narrow: it is the deserialization target for a 401
|
|
12
|
+
challenge this server received from an _upstream_ — nothing to do with "authenticated but not
|
|
13
|
+
permitted". That mismatch was actively misleading people (laikacms#851 proposed routing
|
|
14
|
+
authorization denials through it, which would have answered 401 to callers who are in fact
|
|
15
|
+
authenticated).
|
|
16
|
+
|
|
17
|
+
The auth vocabulary is now unambiguous:
|
|
18
|
+
|
|
19
|
+
| Case | Error | Status |
|
|
20
|
+
| ----------------------------------------------- | --------------------------- | ------ |
|
|
21
|
+
| Caller has not proven who they are | `AuthenticationError` | 401 |
|
|
22
|
+
| Caller is authenticated but not permitted | `ForbiddenError` | 403 |
|
|
23
|
+
| An upstream rejected _this server's_ credential | `UpstreamUnAuthorizedError` | 401 |
|
|
24
|
+
|
|
25
|
+
The wire code is unchanged (`unauthorized`), so JSON:API error payloads and the proxy's
|
|
26
|
+
`rehydrateErrorCodes` round-trip are unaffected. The exported `errorCode`/`errorStatus` key moved
|
|
27
|
+
from `AUTHORIZATION_ERROR` to `UPSTREAM_UNAUTHORIZED`.
|
|
28
|
+
|
|
29
|
+
Two mapping bugs surfaced by the rename are fixed as part of it:
|
|
30
|
+
|
|
31
|
+
- **GitHub 403 returned 401.** `GithubDataSource.mapError` mapped a GitHub `403` to the 401 class,
|
|
32
|
+
so a permission denial told callers to re-authenticate when their token was valid but
|
|
33
|
+
under-scoped. It now returns `ForbiddenError` (403), matching the GitLab and Bitbucket
|
|
34
|
+
datasources.
|
|
35
|
+
- **Upstream 401s claimed the caller was unauthenticated.** All three git-host datasources mapped
|
|
36
|
+
an upstream `401` to `AuthenticationError`, which means "_this_ server rejected your
|
|
37
|
+
credential". A git host rejecting the server's own token is a different failure, and now returns
|
|
38
|
+
`UpstreamUnAuthorizedError`. Status is unchanged (both are 401); only the error code and message
|
|
39
|
+
change.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 14df4cf: Fix `npx laikacli` crashing with `ERR_MODULE_NOT_FOUND` on
|
|
44
|
+
`effect/unstable/http/Multipasta/Node`.
|
|
45
|
+
|
|
46
|
+
The catalog pinned `effect` and `@effect/platform-node` to `4.0.0-beta.66` while
|
|
47
|
+
`@effect/platform-node-shared` sat at `4.0.0-beta.104`. Under npm's hoisting,
|
|
48
|
+
`@effect/platform-node@beta.66`'s own `^4.0.0-beta.66` range on `platform-node-shared` resolved to
|
|
49
|
+
a newer beta whose `effect` peer pulled a newer `effect` to the tree root — so
|
|
50
|
+
`platform-node@beta.66` resolved a module path that no longer exists. pnpm's isolated
|
|
51
|
+
`node_modules` masked this locally, so only npm/npx consumers hit it.
|
|
52
|
+
|
|
53
|
+
The whole effect stack is now aligned on `4.0.0-beta.104`. What matters is that all three packages
|
|
54
|
+
are pinned to the _same_ version: npm then dedupes `platform-node`'s transitive caret onto the
|
|
55
|
+
root pin, so the tree stays consistent even after newer betas ship.
|
|
56
|
+
|
|
57
|
+
Also fixes two problems surfaced by the bump:
|
|
58
|
+
|
|
59
|
+
- `@laikacms/server` imported `effect/DateTime` and `effect/Result` without declaring `effect` as
|
|
60
|
+
a dependency, resolving through a stale phantom symlink. It is now a declared dependency, which
|
|
61
|
+
also makes the published package installable on npm.
|
|
62
|
+
- `effect/Schema`'s `decodeUnknownSync` now throws a real `SchemaError` rather than a plain
|
|
63
|
+
`Error` carrying an `Issue` as its `cause`, so the documents-api error mapper detects it with
|
|
64
|
+
`Schema.isSchemaError`. Without this, internal decode failures regressed from `400 invalid_data`
|
|
65
|
+
to `500 internal_error`.
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [e8ab49b]
|
|
68
|
+
- Updated dependencies [14df4cf]
|
|
69
|
+
- Updated dependencies [387a1b4]
|
|
70
|
+
- Updated dependencies [06b4a5a]
|
|
71
|
+
- Updated dependencies [e8ab49b]
|
|
72
|
+
- Updated dependencies [14df4cf]
|
|
73
|
+
- Updated dependencies [e8ab49b]
|
|
74
|
+
- Updated dependencies [6b918c6]
|
|
75
|
+
- laikacms@6.0.0
|
|
76
|
+
|
|
77
|
+
## 1.0.4
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [2f17498]
|
|
82
|
+
- Updated dependencies [2f17498]
|
|
83
|
+
- Updated dependencies [2f17498]
|
|
84
|
+
- laikacms@5.0.0
|
|
85
|
+
|
|
86
|
+
## 1.0.3
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies
|
|
91
|
+
- Updated dependencies
|
|
92
|
+
- laikacms@3.1.0
|
|
93
|
+
|
|
94
|
+
## 1.0.2
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- laikacms@3.0.1
|
|
99
|
+
|
|
100
|
+
## 1.0.1
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- 7cc69ce: Advertise `changes: unsupportedChanges` in `getCapabilities()` to satisfy the
|
|
105
|
+
now-required `changes` capability on the storage `Capabilities` interface. These git-backed
|
|
106
|
+
repositories do not expose a push change channel, so they report the no-op channel;
|
|
107
|
+
`subscribeChanges` remains unsupported.
|
|
108
|
+
- Updated dependencies [68c658f]
|
|
109
|
+
- Updated dependencies [d26bdfe]
|
|
110
|
+
- laikacms@3.0.0
|
|
111
|
+
|
|
112
|
+
## 1.0.1
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- Updated dependencies [e488528]
|
|
117
|
+
- laikacms@1.0.1
|
|
118
|
+
|
|
119
|
+
## 1.0.0
|
|
120
|
+
|
|
121
|
+
### Major Changes
|
|
122
|
+
|
|
123
|
+
- Integrated with effect channels and changed the interfaces
|
|
124
|
+
|
|
125
|
+
This is a breaking change because it includes changes to the interfaces of the repositories.
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- Updated dependencies
|
|
130
|
+
- laikacms@1.0.0
|
|
131
|
+
|
|
3
132
|
## 0.1.2
|
|
4
133
|
|
|
5
134
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,41 +1,185 @@
|
|
|
1
1
|
# @laikacms/github
|
|
2
2
|
|
|
3
|
-
GitHub-backed `StorageRepository` for Laika CMS. Stores content as commits in a GitHub
|
|
4
|
-
|
|
3
|
+
GitHub-backed `StorageRepository` for Laika CMS. Stores content as commits in a GitHub repository;
|
|
4
|
+
pairs with the FS adapter for local dev so the same flow works against a real git repo with no FS
|
|
5
|
+
required.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
work against a real git repo, no FS required. Pair it with the FS adapter
|
|
8
|
-
(`laikacms/storage-fs`) for local dev to keep behavior identical across environments.
|
|
7
|
+
## Auth modes
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
The package ships with **two** authentication shapes. They are mutually exclusive — supply either
|
|
10
|
+
App credentials **or** a pre-built `Octokit` instance, not both.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
and minted on demand from the App's private key — no long-lived secrets in the running Worker.
|
|
14
|
-
- The user's GitHub identity (logged in via PKCE) is **independent** of the writer identity.
|
|
15
|
-
Editors don't need write access to the content repo; the App does.
|
|
16
|
-
- Audit trail: every commit is attributed to `<App name>[bot]` with the editor's user info in
|
|
17
|
-
the commit message.
|
|
12
|
+
### GitHub App (installation token)
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
Use when the user editing content is **not** a GitHub user (for example: they signed in to Laika
|
|
15
|
+
Cloud with Google, but the content lives in a GitHub repo). The App's installation token lets the
|
|
16
|
+
platform write to GitHub on the user's behalf; the user has no GitHub identity to act under.
|
|
17
|
+
|
|
18
|
+
Practical signs that you need App mode:
|
|
19
|
+
|
|
20
|
+
- Laika Cloud–style multi-tenant operator where editors don't have to have GitHub accounts.
|
|
21
|
+
- A self-hosted gateway that runs its **own** user database (managed via `@laikacms/server/oauth2` +
|
|
22
|
+
`@laikacms/server/api` + `@laikacms/integrations/github`) on top of GitHub storage.
|
|
23
|
+
|
|
24
|
+
### Pre-configured Octokit (bring-your-own client)
|
|
25
|
+
|
|
26
|
+
Pass a pre-built `Octokit` instance instead of App credentials. The package uses it as-is for all
|
|
27
|
+
API calls — no token minting, no TTL management. This is the right choice when:
|
|
28
|
+
|
|
29
|
+
- **Testing** — inject a mocked/intercepted Octokit to avoid real GitHub API calls.
|
|
30
|
+
- **GitHub Enterprise** — construct `new Octokit({ baseUrl: 'https://github.my-corp.com/api/v3' })`
|
|
31
|
+
and pass it in; no App registration required.
|
|
32
|
+
- **Custom plugins / retry strategies** — build an Octokit with `@octokit/plugin-retry` or similar
|
|
33
|
+
and hand it to the storage repository.
|
|
34
|
+
- **Any existing Octokit you already have** — if your app already manages a configured Octokit (PAT,
|
|
35
|
+
OAuth token, custom auth), just pass it rather than setting up a GitHub App.
|
|
36
|
+
|
|
37
|
+
## Usage — App mode
|
|
20
38
|
|
|
21
39
|
```ts
|
|
22
40
|
import { GithubStorageRepository } from '@laikacms/github/storage-gh';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
41
|
+
import { markdownSerializer } from 'laikacms/storage-serializers-markdown';
|
|
42
|
+
import { yamlSerializer } from 'laikacms/storage-serializers-yaml';
|
|
25
43
|
|
|
26
44
|
const storage = new GithubStorageRepository({
|
|
45
|
+
// App-mode auth: supply all three to mint an installation token from the private key.
|
|
27
46
|
appId: env.GITHUB_APP_ID,
|
|
28
47
|
privateKey: env.GITHUB_APP_PRIVATE_KEY,
|
|
29
48
|
installationId: env.GITHUB_APP_INSTALLATION_ID,
|
|
49
|
+
|
|
50
|
+
owner: 'esstudio',
|
|
51
|
+
repo: 'content',
|
|
52
|
+
branch: 'main',
|
|
53
|
+
serializerRegistry: {
|
|
54
|
+
yaml: yamlSerializer,
|
|
55
|
+
md: markdownSerializer,
|
|
56
|
+
},
|
|
57
|
+
defaultFileExtension: 'md',
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then pass `storage` to `laikaApi({ storage, ... })`.
|
|
62
|
+
|
|
63
|
+
## Usage — Octokit mode
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { GithubStorageRepository } from '@laikacms/github/storage-gh';
|
|
67
|
+
import { Octokit } from '@octokit/rest';
|
|
68
|
+
|
|
69
|
+
// Any fully-configured Octokit instance works — PAT, OAuth, GHE, custom plugins.
|
|
70
|
+
const octokit = new Octokit({ auth: env.GITHUB_TOKEN });
|
|
71
|
+
|
|
72
|
+
// GitHub Enterprise example:
|
|
73
|
+
// const octokit = new Octokit({ baseUrl: 'https://github.my-corp.com/api/v3', auth: env.GHE_TOKEN });
|
|
74
|
+
|
|
75
|
+
const storage = new GithubStorageRepository({
|
|
76
|
+
octokit, // mutually exclusive with appId / privateKey / installationId
|
|
77
|
+
|
|
30
78
|
owner: 'esstudio',
|
|
31
79
|
repo: 'content',
|
|
32
80
|
branch: 'main',
|
|
33
81
|
serializerRegistry: {
|
|
34
|
-
yaml:
|
|
35
|
-
md:
|
|
82
|
+
yaml: yamlSerializer,
|
|
83
|
+
md: markdownSerializer,
|
|
36
84
|
},
|
|
37
85
|
defaultFileExtension: 'md',
|
|
38
86
|
});
|
|
39
87
|
```
|
|
40
88
|
|
|
41
|
-
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Behaviour notes
|
|
92
|
+
|
|
93
|
+
- **Extension hiding.** Keys are extension-free at the boundary, exactly like `@laikacms/gitlab` and
|
|
94
|
+
`laikacms/storage-fs`. The on-disk file extension is chosen from the registered serializers and
|
|
95
|
+
looked up on read.
|
|
96
|
+
- **Empty directories.** Git tracks files, not directories. `createFolder` writes a `.keep` file
|
|
97
|
+
(filtered out of listings via the `ignoreList`).
|
|
98
|
+
- **Listings on missing folders.** GitHub's API cannot distinguish an empty directory from a missing
|
|
99
|
+
one — both return HTTP 404. The GitHub backend maps 404 → `Result.succeed([])`, so listing a
|
|
100
|
+
missing folder returns `total: 0` with zero summaries and **no** `recoverableError`. `getFolder`
|
|
101
|
+
on a missing folder similarly succeeds, returning a synthetic `Folder` with `createdAt/updatedAt`
|
|
102
|
+
set to `new Date(0)`. This differs from `@laikacms/gitlab` and `@laikacms/bitbucket`, which
|
|
103
|
+
surface missing-folder 404s as `recoverableError` (`NotFoundError`).
|
|
104
|
+
- **Upsert.** `createOrUpdateObject` maps to GitHub's `createOrUpdateFileContents` endpoint. Pass
|
|
105
|
+
`update.metadata.revisionId` (the file's blob `sha`) for optimistic-concurrency updates.
|
|
106
|
+
- **Rate limits.** Deep listings (Trees API) and write operations count against your installation's
|
|
107
|
+
primary and secondary rate limits. On 429 or a 403 with `x-ratelimit-remaining: 0`, the backend
|
|
108
|
+
raises `TooManyRequestsError`.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Constructor options
|
|
113
|
+
|
|
114
|
+
All options are passed as a single object to `new GithubStorageRepository(options)`.
|
|
115
|
+
|
|
116
|
+
Auth options are a **discriminated union** — supply either `octokit` **or** the three App fields
|
|
117
|
+
(`appId`, `privateKey`, `installationId`), never both.
|
|
118
|
+
|
|
119
|
+
### Required (always)
|
|
120
|
+
|
|
121
|
+
| Option | Type | Description |
|
|
122
|
+
| ---------------------- | --------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
123
|
+
| `owner` | `string` | Repository owner (user or organisation). |
|
|
124
|
+
| `repo` | `string` | Repository name. |
|
|
125
|
+
| `branch` | `string` | Branch to read from and write to. |
|
|
126
|
+
| `serializerRegistry` | `StorageSerializerRegistry` | Map of file extension → serializer. Drives which extensions the integration can read and write. |
|
|
127
|
+
| `defaultFileExtension` | `string` | Extension used when no other serializer can be determined. |
|
|
128
|
+
|
|
129
|
+
### Auth — App mode (mutually exclusive with `octokit`)
|
|
130
|
+
|
|
131
|
+
| Option | Type | Description |
|
|
132
|
+
| ---------------- | ------------------ | -------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| `appId` | `string \| number` | GitHub App ID. |
|
|
134
|
+
| `privateKey` | `string` | PEM private key for the App. Literal `\n` sequences and surrounding quotes are normalised automatically. |
|
|
135
|
+
| `installationId` | `string \| number` | Installation ID for the App on the target repo. |
|
|
136
|
+
|
|
137
|
+
### Auth — Octokit mode (mutually exclusive with App fields)
|
|
138
|
+
|
|
139
|
+
| Option | Type | Description |
|
|
140
|
+
| --------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
+
| `octokit` | `Octokit` | Pre-configured `@octokit/rest` instance. The package uses it as-is for all API calls — no token minting or TTL management. Mutually exclusive with App credentials. |
|
|
142
|
+
|
|
143
|
+
### Optional
|
|
144
|
+
|
|
145
|
+
| Option | Type | Default | Description |
|
|
146
|
+
| -------------------- | --------------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
+
| `ignoreList` | `string[]` | See below | Glob patterns for files that are excluded from directory listings. Overrides the built-in list entirely when supplied. |
|
|
148
|
+
| `commitAuthor` | `{ name: string, email: string }` | _(none)_ | Name and email stamped as **both** the `author` and `committer` fields on every GitHub API write call (`createOrUpdateFileContents` and `deleteFile`). Both fields are set explicitly; neither is left for GitHub to default. Omit to let GitHub fall back to the App installation's identity. |
|
|
149
|
+
| `determineExtension` | `DetermineExtension` | `defaultDetermineExtension` | Custom resolver that picks the file extension for a new object given its key and metadata. Replaces the built-in logic when provided. |
|
|
150
|
+
| `tokenTtlSeconds` | `number` | `3000` (50 min) | App mode only. How many seconds before the cached installation token is considered stale and a fresh one is minted. GitHub installation tokens last ~1 hour; the default refreshes well before expiry. |
|
|
151
|
+
| `userAgent` | `string` | `'@laikacms/github'` | `User-Agent` header sent on every Octokit request. |
|
|
152
|
+
|
|
153
|
+
#### Default `ignoreList`
|
|
154
|
+
|
|
155
|
+
When `ignoreList` is not supplied the following patterns are excluded:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
**/.keep
|
|
159
|
+
**/.DS_Store
|
|
160
|
+
**/Thumbs.db
|
|
161
|
+
**/desktop.ini
|
|
162
|
+
**/.catalog
|
|
163
|
+
**/.laikacms
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## TODO — OAuth user-token auth
|
|
169
|
+
|
|
170
|
+
**Current state.** The package supports two auth modes: GitHub App (installation token) and
|
|
171
|
+
pre-configured Octokit (bring-your-own). The octokit mode unblocks testing, GitHub Enterprise, and
|
|
172
|
+
custom auth plugins. A first-class OAuth user-token flow (where the user's GitHub identity appears
|
|
173
|
+
on commits) is not yet implemented — it belongs in `@laikacms/server/oauth2` for self-hosted
|
|
174
|
+
gateways.
|
|
175
|
+
|
|
176
|
+
**Target shape.** When implemented, the constructor will accept an **async auth provider** — a
|
|
177
|
+
callback invoked on demand to produce credentials. The octokit mode is the interim escape hatch:
|
|
178
|
+
pass `new Octokit({ auth: yourToken })` to get non-App auth today.
|
|
179
|
+
|
|
180
|
+
**Out of scope until the OAuth flow ships:**
|
|
181
|
+
|
|
182
|
+
- Building the GitHub OAuth flow itself. That belongs in `@laikacms/server/oauth2` (and is
|
|
183
|
+
documented there for self-hosted gateways managing their own users).
|
|
184
|
+
- Token storage. Where the token lives between requests (cookie, KV, session, CLI keychain) is a
|
|
185
|
+
consumer concern.
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { Octokit } from '@octokit/rest';
|
|
2
2
|
import { ConflictError } from 'laikacms/core';
|
|
3
3
|
import type { LaikaResult } from 'laikacms/core';
|
|
4
|
-
|
|
4
|
+
type GithubAppAuthOptions = {
|
|
5
5
|
appId: string | number;
|
|
6
6
|
privateKey: string;
|
|
7
7
|
installationId: string | number;
|
|
8
|
+
octokit?: undefined;
|
|
9
|
+
};
|
|
10
|
+
type GithubOctokitAuthOptions = {
|
|
11
|
+
/** Pre-configured Octokit instance. When provided, App credentials are not required. */
|
|
12
|
+
octokit: Octokit;
|
|
13
|
+
appId?: undefined;
|
|
14
|
+
privateKey?: undefined;
|
|
15
|
+
installationId?: undefined;
|
|
16
|
+
};
|
|
17
|
+
export type GithubDataSourceOptions = {
|
|
8
18
|
owner: string;
|
|
9
19
|
repo: string;
|
|
10
20
|
branch: string;
|
|
11
|
-
/** Optional Octokit override — useful for tests. */
|
|
12
|
-
octokit?: Octokit;
|
|
13
21
|
/** Token cache TTL in seconds. Installation tokens last ~1h; default refresh well before. */
|
|
14
22
|
tokenTtlSeconds?: number;
|
|
15
23
|
/** User-Agent string sent on all requests. */
|
|
16
24
|
userAgent?: string;
|
|
17
|
-
}
|
|
25
|
+
} & (GithubAppAuthOptions | GithubOctokitAuthOptions);
|
|
18
26
|
interface GithubDirEntry {
|
|
19
27
|
name: string;
|
|
20
28
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-datasource.d.ts","sourceRoot":"","sources":["../../src/storage-gh/github-datasource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"github-datasource.d.ts","sourceRoot":"","sources":["../../src/storage-gh/github-datasource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,aAAa,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CAAC,oBAAoB,GAAG,wBAAwB,CAAC,CAAC;AAEtD,UAAU,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AAc,CAClB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAO,GACvG,OAAO,CAAC,WAAW,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAoCtD,wFAAwF;IAClF,UAAU,CACd,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAO,GACjF,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAmBzC;;;OAGG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;IAsB7D,OAAO,CAAC,QAAQ;CA+CjB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAppAuth } from '@octokit/auth-app';
|
|
2
2
|
import { Octokit } from '@octokit/rest';
|
|
3
|
-
import { ConflictError, DirInsteadOfFile, FileInsteadOfDir, ForbiddenError, InternalError, NotFoundError, VersionMismatchError, } from 'laikacms/core';
|
|
4
3
|
import * as Result from 'effect/Result';
|
|
4
|
+
import { ConflictError, DirInsteadOfFile, FileInsteadOfDir, ForbiddenError, InternalError, NotFoundError, TooManyRequestsError, UpstreamUnAuthorizedError, VersionMismatchError, } from 'laikacms/core';
|
|
5
5
|
const DEFAULT_TOKEN_TTL_SECONDS = 50 * 60;
|
|
6
6
|
const DEFAULT_USER_AGENT = '@laikacms/github';
|
|
7
7
|
/**
|
|
@@ -211,6 +211,7 @@ export class GithubDataSource {
|
|
|
211
211
|
content: textToBase64(content),
|
|
212
212
|
branch: this.branch,
|
|
213
213
|
sha,
|
|
214
|
+
author: options.author,
|
|
214
215
|
committer: options.author,
|
|
215
216
|
});
|
|
216
217
|
const newSha = data.content?.sha;
|
|
@@ -234,6 +235,7 @@ export class GithubDataSource {
|
|
|
234
235
|
message: options.commitMessage ?? `Delete ${relativePath}`,
|
|
235
236
|
sha,
|
|
236
237
|
branch: this.branch,
|
|
238
|
+
author: options.author,
|
|
237
239
|
committer: options.author,
|
|
238
240
|
});
|
|
239
241
|
return Result.succeed({ path: relativePath });
|
|
@@ -261,7 +263,11 @@ export class GithubDataSource {
|
|
|
261
263
|
if (isOctokitError(e) && e.status === 404) {
|
|
262
264
|
throw new NotFoundError(`The path at ${relativePath} does not exist`);
|
|
263
265
|
}
|
|
264
|
-
|
|
266
|
+
// Route non-404 failures (429 rate-limit, 403 forbidden, 5xx, ...) through the same
|
|
267
|
+
// status→domain-error mapping used elsewhere, so callers can distinguish a real
|
|
268
|
+
// rate-limit/forbidden response from a generic failure instead of treating them alike.
|
|
269
|
+
const mapped = this.mapError(e, relativePath);
|
|
270
|
+
throw Result.isFailure(mapped) ? mapped.failure : e;
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
273
|
mapError(error, contextPath) {
|
|
@@ -272,8 +278,20 @@ export class GithubDataSource {
|
|
|
272
278
|
case 404:
|
|
273
279
|
return Result.fail(new NotFoundError(`The file at ${contextPath} does not exist`));
|
|
274
280
|
case 401:
|
|
275
|
-
|
|
276
|
-
|
|
281
|
+
return Result.fail(new UpstreamUnAuthorizedError(`GitHub rejected this server's credential for ${contextPath}: ${error.message ?? 'unauthorized'}`));
|
|
282
|
+
case 403: {
|
|
283
|
+
const rateLimitRemaining = error.response?.headers?.['x-ratelimit-remaining'];
|
|
284
|
+
if (rateLimitRemaining === '0' || rateLimitRemaining === 0) {
|
|
285
|
+
return Result.fail(new TooManyRequestsError(`GitHub rate limit exceeded for ${contextPath}`));
|
|
286
|
+
}
|
|
287
|
+
const msg = error.message ?? '';
|
|
288
|
+
if (msg.includes('Resource not accessible by')) {
|
|
289
|
+
return Result.fail(new ForbiddenError(`Resource not accessible for ${contextPath}: ${msg}`));
|
|
290
|
+
}
|
|
291
|
+
return Result.fail(new ForbiddenError(`Insufficient permissions for ${contextPath}: ${msg || 'forbidden'}`));
|
|
292
|
+
}
|
|
293
|
+
case 429:
|
|
294
|
+
return Result.fail(new TooManyRequestsError(`GitHub rate-limited request for ${contextPath}`));
|
|
277
295
|
case 409:
|
|
278
296
|
case 422:
|
|
279
297
|
return Result.fail(new VersionMismatchError(`Conflict writing ${contextPath}: someone else modified the file since you last viewed it.`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-datasource.js","sourceRoot":"","sources":["../../src/storage-gh/github-datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AA+BxC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,CAAC;AAC1C,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,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MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,uBAAuB,CAAC,CAAC;gBAC9E,IAAI,kBAAkB,KAAK,GAAG,IAAI,kBAAkB,KAAK,CAAC,EAAE,CAAC;oBAC3D,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,oBAAoB,CAAC,kCAAkC,WAAW,EAAE,CAAC,CAC1E,CAAC;gBACJ,CAAC;gBACD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;gBAChC,IAAI,GAAG,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;oBAC/C,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,cAAc,CAAC,+BAA+B,WAAW,KAAK,GAAG,EAAE,CAAC,CACzE,CAAC;gBACJ,CAAC;gBACD,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,cAAc,CAAC,gCAAgC,WAAW,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,CACzF,CAAC;YACJ,CAAC;YACD,KAAK,GAAG;gBACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,mCAAmC,WAAW,EAAE,CAAC,CAAC,CAAC;YACjG,KAAK,GAAG,CAAC;YACT,KAAK,GAAG;gBACN,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,oBAAoB,CACtB,oBAAoB,WAAW,4DAA4D,CAC5F,CACF,CAAC;YACJ;gBACE,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,aAAa,CAAC,mBAAmB,KAAK,CAAC,MAAM,QAAQ,WAAW,KAAK,KAAK,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC,CACrG,CAAC;QACN,CAAC;IACH,CAAC;CACF;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type Atom, type AtomSummary, type Folder, type FolderCreate, type ListAtomsOptions, type StorageObject, type StorageObjectCreate, type StorageObjectUpdate, StorageRepository, type StorageSerializerRegistry } from 'laikacms/storage';
|
|
1
|
+
import { LaikaStream, LaikaTask } from 'laikacms/core';
|
|
2
|
+
import { type Atom, type AtomSummary, Capabilities, type DetermineExtension, type Folder, type FolderCreate, type ListAtomsDone, type ListAtomsOptions, type RemoveAtomsDone, type StorageObject, type StorageObjectCreate, type StorageObjectUpdate, StorageRepository, type StorageSerializerRegistry } from 'laikacms/storage';
|
|
3
3
|
import { type GithubDataSourceOptions } from './github-datasource.js';
|
|
4
|
-
export
|
|
4
|
+
export type GithubStorageRepositoryOptions = GithubDataSourceOptions & {
|
|
5
5
|
serializerRegistry: StorageSerializerRegistry;
|
|
6
6
|
defaultFileExtension: string;
|
|
7
|
-
/** Glob patterns to exclude when listing. Defaults match storage-fs. */
|
|
8
7
|
ignoreList?: string[];
|
|
9
|
-
/** Optional commit author/committer applied to every write. */
|
|
10
8
|
commitAuthor?: {
|
|
11
9
|
name: string;
|
|
12
10
|
email: string;
|
|
13
11
|
};
|
|
14
|
-
|
|
12
|
+
determineExtension?: DetermineExtension;
|
|
13
|
+
};
|
|
15
14
|
/**
|
|
16
|
-
* StorageRepository backed by a GitHub repository.
|
|
17
|
-
* `laikacms/storage-fs` so that swapping FS for GitHub is purely a wiring change.
|
|
15
|
+
* StorageRepository backed by a GitHub repository.
|
|
18
16
|
*/
|
|
19
17
|
export declare class GithubStorageRepository extends StorageRepository {
|
|
20
18
|
private readonly dataSource;
|
|
@@ -23,21 +21,25 @@ export declare class GithubStorageRepository extends StorageRepository {
|
|
|
23
21
|
private readonly availableExtensions;
|
|
24
22
|
private readonly excludeFilter;
|
|
25
23
|
private readonly commitAuthor?;
|
|
24
|
+
private readonly determineExtension;
|
|
26
25
|
constructor(options: GithubStorageRepositoryOptions);
|
|
26
|
+
private resolveExtension;
|
|
27
27
|
private stripExtension;
|
|
28
28
|
private resolvePathWithExtension;
|
|
29
29
|
private serialize;
|
|
30
30
|
private deserialize;
|
|
31
|
-
getObject(key: string):
|
|
32
|
-
createObject(create: StorageObjectCreate):
|
|
33
|
-
updateObject(update: StorageObjectUpdate):
|
|
34
|
-
createOrUpdateObject(create: StorageObjectCreate):
|
|
35
|
-
getFolder(key: string):
|
|
36
|
-
createFolder(folderCreate: FolderCreate):
|
|
37
|
-
getAtom(key: string):
|
|
38
|
-
listAtomSummaries(folderKey: string, options: ListAtomsOptions):
|
|
39
|
-
listAtoms(folderKey: string, options: ListAtomsOptions):
|
|
40
|
-
private
|
|
41
|
-
|
|
31
|
+
getObject(key: string): LaikaTask.LaikaTask<StorageObject>;
|
|
32
|
+
createObject(create: StorageObjectCreate): LaikaTask.LaikaTask<StorageObject>;
|
|
33
|
+
updateObject(update: StorageObjectUpdate): LaikaTask.LaikaTask<StorageObject>;
|
|
34
|
+
createOrUpdateObject(create: StorageObjectCreate): LaikaTask.LaikaTask<StorageObject>;
|
|
35
|
+
getFolder(key: string): LaikaTask.LaikaTask<Folder>;
|
|
36
|
+
createFolder(folderCreate: FolderCreate): LaikaTask.LaikaTask<Folder>;
|
|
37
|
+
getAtom(key: string): LaikaTask.LaikaTask<Atom>;
|
|
38
|
+
listAtomSummaries(folderKey: string, options: ListAtomsOptions): LaikaStream.LaikaStream<AtomSummary, ListAtomsDone>;
|
|
39
|
+
listAtoms(folderKey: string, options: ListAtomsOptions): LaikaStream.LaikaStream<Atom, ListAtomsDone>;
|
|
40
|
+
private collectFilteredSummaries;
|
|
41
|
+
private listFolderLevel;
|
|
42
|
+
removeAtoms(keys: readonly string[]): LaikaStream.LaikaStream<string, RemoveAtomsDone>;
|
|
43
|
+
getCapabilities(): LaikaTask.LaikaTask<Capabilities>;
|
|
42
44
|
}
|
|
43
45
|
//# sourceMappingURL=github-storage-repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-storage-repository.d.ts","sourceRoot":"","sources":["../../src/storage-gh/github-storage-repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github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