@shortlink-org/portolan 0.2.4 → 0.4.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 +174 -6
- package/catalog/enum_test.go +46 -0
- package/catalog/evidence_test.go +35 -0
- package/catalog/model.go +1213 -0
- package/catalog/roundtrip_test.go +210 -0
- package/catalog/via_test.go +38 -0
- package/cli/init.test.mjs +6 -1
- package/cli/portolan.mjs +14 -1
- package/cli/portolan.test.mjs +49 -0
- package/go.mod +21 -0
- package/go.sum +34 -0
- package/internal/gocall/README.md +19 -0
- package/internal/gocall/analyze.go +189 -0
- package/internal/gocall/analyze_test.go +107 -0
- package/internal/gohttp/analyze.go +2562 -0
- package/internal/gohttp/destination.go +373 -0
- package/internal/gohttp/endpoints.go +1067 -0
- package/internal/gohttp/roots.go +320 -0
- package/internal/gohttp/typed.go +96 -0
- package/internal/goscan/constants.go +85 -0
- package/internal/goscan/goscan_test.go +227 -0
- package/internal/goscan/index.go +629 -0
- package/internal/goscan/index_test.go +66 -0
- package/internal/goscan/names.go +52 -0
- package/internal/goscan/parse_test.go +11 -0
- package/internal/goscan/source.go +37 -0
- package/internal/goscan/tree.go +284 -0
- package/internal/goscan/types.go +99 -0
- package/internal/wsdl/ids.go +127 -0
- package/internal/wsdl/ids_test.go +21 -0
- package/internal/wsdl/model.go +70 -0
- package/internal/wsdl/parse.go +949 -0
- package/internal/wsdl/parse_test.go +170 -0
- package/package.json +28 -15
- package/plugin/describe.go +156 -0
- package/plugin/describe_test.go +114 -0
- package/plugin/protocol.go +141 -0
- package/plugin/schematest/schematest.go +126 -0
- package/plugins/README.md +404 -50
- package/plugins/cmd/portolan-http-clients/main.go +19 -0
- package/plugins/extract-argocd/options.schema.json +44 -0
- package/plugins/extract-celery/extract.py +0 -2
- package/plugins/extract-celery/extract_test.py +1 -1
- package/plugins/extract-celery/main.py +1 -0
- package/plugins/extract-csharp-ddd/README.md +213 -0
- package/plugins/extract-csharp-ddd/options.schema.json +55 -0
- package/plugins/extract-django/README.md +52 -19
- package/plugins/extract-django/choices.py +47 -0
- package/plugins/extract-django/domain.py +30 -18
- package/plugins/extract-django/extract.py +21 -7
- package/plugins/extract-django/extract_test.py +68 -2
- package/plugins/extract-django/lifecycle.py +4 -28
- package/plugins/extract-django/main.py +1 -0
- package/plugins/extract-django/operations.py +1 -1
- package/plugins/extract-django/routing_test.py +109 -1
- package/plugins/extract-django/rules.py +154 -0
- package/plugins/extract-django/rules_test.py +158 -0
- package/plugins/extract-django/store.py +1 -1
- package/plugins/extract-django/transport.py +101 -55
- package/plugins/extract-django/verbs.py +241 -0
- package/plugins/extract-go/README.md +47 -0
- package/plugins/extract-go-sqs/options.schema.json +21 -0
- package/plugins/extract-http-clients/describe.go +20 -0
- package/plugins/extract-http-clients/describe_test.go +11 -0
- package/plugins/extract-http-clients/extract.go +740 -0
- package/plugins/extract-http-clients/extract_test.go +1561 -0
- package/plugins/extract-http-clients/main.go +41 -0
- package/plugins/extract-java/build/org/portolan/extract/Extract.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Main.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Builder.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Input.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Options.class +0 -0
- package/plugins/extract-k8s/options.schema.json +32 -0
- package/plugins/extract-laravel/Cargo.lock +962 -0
- package/plugins/extract-laravel/Cargo.toml +20 -0
- package/plugins/extract-laravel/README.md +200 -0
- package/plugins/extract-laravel/options.schema.json +68 -0
- package/plugins/extract-laravel/rustfmt.toml +1 -0
- package/plugins/extract-php-ddd/Cargo.lock +972 -0
- package/plugins/extract-php-ddd/Cargo.toml +22 -0
- package/plugins/extract-php-ddd/README.md +141 -0
- package/plugins/extract-php-ddd/options.schema.json +50 -0
- package/plugins/extract-php-ddd/rustfmt.toml +1 -0
- package/plugins/extract-python-kafka/extract.py +0 -2
- package/plugins/extract-python-kafka/extract_test.py +1 -1
- package/plugins/extract-python-kafka/main.py +1 -0
- package/plugins/extract-terraform/options.schema.json +26 -0
- package/plugins/extract-ts/extract.test.ts +2 -2
- package/plugins/extract-ts/extract.ts +4 -5
- package/plugins/extract-ts/graphql.test.ts +1 -1
- package/plugins/extract-ts/main.ts +1 -0
- package/plugins/openapi/ids.go +261 -0
- package/plugins/openapi/ids_test.go +98 -0
- package/plugins/phpscan/Cargo.lock +953 -0
- package/plugins/phpscan/Cargo.toml +19 -0
- package/plugins/phpscan/rustfmt.toml +1 -0
- package/plugins/portolan-go.wasm +0 -0
- package/plugins/pyplugin/catalog.py +24 -1
- package/plugins/pyplugin/protocol.py +1 -5
- package/plugins/verify-otel/options.schema.json +12 -0
- package/portolan.json +132 -4
- package/rules/builtin.json +218 -0
- package/schema/portolan.schema.json +905 -4
- package/scripts/README.md +21 -13
- package/scripts/catalog-sources.mjs +6 -0
- package/scripts/delivery-presets.mjs +57 -14
- package/scripts/diff.mjs +5 -1
- package/scripts/django-aggregates.test.mjs +58 -0
- package/scripts/gen-likec4.mjs +150 -17
- package/scripts/gen-likec4.test.mjs +96 -0
- package/scripts/gen.mjs +148 -118
- package/scripts/gitops-example.test.mjs +108 -0
- package/scripts/go-discovery.test.mjs +30 -0
- package/scripts/history.mjs +186 -3
- package/scripts/history.test.mjs +1 -1
- package/scripts/host-plugins/fetch-argocd.mjs +338 -0
- package/scripts/host-plugins/fetch-argocd.options.json +49 -0
- package/scripts/host-plugins/fetch-argocd.test.mjs +274 -0
- package/scripts/host-plugins/fetch-bsr.mjs +1 -0
- package/scripts/host-plugins/fetch-csr.mjs +1 -0
- package/scripts/host-plugins/fetch-git.mjs +78 -21
- package/scripts/host-plugins/fetch-git.test.mjs +62 -8
- package/scripts/host-plugins/fetch-k8s.mjs +263 -0
- package/scripts/host-plugins/fetch-k8s.options.json +50 -0
- package/scripts/host-plugins/fetch-k8s.test.mjs +259 -0
- package/scripts/host-plugins/k8s-topology.mjs +183 -0
- package/scripts/json-format.mjs +192 -0
- package/scripts/json-format.test.mjs +97 -0
- package/scripts/local-api.mjs +287 -12
- package/scripts/local-api.test.mjs +150 -5
- package/scripts/local-discovery.mjs +94 -9
- package/scripts/manifest.mjs +14 -3
- package/scripts/manifest.test.mjs +24 -0
- package/scripts/output-diff.mjs +94 -0
- package/scripts/output-diff.test.mjs +36 -0
- package/scripts/package-smoke.mjs +62 -4
- package/scripts/plugin-host.mjs +45 -3
- package/scripts/plugin-host.test.mjs +9 -0
- package/scripts/plugin-wasm-worker.mjs +4 -1
- package/scripts/plugins-fresh.mjs +97 -0
- package/scripts/plugins-fresh.test.mjs +64 -0
- package/scripts/provenance.mjs +72 -0
- package/scripts/provenance.test.mjs +149 -0
- package/scripts/run-builtin.mjs +62 -7
- package/scripts/schema.mjs +167 -19
- package/scripts/trace-trials.mjs +176 -0
- package/scripts/trace-trials.test.mjs +142 -0
- package/scripts/warning-policy.mjs +167 -0
- package/scripts/warning-policy.test.mjs +93 -0
- package/src/app/Breadcrumbs.test.ts +3 -0
- package/src/app/Breadcrumbs.tsx +3 -0
- package/src/app/CatalogApp.tsx +2 -0
- package/src/app/Sidebar.tsx +3 -3
- package/src/app/SidebarFooter.tsx +20 -4
- package/src/catalog-docs.test.ts +64 -0
- package/src/catalog-docs.ts +35 -0
- package/src/catalog-error.test.ts +15 -0
- package/src/catalog-index.ts +25 -0
- package/src/catalog-model.ts +293 -5
- package/src/catalog-validation.ts +113 -2
- package/src/catalog.test.ts +40 -1
- package/src/chat/Starter.tsx +5 -11
- package/src/chat/tools.test.ts +27 -0
- package/src/chat/tools.ts +5 -9
- package/src/components/CatalogStamp.tsx +10 -8
- package/src/components/ChannelRows.test.tsx +76 -1
- package/src/components/ChannelRows.tsx +223 -60
- package/src/components/DeploymentRows.tsx +131 -0
- package/src/components/DocsLinks.test.tsx +27 -0
- package/src/components/DocsLinks.tsx +56 -0
- package/src/components/FieldTree.tsx +5 -2
- package/src/components/HTTPDestinationEvidence.test.tsx +23 -0
- package/src/components/HTTPDestinationEvidence.tsx +31 -0
- package/src/components/Integrations.tsx +1 -1
- package/src/components/MachineDocs.tsx +6 -5
- package/src/components/MethodRows.tsx +9 -2
- package/src/components/PluginIcon.tsx +77 -0
- package/src/components/ProblemRow.tsx +173 -153
- package/src/components/RelationEvidence.test.tsx +14 -0
- package/src/components/RelationEvidence.tsx +53 -0
- package/src/components/RuleMarks.tsx +22 -0
- package/src/components/ShapeRows.tsx +24 -20
- package/src/data.ts +46 -7
- package/src/enrich.test.ts +459 -4
- package/src/enrich.ts +308 -7
- package/src/er/ErCanvas.tsx +218 -12
- package/src/er/GroupNode.tsx +57 -0
- package/src/er/StoreHeader.tsx +1 -0
- package/src/er/layout.test.ts +85 -2
- package/src/er/layout.ts +140 -5
- package/src/er/spec.test.ts +17 -0
- package/src/er/spec.ts +23 -10
- package/src/flow/Recordings.test.tsx +52 -0
- package/src/flow/Recordings.tsx +236 -0
- package/src/flow/StepDetail.tsx +59 -0
- package/src/flow/TraceTrial.tsx +419 -0
- package/src/flow/evidence.test.ts +16 -0
- package/src/flow/evidence.ts +34 -0
- package/src/flow/examples.test.ts +33 -0
- package/src/flow/examples.ts +37 -0
- package/src/flow/outline.test.ts +28 -0
- package/src/flow/outline.ts +7 -2
- package/src/flow/trace-trial-resume.test.ts +42 -0
- package/src/flow/trace-trial-resume.ts +74 -0
- package/src/graph/elk.ts +78 -0
- package/src/index.css +68 -0
- package/src/landing/DraggableReveal.tsx +3 -2
- package/src/landing/EvidencePipeline.tsx +105 -0
- package/src/landing/LandingPage.tsx +17 -70
- package/src/landing/ProductTour.tsx +6 -6
- package/src/lib/all-problems.ts +27 -17
- package/src/lib/catalog-diff.ts +1 -1
- package/src/lib/centrality.test.ts +251 -0
- package/src/lib/centrality.ts +232 -0
- package/src/lib/confluence.test.ts +37 -0
- package/src/lib/confluence.ts +41 -0
- package/src/lib/context-color.ts +1 -1
- package/src/lib/deployment-drift.ts +22 -0
- package/src/lib/derive.ts +43 -69
- package/src/lib/django-aggregates.d.mts +9 -0
- package/src/lib/django-aggregates.mjs +36 -0
- package/src/lib/django-aggregates.test.ts +29 -0
- package/src/lib/django-aggregates.ts +5 -0
- package/src/lib/environments.test.ts +83 -0
- package/src/lib/environments.ts +57 -0
- package/src/lib/integration-url.test.ts +30 -0
- package/src/lib/integration-url.ts +63 -0
- package/src/lib/kafka-ui.ts +3 -45
- package/src/lib/local-api.ts +116 -4
- package/src/lib/notion.ts +13 -0
- package/src/lib/plugin-index.json +2765 -0
- package/src/lib/plugins.test.ts +68 -0
- package/src/lib/plugins.ts +264 -0
- package/src/lib/problem-flows.test.ts +61 -0
- package/src/lib/problem-flows.ts +78 -0
- package/src/lib/problem-rules-cel.d.mts +43 -0
- package/src/lib/problem-rules-cel.mjs +407 -0
- package/src/lib/problem-rules.test.ts +287 -0
- package/src/lib/problem-rules.ts +271 -0
- package/src/lib/problem-subjects.ts +737 -0
- package/src/lib/rule-entries.ts +39 -0
- package/src/lib/{data-problems.test.ts → rules-data.test.ts} +18 -16
- package/src/lib/rules-deploy.test.ts +133 -0
- package/src/lib/{problems.test.ts → rules-edges.test.ts} +8 -3
- package/src/lib/{proto-problems.test.ts → rules-proto.test.ts} +9 -25
- package/src/lib/{wire-problems.test.ts → rules-wire.test.ts} +13 -11
- package/src/lib/rules.test.ts +51 -0
- package/src/lib/rules.ts +86 -0
- package/src/lib/setup-info.test.ts +17 -0
- package/src/lib/setup-info.ts +58 -0
- package/src/lib/shape.test.ts +32 -0
- package/src/lib/shape.ts +30 -6
- package/src/lib/tech.ts +16 -0
- package/src/lib/trace-project.test.ts +34 -0
- package/src/lib/trace-project.ts +50 -0
- package/src/lib/use-problems.ts +23 -0
- package/src/lib/warnings.test.ts +63 -0
- package/src/lib/warnings.ts +260 -0
- package/src/likec4/ids.test.ts +6 -2
- package/src/likec4/ids.ts +43 -0
- package/src/main.tsx +23 -0
- package/src/map/ContextMapGraph.tsx +76 -32
- package/src/merge-deployments.test.ts +127 -0
- package/src/merge.test.ts +82 -0
- package/src/merge.ts +189 -18
- package/src/pages/AggregatePage.tsx +65 -14
- package/src/pages/ContextMap.tsx +45 -3
- package/src/pages/ContextPage.tsx +8 -5
- package/src/pages/EventPage.tsx +15 -5
- package/src/pages/FlowDetail.tsx +23 -2
- package/src/pages/GraphPage.tsx +40 -3
- package/src/pages/Overview.tsx +152 -12
- package/src/pages/PluginIndex.tsx +190 -0
- package/src/pages/Problems.tsx +396 -128
- package/src/pages/ServicePage.tsx +62 -5
- package/src/pages/Settings.tsx +217 -43
- package/src/pages/settings/AboutSettings.tsx +8 -1
- package/src/pages/settings/DjangoAggregateChoices.tsx +79 -0
- package/src/pages/settings/IntegrationsSettings.tsx +63 -17
- package/src/pages/settings/RecordingSettings.tsx +138 -0
- package/src/pages/settings/RulesSettings.tsx +825 -0
- package/src/routes.test.ts +9 -0
- package/src/routes.ts +22 -1
- package/src/selection/DetailPanel.tsx +15 -0
- package/src/virtual-provenance.d.ts +11 -0
- package/vite.config.ts +5 -0
- package/scripts/vendor-lock.mjs +0 -58
- package/scripts/vendor-lock.test.mjs +0 -69
- package/src/lib/data-problems.ts +0 -314
- package/src/lib/proto-problems.ts +0 -237
- package/src/lib/wire-problems.ts +0 -342
package/src/lib/local-api.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { SetupInfo, SetupPhase, SetupProject, SetupRunStepStatus } from "./setup-info";
|
|
1
|
+
import type { SetupDiagnostic, SetupInfo, SetupPhase, SetupProject, SetupRunStepStatus } from "./setup-info";
|
|
2
|
+
import type { DjangoAggregateCandidates } from "./django-aggregates";
|
|
3
|
+
import type { ProblemRuleEntry } from "./problem-rules";
|
|
2
4
|
|
|
3
5
|
const ROOT = `${import.meta.env.BASE_URL}__portolan`;
|
|
4
6
|
const LOCAL_HEADER = { "Content-Type": "application/json", "X-Portolan-Local": "1" };
|
|
@@ -10,6 +12,7 @@ export interface Detection {
|
|
|
10
12
|
candidates: string[];
|
|
11
13
|
options: Record<string, unknown>;
|
|
12
14
|
selected: boolean;
|
|
15
|
+
preview?: Array<{ file: string; fields: Record<string, string> }>;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export interface Discovery {
|
|
@@ -113,6 +116,7 @@ export interface ProjectTrialStep {
|
|
|
113
116
|
fileCount: number;
|
|
114
117
|
changedCount: number;
|
|
115
118
|
warnings: string[];
|
|
119
|
+
diagnostics: SetupDiagnostic[];
|
|
116
120
|
message?: string;
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -121,18 +125,66 @@ export interface ProjectTrial {
|
|
|
121
125
|
steps: ProjectTrialStep[];
|
|
122
126
|
facts: ProjectTrialFact[];
|
|
123
127
|
warnings: Array<{ plugin: string; message: string }>;
|
|
128
|
+
diagnostics: SetupDiagnostic[];
|
|
124
129
|
generatedFiles: number;
|
|
125
130
|
previewUrl?: string;
|
|
126
131
|
previewError?: string;
|
|
127
132
|
}
|
|
128
133
|
|
|
134
|
+
/** One flow the verifier wrote after reading an uploaded recording. */
|
|
135
|
+
export interface TraceTrialFlow {
|
|
136
|
+
id: string;
|
|
137
|
+
slug: string;
|
|
138
|
+
name: string;
|
|
139
|
+
owner: string;
|
|
140
|
+
kind: "declared" | "observed";
|
|
141
|
+
/** Whether the uploaded recording itself showed this flow. */
|
|
142
|
+
inRecording: boolean;
|
|
143
|
+
/** Traces in the uploaded recording that showed it. */
|
|
144
|
+
traces: number;
|
|
145
|
+
verified: number;
|
|
146
|
+
unresolved: number;
|
|
147
|
+
/** Hops the recordings showed that the code does not declare. */
|
|
148
|
+
added: number;
|
|
149
|
+
/** Distinct steps the uploaded recording showed. */
|
|
150
|
+
shown: number;
|
|
151
|
+
steps: number;
|
|
152
|
+
examples: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface TraceTrialWarning {
|
|
156
|
+
kind: "service" | "event" | "route" | "call" | "channel" | "other";
|
|
157
|
+
/** The name the verifier could not place, for a service or an event. */
|
|
158
|
+
name?: string;
|
|
159
|
+
message: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** What a trial run said about an uploaded recording. */
|
|
163
|
+
export interface TraceTrial {
|
|
164
|
+
project: string;
|
|
165
|
+
/** Where the recording lands, relative to the project root. */
|
|
166
|
+
recording: string;
|
|
167
|
+
/** Whether keeping it adds or widens the project's verify step. */
|
|
168
|
+
stepAdded: boolean;
|
|
169
|
+
/** What keeping it does to portolan.json: a new verify step, one more glob on the step it has, or nothing. */
|
|
170
|
+
stepChange: "added" | "widened" | "none";
|
|
171
|
+
status: SetupRunStepStatus;
|
|
172
|
+
spans: number;
|
|
173
|
+
flows: TraceTrialFlow[];
|
|
174
|
+
warnings: TraceTrialWarning[];
|
|
175
|
+
mappings: { services: Record<string, string>; events: Record<string, string>; routes: Record<string, string> };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type RunMode = "write" | "check" | "preview" | "project-preview" | "trace-preview";
|
|
179
|
+
|
|
129
180
|
export type RunEvent =
|
|
130
|
-
| { type: "run-started"; at: string; runId: string; mode:
|
|
181
|
+
| { type: "run-started"; at: string; runId: string; mode: RunMode }
|
|
131
182
|
| { type: "pipeline-ready"; at: string; stepCount: number }
|
|
132
183
|
| { type: "step-started"; at: string; ordinal: number; phase: SetupPhase; plugin: string; input?: string; output: string }
|
|
133
|
-
| { type: "step-finished"; at: string; ordinal: number; phase: SetupPhase; plugin: string; status: SetupRunStepStatus; durationMs: number; fileCount: number; changedCount: number; changes: Array<{ kind: "added" | "changed" | "removed"; path: string }>; files: string[]; warnings?: string[]; message?: string }
|
|
184
|
+
| { type: "step-finished"; at: string; ordinal: number; phase: SetupPhase; plugin: string; status: SetupRunStepStatus; durationMs: number; fileCount: number; changedCount: number; changes: Array<{ kind: "added" | "changed" | "removed"; path: string }>; files: string[]; warnings?: string[]; diagnostics?: SetupDiagnostic[]; message?: string }
|
|
134
185
|
| { type: "preview-ready"; at: string; files: GeneratedFileDiff[]; totalFiles: number; truncated: boolean }
|
|
135
186
|
| ({ type: "project-trial-ready"; at: string } & ProjectTrial)
|
|
187
|
+
| ({ type: "trace-trial-ready"; at: string } & TraceTrial)
|
|
136
188
|
| { type: "run-finished"; at: string; status: string; durationMs?: number; message?: string }
|
|
137
189
|
| { type: "process-finished"; at: string; status: string; durationMs?: number; message?: string }
|
|
138
190
|
| { type: "log"; at: string; stream: "stdout" | "stderr"; message: string };
|
|
@@ -174,10 +226,39 @@ export class LocalApiError extends Error {
|
|
|
174
226
|
}
|
|
175
227
|
}
|
|
176
228
|
|
|
177
|
-
export async function localStatus(): Promise<{ local: true; workspace: string; setup: SetupInfo; activeRun: { id: string; mode:
|
|
229
|
+
export async function localStatus(): Promise<{ local: true; workspace: string; setup: SetupInfo; activeRun: { id: string; mode: RunMode } | null }> {
|
|
178
230
|
return json("/status");
|
|
179
231
|
}
|
|
180
232
|
|
|
233
|
+
export interface DjangoAggregateProposals {
|
|
234
|
+
revision: string;
|
|
235
|
+
stale: boolean;
|
|
236
|
+
proposals: Array<DjangoAggregateCandidates & { id: string; step: number; plugin: string; input: string; output: string; message: string }>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export async function djangoAggregateProposals(): Promise<DjangoAggregateProposals> {
|
|
240
|
+
return json("/django-aggregates");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export async function saveDjangoAggregates(revision: string, selections: Array<{ id: string; model: string }>): Promise<{ saved: number }> {
|
|
244
|
+
return json("/django-aggregates", { method: "POST", headers: LOCAL_HEADER, body: JSON.stringify({ revision, selections }) });
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** The manifest's `problemRules`, with a revision a save must quote. */
|
|
248
|
+
export interface ProblemRulesState {
|
|
249
|
+
revision: string;
|
|
250
|
+
rules: ProblemRuleEntry[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export async function problemRules(): Promise<ProblemRulesState> {
|
|
254
|
+
return json("/rules");
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Replaces `problemRules` in portolan.json, once the server has type-checked every expression. */
|
|
258
|
+
export async function saveProblemRules(revision: string, rules: ProblemRuleEntry[]): Promise<ProblemRulesState> {
|
|
259
|
+
return json("/rules", { method: "POST", headers: LOCAL_HEADER, body: JSON.stringify({ revision, rules }) });
|
|
260
|
+
}
|
|
261
|
+
|
|
181
262
|
export async function previewDeliveryPreset(provider?: DeliveryProvider, features?: DeliveryFeatureId[]): Promise<DeliveryPreset> {
|
|
182
263
|
const query = new URLSearchParams();
|
|
183
264
|
if (provider) query.set("provider", provider);
|
|
@@ -237,6 +318,37 @@ export async function disposeProjectTrial(runId: string): Promise<void> {
|
|
|
237
318
|
await json(`/projects/trials/${encodeURIComponent(runId)}/dispose`, { method: "POST", headers: LOCAL_HEADER, body: "{}" });
|
|
238
319
|
}
|
|
239
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Uploads a recording and runs the generator over a copy of the workspace
|
|
323
|
+
* with it in place. The bytes go as they are; the project and the file's
|
|
324
|
+
* name go as headers, because a JSON envelope around 30 MB of spans is a
|
|
325
|
+
* copy nobody wants.
|
|
326
|
+
*/
|
|
327
|
+
export async function startTraceTrial(file: File, projectId: string): Promise<{ runId: string; mode: "trace-preview"; recording: string; project: string; stepAdded: boolean; spans: number }> {
|
|
328
|
+
const response = await fetch(`${ROOT}/traces/trials`, {
|
|
329
|
+
method: "POST",
|
|
330
|
+
headers: {
|
|
331
|
+
"Content-Type": "application/octet-stream",
|
|
332
|
+
"X-Portolan-Local": "1",
|
|
333
|
+
"X-Portolan-Project": projectId,
|
|
334
|
+
"X-Portolan-Filename": encodeURIComponent(file.name),
|
|
335
|
+
},
|
|
336
|
+
body: file,
|
|
337
|
+
});
|
|
338
|
+
const value = await response.json() as { runId: string; mode: "trace-preview"; recording: string; project: string; stepAdded: boolean; spans: number; error?: string };
|
|
339
|
+
if (!response.ok) throw new LocalApiError(value.error || `Local API returned ${response.status}.`, { status: response.status });
|
|
340
|
+
return value;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Keeps the recording beside the project, with the names mapped, and regenerates when asked. */
|
|
344
|
+
export async function applyTraceTrial(runId: string, options: { generate: boolean; services?: Record<string, string>; events?: Record<string, string>; routes?: Record<string, string> }): Promise<{ recording: string; project: string; stepAdded: boolean; manifestChanged: boolean; undoToken: string | null; setup: SetupInfo; run: { runId: string; mode: "write" } | null }> {
|
|
345
|
+
return json(`/traces/trials/${encodeURIComponent(runId)}/apply`, { method: "POST", headers: LOCAL_HEADER, body: JSON.stringify(options) });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export async function disposeTraceTrial(runId: string): Promise<void> {
|
|
349
|
+
await json(`/traces/trials/${encodeURIComponent(runId)}/dispose`, { method: "POST", headers: LOCAL_HEADER, body: "{}" });
|
|
350
|
+
}
|
|
351
|
+
|
|
240
352
|
export async function startGeneration(mode: "write" | "check" | "preview" = "preview", previewRunId?: string): Promise<{ runId: string; mode: "write" | "check" | "preview" }> {
|
|
241
353
|
return json("/runs", { method: "POST", headers: LOCAL_HEADER, body: JSON.stringify({ mode, previewRunId }) });
|
|
242
354
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The optional hand-off from the catalog to the Notion workspace where a
|
|
2
|
+
// team writes.
|
|
3
|
+
//
|
|
4
|
+
// Notion has no search address a link can open, so this is the workspace or
|
|
5
|
+
// teamspace itself: a page says where the documentation lives without
|
|
6
|
+
// pretending to know the page. An exact page would need the catalog to carry
|
|
7
|
+
// its URL, which is a field, not a reader preference.
|
|
8
|
+
|
|
9
|
+
import { createIntegrationStore } from "./integration-url";
|
|
10
|
+
|
|
11
|
+
export const NOTION_KEY = "portolan.integrations.notion";
|
|
12
|
+
|
|
13
|
+
export const useNotion = createIntegrationStore(NOTION_KEY);
|