@dudousxd/nestjs-catalog-react 0.14.0 → 0.16.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/dist/routes.js CHANGED
@@ -2,22 +2,35 @@
2
2
  * The paths behind the pipeline and access screens — and, for now, the embed
3
3
  * components, which are the documented exception at the top of the file.
4
4
  *
5
- * These deliberately do **not** live in `@dudousxd/nestjs-catalog/client` beside
6
- * `catalogRoutes`, and the difference is worth being precise about, because it
7
- * is the difference between a route builder that is a promise and one that is a
8
- * guess.
5
+ * Most of these deliberately do **not** live in
6
+ * `@dudousxd/nestjs-catalog/client` beside `catalogRoutes`, and the difference
7
+ * is worth being precise about, because it is the difference between a route
8
+ * builder that is a promise and one that is a default.
9
9
  *
10
- * `catalogRoutes` describes paths the catalog library's own controller serves.
11
- * Install the library, register the module, and `/catalog/objects/...` exists —
12
- * the builder is the library documenting itself, and it cannot be wrong.
10
+ * `catalogRoutes` is a frozen object of builders that take no base path: the
11
+ * paths the catalog library's own controller serves, at the segment it serves
12
+ * them under. Install the library, register the module, and
13
+ * `/catalog/objects/...` exists — the builder is the library documenting itself.
13
14
  *
14
- * Connectors, transforms and access are the other shape. The library defines
15
- * their *model* — `CatalogPipelineStore`, `CatalogConnection`, `CatalogPrincipal`
16
- * — but ships no controller for any of them, because how a deployment exposes
17
- * the code that reshapes its data, and who may create an account, are decisions
18
- * that belong to the deployment. Putting `pipelineRoutes` next to `catalogRoutes`
19
- * would tell a reader that installing the library makes `/pipeline/connectors`
20
- * answer, and it does not: they would get a 404 with nothing to point at.
15
+ * Connectors, transforms and access are the other shape, and what makes them so
16
+ * is not that nothing serves them. It is that WHERE they are served is the
17
+ * host's decision, which a frozen builder cannot express:
18
+ *
19
+ * - Connectors, transforms, workflows and runs are served by
20
+ * `createPipelineController`, which ships in
21
+ * `@dudousxd/nestjs-catalog-pipeline` — a *separate* package, mounted under
22
+ * whatever `path` its `forRoot` was given, and mounted nowhere at all if it
23
+ * was given none. Installing `@dudousxd/nestjs-catalog` does not make
24
+ * `/pipeline/connectors` answer, so putting `pipelineRoutes` beside
25
+ * `catalogRoutes` would tell a reader it does, and they would get a 404 with
26
+ * nothing to point at.
27
+ * - Access is the one that used to be described here as having no controller
28
+ * either, and it does have one: `createAccessController` is in the catalog
29
+ * library and `CatalogModule.forRoot` mounts it unless the host passes
30
+ * `controller: false`. What it does not have is a fixed path — it mounts
31
+ * under `accessPath`, a sibling of the catalog's own mount point — so it is
32
+ * still a default rather than a promise, for the second reason rather than
33
+ * the first.
21
34
  *
22
35
  * So the builders live here, in the package that ships the screens that need
23
36
  * them, and are stated as a *default* the host can move. The defaults are
@@ -25,11 +38,25 @@
25
38
  * `/api/pipeline` — because the transport is what knows the API prefix, and a
26
39
  * screen that hardcoded one app's mount point would be unusable in the next app.
27
40
  *
41
+ * The two load-expectation paths are the case that says what the rule above
42
+ * really is. They are served by that same pipeline controller in that same
43
+ * separate package, yet their builder — `pipelineExpectationRoutes` — is in
44
+ * `@dudousxd/nestjs-catalog/client`, and `pipelineRoutes` below borrows it
45
+ * instead of writing the strings again. That is not an exception, because the
46
+ * test was never which package a builder lives in: it is whether the builder
47
+ * takes a base path. `pipelineExpectationRoutes` does, so it promises nothing
48
+ * about where the routes are mounted no matter where it sits. It sits there
49
+ * because the wire types it goes with — `LoadExpectationInput`,
50
+ * `ResolvedLoadExpectation` — are declared in that entry point and the pipeline
51
+ * controller reads them from there too, and a path split from the shapes it
52
+ * returns is how the two halves of one contract come to be moved separately.
53
+ *
28
54
  * What this package therefore asks of a host is an HTTP surface with these
29
55
  * shapes, wherever it wants to mount it. That contract is the response types on
30
56
  * `CatalogClient` plus these paths, and a host that would rather satisfy it from
31
57
  * somewhere else entirely can pass its own base path, or replace the client.
32
58
  */
59
+ import { pipelineExpectationRoutes } from '@dudousxd/nestjs-catalog/client';
33
60
  /**
34
61
  * The embed API, which is the exception to everything above.
35
62
  *
@@ -53,6 +80,22 @@ export const embedRoutes = {
53
80
  chart: (id) => `/catalog/embed/charts/${encodeURIComponent(id)}`,
54
81
  dashboard: (id) => `/catalog/embed/dashboards/${encodeURIComponent(id)}`,
55
82
  };
83
+ /*
84
+ * A saved query's history is deliberately NOT here.
85
+ *
86
+ * `GET /catalog/saved-queries/:id/revisions` is served by the catalog library's
87
+ * own controller, so by this file's header it belongs beside `catalogRoutes` —
88
+ * and that is where it is: `catalogRoutes.savedQueryRevisions`. The note is here
89
+ * because a reader looking for the pair of it will find `transformRevisions` on
90
+ * `PipelineRoutes` below and reasonably wonder where the other half went. The
91
+ * split is the whole argument of this file: transforms are served by the host
92
+ * and move with the base path it chose; saved queries are served by the library
93
+ * and cannot move at all.
94
+ *
95
+ * A plain comment rather than a docblock on purpose — there is no declaration
96
+ * here for it to belong to, and a `/**` would attach itself to the constant
97
+ * below and describe the wrong thing in every editor tooltip.
98
+ */
56
99
  /** Where the pipeline endpoints sit unless the host says otherwise. */
57
100
  export const DEFAULT_PIPELINE_BASE_PATH = '/pipeline';
58
101
  /**
@@ -81,6 +124,12 @@ function normalise(basePath) {
81
124
  }
82
125
  export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
83
126
  const base = normalise(basePath);
127
+ // The two expectation paths are BORROWED rather than written out again — two
128
+ // copies of a path is how a route ends up moved on one side and 404ing on the
129
+ // other. The header's load-expectation paragraph is why the copy that wins
130
+ // lives in `@dudousxd/nestjs-catalog/client` while everything else here is
131
+ // built in place.
132
+ const expectations = pipelineExpectationRoutes(base);
84
133
  return {
85
134
  capabilities: () => `${base}/capabilities`,
86
135
  connections: () => `${base}/connections`,
@@ -94,10 +143,13 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
94
143
  runs: () => `${base}/runs`,
95
144
  transforms: () => `${base}/transforms`,
96
145
  transform: (id) => `${base}/transforms/${encodeURIComponent(id)}`,
146
+ transformRevisions: (id) => `${base}/transforms/${encodeURIComponent(id)}/revisions`,
97
147
  tryTransform: () => `${base}/transforms/try`,
98
148
  workflows: () => `${base}/workflows`,
99
149
  workflow: (id) => `${base}/workflows/${encodeURIComponent(id)}`,
100
150
  runWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/run`,
151
+ loadExpectations: () => expectations.expectations(),
152
+ loadExpectation: (typeName) => expectations.expectation(typeName),
101
153
  };
102
154
  }
103
155
  export function accessRoutes(basePath = DEFAULT_ACCESS_BASE_PATH) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog-react",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Ready-made React screens for @dudousxd/nestjs-catalog — a model manager and a generic object explorer you can drop into your own app shell.",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -106,7 +106,7 @@
106
106
  "@tiptap/pm": "3.29.2",
107
107
  "tiptap-markdown": "0.9.0",
108
108
  "@tiptap/core": "3.29.2",
109
- "@dudousxd/nestjs-catalog": "0.11.0"
109
+ "@dudousxd/nestjs-catalog": "0.13.0"
110
110
  },
111
111
  "dependencies": {
112
112
  "clsx": "2.1.1",