@graphty/graphty-element / index / SourceContext
Interface: SourceContext ​
Defined in: graph-io/dist/src/sources/types.d.ts:220
What every source method receives: the one place auth, redirects, retries, limits, cancellation and progress are implemented. A source never calls the global fetch. Experimental.
Properties ​
cursor ​
readonlycursor:Readonly<Record<string,string|number|boolean|null>> |null
Defined in: graph-io/dist/src/sources/types.d.ts:245
The caller's cursor, or null on a first load.
endpoint ​
readonlyendpoint:URL|null
Defined in: graph-io/dist/src/sources/types.d.ts:230
The caller's endpoint, else the descriptor's default, else null.
fetch ​
readonlyfetch: (input,init?) =>Promise<Response>
Defined in: graph-io/dist/src/sources/types.d.ts:226
fetch() with the credential, the redirect guard, retries, the signal, the byte cap and progress. A relative URL resolves against endpoint. A status of 401, 403, 404, 429 or any other outside 200 to 299 is raised as its coded issue unless init.allowStatus lists it.
Parameters ​
input ​
string | URL
init? ​
Returns ​
Promise<Response>
fetchJson ​
readonlyfetchJson: <T>(input,init?) =>Promise<T>
Defined in: graph-io/dist/src/sources/types.d.ts:228
fetch and parse the body as JSON; a body that is not JSON is E_SOURCE_RESPONSE.
Type Parameters ​
T ​
T = unknown
Parameters ​
input ​
string | URL
init? ​
Returns ​
Promise<T>
limits ​
readonlylimits:SourceLimits
Defined in: graph-io/dist/src/sources/types.d.ts:236
The caps; reached() counts what the sink received.
report ​
readonlyreport:ImportReportBuilder
Defined in: graph-io/dist/src/sources/types.d.ts:234
The report of this load.
runtime ​
readonlyruntime:SourceRuntime
Defined in: graph-io/dist/src/sources/types.d.ts:253
Where this load runs.
signal ​
readonlysignal:AbortSignal
Defined in: graph-io/dist/src/sources/types.d.ts:232
Aborts when the caller cancels or the load times out.
Methods ​
finish() ​
finish(
result?):ImporterReport
Defined in: graph-io/dist/src/sources/types.d.ts:251
Finish an import() source: record where to resume and the server facts, and return the report.
Parameters ​
result? ​
the cursor and facts
Returns ​
the report
progress() ​
progress(
done,total?,unit?):void
Defined in: graph-io/dist/src/sources/types.d.ts:243
Report progress.
Parameters ​
done ​
number
how much is done
total? ​
number
the total, when the service says it
unit? ​
"items" | "bytes"
what is counted
Returns ​
void