@industream/flowmaker-flowbox-ui-components 1.0.2 → 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.
@@ -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
@@ -148,7 +154,7 @@
148
154
  error = null;
149
155
 
150
156
  try {
151
- const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token);
157
+ const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
152
158
  const filters: { names?: string[]; sourceTypes?: string[] } = {};
153
159
 
154
160
  // Use name filter for API query if provided
@@ -29,6 +29,12 @@
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
 
@@ -89,8 +95,9 @@
89
95
 
90
96
  function getClient(apiUrl: string): DataCatalogClient {
91
97
  // Keep the bearer fresh on the cached client too (token may be re-pushed on refresh).
92
- if (client && clientUrl === apiUrl) return client.setToken(token);
93
- client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(token);
98
+ const t = token || $hubToken;
99
+ if (client && clientUrl === apiUrl) return client.setToken(t);
100
+ client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(t);
94
101
  clientUrl = apiUrl;
95
102
  return client;
96
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;
@@ -55,7 +61,7 @@
55
61
  error = null;
56
62
 
57
63
  try {
58
- const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token);
64
+ const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
59
65
  const filters = {};
60
66
 
61
67
  if (sourcetypefilter && sourcetypefilter.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@industream/flowmaker-flowbox-ui-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Reusable Svelte components for FlowMaker FlowBox UI",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",
@@ -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
@@ -148,7 +154,7 @@
148
154
  error = null;
149
155
 
150
156
  try {
151
- const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token);
157
+ const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
152
158
  const filters: { names?: string[]; sourceTypes?: string[] } = {};
153
159
 
154
160
  // Use name filter for API query if provided
@@ -29,6 +29,12 @@
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
 
@@ -89,8 +95,9 @@
89
95
 
90
96
  function getClient(apiUrl: string): DataCatalogClient {
91
97
  // Keep the bearer fresh on the cached client too (token may be re-pushed on refresh).
92
- if (client && clientUrl === apiUrl) return client.setToken(token);
93
- client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(token);
98
+ const t = token || $hubToken;
99
+ if (client && clientUrl === apiUrl) return client.setToken(t);
100
+ client = new DataCatalogClient({ baseUrl: apiUrl }).setToken(t);
94
101
  clientUrl = apiUrl;
95
102
  return client;
96
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;
@@ -55,7 +61,7 @@
55
61
  error = null;
56
62
 
57
63
  try {
58
- const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token);
64
+ const client = new DataCatalogClient({ baseUrl: dcapiurl }).setToken(token || $hubToken);
59
65
  const filters = {};
60
66
 
61
67
  if (sourcetypefilter && sourcetypefilter.length > 0) {