@antelopejs/interface-dms-builder 0.3.1 → 0.4.1
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/README.md +17 -17
- package/dist/catalog.d.ts +7 -7
- package/dist/drafts.d.ts +10 -9
- package/dist/drafts.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/operation-map.d.ts +67 -0
- package/dist/operation-map.js +57 -0
- package/dist/operation-map.js.map +1 -0
- package/dist/operations.d.ts +7 -5
- package/dist/operations.js.map +1 -1
- package/dist/project.d.ts +3 -2
- package/dist/project.js.map +1 -1
- package/dist/queries.d.ts +12 -11
- package/dist/resources.d.ts +3 -3
- package/dist/results.d.ts +4 -4
- package/dist/structure.d.ts +5 -4
- package/dist/values.d.ts +14 -10
- package/docs/1.introduction.md +28 -22
- package/docs/10.a-chart-without-code.md +47 -71
- package/docs/11.external-databases.md +93 -70
- package/docs/2.addressing-and-structure.md +48 -40
- package/docs/3.catalog.md +105 -49
- package/docs/4.page-operations.md +74 -60
- package/docs/5.resources.md +97 -71
- package/docs/6.queries.md +94 -95
- package/docs/7.values.md +38 -32
- package/docs/8.results-and-errors.md +62 -45
- package/docs/9.drafts-and-preview.md +84 -48
- package/docs/images/captures/editor-selected.webp +0 -0
- package/docs/tsconfig.json +4 -0
- package/package.json +2 -2
- package/docs/images/editor-selected.png +0 -0
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# `@antelopejs/interface-dms-builder`
|
|
4
4
|
|
|
5
|
-
<a href="https://www.npmjs.com/package/@antelopejs/interface-dms-builder"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-dms-builder?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-dms-builder?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
7
|
-
<a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
|
|
8
|
-
<a href="https://dms.antelopejs.com/docs/modules/builder/extending"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@antelopejs/interface-dms-builder"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-dms-builder?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a>
|
|
6
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-dms-builder?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a>
|
|
7
|
+
<a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" data-illustration></a>
|
|
8
|
+
<a href="https://dms.antelopejs.com/docs/modules/builder/extending"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" data-illustration></a>
|
|
9
9
|
|
|
10
|
-
The AntelopeJS interface
|
|
10
|
+
The AntelopeJS interface that edits the pages, blocks, resources and queries of a DMS project from code.
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
14
|
## What it does
|
|
15
15
|
|
|
16
|
-
- Creates and edits pages, categories and their block trees
|
|
17
|
-
- Generates resources
|
|
16
|
+
- Creates and edits pages, categories and their block trees with operations such as `CreatePage`, `AddBlock`, `ConfigureBlock`, `MoveBlock` and `SetPageBlocks`.
|
|
17
|
+
- Generates resources, each a `Table`, a `DataController` and a model, and edits their fields.
|
|
18
18
|
- Compiles query templates into a model method and a page route, so a card gets a number without hand-written code.
|
|
19
19
|
- Reports every block type and DataType the builder can write, with a schema for its options (`GetCatalog`).
|
|
20
|
-
- Returns every mutation as an `OpResult
|
|
20
|
+
- Returns every mutation as an `OpResult`. It holds the files changed on success, and a typed error otherwise.
|
|
21
21
|
|
|
22
|
-
Every operation is an `InterfaceFunction` routed to [`@antelopejs/dms-builder`](https://www.npmjs.com/package/@antelopejs/dms-builder)
|
|
22
|
+
Every operation is an `InterfaceFunction` routed to [`@antelopejs/dms-builder`](https://www.npmjs.com/package/@antelopejs/dms-builder). That module parses the project, applies the edit as an AST rewrite, and writes only if the project still typechecks.
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
26
|
-
Add the interface to the module that calls the builder
|
|
26
|
+
Add the interface to the module that calls the builder.
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
pnpm add @antelopejs/interface-dms-builder
|
|
@@ -31,7 +31,7 @@ pnpm add @antelopejs/interface-dms-builder
|
|
|
31
31
|
|
|
32
32
|
## Quick start
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The following code creates a page and puts a KPI card on it.
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
37
|
import { AddBlock, CreatePage } from "@antelopejs/interface-dms-builder";
|
|
@@ -65,17 +65,17 @@ The interface declares this peer dependency:
|
|
|
65
65
|
|
|
66
66
|
| Package | Supported | Tested with |
|
|
67
67
|
| ---------------------------- | ---------------- | ----------- |
|
|
68
|
-
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
|
|
68
|
+
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.4.0` |
|
|
69
69
|
|
|
70
70
|
<!-- antelopejs-docs-compat:end -->
|
|
71
71
|
|
|
72
|
-
The implementation runs in development only, unless its [`api.enabled`](https://dms.antelopejs.com/docs/modules/builder/configuration) option
|
|
72
|
+
The `@antelopejs/dms-builder` module implements this interface. The `@antelopejs/interface-dms-builder` row in the compatibility block of the [module README](../dms-builder/README.md#compatibility) gives the interface range each module release implements. The implementation is not a peer dependency of the interface package. It runs in development only, unless its [`api.enabled`](https://dms.antelopejs.com/docs/modules/builder/configuration) option turns it on.
|
|
73
73
|
|
|
74
74
|
## Documentation
|
|
75
75
|
|
|
76
|
-
- [Extending the builder](https://dms.antelopejs.com/docs/modules/builder/extending)
|
|
77
|
-
- [Interface reference](./docs/1.introduction.md)
|
|
78
|
-
- [A chart without code](./docs/10.a-chart-without-code.md)
|
|
76
|
+
- [Extending the builder](https://dms.antelopejs.com/docs/modules/builder/extending) covers the interface and the HTTP API.
|
|
77
|
+
- [Interface reference](./docs/1.introduction.md) is the canonical contract. It ships with this package and is published at [/docs/modules/builder/reference](https://dms.antelopejs.com/docs/modules/builder/reference).
|
|
78
|
+
- [A chart without code](./docs/10.a-chart-without-code.md) follows one chart from the choice of a measure to the reopened page.
|
|
79
79
|
|
|
80
80
|
## Contributing
|
|
81
81
|
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConfigObject } from "./values";
|
|
1
2
|
export interface ImportRef {
|
|
2
3
|
name: string;
|
|
3
4
|
module?: string;
|
|
@@ -58,10 +59,9 @@ export interface OptionSchema {
|
|
|
58
59
|
"x-dataType"?: boolean;
|
|
59
60
|
"x-component"?: boolean;
|
|
60
61
|
"x-controller"?: boolean;
|
|
61
|
-
[key: string]: unknown;
|
|
62
62
|
}
|
|
63
63
|
export type ConfigSchema = Record<string, OptionSchema>;
|
|
64
|
-
export type
|
|
64
|
+
export type ConfigOrigin = "inferred" | "annotated";
|
|
65
65
|
export type BlockGroup = "layout" | "content" | "data" | "visualization" | (string & {});
|
|
66
66
|
export interface BlockTypeDescriptor {
|
|
67
67
|
type: string;
|
|
@@ -75,10 +75,10 @@ export interface BlockTypeDescriptor {
|
|
|
75
75
|
slots?: SlotDescriptor[];
|
|
76
76
|
dynamicSlots?: DynamicSlots;
|
|
77
77
|
config: ConfigSchema;
|
|
78
|
-
defaults?:
|
|
78
|
+
defaults?: ConfigObject;
|
|
79
79
|
childMeta?: ConfigSchema;
|
|
80
|
-
fixedOptions?:
|
|
81
|
-
|
|
80
|
+
fixedOptions?: ConfigObject;
|
|
81
|
+
configOrigin: ConfigOrigin;
|
|
82
82
|
description?: string;
|
|
83
83
|
controllerArg?: boolean;
|
|
84
84
|
initialChildren?: BlockInitialChild[];
|
|
@@ -86,7 +86,7 @@ export interface BlockTypeDescriptor {
|
|
|
86
86
|
export interface BlockInitialChild {
|
|
87
87
|
id: string;
|
|
88
88
|
type: string;
|
|
89
|
-
options:
|
|
89
|
+
options: ConfigObject;
|
|
90
90
|
}
|
|
91
91
|
export interface DataTypeDescriptor {
|
|
92
92
|
id: string;
|
|
@@ -104,7 +104,7 @@ export interface DataSourceDescriptor {
|
|
|
104
104
|
id: string;
|
|
105
105
|
title: string;
|
|
106
106
|
description?: string;
|
|
107
|
-
|
|
107
|
+
responseKind: string;
|
|
108
108
|
path: string;
|
|
109
109
|
method?: string;
|
|
110
110
|
params?: ConfigSchema;
|
package/dist/drafts.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import type { AddQueryInput, QueryPreview } from "./queries";
|
|
|
3
3
|
import type { ResourceRef } from "./resources";
|
|
4
4
|
import type { MutationOpts, OpResult } from "./results";
|
|
5
5
|
import type { EditablePageMeta } from "./structure";
|
|
6
|
+
import type { ConfigObject } from "./values";
|
|
6
7
|
export interface BlockDraft {
|
|
7
8
|
name: string;
|
|
8
9
|
type?: string;
|
|
9
|
-
config?:
|
|
10
|
+
config?: ConfigObject;
|
|
10
11
|
lockedOptions?: Record<string, string>;
|
|
11
12
|
slot?: string;
|
|
12
|
-
meta?:
|
|
13
|
+
meta?: ConfigObject;
|
|
13
14
|
controller?: ResourceRef;
|
|
14
15
|
children?: BlockDraft[];
|
|
15
16
|
preserve?: boolean;
|
|
@@ -19,17 +20,17 @@ export interface PageDraft {
|
|
|
19
20
|
blocks: BlockDraft[];
|
|
20
21
|
queries?: AddQueryInput[];
|
|
21
22
|
}
|
|
22
|
-
export
|
|
23
|
+
export type ComponentPreview = {
|
|
23
24
|
componentName: string;
|
|
24
|
-
options?:
|
|
25
|
+
options?: ConfigObject;
|
|
25
26
|
children?: ComponentPreviewChild[];
|
|
26
|
-
}
|
|
27
|
-
export
|
|
27
|
+
};
|
|
28
|
+
export type ComponentPreviewChild = {
|
|
28
29
|
id: string;
|
|
29
30
|
slot?: string;
|
|
30
31
|
component: ComponentPreview;
|
|
31
|
-
[key: string]:
|
|
32
|
-
}
|
|
32
|
+
[key: string]: ConfigObject[string];
|
|
33
|
+
};
|
|
33
34
|
export interface PageLayoutPreview {
|
|
34
35
|
components: Record<string, ComponentPreview>;
|
|
35
36
|
degraded: BlockPath[];
|
|
@@ -41,6 +42,6 @@ export declare const PreviewLayout: (page: string, draft: PageDraft) => Promise<
|
|
|
41
42
|
export declare const PreviewQuery: (request: QueryPreviewRequest) => Promise<OpResult<QueryPreview>>;
|
|
42
43
|
export interface QueryPreviewRequest {
|
|
43
44
|
query: AddQueryInput;
|
|
44
|
-
args?:
|
|
45
|
+
args?: ConfigObject;
|
|
45
46
|
tenant?: string;
|
|
46
47
|
}
|
package/dist/drafts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drafts.js","sourceRoot":"","sources":["../src/drafts.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;
|
|
1
|
+
{"version":3,"file":"drafts.js","sourceRoot":"","sources":["../src/drafts.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAyFlD,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAMd,CAAC;AAOO,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAEd,CAAC;AAUO,QAAA,YAAY,GACvB,IAAA,kCAAiB,GAEd,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./catalog"), exports);
|
|
|
20
20
|
__exportStar(require("./compose"), exports);
|
|
21
21
|
__exportStar(require("./drafts"), exports);
|
|
22
22
|
__exportStar(require("./mapping"), exports);
|
|
23
|
+
__exportStar(require("./operation-map"), exports);
|
|
23
24
|
__exportStar(require("./operations"), exports);
|
|
24
25
|
__exportStar(require("./project"), exports);
|
|
25
26
|
__exportStar(require("./queries"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,kDAAgC;AAChC,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const Operations: {
|
|
2
|
+
AddBlock: (input: import("./operations").AddBlockInput, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<{
|
|
3
|
+
path: import("./addressing").BlockPath;
|
|
4
|
+
}>>;
|
|
5
|
+
AddField: (ref: string, field: import("./resources").FieldSpec, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<{
|
|
6
|
+
path: import("./resources").FieldPath;
|
|
7
|
+
}>>;
|
|
8
|
+
AddModule: (id: string, entry: import("./project").ModuleEntryInput, opts?: import("./project").ProjectConfigOpts | undefined) => Promise<import("./results").OpResult<import("./project").ProjectConfigResult>>;
|
|
9
|
+
AddQuery: (page: string, input: import("./queries").AddQueryInput, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<{
|
|
10
|
+
query: import("./queries").QueryRef;
|
|
11
|
+
route: string;
|
|
12
|
+
}>>;
|
|
13
|
+
AnalyseDatabase: (input: import("./analysis").AnalyseDatabaseInput) => Promise<import("./results").OpResult<import("./analysis").AnalysisState>>;
|
|
14
|
+
ComposePage: (input: import("./compose").ComposePageInput, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<import("./compose").ComposePageData>>;
|
|
15
|
+
ConfigureBlock: (path: string, patch: import("./values").ConfigObject, opts?: import("./operations").ConfigureBlockOpts | undefined) => Promise<import("./results").OpResult>;
|
|
16
|
+
ConfigureCategory: (ref: string, patch: Partial<import("./structure").EditableCategoryMeta>) => Promise<import("./results").OpResult>;
|
|
17
|
+
ConfigureField: (path: string, patch: Partial<import("./resources").FieldAspects>, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
18
|
+
ConfigureModule: (id: string, entry: import("./project").ModuleEntryInput, opts?: import("./project").ProjectConfigOpts | undefined) => Promise<import("./results").OpResult<import("./project").ProjectConfigResult>>;
|
|
19
|
+
ConfigurePage: (ref: string, patch: Partial<import("./structure").EditablePageMeta>, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<{
|
|
20
|
+
ref: import("./addressing").PageRef;
|
|
21
|
+
version: string;
|
|
22
|
+
}>>;
|
|
23
|
+
ConfigureProject: (steps: import("./project").ProjectConfigStep[], opts?: import("./project").ProjectConfigOpts | undefined) => Promise<import("./results").OpResult<import("./project").ProjectConfigResult>>;
|
|
24
|
+
ConfigureQuery: (query: string, patch: Partial<import("./queries").AddQueryInput>, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
25
|
+
ConfigureResource: (ref: string, patch: import("./resources").EditableResourceMeta, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
26
|
+
ConfigureTableView: (page: string, settings: import("./table-view").TableViewSettings, opts?: import("./table-view").ConfigureTableViewOpts | undefined) => Promise<import("./results").OpResult<{
|
|
27
|
+
path: import("./addressing").BlockPath;
|
|
28
|
+
}>>;
|
|
29
|
+
CreateCategory: (input: import("./operations").CreateCategoryInput) => Promise<import("./results").OpResult<{
|
|
30
|
+
ref: import("./addressing").CategoryRef;
|
|
31
|
+
}>>;
|
|
32
|
+
CreateLocalModule: (id: string, path: string, entry?: import("./project").ModuleEntryInput | undefined, opts?: import("./project").CreateLocalModuleOpts | undefined) => Promise<import("./results").OpResult<import("./project").ProjectConfigResult>>;
|
|
33
|
+
CreatePage: (input: import("./operations").CreatePageInput) => Promise<import("./results").OpResult<{
|
|
34
|
+
ref: import("./addressing").PageRef;
|
|
35
|
+
filepath: string;
|
|
36
|
+
}>>;
|
|
37
|
+
CreateResource: (input: import("./resources").CreateResourceInput) => Promise<import("./results").OpResult<{
|
|
38
|
+
ref: import("./resources").ResourceRef;
|
|
39
|
+
files: import("./resources").ResourceFiles;
|
|
40
|
+
}>>;
|
|
41
|
+
DeleteCategory: (ref: string) => Promise<import("./results").OpResult>;
|
|
42
|
+
DeletePage: (ref: string, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
43
|
+
DeleteResource: (ref: string, opts?: import("./resources").DeleteResourceOpts | undefined) => Promise<import("./results").OpResult>;
|
|
44
|
+
GetAnalysis: (id: string) => Promise<import("./results").OpResult<import("./analysis").AnalysisState>>;
|
|
45
|
+
GetCatalog: () => Promise<import("./catalog").BlockCatalog>;
|
|
46
|
+
GetMapping: (connection: string, module: string) => Promise<import("./results").OpResult<import("./analysis").MappedRelation[]>>;
|
|
47
|
+
GetPageStructure: (ref: string) => Promise<import("./results").OpResult<import("./structure").PageStructure>>;
|
|
48
|
+
GetResourceStructure: (ref: string) => Promise<import("./results").OpResult<import("./resources").ResourceStructure>>;
|
|
49
|
+
ListCategories: () => Promise<import("./structure").CategorySummary[]>;
|
|
50
|
+
ListDataSources: (response?: string | undefined) => Promise<import("./catalog").DataSourceDescriptor[]>;
|
|
51
|
+
ListPages: () => Promise<import("./structure").PageSummary[]>;
|
|
52
|
+
ListQueryTemplates: (resourceType?: string | undefined) => Promise<import("./queries").QueryTemplateDescriptor[]>;
|
|
53
|
+
ListResources: () => Promise<import("./resources").ResourceSummary[]>;
|
|
54
|
+
MapResources: (input: import("./mapping").MapResourcesInput) => Promise<import("./results").OpResult<import("./mapping").MapResourcesResult>>;
|
|
55
|
+
PreviewMapResources: (input: import("./mapping").MapResourcesInput) => Promise<import("./results").OpResult<import("./mapping").MapResourcesPreview>>;
|
|
56
|
+
MoveBlock: (path: string, dest: import("./operations").MoveDest, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
57
|
+
PreviewLayout: (page: string, draft: import("./drafts").PageDraft) => Promise<import("./results").OpResult<import("./drafts").PageLayoutPreview>>;
|
|
58
|
+
PreviewQuery: (request: import("./drafts").QueryPreviewRequest) => Promise<import("./results").OpResult<import("./queries").QueryPreview>>;
|
|
59
|
+
RefreshSourceIndex: (scope?: import("./operations").RefreshScope | undefined) => Promise<void>;
|
|
60
|
+
RemoveBlock: (path: string, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
61
|
+
RemoveField: (path: string, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
62
|
+
RemoveQuery: (query: string, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult>;
|
|
63
|
+
SetPageBlocks: (page: string, draft: import("./drafts").PageDraft, opts?: import("./results").MutationOpts | undefined) => Promise<import("./results").OpResult<{
|
|
64
|
+
version: string;
|
|
65
|
+
}>>;
|
|
66
|
+
};
|
|
67
|
+
export type OperationName = keyof typeof Operations;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Operations = void 0;
|
|
4
|
+
const analysis_1 = require("./analysis");
|
|
5
|
+
const compose_1 = require("./compose");
|
|
6
|
+
const drafts_1 = require("./drafts");
|
|
7
|
+
const mapping_1 = require("./mapping");
|
|
8
|
+
const operations_1 = require("./operations");
|
|
9
|
+
const project_1 = require("./project");
|
|
10
|
+
const queries_1 = require("./queries");
|
|
11
|
+
const resources_1 = require("./resources");
|
|
12
|
+
const table_view_1 = require("./table-view");
|
|
13
|
+
exports.Operations = {
|
|
14
|
+
AddBlock: operations_1.AddBlock,
|
|
15
|
+
AddField: resources_1.AddField,
|
|
16
|
+
AddModule: project_1.AddModule,
|
|
17
|
+
AddQuery: queries_1.AddQuery,
|
|
18
|
+
AnalyseDatabase: analysis_1.AnalyseDatabase,
|
|
19
|
+
ComposePage: compose_1.ComposePage,
|
|
20
|
+
ConfigureBlock: operations_1.ConfigureBlock,
|
|
21
|
+
ConfigureCategory: operations_1.ConfigureCategory,
|
|
22
|
+
ConfigureField: resources_1.ConfigureField,
|
|
23
|
+
ConfigureModule: project_1.ConfigureModule,
|
|
24
|
+
ConfigurePage: operations_1.ConfigurePage,
|
|
25
|
+
ConfigureProject: project_1.ConfigureProject,
|
|
26
|
+
ConfigureQuery: queries_1.ConfigureQuery,
|
|
27
|
+
ConfigureResource: resources_1.ConfigureResource,
|
|
28
|
+
ConfigureTableView: table_view_1.ConfigureTableView,
|
|
29
|
+
CreateCategory: operations_1.CreateCategory,
|
|
30
|
+
CreateLocalModule: project_1.CreateLocalModule,
|
|
31
|
+
CreatePage: operations_1.CreatePage,
|
|
32
|
+
CreateResource: resources_1.CreateResource,
|
|
33
|
+
DeleteCategory: operations_1.DeleteCategory,
|
|
34
|
+
DeletePage: operations_1.DeletePage,
|
|
35
|
+
DeleteResource: resources_1.DeleteResource,
|
|
36
|
+
GetAnalysis: analysis_1.GetAnalysis,
|
|
37
|
+
GetCatalog: operations_1.GetCatalog,
|
|
38
|
+
GetMapping: analysis_1.GetMapping,
|
|
39
|
+
GetPageStructure: operations_1.GetPageStructure,
|
|
40
|
+
GetResourceStructure: resources_1.GetResourceStructure,
|
|
41
|
+
ListCategories: operations_1.ListCategories,
|
|
42
|
+
ListDataSources: operations_1.ListDataSources,
|
|
43
|
+
ListPages: operations_1.ListPages,
|
|
44
|
+
ListQueryTemplates: queries_1.ListQueryTemplates,
|
|
45
|
+
ListResources: resources_1.ListResources,
|
|
46
|
+
MapResources: mapping_1.MapResources,
|
|
47
|
+
PreviewMapResources: mapping_1.PreviewMapResources,
|
|
48
|
+
MoveBlock: operations_1.MoveBlock,
|
|
49
|
+
PreviewLayout: drafts_1.PreviewLayout,
|
|
50
|
+
PreviewQuery: drafts_1.PreviewQuery,
|
|
51
|
+
RefreshSourceIndex: operations_1.RefreshSourceIndex,
|
|
52
|
+
RemoveBlock: operations_1.RemoveBlock,
|
|
53
|
+
RemoveField: resources_1.RemoveField,
|
|
54
|
+
RemoveQuery: queries_1.RemoveQuery,
|
|
55
|
+
SetPageBlocks: drafts_1.SetPageBlocks,
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=operation-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-map.js","sourceRoot":"","sources":["../src/operation-map.ts"],"names":[],"mappings":";;;AAAA,yCAAsE;AACtE,uCAAwC;AACxC,qCAAsE;AACtE,uCAA8D;AAC9D,6CAiBsB;AACtB,uCAKmB;AACnB,uCAKmB;AACnB,2CASqB;AACrB,6CAAkD;AASrC,QAAA,UAAU,GAAG;IACxB,QAAQ,EAAR,qBAAQ;IACR,QAAQ,EAAR,oBAAQ;IACR,SAAS,EAAT,mBAAS;IACT,QAAQ,EAAR,kBAAQ;IACR,eAAe,EAAf,0BAAe;IACf,WAAW,EAAX,qBAAW;IACX,cAAc,EAAd,2BAAc;IACd,iBAAiB,EAAjB,8BAAiB;IACjB,cAAc,EAAd,0BAAc;IACd,eAAe,EAAf,yBAAe;IACf,aAAa,EAAb,0BAAa;IACb,gBAAgB,EAAhB,0BAAgB;IAChB,cAAc,EAAd,wBAAc;IACd,iBAAiB,EAAjB,6BAAiB;IACjB,kBAAkB,EAAlB,+BAAkB;IAClB,cAAc,EAAd,2BAAc;IACd,iBAAiB,EAAjB,2BAAiB;IACjB,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,0BAAc;IACd,cAAc,EAAd,2BAAc;IACd,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,0BAAc;IACd,WAAW,EAAX,sBAAW;IACX,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,qBAAU;IACV,gBAAgB,EAAhB,6BAAgB;IAChB,oBAAoB,EAApB,gCAAoB;IACpB,cAAc,EAAd,2BAAc;IACd,eAAe,EAAf,4BAAe;IACf,SAAS,EAAT,sBAAS;IACT,kBAAkB,EAAlB,4BAAkB;IAClB,aAAa,EAAb,yBAAa;IACb,YAAY,EAAZ,sBAAY;IACZ,mBAAmB,EAAnB,6BAAmB;IACnB,SAAS,EAAT,sBAAS;IACT,aAAa,EAAb,sBAAa;IACb,YAAY,EAAZ,qBAAY;IACZ,kBAAkB,EAAlB,+BAAkB;IAClB,WAAW,EAAX,wBAAW;IACX,WAAW,EAAX,uBAAW;IACX,WAAW,EAAX,qBAAW;IACX,aAAa,EAAb,sBAAa;CACd,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BlockCatalog, DataSourceDescriptor } from "./catalog";
|
|
|
3
3
|
import type { ResourceRef } from "./resources";
|
|
4
4
|
import type { MutationOpts, OpResult } from "./results";
|
|
5
5
|
import type { CategorySummary, EditableCategoryMeta, EditablePageMeta, PagePermission, PageStructure, PageSummary } from "./structure";
|
|
6
|
+
import type { ConfigObject } from "./values";
|
|
6
7
|
export interface RefreshScope {
|
|
7
8
|
page?: PageRef;
|
|
8
9
|
}
|
|
@@ -31,9 +32,9 @@ export interface AddBlockInput {
|
|
|
31
32
|
slot?: string;
|
|
32
33
|
index?: number;
|
|
33
34
|
name: string;
|
|
34
|
-
meta?:
|
|
35
|
+
meta?: ConfigObject;
|
|
35
36
|
type: string;
|
|
36
|
-
config:
|
|
37
|
+
config: ConfigObject;
|
|
37
38
|
controller?: ResourceRef;
|
|
38
39
|
}
|
|
39
40
|
export interface MoveDest {
|
|
@@ -43,12 +44,12 @@ export interface MoveDest {
|
|
|
43
44
|
}
|
|
44
45
|
export interface ConfigureBlockOpts extends MutationOpts {
|
|
45
46
|
replace?: boolean;
|
|
46
|
-
meta?:
|
|
47
|
+
meta?: ConfigObject;
|
|
47
48
|
}
|
|
48
49
|
export declare const ListPages: () => Promise<PageSummary[]>;
|
|
49
50
|
export declare const ListCategories: () => Promise<CategorySummary[]>;
|
|
50
51
|
export declare const GetCatalog: () => Promise<BlockCatalog>;
|
|
51
|
-
export declare const ListDataSources: (
|
|
52
|
+
export declare const ListDataSources: (response?: string | undefined) => Promise<DataSourceDescriptor[]>;
|
|
52
53
|
export declare const GetPageStructure: (ref: string) => Promise<OpResult<PageStructure>>;
|
|
53
54
|
export declare const RefreshSourceIndex: (scope?: RefreshScope | undefined) => Promise<void>;
|
|
54
55
|
export declare const CreatePage: (input: CreatePageInput) => Promise<OpResult<{
|
|
@@ -57,6 +58,7 @@ export declare const CreatePage: (input: CreatePageInput) => Promise<OpResult<{
|
|
|
57
58
|
}>>;
|
|
58
59
|
export declare const ConfigurePage: (ref: string, patch: Partial<EditablePageMeta>, opts?: MutationOpts | undefined) => Promise<OpResult<{
|
|
59
60
|
ref: PageRef;
|
|
61
|
+
version: string;
|
|
60
62
|
}>>;
|
|
61
63
|
export declare const DeletePage: (ref: string, opts?: MutationOpts | undefined) => Promise<OpResult>;
|
|
62
64
|
export declare const CreateCategory: (input: CreateCategoryInput) => Promise<OpResult<{
|
|
@@ -67,6 +69,6 @@ export declare const DeleteCategory: (ref: string) => Promise<OpResult>;
|
|
|
67
69
|
export declare const AddBlock: (input: AddBlockInput, opts?: MutationOpts | undefined) => Promise<OpResult<{
|
|
68
70
|
path: BlockPath;
|
|
69
71
|
}>>;
|
|
70
|
-
export declare const ConfigureBlock: (path: string, patch:
|
|
72
|
+
export declare const ConfigureBlock: (path: string, patch: ConfigObject, opts?: ConfigureBlockOpts | undefined) => Promise<OpResult>;
|
|
71
73
|
export declare const MoveBlock: (path: string, dest: MoveDest, opts?: MutationOpts | undefined) => Promise<OpResult>;
|
|
72
74
|
export declare const RemoveBlock: (path: string, opts?: MutationOpts | undefined) => Promise<OpResult>;
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAqGlD,QAAA,SAAS,GAAG,IAAA,kCAAiB,GAAgC,CAAC;AAC9D,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAAoC,CAAC;AAC3C,QAAA,UAAU,GAAG,IAAA,kCAAiB,GAA+B,CAAC;AAS9D,QAAA,eAAe,GAC1B,IAAA,kCAAiB,GAA0D,CAAC;AACjE,QAAA,gBAAgB,GAC3B,IAAA,kCAAiB,GAAsD,CAAC;AAM7D,QAAA,kBAAkB,GAC7B,IAAA,kCAAiB,GAA2C,CAAC;AAElD,QAAA,UAAU,GACrB,IAAA,kCAAiB,GAId,CAAC;AAQO,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAMd,CAAC;AACO,QAAA,UAAU,GACrB,IAAA,kCAAiB,GAA4D,CAAC;AAEnE,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAEd,CAAC;AACO,QAAA,iBAAiB,GAC5B,IAAA,kCAAiB,GAKd,CAAC;AACO,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAA2C,CAAC;AAElD,QAAA,QAAQ,GACnB,IAAA,kCAAiB,GAKd,CAAC;AACO,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAMd,CAAC;AACO,QAAA,SAAS,GACpB,IAAA,kCAAiB,GAEd,CAAC;AACO,QAAA,WAAW,GACtB,IAAA,kCAAiB,GAEd,CAAC"}
|
package/dist/project.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { OpResult } from "./results";
|
|
2
|
+
import type { ConfigObject } from "./values";
|
|
2
3
|
export interface ImportOverrideInput {
|
|
3
4
|
interface: string;
|
|
4
5
|
source?: string;
|
|
5
6
|
id?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface ModuleEntryInput {
|
|
8
|
-
source?:
|
|
9
|
-
config?:
|
|
9
|
+
source?: ConfigObject;
|
|
10
|
+
config?: ConfigObject;
|
|
10
11
|
env?: Record<string, string>;
|
|
11
12
|
importOverrides?: ImportOverrideInput[];
|
|
12
13
|
exportPriority?: Record<string, number>;
|
package/dist/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AA8GlD,QAAA,gBAAgB,GAC3B,IAAA,kCAAiB,GAKd,CAAC;AAGO,QAAA,SAAS,GACpB,IAAA,kCAAiB,GAMd,CAAC;AAGO,QAAA,eAAe,GAC1B,IAAA,kCAAiB,GAMd,CAAC;AAGO,QAAA,iBAAiB,GAC5B,IAAA,kCAAiB,GAOd,CAAC"}
|
package/dist/queries.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import type { ConfigSchema } from "./catalog";
|
|
2
2
|
import type { ResourceRef } from "./resources";
|
|
3
3
|
import type { MutationOpts, OpResult } from "./results";
|
|
4
|
+
import type { ConfigValue } from "./values";
|
|
4
5
|
export type QueryRef = string;
|
|
5
6
|
export type QueryOutputKind = "scalar" | "series";
|
|
6
|
-
export type
|
|
7
|
+
export type QueryArrangement = "series" | "card" | "value" | "items";
|
|
7
8
|
export type FilterOp = "eq" | "ne" | "gt" | "ge" | "lt" | "le";
|
|
8
|
-
export
|
|
9
|
+
export type QueryParamBinding = {
|
|
9
10
|
$param: {
|
|
10
11
|
name: string;
|
|
11
12
|
in?: "query" | "param";
|
|
12
13
|
};
|
|
13
|
-
}
|
|
14
|
-
export type QueryParamValue =
|
|
15
|
-
export
|
|
14
|
+
};
|
|
15
|
+
export type QueryParamValue = ConfigValue;
|
|
16
|
+
export type QueryFilter = {
|
|
16
17
|
field: string;
|
|
17
18
|
op: FilterOp;
|
|
18
19
|
value: QueryParamValue;
|
|
19
|
-
}
|
|
20
|
+
};
|
|
20
21
|
export interface QueryTemplateDescriptor {
|
|
21
22
|
id: string;
|
|
22
23
|
resourceType: "database-table";
|
|
@@ -29,10 +30,10 @@ export interface QueryPoint {
|
|
|
29
30
|
x: number | string;
|
|
30
31
|
y: number;
|
|
31
32
|
}
|
|
32
|
-
export type QueryResponseBody =
|
|
33
|
+
export type QueryResponseBody = object;
|
|
33
34
|
export interface QueryPreview {
|
|
34
35
|
output: QueryOutputKind;
|
|
35
|
-
response?:
|
|
36
|
+
response?: QueryArrangement;
|
|
36
37
|
body: QueryResponseBody;
|
|
37
38
|
truncated: boolean;
|
|
38
39
|
}
|
|
@@ -41,19 +42,19 @@ export interface AddQueryInput {
|
|
|
41
42
|
resource: ResourceRef;
|
|
42
43
|
template: string;
|
|
43
44
|
params?: Record<string, QueryParamValue>;
|
|
44
|
-
response?:
|
|
45
|
+
response?: QueryArrangement;
|
|
45
46
|
compare?: boolean;
|
|
46
47
|
endpoint?: string;
|
|
47
48
|
}
|
|
48
49
|
export interface QueryStructure {
|
|
49
50
|
name: string;
|
|
50
|
-
response?:
|
|
51
|
+
response?: QueryArrangement;
|
|
51
52
|
endpoint: string;
|
|
52
53
|
resource?: ResourceRef;
|
|
53
54
|
modelMethod?: string;
|
|
54
55
|
output?: QueryOutputKind;
|
|
55
56
|
template?: string;
|
|
56
|
-
params?: Record<string,
|
|
57
|
+
params?: Record<string, QueryParamValue>;
|
|
57
58
|
routeParams?: {
|
|
58
59
|
name: string;
|
|
59
60
|
in: "query" | "param" | "header";
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CategoryRef, PageRef } from "./addressing";
|
|
2
2
|
import type { MutationOpts, OpResult } from "./results";
|
|
3
|
-
import type { DataTypeValue } from "./values";
|
|
3
|
+
import type { ConfigObject, DataTypeValue } from "./values";
|
|
4
4
|
export type ResourceRef = string;
|
|
5
5
|
export type FieldPath = string;
|
|
6
6
|
export interface ResourceFiles {
|
|
@@ -29,7 +29,7 @@ export interface FieldAspects {
|
|
|
29
29
|
optional?: boolean;
|
|
30
30
|
decorators?: string[];
|
|
31
31
|
};
|
|
32
|
-
columnExtras?:
|
|
32
|
+
columnExtras?: ConfigObject;
|
|
33
33
|
}
|
|
34
34
|
export interface FieldSpec extends FieldAspects {
|
|
35
35
|
name: string;
|
|
@@ -45,7 +45,7 @@ export interface CreateResourceInput {
|
|
|
45
45
|
displayName?: string;
|
|
46
46
|
schema?: string;
|
|
47
47
|
fields: FieldSpec[];
|
|
48
|
-
seeds?:
|
|
48
|
+
seeds?: ConfigObject[];
|
|
49
49
|
location?: ResourceLocation;
|
|
50
50
|
routes?: ResourceRoute[];
|
|
51
51
|
module?: string;
|
package/dist/results.d.ts
CHANGED
|
@@ -4,15 +4,15 @@ export interface FileChange {
|
|
|
4
4
|
kind: "create" | "modify" | "delete";
|
|
5
5
|
diff: string;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type ValidationIssue = {
|
|
8
8
|
pointer: string;
|
|
9
9
|
message: string;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
};
|
|
11
|
+
export type TypecheckError = {
|
|
12
12
|
file: string;
|
|
13
13
|
line: number;
|
|
14
14
|
message: string;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export interface OpWarning {
|
|
17
17
|
code: "query_opaque" | "query_kept" | "index_clamped" | "datatype_fallback" | "data_not_dropped" | "route_changed" | "data_kept" | "page_not_written" | "relation_missing" | "display_not_proposed" | "module_not_loaded" | "setting_dropped" | "relation_skipped" | "display_dropped" | "field_flag_set" | "label_changed";
|
|
18
18
|
message: string;
|
package/dist/structure.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { BlockPath, CategoryRef, PageRef } from "./addressing";
|
|
2
2
|
import type { QueryStructure } from "./queries";
|
|
3
3
|
import type { ResourceRef } from "./resources";
|
|
4
|
-
|
|
5
|
-
export type
|
|
4
|
+
import type { ConfigObject } from "./values";
|
|
5
|
+
export type PagePermission = ConfigObject;
|
|
6
|
+
export type PageLive = ConfigObject;
|
|
6
7
|
export interface PageMeta {
|
|
7
8
|
ref: PageRef;
|
|
8
9
|
id: string;
|
|
@@ -33,8 +34,8 @@ export interface BlockNode {
|
|
|
33
34
|
editable: boolean;
|
|
34
35
|
opaqueReason?: string;
|
|
35
36
|
slot?: string;
|
|
36
|
-
meta?:
|
|
37
|
-
config?:
|
|
37
|
+
meta?: ConfigObject;
|
|
38
|
+
config?: ConfigObject;
|
|
38
39
|
lockedOptions?: Record<string, string>;
|
|
39
40
|
controller?: ResourceRef;
|
|
40
41
|
children?: BlockNode[];
|
package/dist/values.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export type ConfigValue = string | number | boolean | null | undefined | ConfigValue[] | ConfigObject;
|
|
2
|
+
export interface ConfigObject {
|
|
3
|
+
[key: string]: ConfigValue;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type DataTypeValue = {
|
|
6
|
+
$dataType: string;
|
|
7
|
+
config?: ConfigObject;
|
|
8
|
+
};
|
|
9
|
+
export type ExprValue = {
|
|
6
10
|
$expr: string;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
11
|
+
};
|
|
12
|
+
export type RefValue = {
|
|
9
13
|
$ref: {
|
|
10
14
|
resource: string;
|
|
11
15
|
as?: "dataApi" | "table" | "model";
|
|
12
16
|
};
|
|
13
|
-
}
|
|
14
|
-
export
|
|
17
|
+
};
|
|
18
|
+
export type BlockValue = {
|
|
15
19
|
$block: {
|
|
16
20
|
type: string;
|
|
17
|
-
config?:
|
|
21
|
+
config?: ConfigObject;
|
|
18
22
|
};
|
|
19
|
-
}
|
|
23
|
+
};
|