@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.
- package/LICENSE.md +16 -0
- package/README.md +163 -0
- package/bin/run.js +5 -0
- package/dist/browser/client/react.d.ts +37 -0
- package/dist/browser/client/react.d.ts.map +1 -0
- package/dist/browser/client/react.js +166 -0
- package/dist/browser/client/react.js.map +1 -0
- package/dist/browser/client/solid.d.ts +35 -0
- package/dist/browser/client/solid.d.ts.map +1 -0
- package/dist/browser/client/solid.js +136 -0
- package/dist/browser/client/solid.js.map +1 -0
- package/dist/browser/client/svelte.d.ts +30 -0
- package/dist/browser/client/svelte.d.ts.map +1 -0
- package/dist/browser/client/svelte.js +134 -0
- package/dist/browser/client/svelte.js.map +1 -0
- package/dist/browser/client/vanilla.d.ts +16 -0
- package/dist/browser/client/vanilla.d.ts.map +1 -0
- package/dist/browser/client/vanilla.js +11 -0
- package/dist/browser/client/vanilla.js.map +1 -0
- package/dist/browser/client/vue.d.ts +33 -0
- package/dist/browser/client/vue.d.ts.map +1 -0
- package/dist/browser/client/vue.js +133 -0
- package/dist/browser/client/vue.js.map +1 -0
- package/dist/browser/factory-BIj4C6PD.js +2210 -0
- package/dist/browser/factory-BIj4C6PD.js.map +1 -0
- package/dist/browser/index.d.ts +343 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +3 -0
- package/dist/browser/types-BzeSSOQU.d.ts +660 -0
- package/dist/browser/types-BzeSSOQU.d.ts.map +1 -0
- package/dist/cli/commands/installations.js +92 -0
- package/dist/cli/commands/installations.js.map +1 -0
- package/dist/cli/commands/pulls.js +123 -0
- package/dist/cli/commands/pulls.js.map +1 -0
- package/dist/cli/commands/repositories.js +105 -0
- package/dist/cli/commands/repositories.js.map +1 -0
- package/dist/cli/commands/serve.js +187 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/webhooks.js +122 -0
- package/dist/cli/commands/webhooks.js.map +1 -0
- package/dist/cli/github/api.js +94 -0
- package/dist/cli/github/api.js.map +1 -0
- package/dist/cli/github/definition.js +15 -0
- package/dist/cli/github/definition.js.map +1 -0
- package/dist/cli/github/factory.js +12 -0
- package/dist/cli/github/factory.js.map +1 -0
- package/dist/cli/github/repo-sync.js +33 -0
- package/dist/cli/github/repo-sync.js.map +1 -0
- package/dist/cli/github/utils.js +23 -0
- package/dist/cli/github/utils.js.map +1 -0
- package/dist/cli/github/webhook-processing.js +247 -0
- package/dist/cli/github/webhook-processing.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +263 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/routes.js +718 -0
- package/dist/cli/routes.js.map +1 -0
- package/dist/cli/schema.js +47 -0
- package/dist/cli/schema.js.map +1 -0
- package/dist/cli/utils/client.js +120 -0
- package/dist/cli/utils/client.js.map +1 -0
- package/dist/cli/utils/config.js +113 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/cli/utils/options.js +90 -0
- package/dist/cli/utils/options.js.map +1 -0
- package/dist/cli/utils/output.js +12 -0
- package/dist/cli/utils/output.js.map +1 -0
- package/dist/node/github/api.d.ts +52 -0
- package/dist/node/github/api.d.ts.map +1 -0
- package/dist/node/github/api.js +94 -0
- package/dist/node/github/api.js.map +1 -0
- package/dist/node/github/clients.d.ts +19 -0
- package/dist/node/github/clients.d.ts.map +1 -0
- package/dist/node/github/clients.js +12 -0
- package/dist/node/github/clients.js.map +1 -0
- package/dist/node/github/definition.d.ts +33 -0
- package/dist/node/github/definition.d.ts.map +1 -0
- package/dist/node/github/definition.js +15 -0
- package/dist/node/github/definition.js.map +1 -0
- package/dist/node/github/factory.d.ts +139 -0
- package/dist/node/github/factory.d.ts.map +1 -0
- package/dist/node/github/factory.js +18 -0
- package/dist/node/github/factory.js.map +1 -0
- package/dist/node/github/repo-sync.js +33 -0
- package/dist/node/github/repo-sync.js.map +1 -0
- package/dist/node/github/types.d.ts +24 -0
- package/dist/node/github/types.d.ts.map +1 -0
- package/dist/node/github/utils.js +23 -0
- package/dist/node/github/utils.js.map +1 -0
- package/dist/node/github/webhook-processing.d.ts +15 -0
- package/dist/node/github/webhook-processing.d.ts.map +1 -0
- package/dist/node/github/webhook-processing.js +247 -0
- package/dist/node/github/webhook-processing.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +6 -0
- package/dist/node/routes.d.ts +127 -0
- package/dist/node/routes.d.ts.map +1 -0
- package/dist/node/routes.js +718 -0
- package/dist/node/routes.js.map +1 -0
- package/dist/node/schema.js +47 -0
- package/dist/node/schema.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +114 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Copyright 2025 - present "ReJot Nederland B.V.", and individual contributors.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
4
|
+
associated documentation files (the “Software”), to deal in the Software without restriction,
|
|
5
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
6
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
7
|
+
furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
10
|
+
portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
13
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
14
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
15
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
16
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# github-app-fragment
|
|
2
|
+
|
|
3
|
+
A Fragno fragment that integrates a GitHub App using installation-only authentication. Includes a
|
|
4
|
+
CLI to run a local server and call all fragment routes for integration testing.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- JWT + installation access token auth
|
|
9
|
+
- Webhook-driven installation and repository tracking
|
|
10
|
+
- Explicit repo linking for access control
|
|
11
|
+
- Pull request listing + review creation
|
|
12
|
+
- CLI for serving and exercising all routes
|
|
13
|
+
|
|
14
|
+
## GitHub App Setup (UI)
|
|
15
|
+
|
|
16
|
+
1. Go to GitHub **Settings → Developer settings → GitHub Apps → New GitHub App**.
|
|
17
|
+
2. Fill in:
|
|
18
|
+
- **GitHub App name** (any unique name)
|
|
19
|
+
- **Homepage URL** (can be your project URL)
|
|
20
|
+
- **Webhook URL**: use your tunnel URL + `/api/github-app-fragment/webhooks`
|
|
21
|
+
- **Webhook secret**: set a random secret (keep it)
|
|
22
|
+
3. Permissions (Repository):
|
|
23
|
+
- **Pull requests**: Read & write
|
|
24
|
+
- **Metadata**: Read-only (default)
|
|
25
|
+
4. Subscribe to webhook events:
|
|
26
|
+
- `installation`
|
|
27
|
+
- `installation_repositories`
|
|
28
|
+
5. Generate a **private key** and download the `.pem` file.
|
|
29
|
+
6. Install the App on the repositories you want to test with.
|
|
30
|
+
|
|
31
|
+
### Generating the PEM private key
|
|
32
|
+
|
|
33
|
+
1. Open your GitHub App settings page.
|
|
34
|
+
2. Scroll to **Private keys**.
|
|
35
|
+
3. Click **Generate a private key**.
|
|
36
|
+
4. Download the `.pem` file and store it securely.
|
|
37
|
+
|
|
38
|
+
## Environment
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
GITHUB_APP_ID=123456
|
|
42
|
+
GITHUB_APP_SLUG=my-github-app
|
|
43
|
+
GITHUB_APP_PRIVATE_KEY_FILE=./my-github-app.private-key.pem
|
|
44
|
+
GITHUB_APP_WEBHOOK_SECRET=super-secret
|
|
45
|
+
# Optional
|
|
46
|
+
GITHUB_APP_API_BASE_URL=https://api.github.com
|
|
47
|
+
GITHUB_APP_API_VERSION=2022-11-28
|
|
48
|
+
GITHUB_APP_WEB_BASE_URL=https://github.com
|
|
49
|
+
GITHUB_APP_DEFAULT_LINK_KEY=default
|
|
50
|
+
GITHUB_APP_TOKEN_CACHE_TTL_SECONDS=3300
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If you use `GITHUB_APP_PRIVATE_KEY`, store it as a single line with `\n` escapes.
|
|
54
|
+
|
|
55
|
+
## CLI (Local Integration Testing)
|
|
56
|
+
|
|
57
|
+
Build once:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm exec turbo build --filter=@fragno-dev/github-app-fragment --output-logs=errors-only
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Start a local server (SQLite):
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm exec fragno-github-app serve --port 6173
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use a custom SQLite path:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm exec fragno-github-app serve --db-path ./github-app.sqlite
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Expose it with your tunnel and set the GitHub App webhook URL to:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
https://<tunnel-host>/api/github-app-fragment/webhooks
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Call routes from the CLI:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
export FRAGNO_GITHUB_APP_BASE_URL=http://localhost:6173/api/github-app-fragment
|
|
85
|
+
|
|
86
|
+
pnpm exec fragno-github-app installations list
|
|
87
|
+
pnpm exec fragno-github-app installations repos --installation-id <id>
|
|
88
|
+
pnpm exec fragno-github-app repositories link --installation-id <id> --repo-id <repo>
|
|
89
|
+
pnpm exec fragno-github-app pulls list --owner <owner> --repo <repo>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Send a signed webhook payload (optional):
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pnpm exec fragno-github-app webhooks send \
|
|
96
|
+
--event installation \
|
|
97
|
+
--installation-id <id> \
|
|
98
|
+
--payload '{"installation":{"id":"<id>"},"action":"created"}'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Server Usage (Framework Integration)
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import {
|
|
105
|
+
createGitHubAppFragment,
|
|
106
|
+
type GitHubAppFragmentConfig,
|
|
107
|
+
} from "@fragno-dev/github-app-fragment";
|
|
108
|
+
import { InMemoryAdapter } from "@fragno-dev/db/adapters/in-memory";
|
|
109
|
+
|
|
110
|
+
const config: GitHubAppFragmentConfig = {
|
|
111
|
+
appId: process.env.GITHUB_APP_ID ?? "",
|
|
112
|
+
appSlug: process.env.GITHUB_APP_SLUG ?? "",
|
|
113
|
+
privateKeyPem: process.env.GITHUB_APP_PRIVATE_KEY ?? "",
|
|
114
|
+
webhookSecret: process.env.GITHUB_APP_WEBHOOK_SECRET ?? "",
|
|
115
|
+
webhook: (register) => {
|
|
116
|
+
register("installation.deleted", async ({ payload }) => {
|
|
117
|
+
// Optional: cleanup app-specific state when an installation is removed in GitHub.
|
|
118
|
+
console.log("GitHub app uninstalled", payload.installation.id);
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const fragment = createGitHubAppFragment(config, {
|
|
124
|
+
databaseAdapter: new InMemoryAdapter(),
|
|
125
|
+
outbox: { enabled: true },
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Public service access to both the raw App instance and helper client
|
|
129
|
+
const app = fragment.services.app;
|
|
130
|
+
const githubApiClient = fragment.services.githubApiClient;
|
|
131
|
+
|
|
132
|
+
export const { GET, POST } = fragment.handlersFor("next-js");
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Routes
|
|
136
|
+
|
|
137
|
+
- `POST /webhooks`
|
|
138
|
+
- `GET /installations`
|
|
139
|
+
- `GET /installations/:installationId/repos`
|
|
140
|
+
- `GET /repositories/linked`
|
|
141
|
+
- `POST /repositories/link`
|
|
142
|
+
- `POST /repositories/unlink`
|
|
143
|
+
- `GET /repositories/:owner/:repo/pulls`
|
|
144
|
+
- `POST /repositories/:owner/:repo/pulls/:number/reviews`
|
|
145
|
+
- `POST /installations/:installationId/sync`
|
|
146
|
+
|
|
147
|
+
## Client Usage
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { createGitHubAppFragmentClients } from "@fragno-dev/github-app-fragment";
|
|
151
|
+
|
|
152
|
+
const github = createGitHubAppFragmentClients({ baseUrl: "/" });
|
|
153
|
+
|
|
154
|
+
const syncInstallation = github.useSyncInstallation();
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pnpm exec turbo types:check --filter=@fragno-dev/github-app-fragment --output-logs=errors-only
|
|
161
|
+
pnpm exec turbo build --filter=@fragno-dev/github-app-fragment --output-logs=errors-only
|
|
162
|
+
pnpm exec turbo test --filter=@fragno-dev/github-app-fragment --output-logs=errors-only
|
|
163
|
+
```
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { c as FragnoClientError, d as InferOr, f as ExtractPathParamsOrWiden, h as QueryParamsHint, l as NonGetHTTPMethod, n as GitHubAppFragmentPublicClientConfig, p as HasPathParams, s as ReadableAtom } from "../types-BzeSSOQU.js";
|
|
2
|
+
import * as zod from "zod";
|
|
3
|
+
import "react";
|
|
4
|
+
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
8
|
+
//#region ../fragno/dist/client/react.d.ts
|
|
9
|
+
type FragnoReactMutator<_TMethod extends NonGetHTTPMethod, TPath$1 extends string, TInputSchema extends StandardSchemaV1 | undefined, TOutputSchema$1 extends StandardSchemaV1 | undefined, TErrorCode$1 extends string, TQueryParameters$1 extends string> = () => {
|
|
10
|
+
mutate: ({
|
|
11
|
+
body,
|
|
12
|
+
path,
|
|
13
|
+
query
|
|
14
|
+
}: {
|
|
15
|
+
body?: InferOr<TInputSchema, undefined>;
|
|
16
|
+
path?: HasPathParams<TPath$1> extends true ? ExtractPathParamsOrWiden<TPath$1, string | ReadableAtom<string>> : undefined;
|
|
17
|
+
query?: QueryParamsHint<TQueryParameters$1, string | ReadableAtom<string>>;
|
|
18
|
+
}) => Promise<InferOr<TOutputSchema$1, undefined>>;
|
|
19
|
+
loading?: boolean | undefined;
|
|
20
|
+
error?: FragnoClientError<NonNullable<TErrorCode$1>[number]> | undefined;
|
|
21
|
+
data?: InferOr<TOutputSchema$1, undefined> | undefined;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Type helper that unwraps any Store fields of the object into StoreValues
|
|
25
|
+
*/
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/client/react.d.ts
|
|
28
|
+
declare function createGitHubAppFragmentClient(config?: GitHubAppFragmentPublicClientConfig): {
|
|
29
|
+
useSyncInstallation: FragnoReactMutator<NonGetHTTPMethod, "/installations/:installationId/sync", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
|
|
30
|
+
added: zod.ZodNumber;
|
|
31
|
+
removed: zod.ZodNumber;
|
|
32
|
+
updated: zod.ZodNumber;
|
|
33
|
+
}, zod_v4_core0.$strip> | undefined, "INSTALLATION_NOT_FOUND" | "GITHUB_API_ERROR", string>;
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { createGitHubAppFragmentClient };
|
|
37
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":["ExtractPathParamsOrWiden","HasPathParams","MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","NonGetHTTPMethod","FragnoClientError","FragnoClientHookData","FragnoClientMutatorData","FragnoStoreFactoryData","FragnoStoreObjectData","ReadableAtom","Store","StoreValue","FetcherValue","react0","DependencyList","StandardSchemaV1","FragnoReactHook","_TMethod","TPath$1","TOutputSchema$1","TErrorCode$1","TQueryParameters$1","InferOutput","NonNullable","path","query","args","FragnoReactMutator","TInputSchema","body","Promise","mutate","loading","error","data","FragnoReactStoreValue","T","TStore","K","FragnoReactStore","TArgs","useFragno","Record","TPath","TOutputSchema","TErrorCode","TQueryParameters","TMethod","TInput","TOutput","TError","TStoreObj","TStoreArgs","clientObj","StoreKeys","setKey","k","v","UseStoreOptions","SomeStore","deps","keys","useStore","store","options","FragnoHydrator","children","React","ReactNode"],"sources":["../../../../fragno/dist/client/react.d.ts","../../../src/client/react.ts"],"mappings":";;;;;;;;KAgBK6B,kBAAAA,kBAAoCxB,gBAAAA,+CAA+DY,gBAAAA,sCAAsDA,gBAAAA;EAC5JgB,MAAAA;IACEF,IAAAA;IACAL,IAAAA;IACAC;EAAAA;IAEAI,IAAAA,GAAO3B,OAAAA,CAAQ0B,YAAAA;IACfJ,IAAAA,GAAOzB,aAAAA,CAAcmB,OAAAA,iBAAwBpB,wBAAAA,CAAyBoB,OAAAA,WAAkBT,YAAAA;IACxFgB,KAAAA,GAAQxB,eAAAA,CAAgBoB,kBAAAA,WAA6BZ,YAAAA;EAAAA,MACjDqB,OAAAA,CAAQ5B,OAAAA,CAAQiB,eAAAA;EACtBa,OAAAA;EACAC,KAAAA,GAAQ7B,iBAAAA,CAAkBmB,WAAAA,CAAYH,YAAAA;EACtCc,IAAAA,GAAOhC,OAAAA,CAAQiB,eAAAA;AAAAA;;;;;;iBCvBD,6BAAA,CAA8B,MAAA,GAAQ,mCAAA;0CAAwC,gBAAA"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { c as isMutatorHook, d as isReadableAtom, i as createGitHubAppFragmentClients, l as isStore, s as isGetHook } from "../factory-BIj4C6PD.js";
|
|
2
|
+
import "../index.js";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js
|
|
6
|
+
function listenKeys($store, keys, listener) {
|
|
7
|
+
let keysSet = new Set(keys).add(void 0);
|
|
8
|
+
return $store.listen((value, oldValue, changed) => {
|
|
9
|
+
if (keysSet.has(changed)) listener(value, oldValue, changed);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../fragno/dist/client/react.js
|
|
15
|
+
function createReactHook(hook) {
|
|
16
|
+
return ({ path, query } = {}) => {
|
|
17
|
+
const pathParamValues = path ? Object.values(path) : [];
|
|
18
|
+
const queryParamValues = query ? Object.values(query) : [];
|
|
19
|
+
const store = useMemo(() => hook.store({
|
|
20
|
+
path,
|
|
21
|
+
query
|
|
22
|
+
}), [hook, ...[...pathParamValues, ...queryParamValues]]);
|
|
23
|
+
if (typeof window === "undefined") return store.get();
|
|
24
|
+
return useStore(store);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createReactMutator(hook) {
|
|
28
|
+
return () => {
|
|
29
|
+
return useStore(useMemo(() => hook.mutatorStore, [hook]));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const isPlainObject = (value) => {
|
|
33
|
+
if (!value || typeof value !== "object") return false;
|
|
34
|
+
const prototype = Object.getPrototypeOf(value);
|
|
35
|
+
return prototype === Object.prototype || prototype === null;
|
|
36
|
+
};
|
|
37
|
+
const areStoreFactoryValuesEqual = (left, right) => {
|
|
38
|
+
if (Object.is(left, right)) return true;
|
|
39
|
+
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));
|
|
40
|
+
if (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();
|
|
41
|
+
if (isReadableAtom(left) || isReadableAtom(right)) return left === right;
|
|
42
|
+
if (typeof left === "function" || typeof right === "function") return left === right;
|
|
43
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
44
|
+
const leftKeys = Object.keys(left).sort();
|
|
45
|
+
const rightKeys = Object.keys(right).sort();
|
|
46
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
};
|
|
50
|
+
const areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));
|
|
51
|
+
const getStoreDisposer = (value) => {
|
|
52
|
+
const disposer = value[Symbol.dispose];
|
|
53
|
+
return typeof disposer === "function" ? disposer.bind(value) : void 0;
|
|
54
|
+
};
|
|
55
|
+
function unwrapReactStoreValueOnServer(value) {
|
|
56
|
+
if (isReadableAtom(value)) return value.get();
|
|
57
|
+
const result = {};
|
|
58
|
+
for (const key in value) {
|
|
59
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
60
|
+
const fieldValue = value[key];
|
|
61
|
+
if (isReadableAtom(fieldValue)) result[key] = fieldValue.get();
|
|
62
|
+
else result[key] = fieldValue;
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
function unwrapReactStoreValue(value) {
|
|
67
|
+
if (isReadableAtom(value)) return useStore(value);
|
|
68
|
+
const keys = Object.keys(value);
|
|
69
|
+
const atomEntries = keys.flatMap((key) => {
|
|
70
|
+
const fieldValue = value[key];
|
|
71
|
+
return isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];
|
|
72
|
+
});
|
|
73
|
+
const snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));
|
|
74
|
+
const getSnapshot = () => {
|
|
75
|
+
const nextSnapshot = atomEntries.map(([, store]) => store.get());
|
|
76
|
+
const previousSnapshot = snapshotRef.current;
|
|
77
|
+
if (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;
|
|
78
|
+
snapshotRef.current = nextSnapshot;
|
|
79
|
+
return nextSnapshot;
|
|
80
|
+
};
|
|
81
|
+
const atomValues = useSyncExternalStore((onStoreChange) => {
|
|
82
|
+
const unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));
|
|
83
|
+
return () => {
|
|
84
|
+
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
85
|
+
};
|
|
86
|
+
}, getSnapshot, getSnapshot);
|
|
87
|
+
const result = {};
|
|
88
|
+
let atomIndex = 0;
|
|
89
|
+
for (const key of keys) {
|
|
90
|
+
const fieldValue = value[key];
|
|
91
|
+
if (isReadableAtom(fieldValue)) {
|
|
92
|
+
result[key] = atomValues[atomIndex];
|
|
93
|
+
atomIndex += 1;
|
|
94
|
+
} else result[key] = fieldValue;
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
function createReactStore(hook) {
|
|
99
|
+
return (...args) => {
|
|
100
|
+
const stableArgsRef = useRef(args);
|
|
101
|
+
const pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());
|
|
102
|
+
if (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;
|
|
103
|
+
const value = useMemo(() => {
|
|
104
|
+
if ("factory" in hook) return hook.factory(...stableArgsRef.current);
|
|
105
|
+
return hook.obj;
|
|
106
|
+
}, [hook, stableArgsRef.current]);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const disposer = getStoreDisposer(value);
|
|
109
|
+
const pendingTimeout = pendingDisposalsRef.current.get(value);
|
|
110
|
+
if (pendingTimeout !== void 0) {
|
|
111
|
+
clearTimeout(pendingTimeout);
|
|
112
|
+
pendingDisposalsRef.current.delete(value);
|
|
113
|
+
}
|
|
114
|
+
return () => {
|
|
115
|
+
if (!disposer) return;
|
|
116
|
+
const timeoutId = setTimeout(() => {
|
|
117
|
+
pendingDisposalsRef.current.delete(value);
|
|
118
|
+
disposer();
|
|
119
|
+
}, 0);
|
|
120
|
+
pendingDisposalsRef.current.set(value, timeoutId);
|
|
121
|
+
};
|
|
122
|
+
}, [value]);
|
|
123
|
+
if (typeof window === "undefined") return unwrapReactStoreValueOnServer(value);
|
|
124
|
+
return unwrapReactStoreValue(value);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function useFragno(clientObj) {
|
|
128
|
+
const result = {};
|
|
129
|
+
for (const key in clientObj) {
|
|
130
|
+
if (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;
|
|
131
|
+
const hook = clientObj[key];
|
|
132
|
+
if (isGetHook(hook)) result[key] = createReactHook(hook);
|
|
133
|
+
else if (isMutatorHook(hook)) result[key] = createReactMutator(hook);
|
|
134
|
+
else if (isStore(hook)) result[key] = createReactStore(hook);
|
|
135
|
+
else result[key] = hook;
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
function useStore(store, options = {}) {
|
|
140
|
+
const snapshotRef = useRef(store.get());
|
|
141
|
+
const { keys, deps = [store, keys] } = options;
|
|
142
|
+
const subscribe = useCallback((onChange) => {
|
|
143
|
+
const emitChange = (value) => {
|
|
144
|
+
if (snapshotRef.current === value) return;
|
|
145
|
+
snapshotRef.current = value;
|
|
146
|
+
onChange();
|
|
147
|
+
};
|
|
148
|
+
emitChange(store.value);
|
|
149
|
+
if (keys?.length) return listenKeys(store, keys, emitChange);
|
|
150
|
+
return store.listen(emitChange);
|
|
151
|
+
}, deps);
|
|
152
|
+
const get = () => snapshotRef.current;
|
|
153
|
+
return useSyncExternalStore(subscribe, get, () => {
|
|
154
|
+
return get();
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/client/react.ts
|
|
160
|
+
function createGitHubAppFragmentClient(config = {}) {
|
|
161
|
+
return useFragno(createGitHubAppFragmentClients(config));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//#endregion
|
|
165
|
+
export { createGitHubAppFragmentClient };
|
|
166
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","names":["listenKeys","$store","keys","listener","keysSet","Set","add","undefined","listen","value","oldValue","changed","has","subscribeKeys","unbind","isReadableAtom","hydrateFromWindow","isGetHook","isMutatorHook","isStore","listenKeys","useCallback","useEffect","useMemo","useRef","useSyncExternalStore","createReactHook","hook","path","query","pathParamValues","Object","values","queryParamValues","store","window","get","useStore","createReactMutator","mutatorStore","isPlainObject","value","prototype","getPrototypeOf","areStoreFactoryValuesEqual","left","right","is","Array","isArray","length","every","index","Date","getTime","leftKeys","keys","sort","rightKeys","key","areStoreFactoryArgsEqual","getStoreDisposer","disposer","Symbol","dispose","bind","unwrapReactStoreValueOnServer","result","hasOwnProperty","call","fieldValue","unwrapReactStoreValue","atomEntries","flatMap","snapshotRef","map","getSnapshot","nextSnapshot","previousSnapshot","current","entry","atomValues","onStoreChange","unsubscribes","listen","unsubscribe","atomIndex","createReactStore","args","stableArgsRef","pendingDisposalsRef","Map","factory","obj","pendingTimeout","clearTimeout","delete","timeoutId","setTimeout","set","useFragno","clientObj","options","deps","subscribe","onChange","emitChange","FragnoHydrator","children","useFragno","createGitHubAppFragmentClients","GitHubAppFragmentPublicClientConfig","createGitHubAppFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js","../../../../fragno/dist/client/react.js","../../../src/client/react.ts"],"sourcesContent":["export function listenKeys($store, keys, listener) {\n let keysSet = new Set(keys).add(undefined)\n return $store.listen((value, oldValue, changed) => {\n if (keysSet.has(changed)) {\n listener(value, oldValue, changed)\n }\n })\n}\n\nexport function subscribeKeys($store, keys, listener) {\n let unbind = listenKeys($store, keys, listener)\n listener($store.value)\n return unbind\n}\n","import { isReadableAtom } from \"../util/nanostores.js\";\nimport { hydrateFromWindow } from \"../util/ssr.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { listenKeys } from \"nanostores\";\nimport { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/client/react.ts\nfunction createReactHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParamValues = path ? Object.values(path) : [];\n\t\tconst queryParamValues = query ? Object.values(query) : [];\n\t\tconst store = useMemo(() => hook.store({\n\t\t\tpath,\n\t\t\tquery\n\t\t}), [hook, ...[...pathParamValues, ...queryParamValues]]);\n\t\tif (typeof window === \"undefined\") return store.get();\n\t\treturn useStore(store);\n\t};\n}\nfunction createReactMutator(hook) {\n\treturn () => {\n\t\treturn useStore(useMemo(() => hook.mutatorStore, [hook]));\n\t};\n}\nconst isPlainObject = (value) => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n};\nconst areStoreFactoryValuesEqual = (left, right) => {\n\tif (Object.is(left, right)) return true;\n\tif (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\n\tif (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();\n\tif (isReadableAtom(left) || isReadableAtom(right)) return left === right;\n\tif (typeof left === \"function\" || typeof right === \"function\") return left === right;\n\tif (isPlainObject(left) && isPlainObject(right)) {\n\t\tconst leftKeys = Object.keys(left).sort();\n\t\tconst rightKeys = Object.keys(right).sort();\n\t\treturn leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));\n\t}\n\treturn false;\n};\nconst areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\nconst getStoreDisposer = (value) => {\n\tconst disposer = value[Symbol.dispose];\n\treturn typeof disposer === \"function\" ? disposer.bind(value) : void 0;\n};\nfunction unwrapReactStoreValueOnServer(value) {\n\tif (isReadableAtom(value)) return value.get();\n\tconst result = {};\n\tfor (const key in value) {\n\t\tif (!Object.prototype.hasOwnProperty.call(value, key)) continue;\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) result[key] = fieldValue.get();\n\t\telse result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction unwrapReactStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst keys = Object.keys(value);\n\tconst atomEntries = keys.flatMap((key) => {\n\t\tconst fieldValue = value[key];\n\t\treturn isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];\n\t});\n\tconst snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));\n\tconst getSnapshot = () => {\n\t\tconst nextSnapshot = atomEntries.map(([, store]) => store.get());\n\t\tconst previousSnapshot = snapshotRef.current;\n\t\tif (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;\n\t\tsnapshotRef.current = nextSnapshot;\n\t\treturn nextSnapshot;\n\t};\n\tconst atomValues = useSyncExternalStore((onStoreChange) => {\n\t\tconst unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));\n\t\treturn () => {\n\t\t\tfor (const unsubscribe of unsubscribes) unsubscribe();\n\t\t};\n\t}, getSnapshot, getSnapshot);\n\tconst result = {};\n\tlet atomIndex = 0;\n\tfor (const key of keys) {\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) {\n\t\t\tresult[key] = atomValues[atomIndex];\n\t\t\tatomIndex += 1;\n\t\t} else result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction createReactStore(hook) {\n\treturn ((...args) => {\n\t\tconst stableArgsRef = useRef(args);\n\t\tconst pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());\n\t\tif (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;\n\t\tconst value = useMemo(() => {\n\t\t\tif (\"factory\" in hook) return hook.factory(...stableArgsRef.current);\n\t\t\treturn hook.obj;\n\t\t}, [hook, stableArgsRef.current]);\n\t\tuseEffect(() => {\n\t\t\tconst disposer = getStoreDisposer(value);\n\t\t\tconst pendingTimeout = pendingDisposalsRef.current.get(value);\n\t\t\tif (pendingTimeout !== void 0) {\n\t\t\t\tclearTimeout(pendingTimeout);\n\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tif (!disposer) return;\n\t\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t\t\tdisposer();\n\t\t\t\t}, 0);\n\t\t\t\tpendingDisposalsRef.current.set(value, timeoutId);\n\t\t\t};\n\t\t}, [value]);\n\t\tif (typeof window === \"undefined\") return unwrapReactStoreValueOnServer(value);\n\t\treturn unwrapReactStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createReactHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createReactMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createReactStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store, options = {}) {\n\tconst snapshotRef = useRef(store.get());\n\tconst { keys, deps = [store, keys] } = options;\n\tconst subscribe = useCallback((onChange) => {\n\t\tconst emitChange = (value) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\t\temitChange(store.value);\n\t\tif (keys?.length) return listenKeys(store, keys, emitChange);\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\tconst get = () => snapshotRef.current;\n\treturn useSyncExternalStore(subscribe, get, () => {\n\t\treturn get();\n\t});\n}\nfunction FragnoHydrator({ children }) {\n\tuseMemo(() => {\n\t\thydrateFromWindow();\n\t}, []);\n\treturn children;\n}\n\n//#endregion\nexport { FragnoHydrator, useFragno, useStore };\n//# sourceMappingURL=react.js.map","import { useFragno } from \"@fragno-dev/core/react\";\n\nimport { createGitHubAppFragmentClients } from \"..\";\nimport type { GitHubAppFragmentPublicClientConfig } from \"../github/types\";\n\nexport function createGitHubAppFragmentClient(config: GitHubAppFragmentPublicClientConfig = {}) {\n return useFragno(createGitHubAppFragmentClients(config));\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAAA,SAAgBA,WAAWC,QAAQC,MAAMC,UAAU;CACjD,IAAIC,UAAU,IAAIC,IAAIH,KAAK,CAACI,IAAIC,OAAU;AAC1C,QAAON,OAAOO,QAAQC,OAAOC,UAAUC,YAAY;AACjD,MAAIP,QAAQQ,IAAID,QAAQ,CACtBR,UAASM,OAAOC,UAAUC,QAAQ;GAEpC;;;;;ACCJ,SAASe,gBAAgBC,MAAM;AAC9B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,kBAAkBF,OAAOG,OAAOC,OAAOJ,KAAK,GAAG,EAAE;EACvD,MAAMK,mBAAmBJ,QAAQE,OAAOC,OAAOH,MAAM,GAAG,EAAE;EAC1D,MAAMK,QAAQX,cAAcI,KAAKO,MAAM;GACtCN;GACAC;GACA,CAAC,EAAE,CAACF,MAAM,GAAG,CAAC,GAAGG,iBAAiB,GAAGG,iBAAiB,CAAC,CAAC;AACzD,MAAI,OAAOE,WAAW,YAAa,QAAOD,MAAME,KAAK;AACrD,SAAOC,SAASH,MAAM;;;AAGxB,SAASI,mBAAmBX,MAAM;AACjC,cAAa;AACZ,SAAOU,SAASd,cAAcI,KAAKY,cAAc,CAACZ,KAAK,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E,OAAOW,UAAU0B,eAAeC,KAAKgC,WAAW1C,IAAI,CAAE;EAC3D,MAAMhC,OAAO0E,UAAU1C;AACvB,MAAI1C,UAAUU,KAAK,CAAEwC,QAAOR,OAAOjC,gBAAgBC,KAAK;WAC/CT,cAAcS,KAAK,CAAEwC,QAAOR,OAAOrB,mBAAmBX,KAAK;WAC3DR,QAAQQ,KAAK,CAAEwC,QAAOR,OAAO4B,iBAAiB5D,KAAK;MACvDwC,QAAOR,OAAOhC;;AAEpB,QAAOwC;;AAER,SAAS9B,SAASH,OAAOoE,UAAU,EAAE,EAAE;CACtC,MAAM5B,cAAclD,OAAOU,MAAME,KAAK,CAAC;CACvC,MAAM,EAAEoB,MAAM+C,OAAO,CAACrE,OAAOsB,KAAI,KAAM8C;CACvC,MAAME,YAAYnF,aAAaoF,aAAa;EAC3C,MAAMC,cAAcjE,UAAU;AAC7B,OAAIiC,YAAYK,YAAYtC,MAAO;AACnCiC,eAAYK,UAAUtC;AACtBgE,aAAU;;AAEXC,aAAWxE,MAAMO,MAAM;AACvB,MAAIe,MAAMN,OAAQ,QAAO9B,WAAWc,OAAOsB,MAAMkD,WAAW;AAC5D,SAAOxE,MAAMkD,OAAOsB,WAAW;IAC7BH,KAAK;CACR,MAAMnE,YAAYsC,YAAYK;AAC9B,QAAOtD,qBAAqB+E,WAAWpE,WAAW;AACjD,SAAOA,KAAK;GACX;;;;;AC9IH,SAAgB4E,8BAA8BC,SAA8C,EAAE,EAAE;AAC9F,QAAOJ,UAAUC,+BAA+BG,OAAO,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { c as FragnoClientError, d as InferOr, h as QueryParamsHint, l as NonGetHTTPMethod, m as MaybeExtractPathParamsOrWiden, n as GitHubAppFragmentPublicClientConfig, s as ReadableAtom } from "../types-BzeSSOQU.js";
|
|
2
|
+
import * as zod from "zod";
|
|
3
|
+
import { Accessor } from "solid-js";
|
|
4
|
+
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
8
|
+
//#region ../fragno/dist/client/solid.d.ts
|
|
9
|
+
type FragnoSolidMutator<_TMethod extends NonGetHTTPMethod, TPath$1 extends string, TInputSchema extends StandardSchemaV1 | undefined, TOutputSchema$1 extends StandardSchemaV1 | undefined, TErrorCode$1 extends string, TQueryParameters$1 extends string> = () => {
|
|
10
|
+
mutate: (args: {
|
|
11
|
+
body?: InferOr<TInputSchema, undefined>;
|
|
12
|
+
path?: MaybeExtractPathParamsOrWiden<TPath$1, string | Accessor<string> | ReadableAtom<string>>;
|
|
13
|
+
query?: QueryParamsHint<TQueryParameters$1, string | Accessor<string> | ReadableAtom<string>>;
|
|
14
|
+
}) => Promise<InferOr<TOutputSchema$1, undefined>>;
|
|
15
|
+
loading: Accessor<boolean | undefined>;
|
|
16
|
+
error: Accessor<FragnoClientError<TErrorCode$1[number]> | undefined>;
|
|
17
|
+
data: Accessor<InferOr<TOutputSchema$1, undefined>>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Type guard to check if a value is a SolidJS Accessor.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/client/solid.d.ts
|
|
26
|
+
declare function createGitHubAppFragmentClient(config?: GitHubAppFragmentPublicClientConfig): {
|
|
27
|
+
useSyncInstallation: FragnoSolidMutator<NonGetHTTPMethod, "/installations/:installationId/sync", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
|
|
28
|
+
added: zod.ZodNumber;
|
|
29
|
+
removed: zod.ZodNumber;
|
|
30
|
+
updated: zod.ZodNumber;
|
|
31
|
+
}, zod_v4_core0.$strip> | undefined, "INSTALLATION_NOT_FOUND" | "GITHUB_API_ERROR", string>;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createGitHubAppFragmentClient };
|
|
35
|
+
//# sourceMappingURL=solid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solid.d.ts","names":["MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","NonGetHTTPMethod","FragnoClientError","FragnoClientHookData","FragnoClientMutatorData","FragnoStoreData","FragnoStoreFactoryData","FragnoStoreObjectData","ReadableAtom","Store","StoreValue","Accessor","StandardSchemaV1","FragnoSolidHook","_TMethod","TPath$1","TOutputSchema$1","TErrorCode$1","TQueryParameters$1","path","query","args","data","loading","error","FragnoSolidMutator","TInputSchema","Promise","mutate","body","isAccessor","value","accessorToAtom","T$1","accessor","FragnoSolidStoreValue","K","FragnoSolidStaticStore","FragnoSolidStore","TStore","TArgs","T","useFragno","Record","TPath","TOutputSchema","TErrorCode","TQueryParameters","TMethod","TInput","TOutput","TError","clientObj"],"sources":["../../../../fragno/dist/client/solid.d.ts","../../../src/client/solid.ts"],"mappings":";;;;;;;;KAkBK2B,kBAAAA,kBAAoCxB,gBAAAA,+CAA+DW,gBAAAA,sCAAsDA,gBAAAA;EAC5JgB,MAAAA,GAASP,IAAAA;IACPQ,IAAAA,GAAO7B,OAAAA,CAAQ0B,YAAAA;IACfP,IAAAA,GAAOrB,6BAAAA,CAA8BiB,OAAAA,WAAkBJ,QAAAA,WAAmBH,YAAAA;IAC1EY,KAAAA,GAAQrB,eAAAA,CAAgBmB,kBAAAA,WAA6BP,QAAAA,WAAmBH,YAAAA;EAAAA,MACpEmB,OAAAA,CAAQ3B,OAAAA,CAAQgB,eAAAA;EACtBO,OAAAA,EAASZ,QAAAA;EACTa,KAAAA,EAAOb,QAAAA,CAAST,iBAAAA,CAAkBe,YAAAA;EAClCK,IAAAA,EAAMX,QAAAA,CAASX,OAAAA,CAAQgB,eAAAA;AAAAA;;;;;;;;iBCrBT,6BAAA,CAA8B,MAAA,GAAQ,mCAAA;0CAAwC,gBAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { c as isMutatorHook, d as isReadableAtom, i as createGitHubAppFragmentClients, l as isStore, s as isGetHook, u as atom } from "../factory-BIj4C6PD.js";
|
|
2
|
+
import "../index.js";
|
|
3
|
+
import { createEffect, onCleanup } from "solid-js";
|
|
4
|
+
import { createStore, reconcile } from "solid-js/store";
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.1.0_solid-js@1.9.10/node_modules/@nanostores/solid/dist/index.js
|
|
7
|
+
function m(e, o = {}) {
|
|
8
|
+
let t = e.listen(() => {}), [r, s] = createStore({ value: e.get() }), n = e.subscribe((i) => {
|
|
9
|
+
s("value", reconcile(i, o));
|
|
10
|
+
});
|
|
11
|
+
return onCleanup(() => n()), t(), () => r.value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../fragno/dist/client/solid.js
|
|
16
|
+
/**
|
|
17
|
+
* Type guard to check if a value is a SolidJS Accessor.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
function isAccessor(value) {
|
|
22
|
+
return typeof value === "function";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts a SolidJS Accessor to a NanoStore Atom.
|
|
26
|
+
*
|
|
27
|
+
* This is used to convert SolidJS accessors to atoms, so that we can use them in the store.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
function accessorToAtom(accessor) {
|
|
32
|
+
const a = /* @__PURE__ */ atom(accessor());
|
|
33
|
+
createEffect(() => {
|
|
34
|
+
a.set(accessor());
|
|
35
|
+
});
|
|
36
|
+
return a;
|
|
37
|
+
}
|
|
38
|
+
function createSolidHook(hook) {
|
|
39
|
+
return ({ path, query } = {}) => {
|
|
40
|
+
const pathParams = {};
|
|
41
|
+
const queryParams = {};
|
|
42
|
+
for (const [key, value] of Object.entries(path ?? {})) {
|
|
43
|
+
const v = value;
|
|
44
|
+
pathParams[key] = isAccessor(v) ? accessorToAtom(v) : v;
|
|
45
|
+
}
|
|
46
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
47
|
+
const v = value;
|
|
48
|
+
queryParams[key] = isAccessor(v) ? accessorToAtom(v) : v;
|
|
49
|
+
}
|
|
50
|
+
const storeValue = m(hook.store({
|
|
51
|
+
path: pathParams,
|
|
52
|
+
query: queryParams
|
|
53
|
+
}));
|
|
54
|
+
return {
|
|
55
|
+
data: () => storeValue().data,
|
|
56
|
+
loading: () => storeValue().loading,
|
|
57
|
+
error: () => storeValue().error
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createSolidMutator(hook) {
|
|
62
|
+
return () => {
|
|
63
|
+
const store = m(hook.mutatorStore);
|
|
64
|
+
const mutate = async (args) => {
|
|
65
|
+
const { body, path, query } = args;
|
|
66
|
+
const pathParams = {};
|
|
67
|
+
const queryParams = {};
|
|
68
|
+
for (const [key, value] of Object.entries(path ?? {})) {
|
|
69
|
+
const v = value;
|
|
70
|
+
pathParams[key] = isAccessor(v) ? v() : v;
|
|
71
|
+
}
|
|
72
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
73
|
+
const v = value;
|
|
74
|
+
queryParams[key] = isAccessor(v) ? v() : v;
|
|
75
|
+
}
|
|
76
|
+
return hook.mutatorStore.mutate({
|
|
77
|
+
body,
|
|
78
|
+
path: pathParams,
|
|
79
|
+
query: queryParams
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
mutate,
|
|
84
|
+
data: () => store().data,
|
|
85
|
+
loading: () => store().loading,
|
|
86
|
+
error: () => store().error
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function unwrapSolidStoreValue(value) {
|
|
91
|
+
if (isReadableAtom(value)) return m(value);
|
|
92
|
+
const result = {};
|
|
93
|
+
for (const key in value) {
|
|
94
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
95
|
+
const fieldValue = value[key];
|
|
96
|
+
if (isReadableAtom(fieldValue)) result[key] = m(fieldValue);
|
|
97
|
+
else result[key] = fieldValue;
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
function createSolidStore(hook) {
|
|
102
|
+
if ("obj" in hook) {
|
|
103
|
+
if (isReadableAtom(hook.obj)) return m(hook.obj);
|
|
104
|
+
return () => unwrapSolidStoreValue(hook.obj);
|
|
105
|
+
}
|
|
106
|
+
return (...args) => {
|
|
107
|
+
const value = hook.factory(...args);
|
|
108
|
+
const disposer = value[Symbol.dispose];
|
|
109
|
+
if (typeof disposer === "function") onCleanup(() => {
|
|
110
|
+
disposer.call(value);
|
|
111
|
+
});
|
|
112
|
+
return unwrapSolidStoreValue(value);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function useFragno(clientObj) {
|
|
116
|
+
const result = {};
|
|
117
|
+
for (const key in clientObj) {
|
|
118
|
+
if (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;
|
|
119
|
+
const hook = clientObj[key];
|
|
120
|
+
if (isGetHook(hook)) result[key] = createSolidHook(hook);
|
|
121
|
+
else if (isMutatorHook(hook)) result[key] = createSolidMutator(hook);
|
|
122
|
+
else if (isStore(hook)) result[key] = createSolidStore(hook);
|
|
123
|
+
else result[key] = hook;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/client/solid.ts
|
|
130
|
+
function createGitHubAppFragmentClient(config = {}) {
|
|
131
|
+
return useFragno(createGitHubAppFragmentClients(config));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
export { createGitHubAppFragmentClient };
|
|
136
|
+
//# sourceMappingURL=solid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solid.js","names":["createStore","c","reconcile","u","onCleanup","S","m","e","o","t","listen","r","s","value","get","n","subscribe","i","useStore","isReadableAtom","isGetHook","isMutatorHook","isStore","atom","createEffect","onCleanup","useStore","isAccessor","value","accessorToAtom","accessor","a","set","createSolidHook","hook","path","query","pathParams","queryParams","key","Object","entries","v","storeValue","store","data","loading","error","createSolidMutator","mutatorStore","mutate","args","body","unwrapSolidStoreValue","result","prototype","hasOwnProperty","call","fieldValue","createSolidStore","obj","factory","disposer","Symbol","dispose","useFragno","clientObj","useFragno","createGitHubAppFragmentClients","GitHubAppFragmentPublicClientConfig","createGitHubAppFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/@nanostores+solid@1.1.1_nanostores@1.1.0_solid-js@1.9.10/node_modules/@nanostores/solid/dist/index.js","../../../../fragno/dist/client/solid.js","../../../src/client/solid.ts"],"sourcesContent":["import{createStore as c,reconcile as u}from\"solid-js/store\";import{onCleanup as S}from\"solid-js\";function m(e,o={}){let t=e.listen(()=>{}),[r,s]=c({value:e.get()}),n=e.subscribe(i=>{s(\"value\",u(i,o))});return S(()=>n()),t(),()=>r.value}export{m as useStore};\n","import { isReadableAtom } from \"../util/nanostores.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { atom } from \"nanostores\";\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { useStore } from \"@nanostores/solid\";\n\n//#region src/client/solid.ts\n/**\n* Type guard to check if a value is a SolidJS Accessor.\n*\n* @private\n*/\nfunction isAccessor(value) {\n\treturn typeof value === \"function\";\n}\n/**\n* Converts a SolidJS Accessor to a NanoStore Atom.\n*\n* This is used to convert SolidJS accessors to atoms, so that we can use them in the store.\n*\n* @private\n*/\nfunction accessorToAtom(accessor) {\n\tconst a = atom(accessor());\n\tcreateEffect(() => {\n\t\ta.set(accessor());\n\t});\n\treturn a;\n}\nfunction createSolidHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParams = {};\n\t\tconst queryParams = {};\n\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\tconst v = value;\n\t\t\tpathParams[key] = isAccessor(v) ? accessorToAtom(v) : v;\n\t\t}\n\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\tconst v = value;\n\t\t\tqueryParams[key] = isAccessor(v) ? accessorToAtom(v) : v;\n\t\t}\n\t\tconst storeValue = useStore(hook.store({\n\t\t\tpath: pathParams,\n\t\t\tquery: queryParams\n\t\t}));\n\t\treturn {\n\t\t\tdata: () => storeValue().data,\n\t\t\tloading: () => storeValue().loading,\n\t\t\terror: () => storeValue().error\n\t\t};\n\t};\n}\nfunction createSolidMutator(hook) {\n\treturn () => {\n\t\tconst store = useStore(hook.mutatorStore);\n\t\tconst mutate = async (args) => {\n\t\t\tconst { body, path, query } = args;\n\t\t\tconst pathParams = {};\n\t\t\tconst queryParams = {};\n\t\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tpathParams[key] = isAccessor(v) ? v() : v;\n\t\t\t}\n\t\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tqueryParams[key] = isAccessor(v) ? v() : v;\n\t\t\t}\n\t\t\treturn hook.mutatorStore.mutate({\n\t\t\t\tbody,\n\t\t\t\tpath: pathParams,\n\t\t\t\tquery: queryParams\n\t\t\t});\n\t\t};\n\t\treturn {\n\t\t\tmutate,\n\t\t\tdata: () => store().data,\n\t\t\tloading: () => store().loading,\n\t\t\terror: () => store().error\n\t\t};\n\t};\n}\nfunction unwrapSolidStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst result = {};\n\tfor (const key in value) {\n\t\tif (!Object.prototype.hasOwnProperty.call(value, key)) continue;\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) result[key] = useStore(fieldValue);\n\t\telse result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction createSolidStore(hook) {\n\tif (\"obj\" in hook) {\n\t\tif (isReadableAtom(hook.obj)) return useStore(hook.obj);\n\t\treturn (() => unwrapSolidStoreValue(hook.obj));\n\t}\n\treturn ((...args) => {\n\t\tconst value = hook.factory(...args);\n\t\tconst disposer = value[Symbol.dispose];\n\t\tif (typeof disposer === \"function\") onCleanup(() => {\n\t\t\tdisposer.call(value);\n\t\t});\n\t\treturn unwrapSolidStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createSolidHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createSolidMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createSolidStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\n\n//#endregion\nexport { accessorToAtom, isAccessor, useFragno };\n//# sourceMappingURL=solid.js.map","import { useFragno } from \"@fragno-dev/core/solid\";\n\nimport { createGitHubAppFragmentClients } from \"..\";\nimport type { GitHubAppFragmentPublicClientConfig } from \"../github/types\";\n\nexport function createGitHubAppFragmentClient(config: GitHubAppFragmentPublicClientConfig = {}) {\n return useFragno(createGitHubAppFragmentClients(config));\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAAiG,SAASM,EAAEC,GAAEC,IAAE,EAAE,EAAC;CAAC,IAAIC,IAAEF,EAAEG,aAAW,GAAG,EAAC,CAACC,GAAEC,KAAGX,YAAE,EAACY,OAAMN,EAAEO,KAAI,EAAE,CAAC,EAACC,IAAER,EAAES,WAAUC,MAAG;AAACL,IAAE,SAAQT,UAAEc,GAAET,EAAE,CAAC;GAAE;AAAC,QAAOH,gBAAMU,GAAG,CAAC,EAACN,GAAG,QAAKE,EAAEE;;;;;;;;;;ACYtO,SAASc,WAAWC,OAAO;AAC1B,QAAO,OAAOA,UAAU;;;;;;;;;AASzB,SAASC,eAAeC,UAAU;CACjC,MAAMC,IAAIR,qBAAKO,UAAU,CAAC;AAC1BN,oBAAmB;AA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Of,OAAOoB,iBAAiBzB,KAAK;MACvDoB,QAAOf,OAAOL;;AAEpB,QAAOoB;;;;;AC/GR,SAAgBgB,8BAA8BC,SAA8C,EAAE,EAAE;AAC9F,QAAOJ,UAAUC,+BAA+BG,OAAO,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { c as FragnoClientError, d as InferOr, h as QueryParamsHint, l as NonGetHTTPMethod, m as MaybeExtractPathParamsOrWiden, n as GitHubAppFragmentPublicClientConfig, s as ReadableAtom } from "../types-BzeSSOQU.js";
|
|
2
|
+
import * as zod from "zod";
|
|
3
|
+
import { Readable } from "svelte/store";
|
|
4
|
+
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
8
|
+
//#region ../fragno/dist/client/client.svelte.d.ts
|
|
9
|
+
type FragnoSvelteMutator<_TMethod extends NonGetHTTPMethod, TPath$1 extends string, TInputSchema$1 extends StandardSchemaV1 | undefined, TOutputSchema$1 extends StandardSchemaV1 | undefined, TErrorCode$1 extends string, TQueryParameters$1 extends string> = () => {
|
|
10
|
+
mutate: (args: {
|
|
11
|
+
body?: InferOr<TInputSchema$1, undefined>;
|
|
12
|
+
path?: MaybeExtractPathParamsOrWiden<TPath$1, string | Readable<string> | ReadableAtom<string> | (() => string)>;
|
|
13
|
+
query?: QueryParamsHint<TQueryParameters$1, string | Readable<string> | ReadableAtom<string> | (() => string)>;
|
|
14
|
+
}) => Promise<InferOr<TOutputSchema$1, undefined>>;
|
|
15
|
+
loading: Readable<boolean | undefined>;
|
|
16
|
+
error: Readable<FragnoClientError<TErrorCode$1[number]> | undefined>;
|
|
17
|
+
data: Readable<InferOr<TOutputSchema$1, undefined>>;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/client/svelte.d.ts
|
|
21
|
+
declare function createGitHubAppFragmentClient(config?: GitHubAppFragmentPublicClientConfig): {
|
|
22
|
+
useSyncInstallation: FragnoSvelteMutator<NonGetHTTPMethod, "/installations/:installationId/sync", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
|
|
23
|
+
added: zod.ZodNumber;
|
|
24
|
+
removed: zod.ZodNumber;
|
|
25
|
+
updated: zod.ZodNumber;
|
|
26
|
+
}, zod_v4_core0.$strip> | undefined, "INSTALLATION_NOT_FOUND" | "GITHUB_API_ERROR", string>;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { createGitHubAppFragmentClient };
|
|
30
|
+
//# sourceMappingURL=svelte.d.ts.map
|