@fungi.computer/forage 0.0.0-stage → 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 +24 -0
- package/README.md +223 -2
- package/THIRD_PARTY_NOTICES +13 -0
- package/dist/app-api.d.ts +62 -0
- package/dist/app-api.js +121 -0
- package/dist/catalog.d.ts +16 -0
- package/dist/catalog.js +108 -0
- package/dist/definitions.d.ts +16 -0
- package/dist/definitions.js +25 -0
- package/dist/describe.d.ts +4 -0
- package/dist/describe.js +66 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +16 -0
- package/dist/json-schema-boundary.d.ts +10 -0
- package/dist/json-schema-boundary.js +56 -0
- package/dist/json-schema-subset.d.ts +6 -0
- package/dist/json-schema-subset.js +77 -0
- package/dist/list.d.ts +8 -0
- package/dist/list.js +53 -0
- package/dist/normalization.d.ts +22 -0
- package/dist/normalization.js +109 -0
- package/dist/openapi.d.ts +106 -0
- package/dist/openapi.js +519 -0
- package/dist/rendering.d.ts +26 -0
- package/dist/rendering.js +341 -0
- package/dist/schemas.d.ts +231 -0
- package/dist/schemas.js +156 -0
- package/dist/search.d.ts +17 -0
- package/dist/search.js +258 -0
- package/docs/api/README.md +15 -0
- package/docs/api/index.md +859 -0
- package/docs/api/json-schema-subset.md +42 -0
- package/docs/api/openapi.md +308 -0
- package/package.json +71 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/forage**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/forage](README.md) / json-schema-subset
|
|
8
|
+
|
|
9
|
+
# json-schema-subset
|
|
10
|
+
|
|
11
|
+
## Functions
|
|
12
|
+
|
|
13
|
+
### jsonSchemaSubset()
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
function jsonSchemaSubset(
|
|
17
|
+
allowNullable?,
|
|
18
|
+
): ZodPipe<
|
|
19
|
+
ZodUnknown,
|
|
20
|
+
ZodType<
|
|
21
|
+
boolean | Record<string, JSONType>,
|
|
22
|
+
unknown,
|
|
23
|
+
$ZodTypeInternals<boolean | Record<string, JSONType>, unknown>
|
|
24
|
+
>
|
|
25
|
+
>;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Decode the supported schema subset before using the shared Zod compiler. Refuse
|
|
29
|
+
depth over 32, more than 50,000 expanded nodes and reserved keys before
|
|
30
|
+
recursive decoding. Callers bound transport bytes separately.
|
|
31
|
+
|
|
32
|
+
#### Parameters
|
|
33
|
+
|
|
34
|
+
| Parameter | Type | Default value |
|
|
35
|
+
| --------------- | --------- | ------------- |
|
|
36
|
+
| `allowNullable` | `boolean` | `false` |
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`ZodPipe`\<`ZodUnknown`, `ZodType`\<`boolean` \| `Record`\<`string`,
|
|
41
|
+
`JSONType`\>, `unknown`, `$ZodTypeInternals`\<`boolean` \| `Record`\<`string`,
|
|
42
|
+
`JSONType`\>, `unknown`\>\>\>
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/forage**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/forage](README.md) / openapi
|
|
8
|
+
|
|
9
|
+
# openapi
|
|
10
|
+
|
|
11
|
+
## Classes
|
|
12
|
+
|
|
13
|
+
### OpenApiError
|
|
14
|
+
|
|
15
|
+
A bounded intake refusal, distinct from a listed unsupported operation.
|
|
16
|
+
|
|
17
|
+
#### Extends
|
|
18
|
+
|
|
19
|
+
- `Error`
|
|
20
|
+
|
|
21
|
+
#### Constructors
|
|
22
|
+
|
|
23
|
+
##### Constructor
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
new OpenApiError(
|
|
27
|
+
code,
|
|
28
|
+
message,
|
|
29
|
+
cause?
|
|
30
|
+
): OpenApiError;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
###### Parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type |
|
|
36
|
+
| --------- | ------------------------------------------- |
|
|
37
|
+
| `code` | [`OpenApiRefusalCode`](#openapirefusalcode) |
|
|
38
|
+
| `message` | `string` |
|
|
39
|
+
| `cause?` | `unknown` |
|
|
40
|
+
|
|
41
|
+
###### Returns
|
|
42
|
+
|
|
43
|
+
[`OpenApiError`](#openapierror)
|
|
44
|
+
|
|
45
|
+
###### Overrides
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
Error.constructor;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Properties
|
|
52
|
+
|
|
53
|
+
##### name
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
readonly name: "OpenApiError" = "OpenApiError";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
###### Overrides
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
Error.name;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
##### code
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
readonly code: OpenApiRefusalCode;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Type Aliases
|
|
72
|
+
|
|
73
|
+
### OpenApiThirdPartyText
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
type OpenApiThirdPartyText = string & z.BRAND<"ThirdPartyText">;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Bounded provider-authored text. Hosts must frame it as data, never instructions.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### OpenApiIntakeOptions
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
type OpenApiIntakeOptions = object;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Optional owner-declared credential parameter excluded from guest input.
|
|
90
|
+
|
|
91
|
+
#### Properties
|
|
92
|
+
|
|
93
|
+
##### authParameter?
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
optional authParameter?: object;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
###### in
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
in: "header" | "query";
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
###### name
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
name: string;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### OpenApiRefusalCode
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
type OpenApiRefusalCode =
|
|
117
|
+
| "too_large"
|
|
118
|
+
| "invalid_spec"
|
|
119
|
+
| "not_openapi3"
|
|
120
|
+
| "nodes_limit"
|
|
121
|
+
| "depth_limit"
|
|
122
|
+
| "alias_limit"
|
|
123
|
+
| "external_reference"
|
|
124
|
+
| "recursive_schema"
|
|
125
|
+
| "operations_limit"
|
|
126
|
+
| "invalid_operation"
|
|
127
|
+
| "unsupported_schema"
|
|
128
|
+
| "parameter_collision"
|
|
129
|
+
| "unsafe_auth_parameter"
|
|
130
|
+
| "unsafe_header"
|
|
131
|
+
| "unsupported_parameter"
|
|
132
|
+
| "unsupported_media"
|
|
133
|
+
| "unsupported_path_item"
|
|
134
|
+
| "unsupported_method"
|
|
135
|
+
| "table_too_large"
|
|
136
|
+
| "invalid_table"
|
|
137
|
+
| "unsafe_name"
|
|
138
|
+
| "unsafe_path";
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Stable intake and per-operation refusal codes.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### OpenApiOperation
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
type OpenApiOperation = z.output<typeof openApiOperationSchema>;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Decoded normalized operation ready for selection, not an execution grant.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### OpenApiPreviewOperation
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
type OpenApiPreviewOperation =
|
|
159
|
+
| OpenApiOperation
|
|
160
|
+
| {
|
|
161
|
+
status: "unsupported";
|
|
162
|
+
name: string;
|
|
163
|
+
method: string;
|
|
164
|
+
path: string;
|
|
165
|
+
reason: OpenApiRefusalCode;
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
An operation's supported call shape or bounded unsupported reason.
|
|
170
|
+
|
|
171
|
+
## Variables
|
|
172
|
+
|
|
173
|
+
### openApiOperationSchema
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const openApiOperationSchema: ZodObject<
|
|
177
|
+
{
|
|
178
|
+
status: ZodLiteral<"supported">;
|
|
179
|
+
name: ZodString;
|
|
180
|
+
method: ZodEnum<{
|
|
181
|
+
GET: "GET";
|
|
182
|
+
HEAD: "HEAD";
|
|
183
|
+
OPTIONS: "OPTIONS";
|
|
184
|
+
POST: "POST";
|
|
185
|
+
PUT: "PUT";
|
|
186
|
+
PATCH: "PATCH";
|
|
187
|
+
DELETE: "DELETE";
|
|
188
|
+
}>;
|
|
189
|
+
path: ZodString;
|
|
190
|
+
effect: ZodEnum<{
|
|
191
|
+
write: "write";
|
|
192
|
+
read: "read";
|
|
193
|
+
}>;
|
|
194
|
+
description: $ZodBranded<ZodString, "ThirdPartyText", "out">;
|
|
195
|
+
textSource: ZodLiteral<"third_party">;
|
|
196
|
+
tags: ZodArray<$ZodBranded<ZodString, "ThirdPartyText", "out">>;
|
|
197
|
+
parameters: ZodArray<
|
|
198
|
+
ZodObject<
|
|
199
|
+
{
|
|
200
|
+
name: ZodString;
|
|
201
|
+
in: ZodEnum<{
|
|
202
|
+
header: "header";
|
|
203
|
+
path: "path";
|
|
204
|
+
query: "query";
|
|
205
|
+
}>;
|
|
206
|
+
required: ZodDefault<ZodBoolean>;
|
|
207
|
+
schema: ZodUnion<
|
|
208
|
+
readonly [ZodRecord<ZodString, ZodJSONSchema>, ZodBoolean]
|
|
209
|
+
>;
|
|
210
|
+
style: ZodOptional<ZodString>;
|
|
211
|
+
explode: ZodOptional<ZodBoolean>;
|
|
212
|
+
allowReserved: ZodOptional<ZodBoolean>;
|
|
213
|
+
},
|
|
214
|
+
$strip
|
|
215
|
+
>
|
|
216
|
+
>;
|
|
217
|
+
input: ZodPipe<
|
|
218
|
+
ZodUnknown,
|
|
219
|
+
ZodType<
|
|
220
|
+
boolean | Record<string, JSONType>,
|
|
221
|
+
unknown,
|
|
222
|
+
$ZodTypeInternals<boolean | Record<string, JSONType>, unknown>
|
|
223
|
+
>
|
|
224
|
+
>;
|
|
225
|
+
output: ZodPipe<
|
|
226
|
+
ZodUnknown,
|
|
227
|
+
ZodType<
|
|
228
|
+
boolean | Record<string, JSONType>,
|
|
229
|
+
unknown,
|
|
230
|
+
$ZodTypeInternals<boolean | Record<string, JSONType>, unknown>
|
|
231
|
+
>
|
|
232
|
+
>;
|
|
233
|
+
},
|
|
234
|
+
$strict
|
|
235
|
+
>;
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
One stored operation, independent of spec-host URLs or credentials.
|
|
239
|
+
|
|
240
|
+
## Functions
|
|
241
|
+
|
|
242
|
+
### normalizeOpenApi()
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
function normalizeOpenApi(
|
|
246
|
+
source,
|
|
247
|
+
options?,
|
|
248
|
+
): Promise<{
|
|
249
|
+
title: string & $brand<"ThirdPartyText">;
|
|
250
|
+
version: string;
|
|
251
|
+
servers: string[];
|
|
252
|
+
authHints: (
|
|
253
|
+
| {
|
|
254
|
+
scheme: string;
|
|
255
|
+
kind: "api_key_header" | "api_key_query";
|
|
256
|
+
name: string;
|
|
257
|
+
}
|
|
258
|
+
| {
|
|
259
|
+
scheme: string;
|
|
260
|
+
kind: "bearer" | "oauth" | "unsupported";
|
|
261
|
+
}
|
|
262
|
+
)[];
|
|
263
|
+
operations: OpenApiPreviewOperation[];
|
|
264
|
+
tableDigest: string;
|
|
265
|
+
}>;
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Pure intake: the host supplies bounded spec text, never a fetch locator.
|
|
269
|
+
|
|
270
|
+
#### Parameters
|
|
271
|
+
|
|
272
|
+
| Parameter | Type |
|
|
273
|
+
| --------- | ----------------------------------------------- |
|
|
274
|
+
| `source` | `string` |
|
|
275
|
+
| `options` | [`OpenApiIntakeOptions`](#openapiintakeoptions) |
|
|
276
|
+
|
|
277
|
+
#### Returns
|
|
278
|
+
|
|
279
|
+
`Promise`\<\{ `title`: `string` & `$brand`\<`"ThirdPartyText"`\>; `version`:
|
|
280
|
+
`string`; `servers`: `string`[]; `authHints`: ( \| \{ `scheme`: `string`;
|
|
281
|
+
`kind`: `"api_key_header"` \| `"api_key_query"`; `name`: `string`; \} \| \{
|
|
282
|
+
`scheme`: `string`; `kind`: `"bearer"` \| `"oauth"` \| `"unsupported"`; \})[];
|
|
283
|
+
`operations`: [`OpenApiPreviewOperation`](#openapipreviewoperation)[];
|
|
284
|
+
`tableDigest`: `string`; \}\>
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
### parseOpenApiTable()
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
function parseOpenApiTable(source): Promise<{
|
|
292
|
+
operations: object[];
|
|
293
|
+
digest: string;
|
|
294
|
+
}>;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Decode selected operations before persistence or execution; no authority is
|
|
298
|
+
granted.
|
|
299
|
+
|
|
300
|
+
#### Parameters
|
|
301
|
+
|
|
302
|
+
| Parameter | Type |
|
|
303
|
+
| --------- | --------- |
|
|
304
|
+
| `source` | `unknown` |
|
|
305
|
+
|
|
306
|
+
#### Returns
|
|
307
|
+
|
|
308
|
+
`Promise`\<\{ `operations`: `object`[]; `digest`: `string`; \}\>
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/forage",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": "Levi <levi@technomancy.dev>",
|
|
5
|
+
"description": "Pure immutable Zod-typed capability discovery",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./json-schema-subset": {
|
|
15
|
+
"types": "./dist/json-schema-subset.d.ts",
|
|
16
|
+
"import": "./dist/json-schema-subset.js"
|
|
17
|
+
},
|
|
18
|
+
"./openapi": {
|
|
19
|
+
"types": "./dist/openapi.d.ts",
|
|
20
|
+
"import": "./dist/openapi.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"docs/api",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"THIRD_PARTY_NOTICES"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@apidevtools/json-schema-ref-parser": "16.0.3",
|
|
32
|
+
"@fungi.computer/puffball": "0.0.1",
|
|
33
|
+
"yaml": "2.9.0",
|
|
34
|
+
"zod": "4.4.3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "24.13.3",
|
|
38
|
+
"effect": "4.0.2",
|
|
39
|
+
"typescript": "5.9.3",
|
|
40
|
+
"vitest": "4.1.11"
|
|
41
|
+
},
|
|
42
|
+
"botanical": {
|
|
43
|
+
"role": "package",
|
|
44
|
+
"operations": {
|
|
45
|
+
"lint": "required",
|
|
46
|
+
"typecheck": "required",
|
|
47
|
+
"build": "required",
|
|
48
|
+
"test": "required",
|
|
49
|
+
"docs": "required",
|
|
50
|
+
"pack": "required",
|
|
51
|
+
"smoke": "required",
|
|
52
|
+
"stranger": "required"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/fungi-computer/forage.git"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"lint": "eslint src test --max-warnings=0 && ../../node_modules/.bin/oxlint --config ../../oxlint.config.ts --deny-warnings src test",
|
|
62
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
63
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
64
|
+
"clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"docs": "tsx ../../tooling/repository/src/docs/cli.ts check --root ../..",
|
|
67
|
+
"docs:write": "tsx ../../tooling/repository/src/docs/cli.ts write --root ../..",
|
|
68
|
+
"pack": "mkdir -p ../../.botanical/forage-pack && pnpm pack --pack-destination ../../.botanical/forage-pack",
|
|
69
|
+
"smoke": "node --input-type=module -e \"import('./dist/index.js').then(({Forage}) => { if (!Forage) process.exit(1); })\"",
|
|
70
|
+
"stranger": "tsx ../../tooling/repository/src/artifacts/cli.ts --repo-root ../.. .",
|
|
71
|
+
"format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
|
|
72
|
+
"lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs"
|
|
73
|
+
}
|
|
6
74
|
}
|