@dudousxd/nestjs-catalog-react 0.29.0 → 0.30.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/connection-form.d.ts +11 -7
- package/dist/connection-form.js +11 -7
- package/dist/source-fields.d.ts +4 -1
- package/dist/source-fields.js +30 -8
- package/dist/workflow/templates.js +12 -1
- package/package.json +2 -2
|
@@ -29,13 +29,13 @@ import type { ReactNode } from 'react';
|
|
|
29
29
|
* is for — a form that renders nothing looks like a form somebody has not
|
|
30
30
|
* finished typing into.
|
|
31
31
|
*
|
|
32
|
-
* `file` and `
|
|
33
|
-
* pasted records belong to the load, not to a shared address
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* server's side.
|
|
32
|
+
* `file`, `inline` and `catalog` are refusals, and deliberately: a file's path
|
|
33
|
+
* and a set of pasted records belong to the load, not to a shared address, and a
|
|
34
|
+
* catalog source has no address at all. A connection there would be a name with
|
|
35
|
+
* nothing behind it, and — since a connection's whole worth is the button that
|
|
36
|
+
* finds out whether it answers — a "Test connection" that always passes is worse
|
|
37
|
+
* than no button, because it teaches people that a green tick means nothing.
|
|
38
|
+
* `ConnectionChecker.probe` says the same thing from the server's side.
|
|
39
39
|
*/
|
|
40
40
|
declare const KINDS: {
|
|
41
41
|
http: {
|
|
@@ -80,6 +80,10 @@ declare const KINDS: {
|
|
|
80
80
|
connectable: false;
|
|
81
81
|
because: string;
|
|
82
82
|
};
|
|
83
|
+
catalog: {
|
|
84
|
+
connectable: false;
|
|
85
|
+
because: string;
|
|
86
|
+
};
|
|
83
87
|
};
|
|
84
88
|
/** A kind a connection can actually address, narrowed from the record above. */
|
|
85
89
|
export type ConnectableKind = {
|
package/dist/connection-form.js
CHANGED
|
@@ -33,13 +33,13 @@ import { Switch } from './ui/switch';
|
|
|
33
33
|
* is for — a form that renders nothing looks like a form somebody has not
|
|
34
34
|
* finished typing into.
|
|
35
35
|
*
|
|
36
|
-
* `file` and `
|
|
37
|
-
* pasted records belong to the load, not to a shared address
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* server's side.
|
|
36
|
+
* `file`, `inline` and `catalog` are refusals, and deliberately: a file's path
|
|
37
|
+
* and a set of pasted records belong to the load, not to a shared address, and a
|
|
38
|
+
* catalog source has no address at all. A connection there would be a name with
|
|
39
|
+
* nothing behind it, and — since a connection's whole worth is the button that
|
|
40
|
+
* finds out whether it answers — a "Test connection" that always passes is worse
|
|
41
|
+
* than no button, because it teaches people that a green tick means nothing.
|
|
42
|
+
* `ConnectionChecker.probe` says the same thing from the server's side.
|
|
43
43
|
*/
|
|
44
44
|
const KINDS = {
|
|
45
45
|
http: {
|
|
@@ -79,6 +79,10 @@ const KINDS = {
|
|
|
79
79
|
connectable: false,
|
|
80
80
|
because: 'Inline records are pasted into the source itself. There is no address to share.',
|
|
81
81
|
},
|
|
82
|
+
catalog: {
|
|
83
|
+
connectable: false,
|
|
84
|
+
because: 'A catalog source reads this catalog, through the store the application already holds. There is no address and no credential — which is the point of the kind: pointing the catalog at its own database through a connection meant an operator minting a URL and a secret that did not need to exist.',
|
|
85
|
+
},
|
|
82
86
|
};
|
|
83
87
|
export const CONNECTION_KINDS = KINDS;
|
|
84
88
|
/**
|
package/dist/source-fields.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export declare function readsIncrementally(kind: ConnectorKind): boolean;
|
|
|
19
19
|
* rather than two that happen to agree today.
|
|
20
20
|
*/
|
|
21
21
|
export declare function usesConnection(kind: ConnectorKind): kind is ConnectableKind;
|
|
22
|
+
/** The kinds, in the order the library declares them, never a copy of the list. */
|
|
22
23
|
export declare const KIND_OPTIONS: {
|
|
23
|
-
value:
|
|
24
|
+
value: "inline" | "http" | "sql" | "file" | "s3" | "catalog";
|
|
24
25
|
label: string;
|
|
25
26
|
}[];
|
|
26
27
|
/**
|
|
@@ -72,6 +73,8 @@ export interface SourceDraft {
|
|
|
72
73
|
forcePathStyle: boolean;
|
|
73
74
|
maxObjectsPerRun: string;
|
|
74
75
|
watermarkColumn: string;
|
|
76
|
+
/** The object type a `catalog` source reads. Its whole configuration. */
|
|
77
|
+
objectType: string;
|
|
75
78
|
}
|
|
76
79
|
export declare function sourceDraftFrom(config: Record<string, unknown> | undefined): SourceDraft;
|
|
77
80
|
/**
|
package/dist/source-fields.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CONNECTOR_KINDS, SOURCE_FORMATS } from '@dudousxd/nestjs-catalog/client';
|
|
2
|
+
import { CATALOG_SOURCE_TYPE_KEY, CONNECTOR_KINDS, SOURCE_FORMATS, } from '@dudousxd/nestjs-catalog/client';
|
|
3
3
|
import { cn } from './cn';
|
|
4
4
|
import { CONNECTION_KINDS } from './connection-form';
|
|
5
5
|
import { FieldGroup, TextAreaField, TextField } from './ui/field';
|
|
@@ -47,13 +47,29 @@ export function readsIncrementally(kind) {
|
|
|
47
47
|
export function usesConnection(kind) {
|
|
48
48
|
return CONNECTION_KINDS[kind].connectable;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
/**
|
|
51
|
+
* How each kind reads in the picker.
|
|
52
|
+
*
|
|
53
|
+
* `satisfies Record<ConnectorKind, string>` for the reason {@link FORMAT_LABELS}
|
|
54
|
+
* below has it, and this one had to be repaired to get it: the picker was a
|
|
55
|
+
* hand-written array of five objects, so a sixth kind added to the library
|
|
56
|
+
* arrived in the vocabulary, in the validator, in the fetcher map — and never in
|
|
57
|
+
* the dropdown. A kind nobody can choose is a kind that has shipped invisible,
|
|
58
|
+
* which has happened in this repository before.
|
|
59
|
+
*/
|
|
60
|
+
const KIND_LABELS = {
|
|
61
|
+
http: 'HTTP — a JSON endpoint',
|
|
62
|
+
sql: 'SQL — a database query',
|
|
63
|
+
file: 'File — CSV, NDJSON, JSON, Excel or Parquet',
|
|
64
|
+
s3: 'S3 — a bucket prefix',
|
|
65
|
+
inline: 'Inline — records pasted below',
|
|
66
|
+
catalog: "Catalog — an object type in this catalog's own data",
|
|
67
|
+
};
|
|
68
|
+
/** The kinds, in the order the library declares them, never a copy of the list. */
|
|
69
|
+
export const KIND_OPTIONS = CONNECTOR_KINDS.map((kind) => ({
|
|
70
|
+
value: kind,
|
|
71
|
+
label: KIND_LABELS[kind],
|
|
72
|
+
}));
|
|
57
73
|
/**
|
|
58
74
|
* How each format is labelled, and the reason this is a map rather than a list.
|
|
59
75
|
*
|
|
@@ -117,6 +133,7 @@ export function sourceDraftFrom(config) {
|
|
|
117
133
|
forcePathStyle: source.forcePathStyle === true,
|
|
118
134
|
maxObjectsPerRun: typeof source.maxObjectsPerRun === 'number' ? String(source.maxObjectsPerRun) : '',
|
|
119
135
|
watermarkColumn: text('watermarkColumn'),
|
|
136
|
+
objectType: text(CATALOG_SOURCE_TYPE_KEY),
|
|
120
137
|
};
|
|
121
138
|
}
|
|
122
139
|
export function parseRecords(text) {
|
|
@@ -221,6 +238,8 @@ export function sourceConfigFrom(kind, draft, { viaConnection, incremental }) {
|
|
|
221
238
|
return fileConfig(draft);
|
|
222
239
|
if (kind === 's3')
|
|
223
240
|
return s3Config(draft, viaConnection);
|
|
241
|
+
if (kind === 'catalog')
|
|
242
|
+
return { [CATALOG_SOURCE_TYPE_KEY]: draft.objectType.trim() };
|
|
224
243
|
return inlineConfig(draft);
|
|
225
244
|
}
|
|
226
245
|
/*
|
|
@@ -255,6 +274,9 @@ export function sourceConfigFrom(kind, draft, { viaConnection, incremental }) {
|
|
|
255
274
|
const NO_DISK = '__no_disk__';
|
|
256
275
|
export function SourceFields({ kind, draft, onChange, viaConnection, disabled, storage, }) {
|
|
257
276
|
const set = (patch) => onChange({ ...draft, ...patch });
|
|
277
|
+
if (kind === 'catalog') {
|
|
278
|
+
return (_jsx(TextField, { label: "Object type", value: draft.objectType, onChange: (objectType) => set({ objectType }), placeholder: "e.g. SubwoReplica", disabled: disabled, hint: "The type, not a table. This reads the snapshot the catalog is currently serving, resolved when the run starts \u2014 the physical table keeps every load that has ever run, so naming it directly reads them all." }));
|
|
279
|
+
}
|
|
258
280
|
if (kind === 'http') {
|
|
259
281
|
return (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [!viaConnection && (_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => set({ url }), placeholder: "https://\u2026", disabled: disabled })), _jsx(TextField, { label: "Path to the array", value: draft.path, onChange: (path) => set({ path }), placeholder: "e.g. data", disabled: disabled })] }));
|
|
260
282
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONNECTOR_KINDS, isSafeIdentifier, physicalColumn, } from '@dudousxd/nestjs-catalog/client';
|
|
1
|
+
import { CATALOG_SOURCE_TYPE_KEY, CONNECTOR_KINDS, isSafeIdentifier, physicalColumn, } from '@dudousxd/nestjs-catalog/client';
|
|
2
2
|
export const SOURCE_KINDS = {
|
|
3
3
|
http: {
|
|
4
4
|
label: 'an HTTP endpoint',
|
|
@@ -48,6 +48,17 @@ export const SOURCE_KINDS = {
|
|
|
48
48
|
// disagree with a property name and nothing for the refusal to check.
|
|
49
49
|
keysRecordsBySourceName: false,
|
|
50
50
|
},
|
|
51
|
+
catalog: {
|
|
52
|
+
label: "this catalog's own data",
|
|
53
|
+
required: [CATALOG_SOURCE_TYPE_KEY],
|
|
54
|
+
optional: [],
|
|
55
|
+
// False, and it is the strongest `false` in this record. The rows come out
|
|
56
|
+
// of the store keyed by the *property names of the type they were read
|
|
57
|
+
// from* — that is what `read` and `streamSnapshot` both hand back — so there
|
|
58
|
+
// is no source spelling to disagree with anything. It is the one kind whose
|
|
59
|
+
// records are already in the catalog's own vocabulary.
|
|
60
|
+
keysRecordsBySourceName: false,
|
|
61
|
+
},
|
|
51
62
|
};
|
|
52
63
|
/**
|
|
53
64
|
* The kinds a file drop can arrive as, derived rather than listed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-catalog-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tailwind-merge": "3.4.1",
|
|
111
111
|
"tiptap-markdown": "0.9.0",
|
|
112
112
|
"typescript": "5.9.3",
|
|
113
|
-
"@dudousxd/nestjs-catalog": "0.
|
|
113
|
+
"@dudousxd/nestjs-catalog": "0.26.0"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
116
|
"clsx": "2.1.1",
|