@lantharos/pult 0.9.0 → 0.10.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/cli.mjs +14 -1
- package/index.d.mts +3 -1
- package/package.json +2 -2
package/cli.mjs
CHANGED
|
@@ -184,7 +184,7 @@ function actionChanges(prefix) {
|
|
|
184
184
|
}
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region package.json
|
|
187
|
-
var version = "0.
|
|
187
|
+
var version = "0.10.0";
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region ../protocol/src/checks.ts
|
|
190
190
|
const COLUMNS = [
|
|
@@ -294,6 +294,7 @@ function checkManifest(manifest) {
|
|
|
294
294
|
message: `${name}.${relation} points at unknown resource "${def.resource}"`
|
|
295
295
|
});
|
|
296
296
|
for (const [key, action] of Object.entries(resource.actions)) {
|
|
297
|
+
if (action.moves) checkMoves(manifest, name, key, action.moves, action.source, problems);
|
|
297
298
|
const inputs = action.input?.properties ?? {};
|
|
298
299
|
for (const field of [...Object.keys(action.pick), ...action.choices]) if (!inputs[field]) problems.push({
|
|
299
300
|
source: action.source,
|
|
@@ -356,6 +357,17 @@ function checkManifest(manifest) {
|
|
|
356
357
|
}
|
|
357
358
|
return problems;
|
|
358
359
|
}
|
|
360
|
+
function checkMoves(manifest, resource, key, state, source, problems) {
|
|
361
|
+
const inboxes = Object.values(manifest.inboxes).filter((inbox) => inbox.resource === resource);
|
|
362
|
+
if (!inboxes.length) problems.push({
|
|
363
|
+
source,
|
|
364
|
+
message: `${resource}.${key} moves items, but no inbox is about ${resource}`
|
|
365
|
+
});
|
|
366
|
+
else if (!inboxes.some((inbox) => inbox.states.includes(state))) problems.push({
|
|
367
|
+
source,
|
|
368
|
+
message: `${resource}.${key} moves items to "${state}", which no inbox about ${resource} has`
|
|
369
|
+
});
|
|
370
|
+
}
|
|
359
371
|
function checkSchedule(name, action, problems) {
|
|
360
372
|
const { cron, timezone } = action.schedule;
|
|
361
373
|
try {
|
|
@@ -561,6 +573,7 @@ function actionDef(source, key, action) {
|
|
|
561
573
|
approval: options.approval ?? false,
|
|
562
574
|
contextual: Boolean(options.when || options.defaults),
|
|
563
575
|
background: options.background ?? false,
|
|
576
|
+
moves: options.moves ?? null,
|
|
564
577
|
pick: options.pick ?? {},
|
|
565
578
|
choices: Object.keys(options.choices ?? {}),
|
|
566
579
|
schedule: options.schedule ? schedule(options.schedule) : null
|
package/index.d.mts
CHANGED
|
@@ -258,6 +258,7 @@ interface ActionDef {
|
|
|
258
258
|
approval: boolean;
|
|
259
259
|
contextual: boolean;
|
|
260
260
|
background: boolean;
|
|
261
|
+
moves: string | null;
|
|
261
262
|
pick: Record<string, string>;
|
|
262
263
|
choices: string[];
|
|
263
264
|
schedule: Schedule | null;
|
|
@@ -498,6 +499,7 @@ interface ActionOptions<R, S> {
|
|
|
498
499
|
automatable?: boolean;
|
|
499
500
|
approval?: boolean;
|
|
500
501
|
background?: boolean;
|
|
502
|
+
moves?: string;
|
|
501
503
|
when?: (record: R) => boolean;
|
|
502
504
|
defaults?: (record: R) => Partial<ActionInput<S>>;
|
|
503
505
|
pick?: { [K in keyof ActionInput<S>]?: string; };
|
|
@@ -512,7 +514,7 @@ type ScheduleInput = string | {
|
|
|
512
514
|
cron: string;
|
|
513
515
|
timezone?: string;
|
|
514
516
|
};
|
|
515
|
-
interface StandaloneOptions<S> extends Omit<ActionOptions<null, S>, "when"> {
|
|
517
|
+
interface StandaloneOptions<S> extends Omit<ActionOptions<null, S>, "when" | "moves"> {
|
|
516
518
|
schedule?: ScheduleInput;
|
|
517
519
|
}
|
|
518
520
|
interface Action<R = any, S = any> extends Located, ActionRef {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lantharos/pult",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The other side of your app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"bin": {
|
|
34
|
-
"pult": "
|
|
34
|
+
"pult": "cli.mjs"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|