process-graph 1.3.0 → 2.0.0
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/README.md +21 -19
- package/dist/bin.js +2 -2
- package/dist/cli.d.ts +56 -76
- package/dist/cli.js +4 -3
- package/dist/{data-file-BVMxkTug.js → data-file-B8__c10l.js} +1 -1
- package/dist/dist-B0mKgR5B.js +4 -0
- package/dist/{dist-BI01yxFA.js → dist-BnymJpfk.js} +258 -473
- package/dist/graphql-CGWZ6USe.d.ts +17 -0
- package/dist/index-7nV7hCmv.d.ts +118 -0
- package/dist/{index-BC4tmAuQ.d.ts → index-B2p3mEJ3.d.ts} +2 -2
- package/dist/{index-9Au8pAmP.d.ts → index-C-ZNF81j.d.ts} +5 -24
- package/dist/{index-hri2a13-.d.ts → index-CiaCmQDP.d.ts} +2 -1
- package/dist/{graphql-BE7xm5dB.d.ts → index-CotF9Lhh.d.ts} +4 -45
- package/dist/index-DAevZqW-.d.ts +71 -0
- package/dist/{index-Dvz_I_uQ.d.ts → index-DYl6lZLe.d.ts} +29 -1
- package/dist/{index-D06bcdfw.d.ts → index-DluJZTbT.d.ts} +23 -2
- package/dist/{index-CR8xUK3S.d.ts → index-KhygugOP.d.ts} +6 -44
- package/dist/{index-D4CnOhNf.d.ts → index-wQnLXJmD.d.ts} +1 -1
- package/dist/index.d.ts +25 -4
- package/dist/index.js +4 -3
- package/dist/layout.d.ts +1 -1
- package/dist/project-CP_ye6KI.js +27 -0
- package/dist/react-flow.d.ts +5 -5
- package/dist/react.d.ts +2 -1
- package/dist/react.js +1 -24
- package/dist/{router-Dk91O_9p.js → router-DzVcQ28U.js} +2 -2
- package/dist/{schema-BPT8fmfa.js → schema-CL95Lyni.js} +24 -13
- package/dist/schema-DMXa8gAZ.js +117 -0
- package/dist/source/github/node.d.ts +1 -1
- package/dist/source/github.d.ts +4 -3
- package/dist/source/github.js +39 -2
- package/dist/{source-D51N7K3A.js → source-DM4fLS5P.js} +2 -161
- package/dist/store/node.d.ts +1 -1
- package/dist/store/node.js +1 -1
- package/dist/store/wasm/worker.js +2 -2
- package/dist/store/wasm.d.ts +1 -1
- package/dist/{store-DKzvLGgl.js → store-CgweIG8J.js} +3 -12
- package/dist/store.d.ts +2 -2
- package/dist/store.js +3 -3
- package/dist/sync-CkaJO3OQ.js +213 -0
- package/dist/sync.d.ts +26 -0
- package/dist/sync.js +16 -0
- package/dist/ui.d.ts +4 -4
- package/dist/{version-Dagrkvwt.js → version-_UOnL566.js} +1 -1
- package/dist/view-DcktInd7.js +392 -0
- package/package.json +21 -15
- package/dist/dist-81kTKnMq.js +0 -3
- package/dist/parse-C1Q1zsGt.js +0 -41
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as parseOverlay, c as elementKinds, d as notations, f as overlayStatuses, i as overlaySchema, l as fragmentOperators, m as pseudoRoles, n as modelSchema, o as validateOverlay, p as participantKinds, r as OverlayParseError, t as boundActivitySchema, u as messageModes } from "./schema-CL95Lyni.js";
|
|
3
3
|
import { t as validate } from "./validate-DF3mQZww.js";
|
|
4
|
-
import {
|
|
4
|
+
import { a as stateMachineToDot, c as sequenceToMermaid, d as isUnsafeCharacter, f as terminalJson, h as parseModel, i as sequenceToDot, l as stateMachineToMermaid, m as ModelParseError, n as viewText, o as swimlaneToDot, p as terminalText, r as flowchartToDot, s as flowchartToMermaid, t as exportFormats, u as swimlaneToMermaid } from "./view-DcktInd7.js";
|
|
5
5
|
import { _ as criticalPath$1, a as unmetOutputs, b as actorMap, c as deriveStatuses, d as stateMachineParts, f as toStateMachine, g as handoffs, h as toFlowchart, i as readySet, l as statusRules, m as flowchartParts, n as criticalPath, o as whatIfDone, p as toSwimlane, r as impact, s as explainStatus, t as blockedBy, u as toSequence, v as immediateDominators, y as topologicalLayers } from "./queries-C8kIDRiY.js";
|
|
6
6
|
import { S as UnknownNodeError, _ as descendantsOf, a as artefactKey, b as lookup, c as evaluateBranches, f as layeredFacts, g as ancestorsOf, h as stronglyConnectedComponents, i as UnsupportedConditionError, l as factNamesIn, m as findCycles, n as illegalCycles, o as elementStatusKey, p as assertAcyclic, r as loopTransitions, s as emptyFactRecord, t as controlDag, u as factsFrom, v as assembleDag, x as CycleError, y as buildDag } from "./control-DiygoEhm.js";
|
|
7
|
+
import { t as project } from "./project-CP_ye6KI.js";
|
|
7
8
|
import { t as statuses } from "./status-Bm1CGu9C.js";
|
|
8
9
|
//#region ../../core/graph/schema/dist/artefacts.js
|
|
9
10
|
/**
|
|
@@ -926,4 +927,4 @@ const diffSequence = (model, scenario, edited) => {
|
|
|
926
927
|
};
|
|
927
928
|
};
|
|
928
929
|
//#endregion
|
|
929
|
-
export { ModelParseError, OverlayParseError, UnconfirmedChangeError, UnsupportedConditionError, applyModelDiff, artefactKey, blockedBy, confirmChanges, controlDag, criticalPath, dist_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, emptyFactRecord, evaluateBranches, explainStatus, factNamesIn, factsFrom, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, layeredFacts, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, pseudoRoles, readySet, statusRules, statuses, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, whatIfDone };
|
|
930
|
+
export { ModelParseError, OverlayParseError, UnconfirmedChangeError, UnsupportedConditionError, applyModelDiff, artefactKey, blockedBy, boundActivitySchema, confirmChanges, controlDag, criticalPath, dist_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, emptyFactRecord, evaluateBranches, explainStatus, exportFormats, factNamesIn, factsFrom, flowchartToDot, flowchartToMermaid, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, isUnsafeCharacter, layeredFacts, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, project, pseudoRoles, readySet, sequenceToDot, sequenceToMermaid, stateMachineToDot, stateMachineToMermaid, statusRules, statuses, swimlaneToDot, swimlaneToMermaid, terminalJson, terminalText, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, viewText, whatIfDone };
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as layout, c as EngineBox, d as EngineGroup, f as EngineLeaf, i as LayoutView, l as EngineEdge, m as LayoutEngine, n as LayoutOptions, o as Size, p as EngineNode, r as LayoutResult, s as Direction, t as LaneBounds, u as EngineGraph } from "./index-
|
|
1
|
+
import { a as layout, c as EngineBox, d as EngineGroup, f as EngineLeaf, i as LayoutView, l as EngineEdge, m as LayoutEngine, n as LayoutOptions, o as Size, p as EngineNode, r as LayoutResult, s as Direction, t as LaneBounds, u as EngineGraph } from "./index-B2p3mEJ3.js";
|
|
2
2
|
//#region ../../core/graph/layout/dist/elk-engine.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The default engine: elkjs's layered algorithm, run in the calling context from the bundled build so it needs neither a Worker nor Node-only modules. Groups are laid out together with their children (`INCLUDE_CHILDREN`), so an edge between lanes takes part in layer assignment.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { f as toStateMachine, h as toFlowchart, p as toSwimlane, u as toSequence } from "./queries-C8kIDRiY.js";
|
|
2
|
+
//#region ../../core/graph/projection/dist/project.js
|
|
3
|
+
/**
|
|
4
|
+
* Projects a model into the notation a projection names, with the input it records (a subject, a scenario).
|
|
5
|
+
* @param model - The model to project.
|
|
6
|
+
* @param projection - One of the model's declared projections, or one built the same way.
|
|
7
|
+
* @returns The notation and its view.
|
|
8
|
+
*/
|
|
9
|
+
const project = (model, projection) => {
|
|
10
|
+
if (projection.notation === "stateMachine") return {
|
|
11
|
+
notation: "stateMachine",
|
|
12
|
+
view: toStateMachine(model, projection.subject)
|
|
13
|
+
};
|
|
14
|
+
if (projection.notation === "sequence") return {
|
|
15
|
+
notation: "sequence",
|
|
16
|
+
view: toSequence(model, projection.scenario)
|
|
17
|
+
};
|
|
18
|
+
return projection.notation === "swimlane" ? {
|
|
19
|
+
notation: "swimlane",
|
|
20
|
+
view: toSwimlane(model)
|
|
21
|
+
} : {
|
|
22
|
+
notation: "flowchart",
|
|
23
|
+
view: toFlowchart(model)
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { project as t };
|
package/dist/react-flow.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as Status } from "./index-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as LayoutView, n as LayoutOptions, r as LayoutResult, s as Direction } from "./index-
|
|
5
|
-
import { A as ElementFilter,
|
|
1
|
+
import { B as Status } from "./index-wQnLXJmD.js";
|
|
2
|
+
import { M as Projection, T as Element, Y as IdSpace, b as Model } from "./index-DYl6lZLe.js";
|
|
3
|
+
import { N as Flowchart, k as Swimlane, w as StateMachine } from "./index-DluJZTbT.js";
|
|
4
|
+
import { i as LayoutView, n as LayoutOptions, r as LayoutResult, s as Direction } from "./index-B2p3mEJ3.js";
|
|
5
|
+
import { A as ElementFilter, et as Run, y as NamedElement } from "./index-C-ZNF81j.js";
|
|
6
6
|
import { ReactElement } from "react";
|
|
7
7
|
import { ColorMode, Edge, EdgeProps, Node, NodeProps } from "@xyflow/react";
|
|
8
8
|
//#region ../../ui/graph/react-flow/dist/use-layout.d.ts
|
package/dist/react.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ProjectedView, o as ViewsByNotation, s as project } from "./index-DluJZTbT.js";
|
|
2
|
+
import { $ as useModel, A as ElementFilter, B as useElementFilter, C as ruleDescriptions, D as SelectionContainerProps, E as GraphSelectionOptions, F as emptyFilter, G as useBlockers, H as BlockedChain, I as filterElements, J as useReadySet, K as useCriticalPath, L as filterOptions, M as FilterOption, N as FilterOptions, O as SelectionItemProps, P as actorsOf, Q as ModelState, R as matchesFilter, S as elementLabel, T as GraphSelection, U as stepWeight, V as useProjection, W as useBlockedChain, X as useWhyStatus, Y as useStatuses, Z as ModelClient, _ as ElementCardPart, a as FilterPanelPart, b as StatusBadge, c as LegendPart, d as LanePart, et as Run, f as LaneProps, g as ElementCard, h as TransitionItemProps, i as FilterPanel, j as ElementFilterState, k as useGraphSelection, l as LegendProps, m as TransitionItemPart, n as DetailPanelPart, o as FilterPanelProps, p as TransitionItem, q as useImpact, r as DetailPanelProps, s as Legend, t as DetailPanel, tt as noFacts, u as Lane, v as ElementCardProps, w as statusLabels, x as StatusBadgeProps, y as NamedElement, z as sourceScope } from "./index-C-ZNF81j.js";
|
|
2
3
|
export { type BlockedChain, DetailPanel, type DetailPanelPart, type DetailPanelProps, ElementCard, type ElementCardPart, type ElementCardProps, type ElementFilter, type ElementFilterState, type FilterOption, type FilterOptions, FilterPanel, type FilterPanelPart, type FilterPanelProps, type GraphSelection, type GraphSelectionOptions, Lane, type LanePart, type LaneProps, Legend, type LegendPart, type LegendProps, type ModelClient, type ModelState, type NamedElement, type ProjectedView, type Run, type SelectionContainerProps, type SelectionItemProps, StatusBadge, type StatusBadgeProps, TransitionItem, type TransitionItemPart, type TransitionItemProps, type ViewsByNotation, actorsOf, elementLabel, emptyFilter, filterElements, filterOptions, matchesFilter, noFacts, project, ruleDescriptions, sourceScope, statusLabels, stepWeight, useBlockedChain, useBlockers, useCriticalPath, useElementFilter, useGraphSelection, useImpact, useModel, useProjection, useReadySet, useStatuses, useWhyStatus };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as project } from "./project-CP_ye6KI.js";
|
|
2
2
|
import { a as filterOptions, c as useElementFilter, d as useBlockers, f as useCriticalPath, g as useWhyStatus, h as useStatuses, i as filterElements, l as stepWeight, m as useReadySet, n as actorsOf, o as matchesFilter, p as useImpact, r as emptyFilter, s as sourceScope, t as useGraphSelection, u as useBlockedChain } from "./selection-iet5RAlP.js";
|
|
3
3
|
import { a as TransitionItem, c as elementLabel, i as Lane, l as ruleDescriptions, n as FilterPanel, o as ElementCard, r as Legend, s as StatusBadge, t as DetailPanel, u as statusLabels } from "./detail-panel-B1ZmMuJT.js";
|
|
4
4
|
import { ORPCError } from "@orpc/client";
|
|
@@ -73,29 +73,6 @@ const useModel = (client, modelId) => {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region ../../ui/graph/react/dist/projection.js
|
|
75
75
|
/**
|
|
76
|
-
* Projects a model into the notation a projection names, with the input it records (a subject, a scenario).
|
|
77
|
-
* @param model - The model to project.
|
|
78
|
-
* @param projection - One of the model's declared projections, or one built the same way.
|
|
79
|
-
* @returns The notation and its view.
|
|
80
|
-
*/
|
|
81
|
-
const project = (model, projection) => {
|
|
82
|
-
if (projection.notation === "stateMachine") return {
|
|
83
|
-
notation: "stateMachine",
|
|
84
|
-
view: toStateMachine(model, projection.subject)
|
|
85
|
-
};
|
|
86
|
-
if (projection.notation === "sequence") return {
|
|
87
|
-
notation: "sequence",
|
|
88
|
-
view: toSequence(model, projection.scenario)
|
|
89
|
-
};
|
|
90
|
-
return projection.notation === "swimlane" ? {
|
|
91
|
-
notation: "swimlane",
|
|
92
|
-
view: toSwimlane(model)
|
|
93
|
-
} : {
|
|
94
|
-
notation: "flowchart",
|
|
95
|
-
view: toFlowchart(model)
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
76
|
* A model's view in one notation, projected again only when the model or the projection changes.
|
|
100
77
|
* @param model - The model to project.
|
|
101
78
|
* @param projection - The projection to draw. Keep it stable between renders, for instance one of `model.projections`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
1
|
+
import { i as overlaySchema, n as modelSchema } from "./schema-CL95Lyni.js";
|
|
2
|
+
import { A as modelSummarySchema, F as storeChangeSchema, I as storedFactsSchema, L as storedModelSchema, N as relationSchema, O as issueSchema, P as revisionSchema, S as boundItemsSchema, T as factClearingSchema, j as reachSchema, k as modelIdSchema, w as factChangeSchema, x as GraphStoreError } from "./store-CgweIG8J.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { eventIterator, oc } from "@orpc/contract";
|
|
5
5
|
import { implement } from "@orpc/server";
|
|
@@ -128,19 +128,21 @@ const artefactSchema = record({
|
|
|
128
128
|
name: z.string(),
|
|
129
129
|
deliverable: z.boolean().exactOptional()
|
|
130
130
|
});
|
|
131
|
+
/** The strict object schema of an `activity` element, before it is made read-only: the one definition both the model's activity and a bound activity are built from. */
|
|
132
|
+
const activityObjectSchema = z.strictObject({
|
|
133
|
+
kind: z.literal("activity"),
|
|
134
|
+
id,
|
|
135
|
+
extensions: extensionsSchema.exactOptional(),
|
|
136
|
+
label: z.string(),
|
|
137
|
+
actor: actorRef.exactOptional(),
|
|
138
|
+
action: actionRef.exactOptional(),
|
|
139
|
+
source: z.string().exactOptional(),
|
|
140
|
+
affects: z.array(entityRef).readonly().exactOptional(),
|
|
141
|
+
consumes: z.array(artefactRef).readonly().exactOptional(),
|
|
142
|
+
produces: z.array(artefactRef).readonly().exactOptional()
|
|
143
|
+
});
|
|
131
144
|
const elementSchema = z.discriminatedUnion("kind", [
|
|
132
|
-
|
|
133
|
-
kind: z.literal("activity"),
|
|
134
|
-
id,
|
|
135
|
-
extensions: extensionsSchema.exactOptional(),
|
|
136
|
-
label: z.string(),
|
|
137
|
-
actor: actorRef.exactOptional(),
|
|
138
|
-
action: actionRef.exactOptional(),
|
|
139
|
-
source: z.string().exactOptional(),
|
|
140
|
-
affects: z.array(entityRef).readonly().exactOptional(),
|
|
141
|
-
consumes: z.array(artefactRef).readonly().exactOptional(),
|
|
142
|
-
produces: z.array(artefactRef).readonly().exactOptional()
|
|
143
|
-
}),
|
|
145
|
+
activityObjectSchema.readonly(),
|
|
144
146
|
record({
|
|
145
147
|
kind: z.literal("decision"),
|
|
146
148
|
id,
|
|
@@ -230,5 +232,14 @@ const modelSchema = z.strictObject({
|
|
|
230
232
|
projections: z.array(projectionSchema).readonly(),
|
|
231
233
|
views: viewsSchema.exactOptional()
|
|
232
234
|
}).readonly();
|
|
235
|
+
/**
|
|
236
|
+
* An activity bound to the external record it stands for: the model's `activity` element with `source` required, where the model leaves it optional, and equal to `id`. The source-qualified identifier (`github:org/repo#12`) is the element's identity, so the same record synced twice, or reached from two places, is the same element.
|
|
237
|
+
*
|
|
238
|
+
* This is the one definition of a bound activity: a source's sync page and a store's upserted items both use it, so what a source emits is exactly what a store accepts.
|
|
239
|
+
*/
|
|
240
|
+
const boundActivitySchema = activityObjectSchema.extend({ source: z.string().min(1) }).refine((activity) => activity.id === activity.source, {
|
|
241
|
+
message: "a bound activity's id must equal its source",
|
|
242
|
+
path: ["id"]
|
|
243
|
+
}).readonly();
|
|
233
244
|
//#endregion
|
|
234
|
-
export {
|
|
245
|
+
export { parseOverlay as a, elementKinds as c, notations as d, overlayStatuses as f, overlaySchema as i, fragmentOperators as l, pseudoRoles as m, modelSchema as n, validateOverlay as o, participantKinds as p, OverlayParseError as r, toPointer as s, boundActivitySchema as t, messageModes as u };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { i as overlaySchema, n as modelSchema, t as boundActivitySchema } from "./schema-CL95Lyni.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../../core/graph/source-contract/dist/schema.js
|
|
4
|
+
/**
|
|
5
|
+
* The model's own record schemas, taken from `modelSchema` rather than restated, so a page of a sync is exactly a slice of a model and can never drift from it.
|
|
6
|
+
*/
|
|
7
|
+
const modelShape = modelSchema.unwrap().shape;
|
|
8
|
+
/** A participant as the model declares it: an organisation, a repository, a person. */
|
|
9
|
+
const participantSchema = modelShape.participants.unwrap().element;
|
|
10
|
+
/** A transition as the model declares it. A source emits one per dependency, from the prerequisite to the work that waits on it. */
|
|
11
|
+
const transitionSchema = modelShape.transitions.unwrap().element;
|
|
12
|
+
/** The relation kinds a source reports beside the model's transitions. */
|
|
13
|
+
const relationKinds = [
|
|
14
|
+
"child-of",
|
|
15
|
+
"assigned-to",
|
|
16
|
+
"part-of"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* A structural link between two identifiers that the model has no field for: `child-of` from a sub-task activity to its parent activity, `assigned-to` from an activity to a person participant, `part-of` from one participant to the participant that contains it (a repository to its organisation). Relations carry no ordering, so a consumer decides whether a parent waits on its children.
|
|
20
|
+
*/
|
|
21
|
+
const relationSchema = z.strictObject({
|
|
22
|
+
kind: z.enum(relationKinds),
|
|
23
|
+
from: z.string().min(1),
|
|
24
|
+
to: z.string().min(1)
|
|
25
|
+
}).readonly();
|
|
26
|
+
/** Why part of a requested scope is missing from a sync. */
|
|
27
|
+
const gapReasons = ["not-found", "forbidden"];
|
|
28
|
+
/**
|
|
29
|
+
* A part of the requested scope that the source could not read, reported as data so the rest of the sync still arrives. `target` is the source-qualified identifier of what is missing: a scope, a record, or one of a record's connections.
|
|
30
|
+
*/
|
|
31
|
+
const gapSchema = z.strictObject({
|
|
32
|
+
target: z.string().min(1),
|
|
33
|
+
reason: z.enum(gapReasons),
|
|
34
|
+
message: z.string()
|
|
35
|
+
}).readonly();
|
|
36
|
+
/**
|
|
37
|
+
* One page of a sync: bound activities (graph-schema's `boundActivitySchema`), the participants they name, the transitions between them, their relations, their run state, and any gaps. A page is a partial view; `assembleSync` merges a whole sync into one model.
|
|
38
|
+
*
|
|
39
|
+
* `next` is the cursor to resume after this page. It is absent on the last page.
|
|
40
|
+
*/
|
|
41
|
+
const syncPageSchema = z.strictObject({
|
|
42
|
+
participants: z.array(participantSchema).readonly(),
|
|
43
|
+
activities: z.array(boundActivitySchema).readonly(),
|
|
44
|
+
transitions: z.array(transitionSchema).readonly(),
|
|
45
|
+
relations: z.array(relationSchema).readonly(),
|
|
46
|
+
overlay: overlaySchema,
|
|
47
|
+
gaps: z.array(gapSchema).readonly(),
|
|
48
|
+
next: z.string().min(1).exactOptional()
|
|
49
|
+
}).readonly();
|
|
50
|
+
/** The run states a sync filter can select by: whether the work is still open or done. */
|
|
51
|
+
const filterStates = ["open", "done"];
|
|
52
|
+
/** What a sync filter can order the listed records by: when they were created, when they last changed, or how much discussion they have. */
|
|
53
|
+
const orderFields = [
|
|
54
|
+
"created",
|
|
55
|
+
"updated",
|
|
56
|
+
"comments"
|
|
57
|
+
];
|
|
58
|
+
/** Which way a sync filter orders the listed records. */
|
|
59
|
+
const orderDirections = ["ascending", "descending"];
|
|
60
|
+
/**
|
|
61
|
+
* Narrows and orders the records each scope lists, applied on the source's side where the source supports it. Every field is optional, and an absent field does not narrow.
|
|
62
|
+
*
|
|
63
|
+
* - `states` keeps records whose run state is one of those given.
|
|
64
|
+
* - `labels` keeps records carrying at least one of the labels given.
|
|
65
|
+
* - `order` is the order the records are listed in; absent, the source's own stable order.
|
|
66
|
+
*
|
|
67
|
+
* A filter narrows what a scope lists, not what the listed records reach: a blocker of a listed record is read whatever its own state or labels, because it is a dependency of work the filter kept.
|
|
68
|
+
*/
|
|
69
|
+
const syncFilterSchema = z.strictObject({
|
|
70
|
+
states: z.array(z.enum(filterStates)).min(1).readonly().exactOptional(),
|
|
71
|
+
labels: z.array(z.string().min(1)).min(1).readonly().exactOptional(),
|
|
72
|
+
order: z.strictObject({
|
|
73
|
+
field: z.enum(orderFields),
|
|
74
|
+
direction: z.enum(orderDirections)
|
|
75
|
+
}).readonly().exactOptional()
|
|
76
|
+
}).readonly();
|
|
77
|
+
/**
|
|
78
|
+
* What to sync and where to resume. `scope` names what to read as source-qualified scope identifiers (for GitHub, `github:org` for every repository an owner has, or `github:org/repo`), read in the order given. `after` is a cursor from an earlier page's `next`: the sync continues with the page that followed it. A cursor is valid only with the scope list and the filter it was issued for.
|
|
79
|
+
*
|
|
80
|
+
* `filter` narrows and orders what each scope lists (see `syncFilterSchema`).
|
|
81
|
+
*/
|
|
82
|
+
const syncInputSchema = z.strictObject({
|
|
83
|
+
scope: z.array(z.string().min(1)).min(1).readonly(),
|
|
84
|
+
after: z.string().min(1).exactOptional(),
|
|
85
|
+
filter: syncFilterSchema.exactOptional()
|
|
86
|
+
}).readonly();
|
|
87
|
+
/**
|
|
88
|
+
* A scope a person can choose to sync, as a picker lists it. `scope` is the scope identifier to pass to `sync` (for GitHub, `github:org` for an organisation, `github:org/repo` for a repository), `label` its display name, `description` the source's own description when it has one, `url` where it lives in the source's own interface, and `archived` whether the source has archived it.
|
|
89
|
+
*/
|
|
90
|
+
const scopeEntrySchema = z.strictObject({
|
|
91
|
+
scope: z.string().min(1),
|
|
92
|
+
label: z.string(),
|
|
93
|
+
description: z.string().exactOptional(),
|
|
94
|
+
url: z.url().exactOptional(),
|
|
95
|
+
archived: z.boolean()
|
|
96
|
+
}).readonly();
|
|
97
|
+
/**
|
|
98
|
+
* One page of a scope listing. `entries` are in the source's stable listing order, `gaps` name a parent the source could not read (it does not exist, or the credentials cannot see it), and `next` is the cursor to resume after this page, absent on the last.
|
|
99
|
+
*/
|
|
100
|
+
const scopeListingSchema = z.strictObject({
|
|
101
|
+
entries: z.array(scopeEntrySchema).readonly(),
|
|
102
|
+
gaps: z.array(gapSchema).readonly(),
|
|
103
|
+
next: z.string().min(1).exactOptional()
|
|
104
|
+
}).readonly();
|
|
105
|
+
/** Where a listing of the top-level scopes resumes: a cursor from an earlier page's `next`. */
|
|
106
|
+
const scopeRootsInputSchema = z.strictObject({ after: z.string().min(1).exactOptional() }).readonly();
|
|
107
|
+
/** The scope whose child scopes to list (for GitHub, the repositories of `github:owner`), and where to resume. A cursor is valid only for the parent it was issued for. */
|
|
108
|
+
const scopeChildrenInputSchema = z.strictObject({
|
|
109
|
+
scope: z.string().min(1),
|
|
110
|
+
after: z.string().min(1).exactOptional()
|
|
111
|
+
}).readonly();
|
|
112
|
+
/** What a source says about itself. `source` is the prefix of every identifier it emits, before the colon. */
|
|
113
|
+
const sourceDescriptionSchema = z.strictObject({ source: z.string().regex(/^[a-z][a-z0-9-]*$/u) }).readonly();
|
|
114
|
+
/** Why a request was rejected as malformed. */
|
|
115
|
+
const badRequestReasons = ["invalid-cursor", "invalid-scope"];
|
|
116
|
+
//#endregion
|
|
117
|
+
export { syncPageSchema as _, orderDirections as a, relationKinds as c, scopeEntrySchema as d, scopeListingSchema as f, syncInputSchema as g, syncFilterSchema as h, gapSchema as i, relationSchema as l, sourceDescriptionSchema as m, filterStates as n, orderFields as o, scopeRootsInputSchema as p, gapReasons as r, participantSchema as s, badRequestReasons as t, scopeChildrenInputSchema as u, transitionSchema as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as GitHubTokenPort } from "../../graphql-
|
|
1
|
+
import { t as GitHubTokenPort } from "../../graphql-CGWZ6USe.js";
|
|
2
2
|
//#region ../../adapters/graph/source-github-issues/dist/node.d.ts
|
|
3
3
|
/** Where `githubTokenFromEnvironment` looks. Both are ports, so a test supplies its own. */
|
|
4
4
|
export interface EnvironmentTokenOptions {
|
package/dist/source/github.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
1
|
+
import { $ as transitionSchema, A as SourceDescription, B as orderDirections, C as Relation, D as ScopeListing, E as ScopeEntry, F as SyncPage, G as scopeChildrenInputSchema, H as participantSchema, I as badRequestReasons, J as scopeRootsInputSchema, K as scopeEntrySchema, L as filterStates, M as SourceTransition, N as SyncFilter, O as ScopeListingInput, P as SyncInput, Q as syncPageSchema, R as gapReasons, S as OrderField, T as ScopeChildrenInput, U as relationKinds, V as orderFields, W as relationSchema, X as syncFilterSchema, Y as sourceDescriptionSchema, Z as syncInputSchema, _ as BadRequestReason, a as assembleSync, b as GapReason, c as GraphSourceRouter, d as PageRequest, f as createGraphSourceRouter, g as graphSourceContract, h as GraphSourceClient, i as AssembledSync, j as SourceParticipant, k as ScopeRootsInput, l as GraphSourceScopes, m as GraphSourceFailure, n as FakePage, o as ChildrenRequest, p as GraphSourceError, q as scopeListingSchema, r as createFakeGraphSource, s as GraphSourcePager, t as FakeGraphSourceOptions, u as ListingRequest, v as FilterState, w as RelationKind, x as OrderDirection, y as Gap, z as gapSchema } from "../index-CotF9Lhh.js";
|
|
2
|
+
import { n as GraphqlFetch, r as githubGraphqlEndpoint, t as GitHubTokenPort } from "../graphql-CGWZ6USe.js";
|
|
3
|
+
import { a as GitHubIssuesSourceOptions, i as storedTokenPort, n as StoredTokenPortOptions, o as createGitHubIssuesSource, r as selectStoredToken, t as StoredGitHubToken } from "../index-CiaCmQDP.js";
|
|
3
4
|
//#region ../../core/graph/source-contract/dist/paginate.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Pages through a cursor-linked sequence on demand: each `next()` reads one page, starting after `first`, and the sequence ends after the page whose `next` is absent. Nothing is read ahead of the consumer, so a consumer that stops early stops the reads.
|
|
@@ -46,4 +47,4 @@ export declare const repositoryId: (owner: string, name: string) => string;
|
|
|
46
47
|
/** The identifier of an account participant, organisation or user: `github:@login`. The `@` keeps it apart from the `github:owner` scope syntax. */
|
|
47
48
|
export declare const accountId: (login: string) => string;
|
|
48
49
|
//#endregion
|
|
49
|
-
export { type AssembledSync, type BadRequestReason, type
|
|
50
|
+
export { type AssembledSync, type BadRequestReason, type ChildrenRequest, type FakeGraphSourceOptions, type FakePage, type FilterState, type Gap, type GapReason, type GitHubIssuesSourceOptions, type GitHubTokenPort, type GraphSourceClient, GraphSourceError, type GraphSourceFailure, type GraphSourcePager, type GraphSourceRouter, type GraphSourceScopes, type GraphqlFetch, type ListingRequest, type OrderDirection, type OrderField, type PageRequest, type Relation, type RelationKind, type Scope, type ScopeChildrenInput, type ScopeEntry, type ScopeListing, type ScopeListingInput, type ScopeRootsInput, type SourceDescription, type SourceParticipant, type SourceTransition, type StoredGitHubToken, type StoredTokenPortOptions, type SyncFilter, type SyncInput, type SyncPage, assembleSync, badRequestReasons, createFakeGraphSource, createGitHubIssuesSource, createGraphSourceRouter, filterStates, gapReasons, gapSchema, githubGraphqlEndpoint, graphSourceContract, orderDirections, orderFields, participantSchema, relationKinds, relationSchema, scopeChildrenInputSchema, scopeEntrySchema, scopeListingSchema, scopeRootsInputSchema, selectStoredToken, sourceDescriptionSchema, storedTokenPort, syncFilterSchema, syncInputSchema, syncPageSchema, transitionSchema };
|
package/dist/source/github.js
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as syncPageSchema, a as orderDirections, c as relationKinds, d as scopeEntrySchema, f as scopeListingSchema, g as syncInputSchema, h as syncFilterSchema, i as gapSchema, l as relationSchema, m as sourceDescriptionSchema, n as filterStates, o as orderFields, p as scopeRootsInputSchema, r as gapReasons, s as participantSchema, t as badRequestReasons, u as scopeChildrenInputSchema, v as transitionSchema } from "../schema-DMXa8gAZ.js";
|
|
2
|
+
import { a as ownerScopeId, c as githubGraphqlEndpoint, d as graphSourceContract, i as issueId, l as createGraphSourceRouter, n as accountId, o as parseScope, r as githubSource, s as repositoryId, t as createGitHubIssuesSource, u as paginate } from "../source-DM4fLS5P.js";
|
|
2
3
|
import { t as GraphSourceError } from "../errors-BZe5WzCn.js";
|
|
4
|
+
//#region ../../core/graph/source-contract/dist/assemble.js
|
|
5
|
+
const relationKey = (relation) => JSON.stringify([
|
|
6
|
+
relation.kind,
|
|
7
|
+
relation.from,
|
|
8
|
+
relation.to
|
|
9
|
+
]);
|
|
10
|
+
/** Keeps one entry per key, in first-seen order, holding the latest value seen for it. */
|
|
11
|
+
const latestById = (items, keyOf) => {
|
|
12
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
13
|
+
for (const item of items) byKey.set(keyOf(item), item);
|
|
14
|
+
return [...byKey.values()];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Merges the pages of a sync into one model. A record can appear on several pages, for example an issue in another repository reached through a dependency before its own repository is read; identity is the identifier, so it becomes one element, and where pages disagree the later page wins, being the more recent read.
|
|
18
|
+
* @param pages - The pages of one sync, in the order they arrived.
|
|
19
|
+
* @returns The model, overlay, relations and gaps of the whole sync.
|
|
20
|
+
*/
|
|
21
|
+
const assembleSync = (pages) => {
|
|
22
|
+
const overlay = Object.fromEntries(pages.flatMap((page) => Object.entries(page.overlay)));
|
|
23
|
+
return {
|
|
24
|
+
model: {
|
|
25
|
+
participants: latestById(pages.flatMap((page) => page.participants), (participant) => participant.id),
|
|
26
|
+
events: [],
|
|
27
|
+
actions: [],
|
|
28
|
+
artefacts: [],
|
|
29
|
+
elements: latestById(pages.flatMap((page) => page.activities), (activity) => activity.id),
|
|
30
|
+
transitions: latestById(pages.flatMap((page) => page.transitions), (transition) => transition.id),
|
|
31
|
+
fragments: [],
|
|
32
|
+
projections: []
|
|
33
|
+
},
|
|
34
|
+
overlay,
|
|
35
|
+
relations: latestById(pages.flatMap((page) => page.relations), relationKey),
|
|
36
|
+
gaps: pages.flatMap((page) => page.gaps)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
3
40
|
//#region ../../core/graph/source-contract/dist/fake.js
|
|
4
41
|
const gapIndex = -1;
|
|
5
42
|
const cursorPattern = /^(?<scope>[^@;]+)@(?<index>-1|0|[1-9]\d*)(?:;(?<filter>.+))?$/u;
|
|
@@ -198,4 +235,4 @@ const storedTokenPort = (options) => async (owner, signal) => {
|
|
|
198
235
|
return chosen.token;
|
|
199
236
|
};
|
|
200
237
|
//#endregion
|
|
201
|
-
export { GraphSourceError, accountId, assembleSync, badRequestReasons,
|
|
238
|
+
export { GraphSourceError, accountId, assembleSync, badRequestReasons, createFakeGraphSource, createGitHubIssuesSource, createGraphSourceRouter, filterStates, gapReasons, gapSchema, githubGraphqlEndpoint, githubSource, graphSourceContract, issueId, orderDirections, orderFields, ownerScopeId, paginate, parseScope, participantSchema, relationKinds, relationSchema, repositoryId, scopeChildrenInputSchema, scopeEntrySchema, scopeListingSchema, scopeRootsInputSchema, selectStoredToken, sourceDescriptionSchema, storedTokenPort, syncFilterSchema, syncInputSchema, syncPageSchema, transitionSchema };
|
|
@@ -1,132 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as syncPageSchema, f as scopeListingSchema, g as syncInputSchema, h as syncFilterSchema, m as sourceDescriptionSchema, p as scopeRootsInputSchema, t as badRequestReasons, u as scopeChildrenInputSchema } from "./schema-DMXa8gAZ.js";
|
|
2
2
|
import { t as GraphSourceError } from "./errors-BZe5WzCn.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { eventIterator, oc } from "@orpc/contract";
|
|
5
5
|
import { withEventMeta } from "@orpc/client";
|
|
6
6
|
import { implement } from "@orpc/server";
|
|
7
|
-
//#region ../../core/graph/source-contract/dist/schema.js
|
|
8
|
-
/**
|
|
9
|
-
* The model's own record schemas, taken from `modelSchema` rather than restated, so a page of a sync is exactly a slice of a model and can never drift from it.
|
|
10
|
-
*/
|
|
11
|
-
const modelShape = modelSchema.unwrap().shape;
|
|
12
|
-
/** A participant as the model declares it: an organisation, a repository, a person. */
|
|
13
|
-
const participantSchema = modelShape.participants.unwrap().element;
|
|
14
|
-
/** A transition as the model declares it. A source emits one per dependency, from the prerequisite to the work that waits on it. */
|
|
15
|
-
const transitionSchema = modelShape.transitions.unwrap().element;
|
|
16
|
-
/** The model's `activity` element: the first variant of its element union, pinned by a type test so a reordering of the union is a compile error. */
|
|
17
|
-
const [activityElementSchema] = modelShape.elements.unwrap().element.options;
|
|
18
|
-
/**
|
|
19
|
-
* An activity bound to the external record it stands for. `source` is required here, where the model leaves it optional, and it equals `id`: the source-qualified identifier (`github:org/repo#12`) is the element's identity, so the same record synced twice, or reached from two places, is the same element.
|
|
20
|
-
*/
|
|
21
|
-
const boundActivitySchema = activityElementSchema.unwrap().extend({ source: z.string().min(1) }).refine((activity) => activity.id === activity.source, {
|
|
22
|
-
message: "a bound activity's id must equal its source",
|
|
23
|
-
path: ["id"]
|
|
24
|
-
}).readonly();
|
|
25
|
-
/** The relation kinds a source reports beside the model's transitions. */
|
|
26
|
-
const relationKinds = [
|
|
27
|
-
"child-of",
|
|
28
|
-
"assigned-to",
|
|
29
|
-
"part-of"
|
|
30
|
-
];
|
|
31
|
-
/**
|
|
32
|
-
* A structural link between two identifiers that the model has no field for: `child-of` from a sub-task activity to its parent activity, `assigned-to` from an activity to a person participant, `part-of` from one participant to the participant that contains it (a repository to its organisation). Relations carry no ordering, so a consumer decides whether a parent waits on its children.
|
|
33
|
-
*/
|
|
34
|
-
const relationSchema = z.strictObject({
|
|
35
|
-
kind: z.enum(relationKinds),
|
|
36
|
-
from: z.string().min(1),
|
|
37
|
-
to: z.string().min(1)
|
|
38
|
-
}).readonly();
|
|
39
|
-
/** Why part of a requested scope is missing from a sync. */
|
|
40
|
-
const gapReasons = ["not-found", "forbidden"];
|
|
41
|
-
/**
|
|
42
|
-
* A part of the requested scope that the source could not read, reported as data so the rest of the sync still arrives. `target` is the source-qualified identifier of what is missing: a scope, a record, or one of a record's connections.
|
|
43
|
-
*/
|
|
44
|
-
const gapSchema = z.strictObject({
|
|
45
|
-
target: z.string().min(1),
|
|
46
|
-
reason: z.enum(gapReasons),
|
|
47
|
-
message: z.string()
|
|
48
|
-
}).readonly();
|
|
49
|
-
/**
|
|
50
|
-
* One page of a sync: bound activities, the participants they name, the transitions between them, their relations, their run state, and any gaps. A page is a partial view; `assembleSync` merges a whole sync into one model.
|
|
51
|
-
*
|
|
52
|
-
* `next` is the cursor to resume after this page. It is absent on the last page.
|
|
53
|
-
*/
|
|
54
|
-
const syncPageSchema = z.strictObject({
|
|
55
|
-
participants: z.array(participantSchema).readonly(),
|
|
56
|
-
activities: z.array(boundActivitySchema).readonly(),
|
|
57
|
-
transitions: z.array(transitionSchema).readonly(),
|
|
58
|
-
relations: z.array(relationSchema).readonly(),
|
|
59
|
-
overlay: overlaySchema,
|
|
60
|
-
gaps: z.array(gapSchema).readonly(),
|
|
61
|
-
next: z.string().min(1).exactOptional()
|
|
62
|
-
}).readonly();
|
|
63
|
-
/** The run states a sync filter can select by: whether the work is still open or done. */
|
|
64
|
-
const filterStates = ["open", "done"];
|
|
65
|
-
/** What a sync filter can order the listed records by: when they were created, when they last changed, or how much discussion they have. */
|
|
66
|
-
const orderFields = [
|
|
67
|
-
"created",
|
|
68
|
-
"updated",
|
|
69
|
-
"comments"
|
|
70
|
-
];
|
|
71
|
-
/** Which way a sync filter orders the listed records. */
|
|
72
|
-
const orderDirections$1 = ["ascending", "descending"];
|
|
73
|
-
/**
|
|
74
|
-
* Narrows and orders the records each scope lists, applied on the source's side where the source supports it. Every field is optional, and an absent field does not narrow.
|
|
75
|
-
*
|
|
76
|
-
* - `states` keeps records whose run state is one of those given.
|
|
77
|
-
* - `labels` keeps records carrying at least one of the labels given.
|
|
78
|
-
* - `order` is the order the records are listed in; absent, the source's own stable order.
|
|
79
|
-
*
|
|
80
|
-
* A filter narrows what a scope lists, not what the listed records reach: a blocker of a listed record is read whatever its own state or labels, because it is a dependency of work the filter kept.
|
|
81
|
-
*/
|
|
82
|
-
const syncFilterSchema = z.strictObject({
|
|
83
|
-
states: z.array(z.enum(filterStates)).min(1).readonly().exactOptional(),
|
|
84
|
-
labels: z.array(z.string().min(1)).min(1).readonly().exactOptional(),
|
|
85
|
-
order: z.strictObject({
|
|
86
|
-
field: z.enum(orderFields),
|
|
87
|
-
direction: z.enum(orderDirections$1)
|
|
88
|
-
}).readonly().exactOptional()
|
|
89
|
-
}).readonly();
|
|
90
|
-
/**
|
|
91
|
-
* What to sync and where to resume. `scope` names what to read as source-qualified scope identifiers (for GitHub, `github:org` for every repository an owner has, or `github:org/repo`), read in the order given. `after` is a cursor from an earlier page's `next`: the sync continues with the page that followed it. A cursor is valid only with the scope list and the filter it was issued for.
|
|
92
|
-
*
|
|
93
|
-
* `filter` narrows and orders what each scope lists (see `syncFilterSchema`).
|
|
94
|
-
*/
|
|
95
|
-
const syncInputSchema = z.strictObject({
|
|
96
|
-
scope: z.array(z.string().min(1)).min(1).readonly(),
|
|
97
|
-
after: z.string().min(1).exactOptional(),
|
|
98
|
-
filter: syncFilterSchema.exactOptional()
|
|
99
|
-
}).readonly();
|
|
100
|
-
/**
|
|
101
|
-
* A scope a person can choose to sync, as a picker lists it. `scope` is the scope identifier to pass to `sync` (for GitHub, `github:org` for an organisation, `github:org/repo` for a repository), `label` its display name, `description` the source's own description when it has one, `url` where it lives in the source's own interface, and `archived` whether the source has archived it.
|
|
102
|
-
*/
|
|
103
|
-
const scopeEntrySchema = z.strictObject({
|
|
104
|
-
scope: z.string().min(1),
|
|
105
|
-
label: z.string(),
|
|
106
|
-
description: z.string().exactOptional(),
|
|
107
|
-
url: z.url().exactOptional(),
|
|
108
|
-
archived: z.boolean()
|
|
109
|
-
}).readonly();
|
|
110
|
-
/**
|
|
111
|
-
* One page of a scope listing. `entries` are in the source's stable listing order, `gaps` name a parent the source could not read (it does not exist, or the credentials cannot see it), and `next` is the cursor to resume after this page, absent on the last.
|
|
112
|
-
*/
|
|
113
|
-
const scopeListingSchema = z.strictObject({
|
|
114
|
-
entries: z.array(scopeEntrySchema).readonly(),
|
|
115
|
-
gaps: z.array(gapSchema).readonly(),
|
|
116
|
-
next: z.string().min(1).exactOptional()
|
|
117
|
-
}).readonly();
|
|
118
|
-
/** Where a listing of the top-level scopes resumes: a cursor from an earlier page's `next`. */
|
|
119
|
-
const scopeRootsInputSchema = z.strictObject({ after: z.string().min(1).exactOptional() }).readonly();
|
|
120
|
-
/** The scope whose child scopes to list (for GitHub, the repositories of `github:owner`), and where to resume. A cursor is valid only for the parent it was issued for. */
|
|
121
|
-
const scopeChildrenInputSchema = z.strictObject({
|
|
122
|
-
scope: z.string().min(1),
|
|
123
|
-
after: z.string().min(1).exactOptional()
|
|
124
|
-
}).readonly();
|
|
125
|
-
/** What a source says about itself. `source` is the prefix of every identifier it emits, before the colon. */
|
|
126
|
-
const sourceDescriptionSchema = z.strictObject({ source: z.string().regex(/^[a-z][a-z0-9-]*$/u) }).readonly();
|
|
127
|
-
/** Why a request was rejected as malformed. */
|
|
128
|
-
const badRequestReasons = ["invalid-cursor", "invalid-scope"];
|
|
129
|
-
//#endregion
|
|
130
7
|
//#region ../../core/graph/source-contract/dist/contract.js
|
|
131
8
|
/**
|
|
132
9
|
* The typed errors every procedure can end with, each carrying its detail as data. The codes are oRPC's common codes, so an HTTP transport answers with the matching status (401, 429, 400) without any per-transport mapping.
|
|
@@ -286,42 +163,6 @@ const createGraphSourceRouter = (pager) => os.router({ v1: {
|
|
|
286
163
|
}
|
|
287
164
|
} });
|
|
288
165
|
//#endregion
|
|
289
|
-
//#region ../../core/graph/source-contract/dist/assemble.js
|
|
290
|
-
const relationKey = (relation) => JSON.stringify([
|
|
291
|
-
relation.kind,
|
|
292
|
-
relation.from,
|
|
293
|
-
relation.to
|
|
294
|
-
]);
|
|
295
|
-
/** Keeps one entry per key, in first-seen order, holding the latest value seen for it. */
|
|
296
|
-
const latestById = (items, keyOf) => {
|
|
297
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
298
|
-
for (const item of items) byKey.set(keyOf(item), item);
|
|
299
|
-
return [...byKey.values()];
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Merges the pages of a sync into one model. A record can appear on several pages, for example an issue in another repository reached through a dependency before its own repository is read; identity is the identifier, so it becomes one element, and where pages disagree the later page wins, being the more recent read.
|
|
303
|
-
* @param pages - The pages of one sync, in the order they arrived.
|
|
304
|
-
* @returns The model, overlay, relations and gaps of the whole sync.
|
|
305
|
-
*/
|
|
306
|
-
const assembleSync = (pages) => {
|
|
307
|
-
const overlay = Object.fromEntries(pages.flatMap((page) => Object.entries(page.overlay)));
|
|
308
|
-
return {
|
|
309
|
-
model: {
|
|
310
|
-
participants: latestById(pages.flatMap((page) => page.participants), (participant) => participant.id),
|
|
311
|
-
events: [],
|
|
312
|
-
actions: [],
|
|
313
|
-
artefacts: [],
|
|
314
|
-
elements: latestById(pages.flatMap((page) => page.activities), (activity) => activity.id),
|
|
315
|
-
transitions: latestById(pages.flatMap((page) => page.transitions), (transition) => transition.id),
|
|
316
|
-
fragments: [],
|
|
317
|
-
projections: []
|
|
318
|
-
},
|
|
319
|
-
overlay,
|
|
320
|
-
relations: latestById(pages.flatMap((page) => page.relations), relationKey),
|
|
321
|
-
gaps: pages.flatMap((page) => page.gaps)
|
|
322
|
-
};
|
|
323
|
-
};
|
|
324
|
-
//#endregion
|
|
325
166
|
//#region ../../adapters/graph/source-github-issues/dist/cursor.js
|
|
326
167
|
/**
|
|
327
168
|
* Where the next page of a sync starts. A position is plain data, so a cursor resumes in any process.
|
|
@@ -1333,4 +1174,4 @@ const createGitHubIssuesSource = (options) => {
|
|
|
1333
1174
|
};
|
|
1334
1175
|
};
|
|
1335
1176
|
//#endregion
|
|
1336
|
-
export {
|
|
1177
|
+
export { ownerScopeId as a, githubGraphqlEndpoint as c, graphSourceContract as d, issueId as i, createGraphSourceRouter as l, accountId as n, parseScope as o, githubSource as r, repositoryId as s, createGitHubIssuesSource as t, paginate as u };
|
package/dist/store/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as GraphStore } from "../index-
|
|
1
|
+
import { w as GraphStore } from "../index-KhygugOP.js";
|
|
2
2
|
import { DatabaseSyncOptions } from "node:sqlite";
|
|
3
3
|
import { NodeSQLiteDatabase } from "drizzle-orm/node-sqlite";
|
|
4
4
|
//#region ../../adapters/graph/sqlite-node/dist/open.d.ts
|
package/dist/store/node.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as openNodeGraphStore, n as privateDirectoryMode, r as privateFileMode, t as prepareDataFile } from "../data-file-
|
|
1
|
+
import { i as openNodeGraphStore, n as privateDirectoryMode, r as privateFileMode, t as prepareDataFile } from "../data-file-B8__c10l.js";
|
|
2
2
|
export { openNodeGraphStore, prepareDataFile, privateDirectoryMode, privateFileMode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createGraphStoreRouter } from "../../router-
|
|
1
|
+
import { F as storeChangeSchema, t as createSqliteGraphStore, y as ChangeFeed } from "../../store-CgweIG8J.js";
|
|
2
|
+
import { t as createGraphStoreRouter } from "../../router-DzVcQ28U.js";
|
|
3
3
|
import sqlite3InitModule from "@sqlite.org/sqlite-wasm";
|
|
4
4
|
import { RPCHandler } from "@orpc/server/message-port";
|
|
5
5
|
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
package/dist/store/wasm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ct as GraphStoreClient } from "../index-KhygugOP.js";
|
|
2
2
|
//#region ../../adapters/graph/sqlite-wasm/dist/client.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A client for the graph store a worker serves with `serveGraphStoreInWorker`. Every procedure of the contract is available, with its abort signal and typed errors, as if the store were in the page.
|