@plitzi/sdk-shared 0.38.3 → 0.38.5
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/CHANGELOG.md +522 -0
- package/dist/actions/functions.d.ts +10 -0
- package/dist/actions/functions.mjs +10 -10
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.mjs +6 -6
- package/dist/authoring/elementCallbacks.d.ts +2 -2
- package/dist/dataSource/getBindingsDetails.mjs +1 -1
- package/dist/devTools/chrome.d.ts +8 -0
- package/dist/devTools/chrome.mjs +4 -0
- package/dist/devTools/index.d.ts +1 -0
- package/dist/devTools/index.mjs +5 -4
- package/dist/helpers/images.d.ts +5 -0
- package/dist/helpers/images.mjs +2 -2
- package/dist/helpers/twigWrapper/inspectTemplate.mjs +14 -7
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +4 -3
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +32 -22
- package/dist/history/types.d.ts +4 -4
- package/dist/index.mjs +56 -54
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.d.ts +10 -0
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/index.mjs +124 -122
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +1 -3
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs +4 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +2 -0
- package/dist/network/graphql/builder/Queries/index.mjs +22 -20
- package/dist/network/spaceEvents.d.ts +2 -2
- package/dist/plugins/bundle.d.ts +26 -0
- package/dist/plugins/bundle.mjs +62 -0
- package/dist/plugins/declaration.d.ts +12 -0
- package/dist/plugins/declaration.mjs +9 -0
- package/dist/queries/queryCache.d.ts +7 -0
- package/dist/queries/queryCache.mjs +14 -7
- package/dist/queries/useQuery.d.ts +2 -0
- package/dist/queries/useQuery.mjs +5 -2
- package/dist/schema/anchor.d.ts +11 -0
- package/dist/schema/anchor.mjs +6 -2
- package/dist/schema/index.mjs +6 -6
- package/dist/schema/markdownHeadings.d.ts +13 -0
- package/dist/schema/markdownHeadings.mjs +24 -0
- package/dist/schema/motion.d.ts +47 -15
- package/dist/schema/motion.mjs +208 -32
- package/dist/schema/motionReveal.d.ts +10 -0
- package/dist/schema/motionReveal.mjs +23 -0
- package/dist/schema/pageElements.d.ts +12 -0
- package/dist/schema/pageElements.mjs +41 -0
- package/dist/schema/wire.mjs +4 -3
- package/dist/server/index.mjs +4 -4
- package/dist/server/rsc/projectData.d.ts +6 -0
- package/dist/server/rsc/projectData.mjs +4 -0
- package/dist/server/rsc/refreshRsc.d.ts +18 -5
- package/dist/server/rsc/refreshRsc.mjs +80 -20
- package/dist/server/rsc/useRscSync.mjs +26 -15
- package/dist/server/usePluginRoute.d.ts +18 -0
- package/dist/server/usePluginRoute.mjs +14 -0
- package/dist/source/export.d.ts +18 -0
- package/dist/source/import.d.ts +55 -0
- package/dist/source/import.mjs +4 -0
- package/dist/source/index.d.ts +2 -0
- package/dist/source/index.mjs +3 -2
- package/dist/store/index.d.ts +45 -45
- package/dist/style/cssLayers.d.ts +18 -0
- package/dist/style/cssLayers.mjs +14 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.mjs +11 -10
- package/dist/style/styleConstants.d.ts +10 -2
- package/dist/style/styleConstants.mjs +16 -0
- package/dist/style/useDisplayMode.d.ts +11 -0
- package/dist/style/useDisplayMode.mjs +18 -0
- package/dist/types/ActionTypes.d.ts +3 -3
- package/dist/types/ComponentTypes.d.ts +13 -0
- package/dist/types/DataTypes.d.ts +36 -0
- package/dist/types/InteractionTypes.d.ts +16 -2
- package/dist/types/SchemaTypes.d.ts +10 -2
- package/dist/types/SchemaTypes.mjs +2 -1
- package/dist/types/ServerTypes.d.ts +60 -8
- package/dist/types/StoreTypes.d.ts +19 -6
- package/dist/types/index.d.ts +1 -2
- package/package.json +58 -28
- package/setupTests.ts +16 -13
- package/dist/types/AITypes.d.ts +0 -80
- package/dist/types/McpTypes/index.d.ts +0 -56
- package/dist/types/McpTypes/index.mjs +0 -0
- /package/dist/types/{AITypes.mjs → DataTypes.mjs} +0 -0
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { CommonState } from '../../types';
|
|
2
2
|
import { PathOf, StoreApi } from '@plitzi/nexus';
|
|
3
3
|
export declare const rscDataPath: (id: string) => PathOf<CommonState>;
|
|
4
|
+
/** Where the visitor is, spelled the way the server reads it back. */
|
|
5
|
+
export declare const currentRscLocation: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Stops what a refresh in flight is asking the server for — the request, and the work behind it on the server — and
|
|
8
|
+
* leaves the payload as it is.
|
|
9
|
+
*
|
|
10
|
+
* `ids` cancels the refreshes of those elements; nothing cancels every refresh in flight, a navigation's included.
|
|
11
|
+
* What a STOP button is: the visitor is done waiting, and what is on screen stays.
|
|
12
|
+
*/
|
|
13
|
+
export declare const cancelRsc: (store: StoreApi<CommonState>, ids?: readonly string[]) => void;
|
|
14
|
+
/** Every refresh of this root aborted and forgotten — the SDK root that owned them is going away. */
|
|
15
|
+
export declare const releaseRscRequests: (instance: string) => void;
|
|
4
16
|
/**
|
|
5
17
|
* Re-fetches RSC data into the store.
|
|
6
18
|
*
|
|
@@ -11,9 +23,12 @@ export declare const rscDataPath: (id: string) => PathOf<CommonState>;
|
|
|
11
23
|
* Pass `ids` to refresh only those elements — the response is merged over the existing payload. Omit them for a full
|
|
12
24
|
* refresh, which replaces it. `params` ride along on the query string; that is how a provider asks for a different
|
|
13
25
|
* page window.
|
|
26
|
+
*
|
|
27
|
+
* One request per question, and the newest question wins: asking again for what is already in flight is answered by
|
|
28
|
+
* the request in flight, and a request whose answer a newer one would overwrite anyway — a whole payload asked for
|
|
29
|
+
* again, an element asked for again — is aborted, here and on the server. Before this a click on a link asked twice
|
|
30
|
+
* (its prefetch, then the route change), and a slow answer could land over a newer one.
|
|
14
31
|
*/
|
|
15
|
-
/** Where the visitor is, spelled the way the server reads it back. */
|
|
16
|
-
export declare const currentRscLocation: () => string;
|
|
17
32
|
export declare const refreshRsc: (store: StoreApi<CommonState>, ids?: string[], params?: Record<string, string>,
|
|
18
33
|
/**
|
|
19
34
|
* Resolve for somewhere the visitor is not yet.
|
|
@@ -22,7 +37,5 @@ export declare const refreshRsc: (store: StoreApi<CommonState>, ids?: string[],
|
|
|
22
37
|
* navigation asks for the destination BEFORE it commits. Absent means where the visitor already is, which is
|
|
23
38
|
* every other caller: the initial load, a pager, an element refreshing itself.
|
|
24
39
|
*/
|
|
25
|
-
location?: string
|
|
26
|
-
/** Whether this is the one second asking, after a refusal that renewed the session. */
|
|
27
|
-
retried?: boolean) => Promise<void>;
|
|
40
|
+
location?: string) => Promise<void>;
|
|
28
41
|
export default refreshRsc;
|
|
@@ -7,30 +7,90 @@ var o = (e, t, n) => {
|
|
|
7
7
|
if (!e) return;
|
|
8
8
|
let r = e.pages.reduce((t, n) => (n in e.flat && (t[n] = e.flat[n]), t), {});
|
|
9
9
|
return a(i(r, e.pageFolders, n), t.split("?")[0], n).pageId;
|
|
10
|
-
}, s = (e) => `rsc.data.${e}`, c = () => typeof window > "u" ? "" : `${window.location.pathname}${window.location.search}`, l =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
|
|
10
|
+
}, s = (e) => `rsc.data.${e}`, c = () => typeof window > "u" ? "" : `${window.location.pathname}${window.location.search}`, l = "*", u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new WeakMap(), f = () => ({
|
|
11
|
+
seq: 0,
|
|
12
|
+
inFlight: /* @__PURE__ */ new Set(),
|
|
13
|
+
asked: /* @__PURE__ */ new Map()
|
|
14
|
+
}), p = (e) => {
|
|
15
|
+
let t = e.get("rsc.instance");
|
|
16
|
+
if (typeof t == "string" && t) {
|
|
17
|
+
let e = u.get(t);
|
|
18
|
+
if (e) return e;
|
|
19
|
+
let n = f();
|
|
20
|
+
return u.set(t, n), n;
|
|
21
|
+
}
|
|
22
|
+
let n = d.get(e);
|
|
23
|
+
if (n) return n;
|
|
24
|
+
let r = f();
|
|
25
|
+
return d.set(e, r), r;
|
|
26
|
+
}, m = (e, t) => {
|
|
27
|
+
let n = {};
|
|
28
|
+
t.inFlight.forEach((e) => {
|
|
29
|
+
e.here && (e.ids ?? [l]).forEach((e) => {
|
|
30
|
+
n[e] = !0;
|
|
31
|
+
});
|
|
32
|
+
}), e.set("rsc.refreshing", n);
|
|
33
|
+
}, h = (e, t) => !e || !!t && t.every((t) => e.includes(t)), g = (e, t) => {
|
|
34
|
+
p(e).inFlight.forEach((e) => {
|
|
35
|
+
(!t || e.ids?.some((e) => t.includes(e))) && e.controller.abort();
|
|
36
|
+
});
|
|
37
|
+
}, _ = (e) => {
|
|
38
|
+
u.get(e)?.inFlight.forEach((e) => e.controller.abort()), u.delete(e);
|
|
39
|
+
}, v = (e, t, n, r, i) => {
|
|
40
|
+
let { ids: a, seq: o } = n;
|
|
41
|
+
e.batch(() => {
|
|
42
|
+
if (a?.length) Object.entries(r).forEach(([n, r]) => {
|
|
43
|
+
(t.asked.get(n) ?? 0) <= o && (t.asked.get(l) ?? 0) <= o && e.set(s(n), r);
|
|
44
|
+
});
|
|
45
|
+
else {
|
|
46
|
+
let n = e.get("rsc.data") ?? {}, i = (e) => e !== l && (t.asked.get(e) ?? 0) > o, a = Object.fromEntries([...Object.entries(r).filter(([e]) => !i(e)), ...Object.entries(n).filter(([e]) => i(e))]);
|
|
47
|
+
e.set("rsc.data", a);
|
|
48
|
+
}
|
|
49
|
+
e.set("rsc.loaded", !0), e.set("rsc.stale", !1), e.set("rsc.location", i);
|
|
50
|
+
});
|
|
51
|
+
}, y = async (i, a, s, u) => {
|
|
52
|
+
let { enabled: d, endpoint: f } = i.get("rsc") ?? {};
|
|
53
|
+
if (!d || !f || typeof window > "u") return;
|
|
54
|
+
let g = u ?? c(), _ = i.get("schema"), y = i.get("runtime.sources.auth"), b = u ? o(_, u, !!y?.details) : i.get("navigation.currentPageId"), x = u ? void 0 : i.get("runtime.sources.flags");
|
|
55
|
+
if (!_ || !r(_, b, x)) return;
|
|
56
|
+
let S = new URLSearchParams({ location: g });
|
|
57
|
+
a?.length && S.set("ids", a.join(",")), Object.entries(s ?? {}).forEach(([e, t]) => S.set(e, t));
|
|
58
|
+
let C = `${f}?${S.toString()}`, w = p(i), T = [...w.inFlight].find((e) => e.url === C);
|
|
59
|
+
if (T) return T.promise;
|
|
60
|
+
w.inFlight.forEach((e) => {
|
|
61
|
+
h(a, e.ids) && e.controller.abort();
|
|
62
|
+
});
|
|
63
|
+
let E = ++w.seq;
|
|
64
|
+
a?.length ? a.forEach((e) => w.asked.set(e, E)) : (w.asked.clear(), w.asked.set(l, E));
|
|
65
|
+
let D = new AbortController(), O = {
|
|
66
|
+
url: C,
|
|
67
|
+
...a?.length ? { ids: a } : {},
|
|
68
|
+
here: g === c(),
|
|
69
|
+
seq: E,
|
|
70
|
+
controller: D,
|
|
71
|
+
promise: Promise.resolve()
|
|
72
|
+
}, k = async (r) => {
|
|
73
|
+
let a = await fetch(C, {
|
|
74
|
+
headers: { Accept: "application/json" },
|
|
75
|
+
signal: D.signal
|
|
76
|
+
});
|
|
77
|
+
if (!a.ok) {
|
|
78
|
+
let n = e(a.status, await a.json().catch(() => void 0));
|
|
20
79
|
if (n && await t({
|
|
21
80
|
reason: n,
|
|
22
|
-
url:
|
|
23
|
-
}) && !
|
|
81
|
+
url: f
|
|
82
|
+
}) && !r) return k(!0);
|
|
24
83
|
i.set("rsc.stale", !0);
|
|
25
84
|
return;
|
|
26
85
|
}
|
|
27
|
-
let { serverData:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
86
|
+
let { serverData: o, actionRuns: s } = await a.json();
|
|
87
|
+
s?.length && n(s), v(i, w, O, o ?? {}, g);
|
|
88
|
+
};
|
|
89
|
+
return O.promise = k(!1).catch(() => {
|
|
90
|
+
D.signal.aborted || i.set("rsc.stale", !0);
|
|
91
|
+
}).finally(() => {
|
|
92
|
+
w.inFlight.delete(O), m(i, w);
|
|
93
|
+
}), w.inFlight.add(O), m(i, w), O.promise;
|
|
34
94
|
};
|
|
35
95
|
//#endregion
|
|
36
|
-
export { c as currentRscLocation,
|
|
96
|
+
export { g as cancelRsc, c as currentRscLocation, y as default, y as refreshRsc, _ as releaseRscRequests, s as rscDataPath };
|
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
import { useCommonStore as e, useCommonStoreSync as t } from "../../store/index.mjs";
|
|
2
|
-
import n, { currentRscLocation as r } from "./refreshRsc.mjs";
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { useStoreById as
|
|
2
|
+
import n, { currentRscLocation as r, releaseRscRequests as i } from "./refreshRsc.mjs";
|
|
3
|
+
import { useEffect as a, useId as o } from "react";
|
|
4
|
+
import { useStoreById as s } from "@plitzi/nexus/react";
|
|
5
5
|
//#region src/server/rsc/useRscSync.ts
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
|
|
6
|
+
var c = (c) => {
|
|
7
|
+
let l = s(), u = o(), [d] = e("schema.rsc", { mode: "mount" }), [f] = e([
|
|
8
|
+
"navigation.routeParams",
|
|
9
|
+
"navigation.queryParams",
|
|
10
|
+
"navigation.currentPageId",
|
|
11
|
+
"navigation.href"
|
|
12
|
+
]), p = JSON.stringify(f), { rscData: m, rscPath: h } = c ?? {}, g = (d?.enabled ?? !1) && !!h;
|
|
13
|
+
t([
|
|
14
|
+
"rsc.enabled",
|
|
15
|
+
"rsc.endpoint",
|
|
16
|
+
"rsc.instance"
|
|
17
|
+
], [
|
|
18
|
+
g,
|
|
19
|
+
h,
|
|
20
|
+
u
|
|
21
|
+
]), t([
|
|
9
22
|
"rsc.data",
|
|
10
23
|
"rsc.loaded",
|
|
11
24
|
"rsc.location"
|
|
12
25
|
], [
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
m?.serverData ?? {},
|
|
27
|
+
m !== void 0,
|
|
15
28
|
r()
|
|
16
|
-
], { mode: "mount" })
|
|
17
|
-
|
|
18
|
-
i(() => {
|
|
19
|
-
p && m !== h.current && (h.current = m, n(c));
|
|
29
|
+
], { mode: "mount" }), a(() => () => i(u), [u]), a(() => {
|
|
30
|
+
!g || l.get("rsc.loaded") && l.get("rsc.location") === r() && !l.get("rsc.stale") || n(l);
|
|
20
31
|
}, [
|
|
32
|
+
g,
|
|
21
33
|
p,
|
|
22
|
-
|
|
23
|
-
c
|
|
34
|
+
l
|
|
24
35
|
]);
|
|
25
36
|
};
|
|
26
37
|
//#endregion
|
|
27
|
-
export {
|
|
38
|
+
export { c as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a plugin's own server half answers, for its component: `route('/layout')` is the URL of the plugin's
|
|
3
|
+
* `GET /layout`, served under `/fn/plugins/<type>/` by the server this page came from — with no flow, no server action
|
|
4
|
+
* and nothing for the space to wire.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const route = usePluginRoute('board');
|
|
8
|
+
* const url = route('/layout');
|
|
9
|
+
* if (url) {
|
|
10
|
+
* await fetch(url, { method: 'POST', body: JSON.stringify(layout), credentials: 'same-origin' });
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* `undefined` while the page is served without a server that runs code — the builder's canvas, an embed, an offline
|
|
15
|
+
* render — the same answer that leaves a `runServerAction` step inert there, rather than a request to a guaranteed 404.
|
|
16
|
+
*/
|
|
17
|
+
declare const usePluginRoute: (plugin: string) => (path?: string) => string | undefined;
|
|
18
|
+
export default usePluginRoute;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { pluginRoutePath as e } from "../actions/functions.mjs";
|
|
2
|
+
import { useCommonStore as t } from "../store/index.mjs";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
4
|
+
//#region src/server/usePluginRoute.ts
|
|
5
|
+
var r = (r) => {
|
|
6
|
+
let [i] = t("actions.endpoint");
|
|
7
|
+
return n((t = "/") => {
|
|
8
|
+
if (!i) return;
|
|
9
|
+
let n = e(r, t);
|
|
10
|
+
return typeof window > "u" ? n : new URL(n, new URL(i, window.location.href)).href;
|
|
11
|
+
}, [i, r]);
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as default };
|
package/dist/source/export.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export type SpaceExport = {
|
|
|
28
28
|
};
|
|
29
29
|
/** The version taken out: the draft (`main`, revision 0), or a snapshot an environment holds. */
|
|
30
30
|
version: Pick<SpaceVersionContents, 'environment' | 'revision' | 'snapshot'>;
|
|
31
|
+
/**
|
|
32
|
+
* Which state of the draft's documents this is — its schema, style, actions and connectors — what `plitzi push`
|
|
33
|
+
* checks the space's draft has not moved on from. `null` for a snapshot, which no push writes.
|
|
34
|
+
*/
|
|
35
|
+
draft: string | null;
|
|
31
36
|
/** The space as authoring code, by path (`index.ts`, a file per page): none for a project that reads it from Plitzi. */
|
|
32
37
|
authoring: {
|
|
33
38
|
exportName: string;
|
|
@@ -55,6 +60,14 @@ export type SpaceExport = {
|
|
|
55
60
|
version: string;
|
|
56
61
|
files: Record<string, string>;
|
|
57
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* The space's own data, by path in `src/data/` (JSON its providers read on the server, never served), and the version
|
|
65
|
+
* of it this is — what `plitzi push` checks the space's copy has not moved on from.
|
|
66
|
+
*/
|
|
67
|
+
data: {
|
|
68
|
+
version: string;
|
|
69
|
+
files: Record<string, string>;
|
|
70
|
+
};
|
|
58
71
|
/**
|
|
59
72
|
* The source its plugins and runtime were built from, merged: every file by its path in the project (bytes in
|
|
60
73
|
* base64), the packages they need, and where each build starts.
|
|
@@ -72,9 +85,14 @@ export type SpaceExport = {
|
|
|
72
85
|
};
|
|
73
86
|
/** What there is no source of: kept built, so the project runs it as it is and cannot change it. */
|
|
74
87
|
builtOnly: {
|
|
88
|
+
/**
|
|
89
|
+
* Each plugin's built files, and its server half's source when it brings one (by path in its `functions/`): the
|
|
90
|
+
* platform keeps that privately, so it travels here rather than as a file on the CDN.
|
|
91
|
+
*/
|
|
75
92
|
plugins: {
|
|
76
93
|
type: string;
|
|
77
94
|
files: SpaceExportFile[];
|
|
95
|
+
functions?: Record<string, string>;
|
|
78
96
|
}[];
|
|
79
97
|
/** The packed runtime, in base64 — what `@plitzi/sdk-server/runtime` loads. */
|
|
80
98
|
runtime: string | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Schema, Style } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A project's space put back on Plitzi as the space's draft (docs/en/projects-from-spaces.md): what `plitzi push` sends
|
|
4
|
+
* to `PUT /spaces/:spaceId/import`, and what it is answered. The way back of `SpaceExport` — one shape for both ends.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SPACE_IMPORT_FORMAT = 1;
|
|
7
|
+
export type SpaceImport = {
|
|
8
|
+
format: typeof SPACE_IMPORT_FORMAT;
|
|
9
|
+
/** The space as the project authors it: the two documents the draft is made of, replaced whole. */
|
|
10
|
+
documents: {
|
|
11
|
+
schema: Schema;
|
|
12
|
+
style: Style;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Every server action the project keeps, and every connector: the space's become exactly these. Left out, the project
|
|
16
|
+
* keeps none of its own, and the space's are left as they are.
|
|
17
|
+
*/
|
|
18
|
+
actions?: {
|
|
19
|
+
identifier: string;
|
|
20
|
+
name: string;
|
|
21
|
+
document: unknown;
|
|
22
|
+
}[];
|
|
23
|
+
connectors?: {
|
|
24
|
+
identifier: string;
|
|
25
|
+
name: string;
|
|
26
|
+
manifest: unknown;
|
|
27
|
+
}[];
|
|
28
|
+
/**
|
|
29
|
+
* The draft the project was last given or last pushed (`SpaceExport.draft`): the push is refused when the space's has
|
|
30
|
+
* moved on since. `null` for a project that never had one — refused unless the space is still as it was created.
|
|
31
|
+
*/
|
|
32
|
+
base: string | null;
|
|
33
|
+
/** Replace the draft whatever it holds now. */
|
|
34
|
+
force: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Why a push was not taken, before anything was checked: the draft is not the one the project knows. */
|
|
37
|
+
export type SpaceImportRefusalCode = 'DRAFT_MOVED' | 'DRAFT_NOT_EMPTY';
|
|
38
|
+
export type SpaceImportResult =
|
|
39
|
+
/** Taken: `draft` is what the project knows from now on; `changed` false when it already was the space's draft. */
|
|
40
|
+
{
|
|
41
|
+
ok: true;
|
|
42
|
+
changed: boolean;
|
|
43
|
+
draft: string;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
refusal: {
|
|
47
|
+
code: SpaceImportRefusalCode;
|
|
48
|
+
error: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Not taken: what is wrong with what was sent, each problem where it is. */
|
|
52
|
+
| {
|
|
53
|
+
ok: false;
|
|
54
|
+
problems: string[];
|
|
55
|
+
};
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { readSourceSnapshot, secretIn, sourcePathProblem, SOURCE_SNAPSHOT_FORMAT, SOURCE_SNAPSHOT_LIMITS } from './snapshot';
|
|
2
2
|
export { SPACE_EXPORT_FORMAT } from './export';
|
|
3
|
+
export { SPACE_IMPORT_FORMAT } from './import';
|
|
3
4
|
export type { SourceSnapshot, SourceSnapshotKind, SourceSnapshotReading } from './snapshot';
|
|
4
5
|
export type { SpaceExport, SpaceExportConflict, SpaceExportFile } from './export';
|
|
6
|
+
export type { SpaceImport, SpaceImportRefusalCode, SpaceImportResult } from './import';
|
package/dist/source/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { SPACE_EXPORT_FORMAT as e } from "./export.mjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SPACE_IMPORT_FORMAT as t } from "./import.mjs";
|
|
3
|
+
import { SOURCE_SNAPSHOT_FORMAT as n, SOURCE_SNAPSHOT_LIMITS as r, readSourceSnapshot as i, secretIn as a, sourcePathProblem as o } from "./snapshot.mjs";
|
|
4
|
+
export { n as SOURCE_SNAPSHOT_FORMAT, r as SOURCE_SNAPSHOT_LIMITS, e as SPACE_EXPORT_FORMAT, t as SPACE_IMPORT_FORMAT, i as readSourceSnapshot, a as secretIn, o as sourcePathProblem };
|