@acryldev/blends-frame 0.2.7 → 0.2.8
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/lib/client.js +29 -15
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +5 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +20 -4
- package/lib/index.js.map +1 -1
- package/lib/types/client/plugins-navigator.d.ts +5 -4
- package/lib/types/contract.d.ts +5 -0
- package/package.json +1 -1
package/lib/contract.d.ts
CHANGED
|
@@ -195,6 +195,11 @@ export interface AppSharedView {
|
|
|
195
195
|
}
|
|
196
196
|
export declare function parseAppSharePlan(value: unknown): AppSharePlanView;
|
|
197
197
|
export declare function parseAppShared(value: unknown): AppSharedView;
|
|
198
|
+
/**
|
|
199
|
+
* The GitHub account or organization a person typed to share a plugin to (blank: theirs). `undefined` when none was asked, `null` when what came is not a GitHub name
|
|
200
|
+
* (it goes to a command line: only a name that cannot start with a dash or hold a space or a slash).
|
|
201
|
+
*/
|
|
202
|
+
export declare function parseShareOwner(value: unknown): string | undefined | null;
|
|
198
203
|
export declare function parseAppShareRequest(value: unknown): AppShareRequest | undefined;
|
|
199
204
|
export declare const FRAME_PLUGINS_SHARE_PLAN_PATH = "/api/acryl-blends-frame/plugins/share-plan";
|
|
200
205
|
/** POST `{ name, confirm }`: publish it, only when `confirm` is the plan the person said yes to and it still holds. */
|
package/lib/index.d.ts
CHANGED
|
@@ -62,9 +62,9 @@ export interface PluginsPort {
|
|
|
62
62
|
read(): Promise<AppPluginsView>;
|
|
63
63
|
switch(kind: AppPluginKind, name: string, on: boolean): Promise<void>;
|
|
64
64
|
/** What sharing one local plugin would do (repository, version, visibility); nothing is sent. */
|
|
65
|
-
planShare(name: string, visibility?: ShareVisibility, registry?: boolean): Promise<SharePlan>;
|
|
65
|
+
planShare(name: string, visibility?: ShareVisibility, registry?: boolean, owner?: string): Promise<SharePlan>;
|
|
66
66
|
/** Publish one local plugin to its GitHub repository and release, through the plugin-hub path: only the plan the person confirmed. */
|
|
67
|
-
share(name: string, confirmed: SharePlan): Promise<ShareAppPluginResult>;
|
|
67
|
+
share(name: string, confirmed: SharePlan, owner?: string): Promise<ShareAppPluginResult>;
|
|
68
68
|
/** Keep a packed copy of one local plugin on this machine (the app's plugin store); nothing leaves the machine. */
|
|
69
69
|
save(name: string): Promise<SavedPluginResult>;
|
|
70
70
|
/** The public registry (cordisplugins.github.io), each entry marked with what this app has. Unreadable is an answer, not a failure. */
|
package/lib/index.js
CHANGED
|
@@ -159,6 +159,14 @@ function parseAppShared(value) {
|
|
|
159
159
|
...listed === void 0 ? {} : { listed }
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The GitHub account or organization a person typed to share a plugin to (blank: theirs). `undefined` when none was asked, `null` when what came is not a GitHub name
|
|
164
|
+
* (it goes to a command line: only a name that cannot start with a dash or hold a space or a slash).
|
|
165
|
+
*/
|
|
166
|
+
function parseShareOwner(value) {
|
|
167
|
+
if (value === void 0 || value === "") return void 0;
|
|
168
|
+
return typeof value === "string" && GITHUB_NAME.test(value) ? value : null;
|
|
169
|
+
}
|
|
162
170
|
function parseAppShareRequest(value) {
|
|
163
171
|
if (!isRecord$2(value)) return void 0;
|
|
164
172
|
const { owner, visibility, list } = value;
|
|
@@ -3854,7 +3862,9 @@ function frameRoutes({ state, report = () => {}, plugins, graph, feedback, branc
|
|
|
3854
3862
|
try {
|
|
3855
3863
|
const asked = body.visibility;
|
|
3856
3864
|
const listed = body.registry === true;
|
|
3857
|
-
|
|
3865
|
+
const owner = parseShareOwner(body.owner);
|
|
3866
|
+
if (owner === null) return c.json(error("the GitHub account or organization is not a GitHub name"), 400);
|
|
3867
|
+
return c.json(await plugins.planShare(name, listed ? "public" : asked === "public" || asked === "private" ? asked : void 0, listed, owner));
|
|
3858
3868
|
} catch (cause) {
|
|
3859
3869
|
report(cause);
|
|
3860
3870
|
return c.json(plainBody(plainShareProblem(cause)), 409);
|
|
@@ -3885,8 +3895,10 @@ function frameRoutes({ state, report = () => {}, plugins, graph, feedback, branc
|
|
|
3885
3895
|
} catch {
|
|
3886
3896
|
return c.json(error("a share is published only after the person confirms its plan"), 400);
|
|
3887
3897
|
}
|
|
3898
|
+
const owner = parseShareOwner(fields?.owner);
|
|
3899
|
+
if (owner === null) return c.json(error("the GitHub account or organization is not a GitHub name"), 400);
|
|
3888
3900
|
try {
|
|
3889
|
-
return c.json(await plugins.share(name, confirmed));
|
|
3901
|
+
return c.json(await plugins.share(name, confirmed, owner));
|
|
3890
3902
|
} catch (cause) {
|
|
3891
3903
|
report(cause);
|
|
3892
3904
|
return c.json(plainBody(plainShareProblem(cause)), 409);
|
|
@@ -4145,12 +4157,16 @@ function apply(ctx, config = {}) {
|
|
|
4145
4157
|
const entry = loader === void 0 ? void 0 : [...loader.entries()].find((row) => row.options.id === APP_PLUGINS_ROW);
|
|
4146
4158
|
if (entry?.fiber !== void 0) await entry.fiber.restart();
|
|
4147
4159
|
},
|
|
4148
|
-
planShare: async (name, visibility, registry) => planAppPluginShare(root, ctx.appInstance.home, name, {
|
|
4160
|
+
planShare: async (name, visibility, registry, owner) => planAppPluginShare(root, ctx.appInstance.home, name, {
|
|
4149
4161
|
...shareTo,
|
|
4162
|
+
...owner === void 0 ? {} : { owner },
|
|
4150
4163
|
...visibility === void 0 ? {} : { visibility },
|
|
4151
4164
|
...registry === true ? { registry } : {}
|
|
4152
4165
|
}, githubSharePorts()),
|
|
4153
|
-
share: async (name, confirmed) => shareAppPlugin(root, ctx.appInstance.home, name, confirmed,
|
|
4166
|
+
share: async (name, confirmed, owner) => shareAppPlugin(root, ctx.appInstance.home, name, confirmed, {
|
|
4167
|
+
...shareTo,
|
|
4168
|
+
...owner === void 0 ? {} : { owner }
|
|
4169
|
+
}, githubSharePorts()),
|
|
4154
4170
|
save: async (name) => saveAppPlugin(root, ctx.appInstance.home, name),
|
|
4155
4171
|
github: async () => githubReadiness(() => githubSharePorts().host.login()),
|
|
4156
4172
|
connect: githubConnect,
|