@goodfellow-cms/admin 0.5.0 → 0.7.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/README.md CHANGED
@@ -4,7 +4,7 @@ The admin panel: the visual editor for a site's pages, collections, media, heade
4
4
 
5
5
  Its editor is built with each site's own config, so it always has the site's blocks, and runs them in frames sandboxed away from the admin panel's page, which signs in and publishes: `goodfellow build` adds the page at `/admin` and the editor at `/admin/editor/`, and Next.js sites render `GoodfellowAdmin` and `GoodfellowEditor` from `@goodfellow-cms/next` there.
6
6
 
7
- [Goodfellow](https://github.com/goodfellow-cms/goodfellow-cms) is a website builder for people who aren't developers, with no server or database: pages are files in your own GitHub or GitLab repository, edited in a visual editor built on [Puck](https://puckeditor.com). To start a new site, run `npm create goodfellow@latest my-site`. See the [documentation](https://goodfellow-cms.github.io/goodfellow-cms/) for everything else.
7
+ [Goodfellow](https://github.com/goodfellow-cms/goodfellow-cms) is a website builder for people who aren't developers, with no server or database: pages are files in your own GitHub, GitLab or Bitbucket repository, edited in a visual editor built on [Puck](https://puckeditor.com). To start a new site, run `npm create goodfellow@latest my-site`. See the [documentation](https://goodfellow-cms.github.io/goodfellow-cms/) for everything else.
8
8
 
9
9
  More in the docs: [Edit pages](https://goodfellow-cms.github.io/goodfellow-cms/docs/edit-pages).
10
10
 
package/dist/dev.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { ContentStore } from "@goodfellow-cms/core";
1
+ import { ContentStore, PluginTasks } from "@goodfellow-cms/core";
2
2
  //#region src/dev.d.ts
3
3
  /**
4
4
  * A content store that reads and writes the site's files through
5
5
  * `goodfellow dev`. For local development only: it is never part of a built site.
6
6
  */
7
- export declare function localStore(apiBase?: string): ContentStore;
7
+ export declare function localStore(apiBase?: string): ContentStore & {
8
+ tasks: PluginTasks;
9
+ };
8
10
  //#endregion
package/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ConflictError, decodeBase64, encodeBase64Bytes } from "@goodfellow-cms/core";
1
+ import { ConflictError, PluginTaskError, decodeBase64, encodeBase64Bytes } from "@goodfellow-cms/core";
2
2
  //#region src/dev.ts
3
3
  /**
4
4
  * A content store that reads and writes the site's files through
@@ -53,6 +53,26 @@ function localStore(apiBase = "/__goodfellow/api") {
53
53
  expectedRevision
54
54
  })
55
55
  })).json();
56
+ },
57
+ tasks: {
58
+ async supported() {
59
+ const response = await request("task", {}, true).catch(() => void 0);
60
+ return response?.ok === true && (await response.json()).supported === true;
61
+ },
62
+ async secretsPlace() {
63
+ const response = await request("task", {}, true).catch(() => void 0);
64
+ if (!response?.ok) return void 0;
65
+ return (await response.json()).place;
66
+ },
67
+ async run(task) {
68
+ return (await (await request("task", {
69
+ method: "POST",
70
+ headers: { "content-type": "application/json" },
71
+ body: JSON.stringify(task)
72
+ }).catch((error) => {
73
+ throw new PluginTaskError("failed", error.message);
74
+ })).json()).result;
75
+ }
56
76
  }
57
77
  };
58
78
  }