@streamline-pulse/formkrafter-core 0.32.1 → 0.33.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/index.d.ts +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +3 -3
- package/dist/services/option_source_service.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/** A catalog the host offers to select / multi-select fields (shown in the builder). */
|
|
2
|
+
export interface OptionCatalogEntry {
|
|
3
|
+
/** What to put in `optionsRef` (filters may be appended: `towns?region={{data.region}}`). */
|
|
4
|
+
ref: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Query parameters the catalog accepts, for dependent lists. */
|
|
8
|
+
filters?: string[];
|
|
9
|
+
}
|
|
1
10
|
export interface OptionSourceService {
|
|
2
11
|
fetchOptions(ref: string): Promise<unknown>;
|
|
12
|
+
/** Optional: the catalogs available, so the builder can suggest refs. */
|
|
13
|
+
listCatalogs?(): Promise<OptionCatalogEntry[]>;
|
|
3
14
|
}
|
|
4
15
|
export interface FetchOptionSourceDefaults {
|
|
5
16
|
baseUrl?: string;
|
|
17
|
+
/** Where to list the catalogs (default: `baseUrl`). The response is an array, or `{ data: [...] }`, of `{ ref | value, name | label, description?, filters? }`. */
|
|
18
|
+
catalogsUrl?: string;
|
|
6
19
|
headers?: Record<string, string>;
|
|
7
20
|
credentials?: RequestCredentials;
|
|
8
21
|
fetch?: typeof fetch;
|
|
@@ -13,4 +26,6 @@ export declare class FetchOptionSourceService implements OptionSourceService {
|
|
|
13
26
|
constructor(defaults?: FetchOptionSourceDefaults);
|
|
14
27
|
private resolveUrl;
|
|
15
28
|
fetchOptions(ref: string): Promise<unknown>;
|
|
29
|
+
private catalogs?;
|
|
30
|
+
listCatalogs(): Promise<OptionCatalogEntry[]>;
|
|
16
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Framework-agnostic core for FormKrafter: form specs, RFC 6902 ops with undo/redo, Ajv validation, sandboxed rules engine and injectable services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|