whet 0.1.0 → 0.1.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/bin/whet/Project.d.ts +2 -0
- package/bin/whet/Project.js +38 -1
- package/bin/whet/Whet.js +1 -1
- package/bin/whet/route/Router.d.ts +5 -0
- package/bin/whet/route/Router.js +30 -0
- package/package.json +1 -1
package/bin/whet/Project.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare class Project {
|
|
|
25
25
|
describeStones(): StoneDescription[]
|
|
26
26
|
listStoneOutputs(id: string): Promise<null | string[]>
|
|
27
27
|
getStoneSource(id: string, sourceId?: null | string): Promise<null | Source>
|
|
28
|
+
refreshStoneSource(id: string): Promise<null | Source>
|
|
28
29
|
getStoneConfig(id: string): Promise<null | StoneConfigView>
|
|
29
30
|
setStoneConfig(id: string, patch: any, mode: string): Promise<boolean>
|
|
30
31
|
clearStoneConfigPreview(id: string): Promise<boolean>
|
|
@@ -60,6 +61,7 @@ export type StoneDescription = {
|
|
|
60
61
|
|
|
61
62
|
export type StoneConfigView = {
|
|
62
63
|
editable: any,
|
|
64
|
+
fixed: any,
|
|
63
65
|
id: string,
|
|
64
66
|
meta: StoneConfigMeta
|
|
65
67
|
}
|
package/bin/whet/Project.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import {Router} from "./route/Router.js"
|
|
1
2
|
import {StoneId_Fields_} from "./magic/StoneId.js"
|
|
2
3
|
import {MaybeArray_Fields_} from "./magic/MaybeArray.js"
|
|
3
4
|
import {CacheManager} from "./cache/CacheManager.js"
|
|
4
5
|
import {Whet_Fields_} from "./Whet.js"
|
|
6
|
+
import {Stone} from "./Stone.js"
|
|
5
7
|
import {Log} from "./Log.js"
|
|
6
8
|
import {ConfigStore} from "./ConfigStore.js"
|
|
7
9
|
import * as Path from "path"
|
|
@@ -97,6 +99,14 @@ class Project extends Register.inherits() {
|
|
|
97
99
|
return stone.getSource();
|
|
98
100
|
};
|
|
99
101
|
}
|
|
102
|
+
refreshStoneSource(id) {
|
|
103
|
+
let stone = this.getStone(id);
|
|
104
|
+
if (stone == null) {
|
|
105
|
+
return Promise.resolve(null);
|
|
106
|
+
} else {
|
|
107
|
+
return this.cache.refreshSource(stone);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
100
110
|
getStoneConfig(id) {
|
|
101
111
|
let stone = this.getStone(id);
|
|
102
112
|
if (stone == null) {
|
|
@@ -129,7 +139,34 @@ class Project extends Register.inherits() {
|
|
|
129
139
|
while (_g1 < deps.length) _g.push(deps[_g1++].id);
|
|
130
140
|
depIds = _g;
|
|
131
141
|
};
|
|
132
|
-
|
|
142
|
+
let fixed = {};
|
|
143
|
+
let _g_keys1 = Reflect__1.fields(configObj);
|
|
144
|
+
let _g_index1 = 0;
|
|
145
|
+
while (_g_index1 < _g_keys1.length) {
|
|
146
|
+
let key = _g_keys1[_g_index1++];
|
|
147
|
+
let _g_value = configObj[key];
|
|
148
|
+
if (ConfigStore.BASE_CONFIG_KEYS.includes(key)) {
|
|
149
|
+
continue;
|
|
150
|
+
};
|
|
151
|
+
if (ConfigStore.isJsonSerializable(_g_value)) {
|
|
152
|
+
continue;
|
|
153
|
+
};
|
|
154
|
+
if (((_g_value) instanceof Stone)) {
|
|
155
|
+
fixed[key] = {"type": "stone", "stoneId": _g_value.id};
|
|
156
|
+
} else if (((_g_value) instanceof Router)) {
|
|
157
|
+
fixed[key] = {"type": "stones", "stoneIds": _g_value.collectStoneIds()};
|
|
158
|
+
} else if (((_g_value) instanceof Array)) {
|
|
159
|
+
let arr = _g_value;
|
|
160
|
+
if (arr.length > 0 && ((arr[0]) instanceof Stone)) {
|
|
161
|
+
let _g = [];
|
|
162
|
+
let _g1 = 0;
|
|
163
|
+
let _g2 = arr;
|
|
164
|
+
while (_g1 < _g2.length) _g.push(_g2[_g1++].id);
|
|
165
|
+
fixed[key] = {"type": "stones", "stoneIds": _g};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
return {"id": stone.id, "editable": editable, "fixed": fixed, "meta": {"className": StoneId_Fields_.getTypeName(stone), "cacheStrategy": stone.cacheStrategy, "dependencyIds": depIds, "hasStoneConfigStore": stone.config.configStore != null, "hasProjectConfigStore": _gthis.configStore != null}};
|
|
133
170
|
});
|
|
134
171
|
}
|
|
135
172
|
setStoneConfig(id, patch, mode) {
|
package/bin/whet/Whet.js
CHANGED
|
@@ -26,7 +26,7 @@ class Whet_Fields_ {
|
|
|
26
26
|
if (entryUrl != thisUrl) {
|
|
27
27
|
return;
|
|
28
28
|
};
|
|
29
|
-
Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.1.
|
|
29
|
+
Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.1.1", "-v, --version").allowUnknownOption(true).allowExcessArguments(true).showSuggestionAfterError(true).option("-p, --project <file>", "project to run", "Project.mjs").option("-l, --log-level <level>", "log level, a string/number", "info").option("--no-pretty", "disable pretty logging").exitOverride();
|
|
30
30
|
try {
|
|
31
31
|
Whet_Fields_.program.parse();
|
|
32
32
|
}catch (_g) {
|
|
@@ -11,6 +11,11 @@ export declare class Router {
|
|
|
11
11
|
protected routes: RoutePath[]
|
|
12
12
|
route(r: RoutePathType): void
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
Recursively collect all Stone IDs referenced in this Router's routes.
|
|
16
|
+
*/
|
|
17
|
+
collectStoneIds(): string[]
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* Find data sources routed under `pattern`.
|
|
16
21
|
* @param pattern A glob pattern to search for.
|
package/bin/whet/route/Router.js
CHANGED
|
@@ -21,6 +21,36 @@ class Router extends Register.inherits() {
|
|
|
21
21
|
while (_g < _g1.length) this.routes.push(_g1[_g++]);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
Recursively collect all Stone IDs referenced in this Router's routes.
|
|
26
|
+
*/
|
|
27
|
+
collectStoneIds() {
|
|
28
|
+
let ids = [];
|
|
29
|
+
let _g = 0;
|
|
30
|
+
let _g1 = this.routes;
|
|
31
|
+
while (_g < _g1.length) {
|
|
32
|
+
let route = _g1[_g];
|
|
33
|
+
++_g;
|
|
34
|
+
if (((route.source) instanceof Stone)) {
|
|
35
|
+
let id = route.source.id;
|
|
36
|
+
if (ids.indexOf(id) == -1) {
|
|
37
|
+
ids.push(id);
|
|
38
|
+
};
|
|
39
|
+
} else if (((route.source) instanceof Router)) {
|
|
40
|
+
let _g = 0;
|
|
41
|
+
let _g1 = route.source.collectStoneIds();
|
|
42
|
+
while (_g < _g1.length) {
|
|
43
|
+
let id = _g1[_g];
|
|
44
|
+
++_g;
|
|
45
|
+
if (ids.indexOf(id) == -1) {
|
|
46
|
+
ids.push(id);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
return ids;
|
|
52
|
+
}
|
|
53
|
+
|
|
24
54
|
/**
|
|
25
55
|
* Find data sources routed under `pattern`.
|
|
26
56
|
* @param pattern A glob pattern to search for.
|
package/package.json
CHANGED