Skip to content

Commit af6950b

Browse files
committed
feat(api): document the API composition group (Wave 3)
Ships the generated reference for @imqueue/graphql-dependency 3.1.0 and @imqueue/type-graphql-dependency 3.0.3 — 43 pages, the last two entries in the API composition group. Both were proof-read first, which is what the wave was gated on: type-graphql-dependency had 7 of its 9 exported symbols carrying no doc comment at all, so shipping as-is would have published pages of bare type signatures. Summary coverage went 73% -> 100% and 13% -> 100%, and all ten documented packages now report 100%. The proof-read also turned up a crash in graphql-dependency: defineInitializer() threw before any loader ran, making one of the three features its README documents unusable. Fixed and covered by tests in that repo and released as 3.1.0, which is why this is a minor there. Site-side changes are the usual wave shape: two `status` flips in scripts/lib/api-packages.js, which is what adds the /api/ list entries, the two JSON-LD SoftwareSourceCode graph members and the Pages Functions. Placeholder blurbs replaced with real ones, since they render both on /api/ and as the graph descriptions. Verified: all four guards pass on a clean build, sitemap-api.xml 239 -> 263, the search index 672 -> 715 entries with no empty summaries and no table-markup leaks, both landing pages carry their @packageDocumentation summary rather than a generated fallback, and the fenced decorator examples render with a literal @.
1 parent c3f463a commit af6950b

50 files changed

Lines changed: 2668 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// GENERATED by scripts/build-api-docs.js — do not edit by hand.
2+
// Cloudflare Pages Function — /api/graphql-dependency/*
3+
// Resolves retired @imqueue/graphql-dependency version URLs onto the kept version trees.
4+
// See lib/api-redirects.js for the policy and why this is not in _redirects.
5+
import { handleApiRequest } from "../../../lib/api-handler.js";
6+
7+
export const onRequest = handleApiRequest;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// GENERATED by scripts/build-api-docs.js — do not edit by hand.
2+
// Cloudflare Pages Function — /api/type-graphql-dependency/*
3+
// Resolves retired @imqueue/type-graphql-dependency version URLs onto the kept version trees.
4+
// See lib/api-redirects.js for the policy and why this is not in _redirects.
5+
import { handleApiRequest } from "../../../lib/api-handler.js";
6+
7+
export const onRequest = handleApiRequest;

lib/api-versions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ export const API_VERSIONS = {
1111
"tag-cache": { "latest": "3.0.3", "archives": [] },
1212
"async-logger": { "latest": "3.2.0", "archives": [] },
1313
"opentelemetry-instrumentation-imqueue": { "latest": "3.3.1", "archives": [] },
14-
"dd-trace": { "latest": "3.1.0", "archives": [] }
14+
"dd-trace": { "latest": "3.1.0", "archives": [] },
15+
"graphql-dependency": { "latest": "3.1.0", "archives": [] },
16+
"type-graphql-dependency": { "latest": "3.0.3", "archives": [] }
1517
};

scripts/lib/api-packages.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,23 @@ const PACKAGES = [
199199
tier: 2,
200200
group: 'API composition',
201201
tags: [],
202-
blurb: 'Cross-service GraphQL dependencies for underlying @imqueue services.',
202+
blurb:
203+
'Declarative cross-service dependency loading for GraphQL — nested data in bulk instead of one call per resolved object.',
203204
cliId: 'graphql-dependency',
204205
latestOnly: true,
205-
status: 'planned',
206+
status: 'shipped',
206207
wave: 3,
207208
},
208209
{
209210
name: 'type-graphql-dependency',
210211
tier: 2,
211212
group: 'API composition',
212213
tags: [],
213-
blurb: 'Adoption of @imqueue/graphql-dependency for use with type-graphql.',
214+
blurb:
215+
'The same dependency loading for type-graphql — declared on your decorated classes rather than on raw GraphQL types.',
214216
cliId: 'type-graphql-dependency',
215217
latestOnly: true,
216-
status: 'planned',
218+
status: 'shipped',
217219
wave: 3,
218220
},
219221

src/_data/apiVersions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,13 @@
3636
"dd-trace": {
3737
"latest": "3.1.0",
3838
"archives": []
39+
},
40+
"graphql-dependency": {
41+
"latest": "3.1.0",
42+
"archives": []
43+
},
44+
"type-graphql-dependency": {
45+
"latest": "3.0.3",
46+
"archives": []
3947
}
4048
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "DataInitializer type · @imqueue/graphql-dependency"
3+
description: "An async routine that fills extra fields onto a type's own objects before its dependencies load, registered with defineInitializer()."
4+
apiCrumbs: [{"name":"API reference","url":"/api/"},{"name":"@imqueue/graphql-dependency","url":"/api/graphql-dependency/latest/"},{"name":"DataInitializer","url":"/api/graphql-dependency/latest/graphql-dependency.datainitializer/"}]
5+
---
6+
7+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
8+
9+
# DataInitializer type
10+
11+
An async routine that fills extra fields onto a type's own objects before its dependencies load, registered with `defineInitializer()`<!-- -->.
12+
13+
**Signature:**
14+
15+
```typescript
16+
export type DataInitializer<T> = (context: any, result: T, fields?: any) => Promise<DataInitializerResult>;
17+
```
18+
**References:** [DataInitializerResult](/api/graphql-dependency/latest/graphql-dependency.datainitializerresult/)
19+
20+
## Remarks
21+
22+
Its job is to supply what a dependency filter needs but the initial result does not carry — foreign ids that have to be fetched or derived first, for instance. It is handed the resolver context, the objects loaded so far, and the fields the request asked for, and returns a map keyed by object id.
23+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "DataInitializerResult interface · @imqueue/graphql-dependency"
3+
description: "What an initializer gives back: the extra fields to merge onto each object, keyed by that object's id."
4+
apiCrumbs: [{"name":"API reference","url":"/api/"},{"name":"@imqueue/graphql-dependency","url":"/api/graphql-dependency/latest/"},{"name":"DataInitializerResult","url":"/api/graphql-dependency/latest/graphql-dependency.datainitializerresult/"}]
5+
---
6+
7+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
8+
9+
# DataInitializerResult interface
10+
11+
What an initializer gives back: the extra fields to merge onto each object, keyed by that object's `id`<!-- -->.
12+
13+
**Signature:**
14+
15+
```typescript
16+
export interface DataInitializerResult
17+
```
18+
19+
## Remarks
20+
21+
Each value is merged onto the matching object with `Object.assign`<!-- -->, so it holds only the fields being addednot a replacement object. An id with no matching object is ignored, and an object whose id is absent here is left exactly as it was.
22+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "DataLoader type · @imqueue/graphql-dependency"
3+
description: "A bulk fetch for one entity type, registered with defineLoader() and called whenever that type is needed as another type's dependency."
4+
apiCrumbs: [{"name":"API reference","url":"/api/"},{"name":"@imqueue/graphql-dependency","url":"/api/graphql-dependency/latest/"},{"name":"DataLoader","url":"/api/graphql-dependency/latest/graphql-dependency.dataloader/"}]
5+
---
6+
7+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
8+
9+
# DataLoader type
10+
11+
A bulk fetch for one entity type, registered with `defineLoader()` and called whenever that type is needed as another type's dependency.
12+
13+
**Signature:**
14+
15+
```typescript
16+
export type DataLoader<T> = (context: any, filter: any, fields?: any) => Promise<T[]>;
17+
```
18+
19+
## Remarks
20+
21+
Every object returned must carry an `id`<!-- -->: results are keyed by it and attached to their parents by it, and one without an `id` is silently unreachable.
22+
23+
`filter` arrives with a \*set\* of values under each key rather than one value, because a whole level of parent objects is fetched in a single call — so the implementation has to treat every key as a list. Its shape is decided by the `require()` calls that point at this type.
24+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "Dependency variable · @imqueue/graphql-dependency"
3+
description: "The dependency description for a GraphQL object type — an alias for GraphQLDependency.create(), and the intended way to reach every method on this package's…"
4+
apiCrumbs: [{"name":"API reference","url":"/api/"},{"name":"@imqueue/graphql-dependency","url":"/api/graphql-dependency/latest/"},{"name":"Dependency","url":"/api/graphql-dependency/latest/graphql-dependency.dependency/"}]
5+
---
6+
7+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
8+
9+
# Dependency variable
10+
11+
The dependency description for a GraphQL object type — an alias for [GraphQLDependency.create()](/api/graphql-dependency/latest/graphql-dependency.graphqldependency.create/)<!-- -->, and the intended way to reach every method on this package's API.
12+
13+
**Signature:**
14+
15+
```typescript
16+
Dependency: typeof GraphQLDependency.create
17+
```
18+
19+
## Remarks
20+
21+
Reads as a static constructor at the call site, but it is a lookup: the description is created on first use and the same one is returned afterwards. That is what allows `Dependency(SomeType)` to appear in as many modules as is convenient — a loader beside the type, requirements beside the relation, a `load()` in the resolver — and still describe one type once.
22+
23+
## Example
24+
25+
26+
```typescript
27+
Dependency(UserType).require(CompanyType, () => ({
28+
as: UserType.getFields().company,
29+
filter: {
30+
// the key belongs to CompanyType's loader filter, the value is the
31+
// field on UserType whose values fill it
32+
[CompanyType.getFields().id.name]:
33+
UserType.getFields().companyId,
34+
},
35+
}));
36+
```
37+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: "DependencyFieldsGetter type · @imqueue/graphql-dependency"
3+
description: "A single field supplied as a thunk, used to name the fields an initializer fills. Deferred for the same reason as DependencyOptionsGetter."
4+
apiCrumbs: [{"name":"API reference","url":"/api/"},{"name":"@imqueue/graphql-dependency","url":"/api/graphql-dependency/latest/"},{"name":"DependencyFieldsGetter","url":"/api/graphql-dependency/latest/graphql-dependency.dependencyfieldsgetter/"}]
5+
---
6+
7+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
8+
9+
# DependencyFieldsGetter type
10+
11+
A single field supplied as a thunk, used to name the fields an initializer fills. Deferred for the same reason as [DependencyOptionsGetter](/api/graphql-dependency/latest/graphql-dependency.dependencyoptionsgetter/)<!-- -->.
12+
13+
**Signature:**
14+
15+
```typescript
16+
export type DependencyFieldsGetter = () => GraphQLField<any, any, any>;
17+
```

0 commit comments

Comments
 (0)