nucleus-core-ts 0.9.845 → 0.9.846

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.
@@ -2,10 +2,12 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
4
  import { useIntegrationsStore } from '../store';
5
+ import { useLabels } from '../text/context';
5
6
  import { integrationsPageTheme as theme } from '../theme';
6
7
  import { deleteIsConfirmed } from './deleteIsConfirmed';
7
8
  import { Notice } from './Primitives';
8
9
  export function ConnectionDelete({ actions, source, onDeleted }) {
10
+ const labels = useLabels();
9
11
  const store = useIntegrationsStore();
10
12
  const [asking, setAsking] = useState(false);
11
13
  const [typed, setTyped] = useState('');
@@ -18,7 +20,7 @@ export function ConnectionDelete({ actions, source, onDeleted }) {
18
20
  actions.deleteSource(source.id).then((done)=>{
19
21
  setBusy(false);
20
22
  if (!done) {
21
- store.setError('The connection was not deleted.');
23
+ store.setError(labels.connections.deleteFailed);
22
24
  return;
23
25
  }
24
26
  setAsking(false);
@@ -38,13 +40,13 @@ export function ConnectionDelete({ actions, source, onDeleted }) {
38
40
  children: [
39
41
  /*#__PURE__*/ _jsx("h3", {
40
42
  className: theme.card.title,
41
- children: "Remove this connection"
43
+ children: labels.connections.deleteHeading
42
44
  }),
43
45
  asking ? null : /*#__PURE__*/ _jsx("button", {
44
46
  className: theme.button.danger,
45
47
  onClick: ()=>setAsking(true),
46
48
  type: "button",
47
- children: "Delete"
49
+ children: labels.connections.deleteStart
48
50
  })
49
51
  ]
50
52
  }),
@@ -52,27 +54,17 @@ export function ConnectionDelete({ actions, source, onDeleted }) {
52
54
  className: theme.card.body,
53
55
  children: asking ? /*#__PURE__*/ _jsxs(_Fragment, {
54
56
  children: [
55
- /*#__PURE__*/ _jsxs(Notice, {
56
- title: "This takes its calls and mappings with it",
57
+ /*#__PURE__*/ _jsx(Notice, {
58
+ title: labels.connections.deleteWarnTitle,
57
59
  tone: "danger",
58
- children: [
59
- "Everything configured under “",
60
- source.name,
61
- "” goes: the calls, the mappings and the record of what they imported. The rows already written into your tables stay where they are — but nothing will be able to undo the imports that put them there."
62
- ]
60
+ children: labels.connections.deleteWarnBody(source.name)
63
61
  }),
64
62
  /*#__PURE__*/ _jsxs("label", {
65
63
  className: theme.field.wrapper,
66
64
  children: [
67
- /*#__PURE__*/ _jsxs("span", {
65
+ /*#__PURE__*/ _jsx("span", {
68
66
  className: theme.field.label,
69
- children: [
70
- "Type ",
71
- /*#__PURE__*/ _jsx("strong", {
72
- children: source.name
73
- }),
74
- " to confirm"
75
- ]
67
+ children: labels.connections.deleteTypeToConfirm
76
68
  }),
77
69
  /*#__PURE__*/ _jsx("input", {
78
70
  className: theme.field.input,
@@ -94,21 +86,21 @@ export function ConnectionDelete({ actions, source, onDeleted }) {
94
86
  setTyped('');
95
87
  },
96
88
  type: "button",
97
- children: "Cancel"
89
+ children: labels.common.cancel
98
90
  }),
99
91
  /*#__PURE__*/ _jsx("button", {
100
92
  className: theme.button.danger,
101
93
  disabled: busy || !confirmed,
102
94
  onClick: remove,
103
95
  type: "button",
104
- children: busy ? 'Deleting…' : 'Delete this connection'
96
+ children: busy ? labels.common.deleting : labels.connections.deleteConfirm
105
97
  })
106
98
  ]
107
99
  })
108
100
  ]
109
101
  }) : /*#__PURE__*/ _jsx("p", {
110
102
  className: theme.field.hint,
111
- children: "A connection can be turned off instead — that stops every call and import through it and keeps the settings. Deleting is for one that should not have existed."
103
+ children: labels.connections.deleteHint
112
104
  })
113
105
  })
114
106
  ]
@@ -66,13 +66,9 @@ export function ConnectionTest({ actions, source, loading = false }) {
66
66
  /*#__PURE__*/ _jsxs("div", {
67
67
  className: theme.card.body,
68
68
  children: [
69
- source ? /*#__PURE__*/ _jsxs("p", {
69
+ source ? /*#__PURE__*/ _jsx("p", {
70
70
  className: theme.field.hint,
71
- children: [
72
- "Calls ",
73
- source.baseUrl,
74
- " with the settings and credentials as they are stored right now."
75
- ]
71
+ children: labels.auth.testCalls(source.baseUrl)
76
72
  }) : /*#__PURE__*/ _jsx("p", {
77
73
  className: theme.field.hint,
78
74
  children: labels.auth.testSaveFirst
@@ -261,7 +261,7 @@ export function MappingEditor({ mapping, targets, targetsLoading, endpoints, fre
261
261
  disabled: busy,
262
262
  onClick: ()=>onDelete(draft.id ?? ''),
263
263
  type: "button",
264
- children: deleting ? 'Deleting…' : 'Delete'
264
+ children: deleting ? labels.common.deleting : labels.common.delete
265
265
  }) : null,
266
266
  /*#__PURE__*/ _jsx("button", {
267
267
  className: theme.button.secondary,
@@ -282,7 +282,7 @@ export function MappingEditor({ mapping, targets, targetsLoading, endpoints, fre
282
282
  disabled: busy || issues.length > 0,
283
283
  onClick: ()=>onSave(draft),
284
284
  type: "button",
285
- children: saving ? 'Saving…' : 'Save mapping'
285
+ children: saving ? labels.common.saving : labels.mappings.save
286
286
  })
287
287
  ]
288
288
  })
@@ -60,13 +60,10 @@ import { Notice } from './Primitives';
60
60
  className: theme.field.hint,
61
61
  children: labels.endpoints.bindingsNone
62
62
  }) : null,
63
- unbound.length > 0 ? /*#__PURE__*/ _jsxs(Notice, {
63
+ unbound.length > 0 ? /*#__PURE__*/ _jsx(Notice, {
64
64
  title: labels.endpoints.bindingsTitle,
65
65
  tone: "warning",
66
- children: [
67
- unbound.join(', '),
68
- " — an import cannot run until every one of them is bound. Add a binding for each below."
69
- ]
66
+ children: labels.endpoints.bindingsUnbound(unbound.join(', '))
70
67
  }) : null,
71
68
  value.map((binding, index)=>/*#__PURE__*/ _jsx(ParamBindingRow, {
72
69
  binding: binding,
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useLabels } from '../text/context';
3
4
  import { integrationsPageTheme } from '../theme';
4
5
  import { Notice } from './Primitives';
5
6
  /**
@@ -10,6 +11,7 @@ import { Notice } from './Primitives';
10
11
  * sure?" transfers no information, so this one refuses to be that.
11
12
  */ const theme = integrationsPageTheme;
12
13
  export function RunConfirmStep({ lines, counted, working, onConfirm, onDismiss }) {
14
+ const labels = useLabels();
13
15
  return /*#__PURE__*/ _jsxs(Notice, {
14
16
  tone: "danger",
15
17
  title: "This import destroys data. Read what it removes, then confirm.",
@@ -32,7 +34,7 @@ export function RunConfirmStep({ lines, counted, working, onConfirm, onDismiss }
32
34
  disabled: working,
33
35
  onClick: onConfirm,
34
36
  type: "button",
35
- children: working ? 'Starting…' : 'Run it and remove those rows'
37
+ children: working ? labels.runs.starting : 'Run it and remove those rows'
36
38
  }),
37
39
  /*#__PURE__*/ _jsx("button", {
38
40
  className: theme.button.secondary,
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from '../../../utils/cn';
4
+ import { useLabels } from '../text/context';
4
5
  import { integrationsPageTheme } from '../theme';
5
6
  /**
6
7
  * How far the run this panel started has got.
@@ -17,6 +18,7 @@ const PHASE_LABEL = {
17
18
  done: 'Finished'
18
19
  };
19
20
  export function RunProgressBar({ runId, progress, cancelling, onCancel }) {
21
+ const labels = useLabels();
20
22
  const total = progress?.total ?? 0;
21
23
  const processed = progress?.processed ?? 0;
22
24
  const determinate = total > 0;
@@ -68,7 +70,7 @@ export function RunProgressBar({ runId, progress, cancelling, onCancel }) {
68
70
  disabled: cancelling,
69
71
  onClick: onCancel,
70
72
  type: "button",
71
- children: cancelling ? 'Cancelling…' : 'Cancel'
73
+ children: cancelling ? labels.runs.cancelling : labels.runs.cancel
72
74
  })
73
75
  ]
74
76
  })
@@ -7,9 +7,6 @@ export const { useStore: useIntegrationsStore } = createStore(initial, {
7
7
  store.sourcesTotal = total;
8
8
  store.sourcesLoading = false;
9
9
  }),
10
- setSourcesPage: (store)=>(page)=>{
11
- store.sourcesPage = page;
12
- },
13
10
  setSourcesSearch: (store)=>(search)=>batch(()=>{
14
11
  store.sourcesSearch = search;
15
12
  // A new search is a new result set; staying on page 4 would show an empty
@@ -53,12 +50,6 @@ export const { useStore: useIntegrationsStore } = createStore(initial, {
53
50
  store.endpointsTotal = total;
54
51
  store.endpointsLoading = false;
55
52
  }),
56
- setEndpointsTotal: (store)=>(total)=>{
57
- store.endpointsTotal = total;
58
- },
59
- setEndpointsPage: (store)=>(page)=>{
60
- store.endpointsPage = page;
61
- },
62
53
  setEndpointsSearch: (store)=>(search)=>batch(()=>{
63
54
  store.endpointsSearch = search;
64
55
  store.endpointsPage = 1;
@@ -80,9 +71,6 @@ export const { useStore: useIntegrationsStore } = createStore(initial, {
80
71
  setMappingsTotal: (store)=>(total)=>{
81
72
  store.mappingsTotal = total;
82
73
  },
83
- setMappingsPage: (store)=>(page)=>{
84
- store.mappingsPage = page;
85
- },
86
74
  setMappingsSearch: (store)=>(search)=>batch(()=>{
87
75
  store.mappingsSearch = search;
88
76
  store.mappingsPage = 1;
@@ -107,12 +95,6 @@ export const { useStore: useIntegrationsStore } = createStore(initial, {
107
95
  store.runsTotal = total;
108
96
  store.runsLoading = false;
109
97
  }),
110
- setRunsTotal: (store)=>(total)=>{
111
- store.runsTotal = total;
112
- },
113
- setRunsPage: (store)=>(page)=>{
114
- store.runsPage = page;
115
- },
116
98
  setRunsLoading: (store)=>(loading)=>{
117
99
  store.runsLoading = loading;
118
100
  },
@@ -15,7 +15,6 @@ export type State = {
15
15
  [key: string]: unknown;
16
16
  sources: IntegrationSource[];
17
17
  sourcesTotal: number;
18
- sourcesPage: number;
19
18
  sourcesSearch: string;
20
19
  sourcesLoading: boolean;
21
20
  selectedSourceId: string | null;
@@ -33,19 +32,16 @@ export type State = {
33
32
  focusStep: 'mapping' | 'import';
34
33
  endpoints: IntegrationEndpoint[];
35
34
  endpointsTotal: number;
36
- endpointsPage: number;
37
35
  endpointsSearch: string;
38
36
  endpointsLoading: boolean;
39
37
  selectedEndpointId: string | null;
40
38
  mappings: IntegrationMapping[];
41
39
  mappingsTotal: number;
42
- mappingsPage: number;
43
40
  mappingsSearch: string;
44
41
  mappingsLoading: boolean;
45
42
  selectedMappingId: string | null;
46
43
  runs: IntegrationRun[];
47
44
  runsTotal: number;
48
- runsPage: number;
49
45
  runsLoading: boolean;
50
46
  /** The real shape of the selected endpoint's response, once sampled. */
51
47
  sample: EndpointSampleValue | null;
@@ -62,7 +58,6 @@ export type State = {
62
58
  export type Actions = {
63
59
  [key: string]: unknown;
64
60
  setSources: (items: IntegrationSource[], total: number) => void;
65
- setSourcesPage: (page: number) => void;
66
61
  setSourcesSearch: (search: string) => void;
67
62
  setSourcesLoading: (loading: boolean) => void;
68
63
  selectSource: (id: string | null) => void;
@@ -75,20 +70,15 @@ export type Actions = {
75
70
  * The step strip reports how far a connection has got, and it cannot wait for
76
71
  * the tab that lists the rows to have been opened — so it counts directly.
77
72
  */
78
- setEndpointsTotal: (total: number) => void;
79
- setEndpointsPage: (page: number) => void;
80
73
  setEndpointsSearch: (search: string) => void;
81
74
  setEndpointsLoading: (loading: boolean) => void;
82
75
  selectEndpoint: (id: string | null) => void;
83
76
  setMappings: (items: IntegrationMapping[], total: number) => void;
84
77
  setMappingsTotal: (total: number) => void;
85
- setMappingsPage: (page: number) => void;
86
78
  setMappingsSearch: (search: string) => void;
87
79
  setMappingsLoading: (loading: boolean) => void;
88
80
  selectMapping: (id: string | null) => void;
89
81
  setRuns: (items: IntegrationRun[], total: number) => void;
90
- setRunsTotal: (total: number) => void;
91
- setRunsPage: (page: number) => void;
92
82
  setRunsLoading: (loading: boolean) => void;
93
83
  setSample: (sample: EndpointSampleValue | null) => void;
94
84
  setSampling: (sampling: boolean) => void;
@@ -1,7 +1,6 @@
1
1
  export const initial = {
2
2
  sources: [],
3
3
  sourcesTotal: 0,
4
- sourcesPage: 1,
5
4
  sourcesSearch: '',
6
5
  sourcesLoading: false,
7
6
  selectedSourceId: null,
@@ -10,19 +9,16 @@ export const initial = {
10
9
  focusStep: 'mapping',
11
10
  endpoints: [],
12
11
  endpointsTotal: 0,
13
- endpointsPage: 1,
14
12
  endpointsSearch: '',
15
13
  endpointsLoading: false,
16
14
  selectedEndpointId: null,
17
15
  mappings: [],
18
16
  mappingsTotal: 0,
19
- mappingsPage: 1,
20
17
  mappingsSearch: '',
21
18
  mappingsLoading: false,
22
19
  selectedMappingId: null,
23
20
  runs: [],
24
21
  runsTotal: 0,
25
- runsPage: 1,
26
22
  runsLoading: false,
27
23
  sample: null,
28
24
  sampling: false,
@@ -63,6 +63,14 @@ export type IntegrationsLabels = {
63
63
  disabledBadge: string;
64
64
  saveChanges: string;
65
65
  createSubmit: string;
66
+ deleteHeading: string;
67
+ deleteStart: string;
68
+ deleteWarnTitle: string;
69
+ deleteWarnBody: (name: string) => string;
70
+ deleteTypeToConfirm: string;
71
+ deleteConfirm: string;
72
+ deleteHint: string;
73
+ deleteFailed: string;
66
74
  };
67
75
  runs: {
68
76
  /** The one-line summary above the buttons. */
@@ -72,6 +80,7 @@ export type IntegrationsLabels = {
72
80
  start: string;
73
81
  starting: string;
74
82
  cancel: string;
83
+ cancelling: string;
75
84
  previewExplainTitle: string;
76
85
  previewExplainBody: string;
77
86
  historyHeading: string;
@@ -56,7 +56,15 @@
56
56
  enabledBadge: 'Enabled',
57
57
  disabledBadge: 'Off',
58
58
  saveChanges: 'Save changes',
59
- createSubmit: 'Create connection'
59
+ createSubmit: 'Create connection',
60
+ deleteHeading: 'Remove this connection',
61
+ deleteStart: 'Delete',
62
+ deleteWarnTitle: 'This takes its calls and mappings with it',
63
+ deleteWarnBody: (name)=>`Everything configured under “${name}” goes: the calls, the mappings and the record of what they imported. The rows already written into your tables stay where they are — but nothing will be able to undo the imports that put them there.`,
64
+ deleteTypeToConfirm: 'Type the connection name to confirm',
65
+ deleteConfirm: 'Delete this connection',
66
+ deleteHint: 'A connection can be turned off instead — that stops every call and import through it and keeps the settings. Deleting is for one that should not have existed.',
67
+ deleteFailed: 'The connection was not deleted.'
60
68
  },
61
69
  runs: {
62
70
  summary: (target, writeMode, missing)=>`Writes into ${target} · ${writeMode} · missing rows: ${missing}`,
@@ -65,6 +73,7 @@
65
73
  start: 'Run import',
66
74
  starting: 'Starting…',
67
75
  cancel: 'Cancel',
76
+ cancelling: 'Cancelling…',
68
77
  previewExplainTitle: 'Preview before you run',
69
78
  previewExplainBody: 'A preview reads the source without writing anything, and reports how many rows would be created, updated, skipped, and how many rows in the target the source no longer returns.',
70
79
  historyHeading: 'History',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.9.845",
3
+ "version": "0.9.846",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",