@nice2dev/ui-api 1.4.30 → 1.4.32
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/CHANGELOG.md +47 -0
- package/dist/NiceApiClient.d.ts +10 -0
- package/dist/NiceIntegrationsEditor.d.ts +18 -1
- package/dist/apiClient/ApiClientParts.d.ts +31 -1
- package/dist/core/integration.d.ts +11 -0
- package/dist/core/model.d.ts +12 -0
- package/dist/core/variables.d.ts +9 -1
- package/dist/core.cjs +37 -37
- package/dist/core.mjs +401 -351
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2809 -1947
- package/dist/ui-api.css +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @nice2dev/ui-api
|
|
2
2
|
|
|
3
|
+
## 1.4.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b909e45: NiceIntegrationsEditor and NiceEnvironmentSetsEditor (round 44, 1.4.32).
|
|
8
|
+
|
|
9
|
+
- **NiceIntegrationsEditor**:
|
|
10
|
+
- the integrations as a tree with folders on any level — an integration's `package` is its folder
|
|
11
|
+
path (`Banking/PSD2` is two folders); folders are dragged and renamed (everything inside follows),
|
|
12
|
+
integrations dragged into folders, Add ▸ Integration / Folder adds into the picked folder; a
|
|
13
|
+
folder's page renames it and adds inside; removing a folder moves its content up a level. Empty
|
|
14
|
+
folders are kept in the file's new `folders`;
|
|
15
|
+
- new `dataSources` (`{ key, name?, fields? }`): an operation's source and target suggest them;
|
|
16
|
+
- the field mapping is a table with suggestions — the target's fields, the source's fields or what
|
|
17
|
+
the endpoint answers with (new core `responseFieldPaths`: `$[*].title`, `$.accounts[*].iban`) —
|
|
18
|
+
and "Map matching fields" pairs the fields of the same name.
|
|
19
|
+
- **NiceEnvironmentSetsEditor**: one set at a time — ‹ › or the list — and at most one more beside it to
|
|
20
|
+
compare (every set at once squeezed the values to nothing); the shown sets' settings sit above the
|
|
21
|
+
table; variables can be removed; on a narrow screen every variable is a card.
|
|
22
|
+
- NiceApiClient's 1.4.31 buttons use the existing icon / link button styles (a duplicate pair removed);
|
|
23
|
+
the `NiceApiClientLayout` and `NiceIntegrationDataSource` types are exported.
|
|
24
|
+
- Translations for the new texts in all twelve dictionaries.
|
|
25
|
+
|
|
26
|
+
## 1.4.31
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 7eb35bc: NiceApiClient (round 44, 1.4.31).
|
|
31
|
+
|
|
32
|
+
- A menubar: File ▸ New / Open… / Save / Import… / Export ▸ (OpenAPI YAML / JSON, Postman, HAR,
|
|
33
|
+
Markdown), Edit ▸ New request / New folder / Duplicate / Delete, View ▸ Try / Docs and
|
|
34
|
+
Layout ▸ Horizontal (the response beside the request) / Vertical (under it). New props `onSave`,
|
|
35
|
+
`onNew`, `layout` / `defaultLayout` / `onLayoutChange`.
|
|
36
|
+
- Export is a button with a list (it was an icon beside a select); adding is one icon button with a
|
|
37
|
+
list — a request or a folder (into the selected folder, or the folder of the selected request).
|
|
38
|
+
- The collection is the tree's fixed root (it replaces the Overview button); folders and requests are
|
|
39
|
+
dragged — before, after or into a folder, also with Ctrl+Shift+arrows — and several at once: Shift +
|
|
40
|
+
click picks a range, Ctrl + click adds or removes one; Delete and dragging work on all picked.
|
|
41
|
+
- Variable sets: the collection keeps named sets of variables (`variableSets` — on its page, the
|
|
42
|
+
tree's root); a folder or a request uses one or several of them in order (its Variables tab / the
|
|
43
|
+
folder page), shown with the sets it inherits and the variables in force with their source. Resolved:
|
|
44
|
+
collection variables, the environment, the folders' sets (outermost first), the request's — a later
|
|
45
|
+
one wins (`variableScope(…, assigned)`, new `assignedVariableSets`).
|
|
46
|
+
- NiceTreeView: new `selectionBehavior="extended"` — a click selects one node, Ctrl / ⌘ + click adds or
|
|
47
|
+
removes it, Shift + click selects a range in the order shown.
|
|
48
|
+
- Translations for the new texts in all twelve dictionaries.
|
|
49
|
+
|
|
3
50
|
## 1.4.30
|
|
4
51
|
|
|
5
52
|
No changes in this release.
|
package/dist/NiceApiClient.d.ts
CHANGED
|
@@ -33,7 +33,17 @@ export interface NiceApiClientProps {
|
|
|
33
33
|
readOnly?: boolean;
|
|
34
34
|
/** Height of the client. Default 640. */
|
|
35
35
|
height?: number | string;
|
|
36
|
+
/** 1.4.31: File ▸ Save — the whole collection. Without it the menu has no Save. */
|
|
37
|
+
onSave?: (collection: NiceApiCollection) => void;
|
|
38
|
+
/** 1.4.31: File ▸ New. Default: an empty collection in place of this one. */
|
|
39
|
+
onNew?: () => void;
|
|
40
|
+
/** 1.4.31: the response beside the request (`horizontal`, default) or under it (`vertical`). */
|
|
41
|
+
layout?: NiceApiClientLayout;
|
|
42
|
+
defaultLayout?: NiceApiClientLayout;
|
|
43
|
+
onLayoutChange?: (layout: NiceApiClientLayout) => void;
|
|
36
44
|
className?: string;
|
|
37
45
|
style?: React.CSSProperties;
|
|
38
46
|
}
|
|
47
|
+
/** Where the response sits: beside the request or under it. */
|
|
48
|
+
export type NiceApiClientLayout = 'horizontal' | 'vertical';
|
|
39
49
|
export declare function NiceApiClient(props: NiceApiClientProps): React.ReactElement;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { NiceApiTransport, NiceEnvironmentSets, NiceIntegrationsFile } from './core';
|
|
3
|
+
/** 1.4.32: a data source an operation reads from or writes to, with its fields for the mapping. */
|
|
4
|
+
export interface NiceIntegrationDataSource {
|
|
5
|
+
key: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
fields?: string[];
|
|
8
|
+
}
|
|
3
9
|
export interface NiceIntegrationsEditorProps {
|
|
4
10
|
/** The module's integrations (controlled). */
|
|
5
11
|
value?: NiceIntegrationsFile;
|
|
@@ -12,6 +18,11 @@ export interface NiceIntegrationsEditorProps {
|
|
|
12
18
|
modules?: string[];
|
|
13
19
|
dataSources?: string[];
|
|
14
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* 1.4.32: the data sources an operation can read from and write to, with their fields — offered as
|
|
23
|
+
* an operation's source / target and as the fields of its mapping.
|
|
24
|
+
*/
|
|
25
|
+
dataSources?: NiceIntegrationDataSource[];
|
|
15
26
|
/** Sends the API tab's requests (the host's proxy). */
|
|
16
27
|
sendRequest?: NiceApiTransport;
|
|
17
28
|
resolveSecret?: (key: string) => string | undefined;
|
|
@@ -32,7 +43,13 @@ export interface NiceEnvironmentSetsEditorProps {
|
|
|
32
43
|
className?: string;
|
|
33
44
|
style?: React.CSSProperties;
|
|
34
45
|
}
|
|
35
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Variables × sets: each set's own values, the inherited ones shown faded, secrets as `{{secret:KEY}}`.
|
|
48
|
+
*
|
|
49
|
+
* 1.4.32: one set at a time — switched with ‹ › or picked from the list — and at most a second one
|
|
50
|
+
* beside it to compare (every set at once squeezed the values to nothing); the table turns into
|
|
51
|
+
* cards on a narrow screen.
|
|
52
|
+
*/
|
|
36
53
|
export declare function NiceEnvironmentSetsEditor(props: NiceEnvironmentSetsEditorProps): React.ReactElement;
|
|
37
54
|
/** What NiceDevelopmentStudio hands an editor plug-in (structural — no dependency on ui-forms). */
|
|
38
55
|
export interface NiceApiStudioEditorContext {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { NiceApiAuth, NiceApiBody, NiceApiCollection, NiceApiParam, NiceApiParamLocation, NiceApiRequest, NiceApiResolvedRequest, NiceApiResponse, NiceApiSchema } from '../core';
|
|
2
|
+
import { NiceApiAuth, NiceApiBody, NiceApiCollection, NiceApiEnvironment, NiceApiParam, NiceApiParamLocation, NiceApiRequest, NiceApiResolvedRequest, NiceApiResponse, NiceApiSchema } from '../core';
|
|
3
3
|
/** The method as a coloured badge (GET, POST, …). */
|
|
4
4
|
export declare function ApiMethodBadge({ method }: {
|
|
5
5
|
method: string;
|
|
@@ -73,3 +73,33 @@ export declare function ApiCollectionDocs({ collection, showModels, }: {
|
|
|
73
73
|
/** The Models section (off when the models have a tab of their own). */
|
|
74
74
|
showModels?: boolean;
|
|
75
75
|
}): React.ReactElement;
|
|
76
|
+
export interface ApiVariableSetsEditorProps {
|
|
77
|
+
sets: NiceApiEnvironment[];
|
|
78
|
+
onChange: (sets: NiceApiEnvironment[]) => void;
|
|
79
|
+
/** Ids in use (assigned to a folder or a request) — removing one asks first. */
|
|
80
|
+
usedIds?: ReadonlySet<string>;
|
|
81
|
+
readOnly?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** The collection's variable sets: a name and a table of variables each; add, rename, remove. */
|
|
84
|
+
export declare function ApiVariableSetsEditor({ sets, onChange, usedIds, readOnly, }: ApiVariableSetsEditorProps): React.ReactElement;
|
|
85
|
+
export interface ApiAssignedSetsProps {
|
|
86
|
+
/** The item's own sets, in order. */
|
|
87
|
+
value: readonly string[];
|
|
88
|
+
onChange: (ids: string[]) => void;
|
|
89
|
+
/** Every set it can use: the collection's and the host's environments. */
|
|
90
|
+
available: readonly NiceApiEnvironment[];
|
|
91
|
+
/** The sets it gets from its folders (outermost first) — shown, not edited here. */
|
|
92
|
+
inherited?: ReadonlyArray<{
|
|
93
|
+
set: NiceApiEnvironment;
|
|
94
|
+
from: string;
|
|
95
|
+
}>;
|
|
96
|
+
/** The values in force for this item, with the set each comes from. */
|
|
97
|
+
resolved?: ReadonlyArray<{
|
|
98
|
+
key: string;
|
|
99
|
+
value: string;
|
|
100
|
+
from: string;
|
|
101
|
+
}>;
|
|
102
|
+
readOnly?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** The variable sets of a folder or a request: the inherited ones, then its own, in order. */
|
|
105
|
+
export declare function ApiAssignedSets({ value, onChange, available, inherited, resolved, readOnly, }: ApiAssignedSetsProps): React.ReactElement;
|
|
@@ -93,6 +93,11 @@ export interface NiceIntegrationDef {
|
|
|
93
93
|
/** A module's `{prefix}.integrations.json`. */
|
|
94
94
|
export interface NiceIntegrationsFile {
|
|
95
95
|
integrations: NiceIntegrationDef[];
|
|
96
|
+
/**
|
|
97
|
+
* 1.4.32: folders of the tree (`Banking/PSD2` — an integration's `package` is its folder), kept
|
|
98
|
+
* here so an empty one stays; the folders of the packages in use need not be listed.
|
|
99
|
+
*/
|
|
100
|
+
folders?: string[];
|
|
96
101
|
}
|
|
97
102
|
/** A declared variable (its values live in the sets). */
|
|
98
103
|
export interface NiceEnvironmentVariableDecl {
|
|
@@ -157,6 +162,12 @@ export declare function validateIntegrations(file: NiceIntegrationsFile, sets?:
|
|
|
157
162
|
dataSources?: string[];
|
|
158
163
|
}): NiceIntegrationIssue[];
|
|
159
164
|
/** The integrations grouped for a tree: package → direction → integrations. */
|
|
165
|
+
/**
|
|
166
|
+
* 1.4.32: the fields a request answers with, as source paths for a mapping — `$.name` for an object,
|
|
167
|
+
* `$[*].name` for a list, `$.items[*].id` for a list inside — from its documented 200 / 201 response
|
|
168
|
+
* (named schemas resolved, `allOf` merged).
|
|
169
|
+
*/
|
|
170
|
+
export declare function responseFieldPaths(endpoints: NiceApiCollection | undefined, requestId: string | undefined): string[];
|
|
160
171
|
export declare function groupIntegrations(integrations: readonly NiceIntegrationDef[]): {
|
|
161
172
|
package: string;
|
|
162
173
|
directions: {
|
package/dist/core/model.d.ts
CHANGED
|
@@ -246,6 +246,11 @@ export interface NiceApiRequest {
|
|
|
246
246
|
deprecated?: boolean;
|
|
247
247
|
responses?: Record<string, NiceApiResponseDoc>;
|
|
248
248
|
examples?: NiceApiExample[];
|
|
249
|
+
/**
|
|
250
|
+
* 1.4.31: the variable sets this request uses (ids from the collection's `variableSets` or the
|
|
251
|
+
* host's environments), in order — a later set wins; over its folders' sets.
|
|
252
|
+
*/
|
|
253
|
+
variableSets?: string[];
|
|
249
254
|
}
|
|
250
255
|
/** A folder of requests and folders. */
|
|
251
256
|
export interface NiceApiFolder {
|
|
@@ -255,6 +260,8 @@ export interface NiceApiFolder {
|
|
|
255
260
|
description?: string;
|
|
256
261
|
items: NiceApiItem[];
|
|
257
262
|
auth?: NiceApiAuth;
|
|
263
|
+
/** 1.4.31: the variable sets every request inside uses (see {@link NiceApiRequest.variableSets}). */
|
|
264
|
+
variableSets?: string[];
|
|
258
265
|
}
|
|
259
266
|
/** A collection entry: a request or a folder. */
|
|
260
267
|
export type NiceApiItem = NiceApiRequest | NiceApiFolder;
|
|
@@ -283,6 +290,11 @@ export interface NiceApiCollection {
|
|
|
283
290
|
servers?: NiceApiServer[];
|
|
284
291
|
/** Named models, referenced from requests as `#/components/schemas/<name>`. */
|
|
285
292
|
schemas?: Record<string, NiceApiSchema>;
|
|
293
|
+
/**
|
|
294
|
+
* 1.4.31: named sets of variables kept with the collection (auth, tenant, paging…), assigned to
|
|
295
|
+
* folders and requests; the environment switch stays for dev / test / prod.
|
|
296
|
+
*/
|
|
297
|
+
variableSets?: NiceApiEnvironment[];
|
|
286
298
|
}
|
|
287
299
|
/** A named set of variable values (dev, test, prod…). */
|
|
288
300
|
export interface NiceApiEnvironment {
|
package/dist/core/variables.d.ts
CHANGED
|
@@ -18,8 +18,16 @@ export declare function findVariables(text: string): string[];
|
|
|
18
18
|
export declare function interpolate(text: string, lookup: NiceApiVariableLookup | Record<string, string>, options?: NiceApiInterpolateOptions): string;
|
|
19
19
|
/** The names `text` still refers to after interpolation — what is missing. */
|
|
20
20
|
export declare function unresolvedVariables(text: string, lookup: NiceApiVariableLookup | Record<string, string>, options?: NiceApiInterpolateOptions): string[];
|
|
21
|
+
/**
|
|
22
|
+
* 1.4.31: the variable sets assigned on the way to an item — its folders' (outermost first), then its
|
|
23
|
+
* own — each list in its order. `sets`: the collection's sets and the host's environments.
|
|
24
|
+
*/
|
|
25
|
+
export declare function assignedVariableSets(path: ReadonlyArray<{
|
|
26
|
+
variableSets?: readonly string[];
|
|
27
|
+
} | undefined>, sets: readonly NiceApiEnvironment[]): NiceApiEnvironment[];
|
|
21
28
|
/**
|
|
22
29
|
* The values in force: the collection's variables, overridden by the environment's, overridden by
|
|
30
|
+
* the assigned variable sets (1.4.31, in order — see {@link assignedVariableSets}), overridden by
|
|
23
31
|
* `extra` (values set at run time — a token from a login call). Disabled rows are skipped.
|
|
24
32
|
*/
|
|
25
|
-
export declare function variableScope(collection?: Pick<NiceApiCollection, 'variables'>, environment?: Pick<NiceApiEnvironment, 'values'>, extra?: Record<string, string
|
|
33
|
+
export declare function variableScope(collection?: Pick<NiceApiCollection, 'variables'>, environment?: Pick<NiceApiEnvironment, 'values'>, extra?: Record<string, string>, assigned?: ReadonlyArray<Pick<NiceApiEnvironment, 'values'>>): Record<string, string>;
|