@industream/flowmaker-flowbox-ui-components 1.0.1 → 1.0.3
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/DCCatalogEntry.svelte +10 -1
- package/dist/DCCatalogEntry.svelte.d.ts +2 -0
- package/dist/DCCatalogEntryPicker/DCCatalogEntryPicker.svelte +13 -2
- package/dist/DCCatalogEntryPicker/DCCatalogEntryPicker.svelte.d.ts +2 -0
- package/dist/DCSourceConnection.svelte +10 -1
- package/dist/DCSourceConnection.svelte.d.ts +2 -0
- package/package.json +1 -1
- package/src/DCCatalogEntry.svelte +10 -1
- package/src/DCCatalogEntryPicker/DCCatalogEntryPicker.svelte +13 -2
- package/src/DCSourceConnection.svelte +10 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DataCatalogClient } from '@industream/datacatalog-client';
|
|
3
3
|
import type { CatalogEntry, DataType, SourceType } from '@industream/datacatalog-client/dto';
|
|
4
|
+
import { getContext } from 'svelte';
|
|
5
|
+
import { readable, type Readable } from 'svelte/store';
|
|
6
|
+
|
|
7
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
8
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
9
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
4
10
|
|
|
5
11
|
interface FilterOptions {
|
|
6
12
|
searchtext?: string | null; // Case-insensitive LIKE %text% filter on entry name
|
|
@@ -10,6 +16,8 @@
|
|
|
10
16
|
interface Props {
|
|
11
17
|
id?: string;
|
|
12
18
|
dcapiurl?: string;
|
|
19
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
20
|
+
token?: string;
|
|
13
21
|
sourcetypefilter?: string | string[] | null; // Source type names like "PostgreSQL", "InfluxDB2"
|
|
14
22
|
datatypefilter?: DataType | DataType[] | null;
|
|
15
23
|
namefilter?: string | string[] | null;
|
|
@@ -22,6 +30,7 @@
|
|
|
22
30
|
let {
|
|
23
31
|
id = undefined,
|
|
24
32
|
dcapiurl = '',
|
|
33
|
+
token = '',
|
|
25
34
|
sourcetypefilter = null,
|
|
26
35
|
datatypefilter = null,
|
|
27
36
|
namefilter = null,
|
|
@@ -145,7 +154,7 @@
|
|
|
145
154
|
error = null;
|
|
146
155
|
|
|
147
156
|
try {
|
|
148
|
-
const client = new DataCatalogClient({ baseUrl: dcapiurl });
|
|
157
|
+
const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
|
|
149
158
|
const filters: { names?: string[]; sourceTypes?: string[] } = {};
|
|
150
159
|
|
|
151
160
|
// Use name filter for API query if provided
|
|
@@ -6,6 +6,8 @@ interface FilterOptions {
|
|
|
6
6
|
interface Props {
|
|
7
7
|
id?: string;
|
|
8
8
|
dcapiurl?: string;
|
|
9
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
10
|
+
token?: string;
|
|
9
11
|
sourcetypefilter?: string | string[] | null;
|
|
10
12
|
datatypefilter?: DataType | DataType[] | null;
|
|
11
13
|
namefilter?: string | string[] | null;
|
|
@@ -29,11 +29,19 @@
|
|
|
29
29
|
import { DEFAULT_COLUMNS, DEFAULT_SELECTED_COLUMNS_DISPLAY } from './picker-column-helpers';
|
|
30
30
|
import TagBrowser from './TagBrowser.svelte';
|
|
31
31
|
import SelectedTags from './SelectedTags.svelte';
|
|
32
|
+
import { getContext } from 'svelte';
|
|
33
|
+
import { readable, type Readable } from 'svelte/store';
|
|
34
|
+
|
|
35
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
36
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
37
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
32
38
|
|
|
33
39
|
const MAX_ENTRIES = 100;
|
|
34
40
|
|
|
35
41
|
interface Props {
|
|
36
42
|
dcApiUrl?: string;
|
|
43
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
44
|
+
token?: string;
|
|
37
45
|
sourceConnectionId?: string;
|
|
38
46
|
selectedIds?: string[];
|
|
39
47
|
entries?: CatalogEntry[];
|
|
@@ -46,6 +54,7 @@
|
|
|
46
54
|
|
|
47
55
|
let {
|
|
48
56
|
dcApiUrl = '',
|
|
57
|
+
token = '',
|
|
49
58
|
sourceConnectionId = '',
|
|
50
59
|
selectedIds = $bindable([]),
|
|
51
60
|
entries = $bindable([]),
|
|
@@ -85,8 +94,10 @@
|
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
function getClient(apiUrl: string): DataCatalogClient {
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
// Keep the bearer fresh on the cached client too (token may be re-pushed on refresh).
|
|
98
|
+
const t = token || $hubToken;
|
|
99
|
+
if (client && clientUrl === apiUrl) return client.setToken(t);
|
|
100
|
+
client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(t);
|
|
90
101
|
clientUrl = apiUrl;
|
|
91
102
|
return client;
|
|
92
103
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CatalogEntry } from '@industream/datacatalog-client/dto';
|
|
2
2
|
interface Props {
|
|
3
3
|
dcApiUrl?: string;
|
|
4
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
5
|
+
token?: string;
|
|
4
6
|
sourceConnectionId?: string;
|
|
5
7
|
selectedIds?: string[];
|
|
6
8
|
entries?: CatalogEntry[];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DataCatalogClient } from '@industream/datacatalog-client';
|
|
3
|
+
import { getContext } from 'svelte';
|
|
4
|
+
import { readable, type Readable } from 'svelte/store';
|
|
5
|
+
|
|
6
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
7
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
8
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
3
9
|
|
|
4
10
|
export interface SourceConnection {
|
|
5
11
|
id: string;
|
|
@@ -10,6 +16,8 @@
|
|
|
10
16
|
|
|
11
17
|
interface Props {
|
|
12
18
|
dcapiurl?: string;
|
|
19
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
20
|
+
token?: string;
|
|
13
21
|
sourcetypefilter?: string | string[] | null;
|
|
14
22
|
initialselection?: string | null;
|
|
15
23
|
onsourceselect?: (connection: SourceConnection) => void;
|
|
@@ -18,6 +26,7 @@
|
|
|
18
26
|
|
|
19
27
|
let {
|
|
20
28
|
dcapiurl = '',
|
|
29
|
+
token = '',
|
|
21
30
|
sourcetypefilter = null,
|
|
22
31
|
initialselection = null,
|
|
23
32
|
onsourceselect = null,
|
|
@@ -52,7 +61,7 @@
|
|
|
52
61
|
error = null;
|
|
53
62
|
|
|
54
63
|
try {
|
|
55
|
-
const client = new DataCatalogClient({ baseUrl: dcapiurl });
|
|
64
|
+
const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
|
|
56
65
|
const filters = {};
|
|
57
66
|
|
|
58
67
|
if (sourcetypefilter && sourcetypefilter.length > 0) {
|
|
@@ -8,6 +8,8 @@ export interface SourceConnection {
|
|
|
8
8
|
}
|
|
9
9
|
interface Props {
|
|
10
10
|
dcapiurl?: string;
|
|
11
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
12
|
+
token?: string;
|
|
11
13
|
sourcetypefilter?: string | string[] | null;
|
|
12
14
|
initialselection?: string | null;
|
|
13
15
|
onsourceselect?: (connection: SourceConnection) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DataCatalogClient } from '@industream/datacatalog-client';
|
|
3
3
|
import type { CatalogEntry, DataType, SourceType } from '@industream/datacatalog-client/dto';
|
|
4
|
+
import { getContext } from 'svelte';
|
|
5
|
+
import { readable, type Readable } from 'svelte/store';
|
|
6
|
+
|
|
7
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
8
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
9
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
4
10
|
|
|
5
11
|
interface FilterOptions {
|
|
6
12
|
searchtext?: string | null; // Case-insensitive LIKE %text% filter on entry name
|
|
@@ -10,6 +16,8 @@
|
|
|
10
16
|
interface Props {
|
|
11
17
|
id?: string;
|
|
12
18
|
dcapiurl?: string;
|
|
19
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
20
|
+
token?: string;
|
|
13
21
|
sourcetypefilter?: string | string[] | null; // Source type names like "PostgreSQL", "InfluxDB2"
|
|
14
22
|
datatypefilter?: DataType | DataType[] | null;
|
|
15
23
|
namefilter?: string | string[] | null;
|
|
@@ -22,6 +30,7 @@
|
|
|
22
30
|
let {
|
|
23
31
|
id = undefined,
|
|
24
32
|
dcapiurl = '',
|
|
33
|
+
token = '',
|
|
25
34
|
sourcetypefilter = null,
|
|
26
35
|
datatypefilter = null,
|
|
27
36
|
namefilter = null,
|
|
@@ -145,7 +154,7 @@
|
|
|
145
154
|
error = null;
|
|
146
155
|
|
|
147
156
|
try {
|
|
148
|
-
const client = new DataCatalogClient({ baseUrl: dcapiurl });
|
|
157
|
+
const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
|
|
149
158
|
const filters: { names?: string[]; sourceTypes?: string[] } = {};
|
|
150
159
|
|
|
151
160
|
// Use name filter for API query if provided
|
|
@@ -29,11 +29,19 @@
|
|
|
29
29
|
import { DEFAULT_COLUMNS, DEFAULT_SELECTED_COLUMNS_DISPLAY } from './picker-column-helpers';
|
|
30
30
|
import TagBrowser from './TagBrowser.svelte';
|
|
31
31
|
import SelectedTags from './SelectedTags.svelte';
|
|
32
|
+
import { getContext } from 'svelte';
|
|
33
|
+
import { readable, type Readable } from 'svelte/store';
|
|
34
|
+
|
|
35
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
36
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
37
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
32
38
|
|
|
33
39
|
const MAX_ENTRIES = 100;
|
|
34
40
|
|
|
35
41
|
interface Props {
|
|
36
42
|
dcApiUrl?: string;
|
|
43
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
44
|
+
token?: string;
|
|
37
45
|
sourceConnectionId?: string;
|
|
38
46
|
selectedIds?: string[];
|
|
39
47
|
entries?: CatalogEntry[];
|
|
@@ -46,6 +54,7 @@
|
|
|
46
54
|
|
|
47
55
|
let {
|
|
48
56
|
dcApiUrl = '',
|
|
57
|
+
token = '',
|
|
49
58
|
sourceConnectionId = '',
|
|
50
59
|
selectedIds = $bindable([]),
|
|
51
60
|
entries = $bindable([]),
|
|
@@ -85,8 +94,10 @@
|
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
function getClient(apiUrl: string): DataCatalogClient {
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
// Keep the bearer fresh on the cached client too (token may be re-pushed on refresh).
|
|
98
|
+
const t = token || $hubToken;
|
|
99
|
+
if (client && clientUrl === apiUrl) return client.setToken(t);
|
|
100
|
+
client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(t);
|
|
90
101
|
clientUrl = apiUrl;
|
|
91
102
|
return client;
|
|
92
103
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { DataCatalogClient } from '@industream/datacatalog-client';
|
|
3
|
+
import { getContext } from 'svelte';
|
|
4
|
+
import { readable, type Readable } from 'svelte/store';
|
|
5
|
+
|
|
6
|
+
// Hub bearer published by flowMakerBridge (key 'industream-hub-token'); used by
|
|
7
|
+
// default so boxes don't wire it per call. An explicit `token` prop overrides it.
|
|
8
|
+
const hubToken: Readable<string> = getContext('industream-hub-token') ?? readable('');
|
|
3
9
|
|
|
4
10
|
export interface SourceConnection {
|
|
5
11
|
id: string;
|
|
@@ -10,6 +16,8 @@
|
|
|
10
16
|
|
|
11
17
|
interface Props {
|
|
12
18
|
dcapiurl?: string;
|
|
19
|
+
/** Hub access token, injected from the box context — sent as Bearer to datacatalog-api. */
|
|
20
|
+
token?: string;
|
|
13
21
|
sourcetypefilter?: string | string[] | null;
|
|
14
22
|
initialselection?: string | null;
|
|
15
23
|
onsourceselect?: (connection: SourceConnection) => void;
|
|
@@ -18,6 +26,7 @@
|
|
|
18
26
|
|
|
19
27
|
let {
|
|
20
28
|
dcapiurl = '',
|
|
29
|
+
token = '',
|
|
21
30
|
sourcetypefilter = null,
|
|
22
31
|
initialselection = null,
|
|
23
32
|
onsourceselect = null,
|
|
@@ -52,7 +61,7 @@
|
|
|
52
61
|
error = null;
|
|
53
62
|
|
|
54
63
|
try {
|
|
55
|
-
const client = new DataCatalogClient({ baseUrl: dcapiurl });
|
|
64
|
+
const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
|
|
56
65
|
const filters = {};
|
|
57
66
|
|
|
58
67
|
if (sourcetypefilter && sourcetypefilter.length > 0) {
|