@fragno-dev/github-app-fragment 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE.md +16 -0
  2. package/README.md +163 -0
  3. package/bin/run.js +5 -0
  4. package/dist/browser/client/react.d.ts +37 -0
  5. package/dist/browser/client/react.d.ts.map +1 -0
  6. package/dist/browser/client/react.js +166 -0
  7. package/dist/browser/client/react.js.map +1 -0
  8. package/dist/browser/client/solid.d.ts +35 -0
  9. package/dist/browser/client/solid.d.ts.map +1 -0
  10. package/dist/browser/client/solid.js +136 -0
  11. package/dist/browser/client/solid.js.map +1 -0
  12. package/dist/browser/client/svelte.d.ts +30 -0
  13. package/dist/browser/client/svelte.d.ts.map +1 -0
  14. package/dist/browser/client/svelte.js +134 -0
  15. package/dist/browser/client/svelte.js.map +1 -0
  16. package/dist/browser/client/vanilla.d.ts +16 -0
  17. package/dist/browser/client/vanilla.d.ts.map +1 -0
  18. package/dist/browser/client/vanilla.js +11 -0
  19. package/dist/browser/client/vanilla.js.map +1 -0
  20. package/dist/browser/client/vue.d.ts +33 -0
  21. package/dist/browser/client/vue.d.ts.map +1 -0
  22. package/dist/browser/client/vue.js +133 -0
  23. package/dist/browser/client/vue.js.map +1 -0
  24. package/dist/browser/factory-BIj4C6PD.js +2210 -0
  25. package/dist/browser/factory-BIj4C6PD.js.map +1 -0
  26. package/dist/browser/index.d.ts +343 -0
  27. package/dist/browser/index.d.ts.map +1 -0
  28. package/dist/browser/index.js +3 -0
  29. package/dist/browser/types-BzeSSOQU.d.ts +660 -0
  30. package/dist/browser/types-BzeSSOQU.d.ts.map +1 -0
  31. package/dist/cli/commands/installations.js +92 -0
  32. package/dist/cli/commands/installations.js.map +1 -0
  33. package/dist/cli/commands/pulls.js +123 -0
  34. package/dist/cli/commands/pulls.js.map +1 -0
  35. package/dist/cli/commands/repositories.js +105 -0
  36. package/dist/cli/commands/repositories.js.map +1 -0
  37. package/dist/cli/commands/serve.js +187 -0
  38. package/dist/cli/commands/serve.js.map +1 -0
  39. package/dist/cli/commands/webhooks.js +122 -0
  40. package/dist/cli/commands/webhooks.js.map +1 -0
  41. package/dist/cli/github/api.js +94 -0
  42. package/dist/cli/github/api.js.map +1 -0
  43. package/dist/cli/github/definition.js +15 -0
  44. package/dist/cli/github/definition.js.map +1 -0
  45. package/dist/cli/github/factory.js +12 -0
  46. package/dist/cli/github/factory.js.map +1 -0
  47. package/dist/cli/github/repo-sync.js +33 -0
  48. package/dist/cli/github/repo-sync.js.map +1 -0
  49. package/dist/cli/github/utils.js +23 -0
  50. package/dist/cli/github/utils.js.map +1 -0
  51. package/dist/cli/github/webhook-processing.js +247 -0
  52. package/dist/cli/github/webhook-processing.js.map +1 -0
  53. package/dist/cli/index.d.ts +5 -0
  54. package/dist/cli/index.d.ts.map +1 -0
  55. package/dist/cli/index.js +263 -0
  56. package/dist/cli/index.js.map +1 -0
  57. package/dist/cli/routes.js +718 -0
  58. package/dist/cli/routes.js.map +1 -0
  59. package/dist/cli/schema.js +47 -0
  60. package/dist/cli/schema.js.map +1 -0
  61. package/dist/cli/utils/client.js +120 -0
  62. package/dist/cli/utils/client.js.map +1 -0
  63. package/dist/cli/utils/config.js +113 -0
  64. package/dist/cli/utils/config.js.map +1 -0
  65. package/dist/cli/utils/options.js +90 -0
  66. package/dist/cli/utils/options.js.map +1 -0
  67. package/dist/cli/utils/output.js +12 -0
  68. package/dist/cli/utils/output.js.map +1 -0
  69. package/dist/node/github/api.d.ts +52 -0
  70. package/dist/node/github/api.d.ts.map +1 -0
  71. package/dist/node/github/api.js +94 -0
  72. package/dist/node/github/api.js.map +1 -0
  73. package/dist/node/github/clients.d.ts +19 -0
  74. package/dist/node/github/clients.d.ts.map +1 -0
  75. package/dist/node/github/clients.js +12 -0
  76. package/dist/node/github/clients.js.map +1 -0
  77. package/dist/node/github/definition.d.ts +33 -0
  78. package/dist/node/github/definition.d.ts.map +1 -0
  79. package/dist/node/github/definition.js +15 -0
  80. package/dist/node/github/definition.js.map +1 -0
  81. package/dist/node/github/factory.d.ts +139 -0
  82. package/dist/node/github/factory.d.ts.map +1 -0
  83. package/dist/node/github/factory.js +18 -0
  84. package/dist/node/github/factory.js.map +1 -0
  85. package/dist/node/github/repo-sync.js +33 -0
  86. package/dist/node/github/repo-sync.js.map +1 -0
  87. package/dist/node/github/types.d.ts +24 -0
  88. package/dist/node/github/types.d.ts.map +1 -0
  89. package/dist/node/github/utils.js +23 -0
  90. package/dist/node/github/utils.js.map +1 -0
  91. package/dist/node/github/webhook-processing.d.ts +15 -0
  92. package/dist/node/github/webhook-processing.d.ts.map +1 -0
  93. package/dist/node/github/webhook-processing.js +247 -0
  94. package/dist/node/github/webhook-processing.js.map +1 -0
  95. package/dist/node/index.d.ts +7 -0
  96. package/dist/node/index.js +6 -0
  97. package/dist/node/routes.d.ts +127 -0
  98. package/dist/node/routes.d.ts.map +1 -0
  99. package/dist/node/routes.js +718 -0
  100. package/dist/node/routes.js.map +1 -0
  101. package/dist/node/schema.js +47 -0
  102. package/dist/node/schema.js.map +1 -0
  103. package/dist/tsconfig.tsbuildinfo +1 -0
  104. package/package.json +114 -0
@@ -0,0 +1,660 @@
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import { EmitterWebhookEvent, EmitterWebhookEventName } from "@octokit/webhooks";
3
+
4
+ //#region ../fragno/dist/api/internal/path.d.ts
5
+ //#region src/api/internal/path.d.ts
6
+ type SplitPath<T extends string> = T extends `${infer First}/${infer Rest}` ? First extends "" ? SplitPath<Rest> : [First, ...SplitPath<Rest>] : T extends "" ? [] : [T];
7
+ type ExtractParam<T extends string> = T extends `:${infer Name}` ? Name : T extends `**:${infer Name}` ? Name : T extends "**" ? "**" : never;
8
+ type ExtractParamsFromSegments<T extends readonly string[]> = T extends readonly [infer First, ...infer Rest] ? First extends string ? Rest extends readonly string[] ? ExtractParam<First> | ExtractParamsFromSegments<Rest> : ExtractParam<First> : never : never;
9
+ /**
10
+ * Type helper to extract path parameters from a const string path
11
+ *
12
+ * Supports:
13
+ * - Regular paths: "/path" -> never
14
+ * - Named parameters: "/path/:name" -> "name"
15
+ * - Wildcard paths: "/path/foo/**" -> "**"
16
+ * - Named wildcard paths: "/path/foo/**:name" -> "name"
17
+ * - String (narrows): string -> never
18
+ */
19
+ type ExtractPathParams<T extends string, ValueType = string> = ExtractParamsFromSegments<SplitPath<T>> extends never ? Record<string, never> : Record<ExtractParamsFromSegments<SplitPath<T>>, ValueType>;
20
+ /**
21
+ * Same as @see ExtractPathParams, but returns `Record<string, ValueType>` when a string is
22
+ * passed in.
23
+ */
24
+ type ExtractPathParamsOrWiden<T extends string, ValueType = string> = string extends T ? Record<string, ValueType> : ExtractPathParams<T, ValueType>;
25
+ /**
26
+ * Same as @see ExtractPathParamsOrWiden, but returns `undefined` when no path parameters in the
27
+ * const.
28
+ */
29
+ type MaybeExtractPathParamsOrWiden<T extends string, ValueType = string> = HasPathParams<T> extends true ? ExtractPathParamsOrWiden<T, ValueType> : undefined;
30
+ type ExtractPathParamNames<T extends string> = ExtractParamsFromSegments<SplitPath<T>>;
31
+ type HasPathParams<T extends string> = ExtractPathParamNames<T> extends never ? false : true;
32
+ /**
33
+ * Creates a query parameters type where the specified keys are hints (optional)
34
+ * and additional string keys are also allowed.
35
+ *
36
+ * This allows for flexible query parameter typing where:
37
+ * - All hinted parameters are optional
38
+ * - Additional parameters beyond the hints are allowed
39
+ * - Values can be of any specified type (defaults to string)
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * type MyQuery = QueryParamsHint<"page" | "limit", string>;
44
+ * // Allows: { page?: string, limit?: string, [key: string]: string }
45
+ *
46
+ * const query1: MyQuery = {}; // Valid - no params required
47
+ * const query2: MyQuery = { page: "1" }; // Valid - hinted param
48
+ * const query3: MyQuery = { page: "1", sort: "asc" }; // Valid - additional param
49
+ * ```
50
+ */
51
+ type QueryParamsHint<TQueryParameters extends string, ValueType = string> = Partial<Record<TQueryParameters, ValueType>> & Record<string, ValueType | undefined>; //#endregion
52
+ //#endregion
53
+ //#region ../fragno/dist/api/mutable-request-state.d.ts
54
+ //#region src/api/mutable-request-state.d.ts
55
+ /**
56
+ * Holds mutable request state that can be modified by middleware and consumed by handlers.
57
+ *
58
+ * This class provides a structural way for middleware to modify request data:
59
+ * - Path parameters can be modified
60
+ * - Query/search parameters can be modified
61
+ * - Request body can be overridden
62
+ * - Request headers can be modified
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // In middleware
67
+ * const state = new MutableRequestState({
68
+ * pathParams: { id: "123" },
69
+ * searchParams: new URLSearchParams("?role=user"),
70
+ * body: { name: "John" },
71
+ * headers: new Headers()
72
+ * });
73
+ *
74
+ * // Modify query parameters
75
+ * state.searchParams.set("role", "admin");
76
+ *
77
+ * // Override body
78
+ * state.setBody({ name: "Jane" });
79
+ *
80
+ * // Modify headers
81
+ * state.headers.set("X-Custom", "value");
82
+ * ```
83
+ */
84
+ declare class MutableRequestState {
85
+ #private;
86
+ constructor(config: {
87
+ pathParams: Record<string, string>;
88
+ searchParams: URLSearchParams;
89
+ body: RequestBodyType;
90
+ headers: Headers;
91
+ });
92
+ /**
93
+ * Path parameters extracted from the route.
94
+ * Can be modified directly (e.g., `state.pathParams.id = "456"`).
95
+ */
96
+ get pathParams(): Record<string, string>;
97
+ /**
98
+ * URLSearchParams for query parameters.
99
+ * Can be modified using URLSearchParams API (e.g., `state.searchParams.set("key", "value")`).
100
+ */
101
+ get searchParams(): URLSearchParams;
102
+ /**
103
+ * Request headers.
104
+ * Can be modified using Headers API (e.g., `state.headers.set("X-Custom", "value")`).
105
+ */
106
+ get headers(): Headers;
107
+ /**
108
+ * Get the current body value.
109
+ * Returns the override if set, otherwise the initial body.
110
+ */
111
+ get body(): RequestBodyType;
112
+ /**
113
+ * Override the request body.
114
+ * This allows middleware to replace the body that will be seen by the handler.
115
+ *
116
+ * @param body - The new body value
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * // In middleware
121
+ * state.setBody({ modifiedField: "new value" });
122
+ * ```
123
+ */
124
+ setBody(body: RequestBodyType): void;
125
+ /**
126
+ * Check if the body has been overridden by middleware.
127
+ */
128
+ get hasBodyOverride(): boolean;
129
+ } //#endregion
130
+ //#endregion
131
+ //#region ../fragno/dist/api/request-input-context.d.ts
132
+ //#region src/api/request-input-context.d.ts
133
+ type RequestBodyType = unknown | FormData | Blob | ReadableStream<Uint8Array> | null | undefined;
134
+ declare class RequestInputContext<TPath extends string = string, TInputSchema extends StandardSchemaV1 | undefined = undefined> {
135
+ #private;
136
+ constructor(config: {
137
+ path: TPath;
138
+ method: string;
139
+ pathParams: ExtractPathParams<TPath>;
140
+ searchParams: URLSearchParams;
141
+ parsedBody: RequestBodyType;
142
+ rawBody?: string;
143
+ headers: Headers;
144
+ request?: Request;
145
+ inputSchema?: TInputSchema;
146
+ shouldValidateInput?: boolean;
147
+ });
148
+ /**
149
+ * Create a RequestContext from a Request object for server-side handling
150
+ */
151
+ static fromRequest<TPath extends string, TInputSchema extends StandardSchemaV1 | undefined = undefined>(config: {
152
+ request: Request;
153
+ method: string;
154
+ path: TPath;
155
+ pathParams: ExtractPathParams<TPath>;
156
+ inputSchema?: TInputSchema;
157
+ shouldValidateInput?: boolean;
158
+ state: MutableRequestState;
159
+ rawBody?: string;
160
+ }): Promise<RequestInputContext<TPath, TInputSchema>>;
161
+ /**
162
+ * Create a RequestContext for server-side rendering contexts (no Request object)
163
+ */
164
+ static fromSSRContext<TPath extends string, TInputSchema extends StandardSchemaV1 | undefined = undefined>(config: {
165
+ method: "GET";
166
+ path: TPath;
167
+ pathParams: ExtractPathParams<TPath>;
168
+ searchParams?: URLSearchParams;
169
+ headers?: Headers;
170
+ } | {
171
+ method: Exclude<HTTPMethod, "GET">;
172
+ path: TPath;
173
+ pathParams: ExtractPathParams<TPath>;
174
+ searchParams?: URLSearchParams;
175
+ headers?: Headers;
176
+ body: RequestBodyType;
177
+ inputSchema?: TInputSchema;
178
+ }): RequestInputContext<TPath, TInputSchema>;
179
+ /**
180
+ * The HTTP method as string (e.g., `GET`, `POST`)
181
+ */
182
+ get method(): string;
183
+ /**
184
+ * The matched route path (e.g., `/users/:id`)
185
+ * @remarks `string`
186
+ */
187
+ get path(): TPath;
188
+ /**
189
+ * Extracted path parameters as object (e.g., `{ id: '123' }`)
190
+ * @remarks `Record<string, string>`
191
+ */
192
+ get pathParams(): ExtractPathParams<TPath>;
193
+ /**
194
+ * [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) object for query parameters
195
+ * @remarks `URLSearchParams`
196
+ */
197
+ get query(): URLSearchParams;
198
+ /**
199
+ * [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object for request headers
200
+ * @remarks `Headers`
201
+ */
202
+ get headers(): Headers;
203
+ get rawBody(): string | undefined;
204
+ /**
205
+ * Access the request body as FormData.
206
+ *
207
+ * Use this method when handling file uploads or multipart form submissions.
208
+ * The request must have been sent with Content-Type: multipart/form-data.
209
+ *
210
+ * @throws Error if the request body is not FormData
211
+ *
212
+ * @example
213
+ * ```typescript
214
+ * defineRoute({
215
+ * method: "POST",
216
+ * path: "/upload",
217
+ * async handler(ctx, res) {
218
+ * const formData = ctx.formData();
219
+ * const file = formData.get("file") as File;
220
+ * const description = formData.get("description") as string;
221
+ * // ... process file
222
+ * }
223
+ * });
224
+ * ```
225
+ */
226
+ formData(): FormData;
227
+ /**
228
+ * Check if the request body is FormData.
229
+ *
230
+ * Useful for routes that accept both JSON and FormData payloads.
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * defineRoute({
235
+ * method: "POST",
236
+ * path: "/upload",
237
+ * async handler(ctx, res) {
238
+ * if (ctx.isFormData()) {
239
+ * const formData = ctx.formData();
240
+ * // handle file upload
241
+ * } else {
242
+ * const json = await ctx.input.valid();
243
+ * // handle JSON payload
244
+ * }
245
+ * }
246
+ * });
247
+ * ```
248
+ */
249
+ isFormData(): boolean;
250
+ /**
251
+ * Access the request body as a ReadableStream (application/octet-stream).
252
+ *
253
+ * @throws Error if the request body is not a ReadableStream
254
+ */
255
+ bodyStream(): ReadableStream<Uint8Array>;
256
+ /**
257
+ * Check if the request body is a ReadableStream.
258
+ */
259
+ isBodyStream(): boolean;
260
+ /**
261
+ * Input validation context (only if inputSchema is defined)
262
+ * @remarks `InputContext`
263
+ */
264
+ get input(): TInputSchema extends undefined ? undefined : {
265
+ schema: TInputSchema;
266
+ valid: () => Promise<TInputSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TInputSchema> : unknown>;
267
+ };
268
+ } //#endregion
269
+ //#endregion
270
+ //#region ../fragno/dist/http/http-status.d.ts
271
+ //#region src/http/http-status.d.ts
272
+ /**
273
+ * @module
274
+ * HTTP Status utility.
275
+ *
276
+ * Modified from honojs/hono
277
+ * Original source: https://github.com/honojs/hono/blob/0e3db674ad3f40be215a55a18062dd8e387ce525/src/utils/http-status.ts
278
+ * License: MIT
279
+ * Date obtained: August 28 2025
280
+ * Copyright (c) 2021-present Yusuke Wada and Hono contributors
281
+ *
282
+ */
283
+ type InfoStatusCode = 100 | 101 | 102 | 103;
284
+ type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
285
+ type DeprecatedStatusCode = 305 | 306;
286
+ type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
287
+ type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
288
+ type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
289
+ /**
290
+ * If you want to use an unofficial status, use `UnofficialStatusCode`.
291
+ */
292
+ type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode;
293
+ type ContentlessStatusCode = 101 | 204 | 205 | 304; //#endregion
294
+ //#endregion
295
+ //#region ../fragno/dist/util/types-util.d.ts
296
+ //#region src/util/types-util.d.ts
297
+ type InferOr<T, U> = T extends NonNullable<StandardSchemaV1> ? StandardSchemaV1.InferOutput<T> : T extends undefined ? U : U;
298
+ type InferOrUnknown<T> = InferOr<T, unknown>; //#endregion
299
+ //#endregion
300
+ //#region ../fragno/dist/api/internal/response-stream.d.ts
301
+ //#region src/api/internal/response-stream.d.ts
302
+ /**
303
+ * @module
304
+ * Stream utility.
305
+ *
306
+ * Modified from honojs/hono
307
+ * Original source: https://github.com/honojs/hono/blob/0e3db674ad3f40be215a55a18062dd8e387ce525/src/utils/stream.ts
308
+ * License: MIT
309
+ * Date obtained: August 28 2025
310
+ * Copyright (c) 2021-present Yusuke Wada and Hono contributors
311
+ */
312
+ type Error$1<Message extends string> = {
313
+ __errorMessage: Message;
314
+ };
315
+ declare class ResponseStream<TArray> {
316
+ #private;
317
+ /**
318
+ * Whether the stream has been aborted.
319
+ */
320
+ get aborted(): boolean;
321
+ /**
322
+ * Whether the stream has been closed normally.
323
+ */
324
+ get closed(): boolean;
325
+ /**
326
+ * The readable stream that the response is piped to.
327
+ */
328
+ get responseReadable(): ReadableStream;
329
+ constructor(writable: WritableStream, readable: ReadableStream);
330
+ writeRaw(input: Uint8Array | string): Promise<void>;
331
+ write(input: TArray extends (infer U)[] ? U : Error$1<"To use a streaming response, outputSchema must be an array.">): Promise<void>;
332
+ sleep(ms: number): Promise<unknown>;
333
+ close(): Promise<void>;
334
+ onAbort(listener: () => void | Promise<void>): void;
335
+ /**
336
+ * Abort the stream.
337
+ * You can call this method when stream is aborted by external event.
338
+ */
339
+ abort(): void;
340
+ } //#endregion
341
+ //#endregion
342
+ //#region ../fragno/dist/api/request-output-context.d.ts
343
+ //#region src/api/request-output-context.d.ts
344
+ interface ResponseInit<T extends StatusCode = StatusCode> {
345
+ headers?: HeadersInit;
346
+ status?: T;
347
+ statusText?: string;
348
+ }
349
+ declare abstract class OutputContext<const TOutput, const TErrorCode extends string> {
350
+ /**
351
+ * Creates an error response.
352
+ *
353
+ * Shortcut for `throw new FragnoApiError(...)`
354
+ */
355
+ error: ({
356
+ message,
357
+ code
358
+ }: {
359
+ message: string;
360
+ code: TErrorCode;
361
+ }, initOrStatus?: ResponseInit | StatusCode, headers?: HeadersInit) => Response;
362
+ empty: (initOrStatus?: ResponseInit<ContentlessStatusCode> | ContentlessStatusCode, headers?: HeadersInit) => Response;
363
+ json: (object: TOutput, initOrStatus?: ResponseInit | StatusCode, headers?: HeadersInit) => Response;
364
+ jsonStream: (cb: (stream: ResponseStream<TOutput>) => void | Promise<void>, {
365
+ onError,
366
+ headers
367
+ }?: {
368
+ onError?: (error: Error, stream: ResponseStream<TOutput>) => void | Promise<void>;
369
+ headers?: HeadersInit;
370
+ }) => Response;
371
+ }
372
+ declare class RequestOutputContext<const TOutputSchema extends StandardSchemaV1 | undefined = undefined, const TErrorCode extends string = string> extends OutputContext<InferOrUnknown<TOutputSchema>, TErrorCode> {
373
+ #private;
374
+ constructor(outputSchema?: TOutputSchema);
375
+ } //#endregion
376
+ //#endregion
377
+ //#region ../fragno/dist/api/shared-types.d.ts
378
+ /**
379
+ * Configuration for custom fetch behavior in client-side fragments.
380
+ */
381
+ type FetcherConfig = {
382
+ type: "options";
383
+ options: RequestInit;
384
+ } | {
385
+ type: "function";
386
+ fetcher: typeof fetch;
387
+ };
388
+ /**
389
+ * Public configuration for Fragno fragments on the client side.
390
+ */
391
+ interface FragnoPublicClientConfig {
392
+ mountRoute?: string;
393
+ baseUrl?: string;
394
+ fetcherConfig?: FetcherConfig;
395
+ }
396
+ /**
397
+ * Shared configuration for fragment routes.
398
+ */
399
+ //#endregion
400
+ //#region ../fragno/dist/api/api.d.ts
401
+ //#region src/api/api.d.ts
402
+ type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
403
+ type NonGetHTTPMethod = Exclude<HTTPMethod, "GET">;
404
+ interface RequestThisContext {}
405
+ /**
406
+ * Content types that can be accepted by a route.
407
+ *
408
+ * - `"application/json"` (default): JSON request body, validated against inputSchema
409
+ * - `"multipart/form-data"`: FormData request body (file uploads), no schema validation
410
+ */
411
+ type RouteContentType = "application/json" | "multipart/form-data" | "application/octet-stream";
412
+ interface FragnoRouteConfig<TMethod extends HTTPMethod, TPath extends string, TInputSchema extends StandardSchemaV1 | undefined, TOutputSchema extends StandardSchemaV1 | undefined, TErrorCode extends string = string, TQueryParameters extends string = string, TThisContext extends RequestThisContext = RequestThisContext> {
413
+ method: TMethod;
414
+ path: TPath;
415
+ /**
416
+ * The expected content type for this route's request body.
417
+ *
418
+ * - `"application/json"` (default): Expects JSON body, will be validated against inputSchema
419
+ * - `"multipart/form-data"`: Expects FormData body (for file uploads), use `ctx.formData()` in handler
420
+ *
421
+ * The server will reject requests with mismatched Content-Type headers.
422
+ *
423
+ * @default "application/json"
424
+ */
425
+ contentType?: RouteContentType;
426
+ inputSchema?: TInputSchema;
427
+ outputSchema?: TOutputSchema;
428
+ errorCodes?: readonly TErrorCode[];
429
+ queryParameters?: readonly TQueryParameters[];
430
+ handler(this: TThisContext, inputCtx: RequestInputContext<TPath, TInputSchema>, outputCtx: RequestOutputContext<TOutputSchema, TErrorCode>): Promise<Response>;
431
+ }
432
+ //#endregion
433
+ //#region ../fragno/dist/client/client-error.d.ts
434
+ //#region src/client/client-error.d.ts
435
+ type FragnoErrorOptions = {
436
+ cause?: Error | unknown;
437
+ };
438
+ /**
439
+ * Base error class for all Fragno client errors.
440
+ */
441
+ declare abstract class FragnoClientError<TCode extends string = string> extends Error {
442
+ #private;
443
+ constructor(message: string, code: TCode, options?: FragnoErrorOptions);
444
+ get code(): TCode | (string & {});
445
+ }
446
+ //#endregion
447
+ //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/atom/index.d.ts
448
+ type AllKeys<T> = T extends any ? keyof T : never;
449
+ type Primitive = boolean | number | string;
450
+ type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends ((...args: any) => any) ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
451
+ /**
452
+ * Store object.
453
+ */
454
+ interface ReadableAtom<Value = any> {
455
+ /**
456
+ * Get store value.
457
+ *
458
+ * In contrast with {@link ReadableAtom#value} this value will be always
459
+ * initialized even if store had no listeners.
460
+ *
461
+ * ```js
462
+ * $store.get()
463
+ * ```
464
+ *
465
+ * @returns Store value.
466
+ */
467
+ get(): Value;
468
+ /**
469
+ * Listeners count.
470
+ */
471
+ readonly lc: number;
472
+ /**
473
+ * Subscribe to store changes.
474
+ *
475
+ * In contrast with {@link Store#subscribe} it do not call listener
476
+ * immediately.
477
+ *
478
+ * @param listener Callback with store value and old value.
479
+ * @returns Function to remove listener.
480
+ */
481
+ listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>) => void): () => void;
482
+ /**
483
+ * Low-level method to notify listeners about changes in the store.
484
+ *
485
+ * Can cause unexpected behaviour when combined with frontend frameworks
486
+ * that perform equality checks for values, such as React.
487
+ */
488
+ notify(oldValue?: ReadonlyIfObject<Value>): void;
489
+ /**
490
+ * Unbind all listeners.
491
+ */
492
+ off(): void;
493
+ /**
494
+ * Subscribe to store changes and call listener immediately.
495
+ *
496
+ * ```
497
+ * import { $router } from '../store'
498
+ *
499
+ * $router.subscribe(page => {
500
+ * console.log(page)
501
+ * })
502
+ * ```
503
+ *
504
+ * @param listener Callback with store value and old value.
505
+ * @returns Function to remove listener.
506
+ */
507
+ subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue?: ReadonlyIfObject<Value>) => void): () => void;
508
+ /**
509
+ * Low-level method to read store’s value without calling `onStart`.
510
+ *
511
+ * Try to use only {@link ReadableAtom#get}.
512
+ * Without subscribers, value can be undefined.
513
+ */
514
+ readonly value: undefined | Value;
515
+ }
516
+ /**
517
+ * Store with a way to manually change the value.
518
+ */
519
+ interface WritableAtom<Value = any> extends ReadableAtom<Value> {
520
+ /**
521
+ * Change store value.
522
+ *
523
+ * ```js
524
+ * $router.set({ path: location.pathname, page: parse(location.pathname) })
525
+ * ```
526
+ *
527
+ * @param newValue New store value.
528
+ */
529
+ set(newValue: Value): void;
530
+ }
531
+ //#endregion
532
+ //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/map/index.d.ts
533
+ type KeyofBase = keyof any;
534
+ type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K];
535
+ type HasIndexSignature<T> = string extends keyof T ? true : false;
536
+ type ValueWithUndefinedForIndexSignatures<Value, Key extends keyof Value> = HasIndexSignature<Value> extends true ? undefined | Value[Key] : Value[Key];
537
+ interface MapStore<Value extends object = any> extends WritableAtom<Value> {
538
+ /**
539
+ * Subscribe to store changes.
540
+ *
541
+ * In contrast with {@link Store#subscribe} it do not call listener
542
+ * immediately.
543
+ *
544
+ * @param listener Callback with store value and old value.
545
+ * @param changedKey Key that was changed. Will present only if `setKey`
546
+ * has been used to change a store.
547
+ * @returns Function to remove listener.
548
+ */
549
+ listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>, changedKey: AllKeys<Value>) => void): () => void;
550
+ /**
551
+ * Low-level method to notify listeners about changes in the store.
552
+ *
553
+ * Can cause unexpected behaviour when combined with frontend frameworks
554
+ * that perform equality checks for values, such as React.
555
+ */
556
+ notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void;
557
+ /**
558
+ * Change store value.
559
+ *
560
+ * ```js
561
+ * $settings.set({ theme: 'dark' })
562
+ * ```
563
+ *
564
+ * Operation is atomic, subscribers will be notified once with the new value.
565
+ * `changedKey` will be undefined
566
+ *
567
+ * @param newValue New store value.
568
+ */
569
+ set(newValue: Value): void;
570
+ /**
571
+ * Change key in store value.
572
+ *
573
+ * ```js
574
+ * $settings.setKey('theme', 'dark')
575
+ * ```
576
+ *
577
+ * To delete key set `undefined`.
578
+ *
579
+ * ```js
580
+ * $settings.setKey('theme', undefined)
581
+ * ```
582
+ *
583
+ * @param key The key name.
584
+ * @param value New value.
585
+ */
586
+ setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | ValueWithUndefinedForIndexSignatures<Value, Key>): void;
587
+ /**
588
+ * Subscribe to store changes and call listener immediately.
589
+ *
590
+ * ```
591
+ * import { $router } from '../store'
592
+ *
593
+ * $router.subscribe(page => {
594
+ * console.log(page)
595
+ * })
596
+ * ```
597
+ *
598
+ * @param listener Callback with store value and old value.
599
+ * @param changedKey Key that was changed. Will present only
600
+ * if `setKey` has been used to change a store.
601
+ * @returns Function to remove listener.
602
+ */
603
+ subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value> | undefined, changedKey: AllKeys<Value> | undefined) => void): () => void;
604
+ }
605
+ //#endregion
606
+ //#region ../../node_modules/.pnpm/@nanostores+query@0.3.4_nanostores@1.1.0/node_modules/@nanostores/query/dist/factory.d.ts
607
+ type MutateCb<Data, Result = unknown> = Data extends void ? () => Promise<Result> : (data: Data) => Promise<Result>;
608
+ type MutatorStore<Data = void, Result = unknown, E = Error> = MapStore<{
609
+ mutate: MutateCb<Data, Result>;
610
+ data?: Result;
611
+ loading?: boolean;
612
+ error?: E;
613
+ }> & {
614
+ mutate: MutateCb<Data, Result>;
615
+ };
616
+ //#endregion
617
+ //#region ../fragno/dist/client/client.d.ts
618
+ declare const MUTATOR_HOOK_SYMBOL: unique symbol;
619
+ type FragnoClientMutatorData<TMethod extends NonGetHTTPMethod, TPath extends string, TInputSchema extends StandardSchemaV1 | undefined, TOutputSchema extends StandardSchemaV1 | undefined, TErrorCode extends string, TQueryParameters extends string> = {
620
+ route: FragnoRouteConfig<TMethod, TPath, TInputSchema, TOutputSchema, TErrorCode, TQueryParameters>;
621
+ mutateQuery(args?: {
622
+ body?: InferOr<TInputSchema, undefined>;
623
+ path?: MaybeExtractPathParamsOrWiden<TPath, string>;
624
+ query?: Record<TQueryParameters, string | undefined>;
625
+ }): Promise<InferOr<TOutputSchema, undefined>>;
626
+ mutatorStore: MutatorStore<{
627
+ body?: InferOr<TInputSchema, undefined>;
628
+ path?: MaybeExtractPathParamsOrWiden<TPath, string | ReadableAtom<string>>;
629
+ query?: Record<TQueryParameters, string | undefined | ReadableAtom<string | undefined>>;
630
+ }, InferOr<TOutputSchema, undefined>, FragnoClientError<TErrorCode>>;
631
+ [MUTATOR_HOOK_SYMBOL]: true;
632
+ } & {
633
+ readonly _inputSchema?: TInputSchema;
634
+ readonly _outputSchema?: TOutputSchema;
635
+ };
636
+ /**
637
+ * @internal
638
+ */
639
+ //#endregion
640
+ //#region src/github/types.d.ts
641
+ type GitHubAppWebhookHandler<TEventName extends EmitterWebhookEventName> = (event: EmitterWebhookEvent<TEventName>, idempotencyKey: string) => void | Promise<void>;
642
+ type GitHubAppWebhookOn = <TEventName extends EmitterWebhookEventName>(event: TEventName | TEventName[], handler: GitHubAppWebhookHandler<TEventName>) => void;
643
+ type GitHubAppWebhookConfig = (register: GitHubAppWebhookOn) => void;
644
+ type GitHubAppFragmentConfig = {
645
+ appId: string;
646
+ appSlug: string;
647
+ privateKeyPem: string;
648
+ webhookSecret: string;
649
+ webhookDebug?: boolean;
650
+ apiBaseUrl?: string;
651
+ apiVersion?: string;
652
+ webBaseUrl?: string;
653
+ defaultLinkKey?: string;
654
+ tokenCacheTtlSeconds?: number;
655
+ webhook?: GitHubAppWebhookConfig;
656
+ };
657
+ type GitHubAppFragmentPublicClientConfig = FragnoPublicClientConfig;
658
+ //#endregion
659
+ export { GitHubAppWebhookOn as a, FragnoClientError as c, InferOr as d, ExtractPathParamsOrWiden as f, QueryParamsHint as h, GitHubAppWebhookHandler as i, NonGetHTTPMethod as l, MaybeExtractPathParamsOrWiden as m, GitHubAppFragmentPublicClientConfig as n, FragnoClientMutatorData as o, HasPathParams as p, GitHubAppWebhookConfig as r, ReadableAtom as s, GitHubAppFragmentConfig as t, FragnoPublicClientConfig as u };
660
+ //# sourceMappingURL=types-BzeSSOQU.d.ts.map