@studiocms/devapps 0.1.0-beta.10 → 0.1.0-beta.12
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/dist/apps/libsql-viewer.d.ts +0 -44
- package/dist/apps/libsql-viewer.js +12 -75
- package/dist/index.js +8 -2
- package/dist/routes/outerbase.astro +118 -0
- package/dist/schema/index.d.ts +38 -9
- package/dist/schema/index.js +9 -4
- package/dist/schema/wp-api.d.ts +16 -16
- package/dist/utils/wp-api/converters.js +1 -1
- package/dist/virt.d.ts +6 -0
- package/package.json +4 -6
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates the source URL for an iframe based on the provided database URL.
|
|
3
|
-
*
|
|
4
|
-
* @param dbUrl - The URL of the database.
|
|
5
|
-
* @returns The source URL for the iframe. If the database URL contains 'turso.io',
|
|
6
|
-
* it returns `tursoURL`. Otherwise, it returns `sqlLiteUrl`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getIFrameSrc(dbUrl: string): "https://studio.outerbase.com/embed/sqlite?theme=dark" | "https://studio.outerbase.com/embed/turso?theme=dark";
|
|
9
|
-
/**
|
|
10
|
-
* Defines a toolbar application for viewing and interacting with a libSQL database.
|
|
11
|
-
*
|
|
12
|
-
* @param {HTMLCanvasElement} canvas - The canvas element where the app will be initialized.
|
|
13
|
-
* @param {EventTarget} eventTarget - The event target for handling outside click events.
|
|
14
|
-
*
|
|
15
|
-
* @returns {void}
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import libsqlViewer from './libsql-viewer';
|
|
20
|
-
*
|
|
21
|
-
* const canvas = document.getElementById('appCanvas') as HTMLCanvasElement;
|
|
22
|
-
* const eventTarget = new EventTarget();
|
|
23
|
-
*
|
|
24
|
-
* libsqlViewer.init(canvas, eventTarget);
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* This function creates an iframe to display the libSQL database viewer and sets up
|
|
29
|
-
* event listeners to handle SQL query and transaction requests via postMessage.
|
|
30
|
-
*
|
|
31
|
-
* The iframe's source URL and authentication token are retrieved from the `dbEnv` object.
|
|
32
|
-
*
|
|
33
|
-
* The `createClient` function is used to create a client for executing SQL queries and transactions.
|
|
34
|
-
*
|
|
35
|
-
* The `closeOnOutsideClick` function is used to close the app window when a click is detected outside of it.
|
|
36
|
-
*
|
|
37
|
-
* The `transformTursoResult` function is used to transform the results of SQL queries and transactions.
|
|
38
|
-
*
|
|
39
|
-
* The `biome-ignore` comments are used to suppress linting warnings for non-null assertions.
|
|
40
|
-
*
|
|
41
|
-
* @see {@link createClient}
|
|
42
|
-
* @see {@link closeOnOutsideClick}
|
|
43
|
-
* @see {@link transformTursoResult}
|
|
44
|
-
*/
|
|
45
1
|
declare const _default: import("astro").DevToolbarApp;
|
|
46
2
|
export default _default;
|
|
@@ -1,95 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createClient } from "@libsql/client/web";
|
|
3
|
-
import { transformTursoResult } from "@outerbase/sdk-transform";
|
|
1
|
+
import { libsqlEndpoint } from "virtual:studiocms-devapps/endpoints";
|
|
4
2
|
import { defineToolbarApp } from "astro/toolbar";
|
|
5
3
|
import { closeOnOutsideClick } from "../utils/app-utils.js";
|
|
6
|
-
const sqlLiteUrl = "https://studio.outerbase.com/embed/sqlite?theme=dark";
|
|
7
|
-
const tursoURL = "https://studio.outerbase.com/embed/turso?theme=dark";
|
|
8
|
-
function getIFrameSrc(dbUrl) {
|
|
9
|
-
if (dbUrl.includes("turso.io")) {
|
|
10
|
-
return tursoURL;
|
|
11
|
-
}
|
|
12
|
-
return sqlLiteUrl;
|
|
13
|
-
}
|
|
14
4
|
var libsql_viewer_default = defineToolbarApp({
|
|
15
5
|
init(canvas, eventTarget) {
|
|
16
6
|
const appWindow = document.createElement("astro-dev-toolbar-window");
|
|
17
|
-
appWindow.style.width = "
|
|
18
|
-
appWindow.style.height = "
|
|
7
|
+
appWindow.style.width = "90%";
|
|
8
|
+
appWindow.style.height = "100%";
|
|
9
|
+
appWindow.style.marginLeft = "1rem";
|
|
10
|
+
appWindow.style.marginRight = "1rem";
|
|
11
|
+
appWindow.style.padding = "0";
|
|
12
|
+
appWindow.style.border = "none";
|
|
13
|
+
appWindow.style.overflow = "hidden";
|
|
14
|
+
appWindow.style.borderRadius = "0.5rem";
|
|
15
|
+
appWindow.style.boxShadow = "0 0 1rem rgba(0, 0, 0, 0.1)";
|
|
19
16
|
closeOnOutsideClick(eventTarget);
|
|
20
17
|
const viewerIframe = document.createElement("iframe");
|
|
21
|
-
viewerIframe.src =
|
|
18
|
+
viewerIframe.src = libsqlEndpoint;
|
|
22
19
|
viewerIframe.id = "sqlIframe";
|
|
23
20
|
viewerIframe.title = "libSQL Database Viewer";
|
|
24
|
-
Object.assign(viewerIframe.dataset, {
|
|
25
|
-
url: dbEnv.remoteUrl,
|
|
26
|
-
authtoken: dbEnv.token
|
|
27
|
-
});
|
|
28
21
|
Object.assign(viewerIframe.style, {
|
|
29
22
|
height: "100%",
|
|
30
23
|
width: "100%",
|
|
31
24
|
border: "1px solid rgba(27, 30, 36, 1)"
|
|
32
25
|
});
|
|
33
26
|
appWindow.appendChild(viewerIframe);
|
|
34
|
-
const client = createClient({
|
|
35
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
36
|
-
url: viewerIframe.dataset.url,
|
|
37
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
38
|
-
authToken: viewerIframe.dataset.authtoken
|
|
39
|
-
});
|
|
40
|
-
window.addEventListener("message", async (e) => {
|
|
41
|
-
const contentWindow = viewerIframe.contentWindow;
|
|
42
|
-
if (contentWindow && e.data) {
|
|
43
|
-
const { type, id, statement, statements } = e.data;
|
|
44
|
-
if (type === "query" && statement) {
|
|
45
|
-
try {
|
|
46
|
-
const result = await client.execute(statement);
|
|
47
|
-
contentWindow.postMessage(
|
|
48
|
-
{
|
|
49
|
-
type,
|
|
50
|
-
id,
|
|
51
|
-
data: transformTursoResult(result)
|
|
52
|
-
},
|
|
53
|
-
"*"
|
|
54
|
-
);
|
|
55
|
-
} catch (err) {
|
|
56
|
-
contentWindow.postMessage(
|
|
57
|
-
{
|
|
58
|
-
type,
|
|
59
|
-
id,
|
|
60
|
-
error: err.message
|
|
61
|
-
},
|
|
62
|
-
"*"
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
} else if (type === "transaction" && statements) {
|
|
66
|
-
try {
|
|
67
|
-
const result = await client.batch(statements, "write");
|
|
68
|
-
contentWindow.postMessage(
|
|
69
|
-
{
|
|
70
|
-
type,
|
|
71
|
-
id,
|
|
72
|
-
data: result.map(transformTursoResult)
|
|
73
|
-
},
|
|
74
|
-
"*"
|
|
75
|
-
);
|
|
76
|
-
} catch (err) {
|
|
77
|
-
contentWindow.postMessage(
|
|
78
|
-
{
|
|
79
|
-
type,
|
|
80
|
-
id,
|
|
81
|
-
error: err.message
|
|
82
|
-
},
|
|
83
|
-
"*"
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
27
|
canvas.appendChild(appWindow);
|
|
90
28
|
}
|
|
91
29
|
});
|
|
92
30
|
export {
|
|
93
|
-
libsql_viewer_default as default
|
|
94
|
-
getIFrameSrc
|
|
31
|
+
libsql_viewer_default as default
|
|
95
32
|
};
|
package/dist/index.js
CHANGED
|
@@ -16,11 +16,13 @@ function studioCMSDevApps(opts) {
|
|
|
16
16
|
options.verbose && logger.info("Setting up StudioCMS DevApps");
|
|
17
17
|
if (command === "dev") {
|
|
18
18
|
const wpAPIPath = makeEndpointPath(options.appsConfig.wpImporter.endpoint);
|
|
19
|
+
const libsqlIFrame = makeEndpointPath(options.appsConfig.libSQLViewer.endpoint);
|
|
19
20
|
addVirtualImports(params, {
|
|
20
21
|
name: "@studiocms/devapps",
|
|
21
22
|
imports: {
|
|
22
23
|
"virtual:studiocms-devapps/endpoints": `
|
|
23
24
|
export const wpAPIEndpoint = "${wpAPIPath}";
|
|
25
|
+
export const libsqlEndpoint = "${libsqlIFrame}";
|
|
24
26
|
`,
|
|
25
27
|
"virtual:studiocms-devapps/config": `
|
|
26
28
|
export const userProjectRoot = "${config.root.pathname}";
|
|
@@ -34,11 +36,15 @@ function studioCMSDevApps(opts) {
|
|
|
34
36
|
});
|
|
35
37
|
if (options.appsConfig.libSQLViewer.enabled) {
|
|
36
38
|
options.verbose && logger.info("Adding Dev Toolbar App: LibSQL Viewer");
|
|
39
|
+
injectDevRoute(params, {
|
|
40
|
+
entrypoint: resolve("./routes/outerbase.astro"),
|
|
41
|
+
pattern: libsqlIFrame
|
|
42
|
+
});
|
|
37
43
|
addDevToolbarApp({
|
|
38
|
-
name: "
|
|
44
|
+
name: "Outerbase Studio Embedded",
|
|
39
45
|
id: "studiocms-devapps-libsql-viewer",
|
|
40
46
|
entrypoint: resolve("./apps/libsql-viewer.js"),
|
|
41
|
-
icon: '<svg
|
|
47
|
+
icon: '<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" class="mb-4 hidden size-4 md:block"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 0C8.97048 0 0 8.96666 0 19.9999C0 31.0227 8.97048 40 20 40C31.0294 40 40 31.0333 40 19.9999C40 8.96666 31.0294 0 20 0ZM27.4346 33.7676L27.3343 33.8966C26.2881 35.1776 25.0082 35.5974 24.1178 35.7158C23.8841 35.748 23.6504 35.759 23.4056 35.759C20.9794 35.759 18.5308 34.112 16.3272 30.9795C14.5353 28.4284 12.9771 25.027 11.9421 21.3992C10.1057 14.9299 10.3172 9.03117 12.4763 6.36169C13.5225 5.08067 14.8024 4.66086 15.6928 4.5425C18.2192 4.19787 20.8013 5.67267 23.1385 8.79421C25.0749 11.3779 26.7445 14.9408 27.8576 18.8481C29.6716 25.2207 29.4935 31.0549 27.4346 33.7676Z" fill="currentColor"></path></svg>'
|
|
42
48
|
});
|
|
43
49
|
}
|
|
44
50
|
if (options.appsConfig.wpImporter.enabled) {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { dbEnv } from 'virtual:studiocms-devapps/config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates the source URL for an iframe based on the provided database URL.
|
|
6
|
+
*
|
|
7
|
+
* @param dbUrl - The URL of the database.
|
|
8
|
+
* @returns The source URL for the iframe. If the database URL contains 'turso.io',
|
|
9
|
+
* it returns `tursoURL`. Otherwise, it returns `sqlLiteUrl`.
|
|
10
|
+
*/
|
|
11
|
+
function getIFrameSrc(dbUrl: string) {
|
|
12
|
+
if (dbUrl.includes('turso.io')) {
|
|
13
|
+
return 'https://studio.outerbase.com/embed/turso?theme=dark';
|
|
14
|
+
}
|
|
15
|
+
return 'https://studio.outerbase.com/embed/turso?theme=dark';
|
|
16
|
+
}
|
|
17
|
+
---
|
|
18
|
+
<html>
|
|
19
|
+
<head>
|
|
20
|
+
<style is:global>
|
|
21
|
+
astro-dev-toolbar {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body style="margin: 0; padding: 0; overflow: hidden;">
|
|
27
|
+
<iframe id="sqlIframe"
|
|
28
|
+
style="width: 100%; height: 100vh; border: none;"
|
|
29
|
+
src={getIFrameSrc(dbEnv.remoteUrl)}
|
|
30
|
+
title="Outerbase Studio"
|
|
31
|
+
allow="clipboard-read; clipboard-write"
|
|
32
|
+
data-dburl={dbEnv.remoteUrl}
|
|
33
|
+
data-dbtoken={dbEnv.token}
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
import { createClient } from 'https://esm.sh/@libsql/client@0.14.0/web';
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
import { transformTursoResult } from 'https://esm.sh/@outerbase/sdk-transform@1.0.7';
|
|
41
|
+
|
|
42
|
+
interface ClientRequest {
|
|
43
|
+
type: 'query' | 'transaction';
|
|
44
|
+
id: number;
|
|
45
|
+
statement?: string;
|
|
46
|
+
statements?: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const iframe = document.querySelector('#sqlIframe') as HTMLIFrameElement;
|
|
50
|
+
|
|
51
|
+
const dbUrl = iframe.dataset.dburl;
|
|
52
|
+
const dbToken = iframe.dataset.dbtoken;
|
|
53
|
+
|
|
54
|
+
const client = createClient({
|
|
55
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
56
|
+
url: dbUrl!,
|
|
57
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
58
|
+
authToken: dbToken!,
|
|
59
|
+
intMode: 'bigint',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Event listener to handle postMessage events
|
|
63
|
+
window.addEventListener('message', async (e: MessageEvent<ClientRequest>) => {
|
|
64
|
+
const contentWindow = iframe.contentWindow;
|
|
65
|
+
|
|
66
|
+
if (contentWindow && e.data) {
|
|
67
|
+
const { type, id, statement, statements } = e.data;
|
|
68
|
+
|
|
69
|
+
if (type === 'query' && statement) {
|
|
70
|
+
// Execute a single SQL query
|
|
71
|
+
try {
|
|
72
|
+
const result = await client.execute(statement);
|
|
73
|
+
contentWindow.postMessage(
|
|
74
|
+
{
|
|
75
|
+
type,
|
|
76
|
+
id,
|
|
77
|
+
data: transformTursoResult(result),
|
|
78
|
+
},
|
|
79
|
+
'*'
|
|
80
|
+
);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
contentWindow.postMessage(
|
|
83
|
+
{
|
|
84
|
+
type,
|
|
85
|
+
id,
|
|
86
|
+
error: (err as Error).message,
|
|
87
|
+
},
|
|
88
|
+
'*'
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
} else if (type === 'transaction' && statements) {
|
|
92
|
+
// Execute a batch of SQL statements in a transaction
|
|
93
|
+
try {
|
|
94
|
+
const result = await client.batch(statements, 'write');
|
|
95
|
+
contentWindow.postMessage(
|
|
96
|
+
{
|
|
97
|
+
type,
|
|
98
|
+
id,
|
|
99
|
+
data: result.map(transformTursoResult),
|
|
100
|
+
},
|
|
101
|
+
'*'
|
|
102
|
+
);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
contentWindow.postMessage(
|
|
105
|
+
{
|
|
106
|
+
type,
|
|
107
|
+
id,
|
|
108
|
+
error: (err as Error).message,
|
|
109
|
+
},
|
|
110
|
+
'*'
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
</script>
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -26,7 +26,13 @@ export declare const AppsConfigSchema: z.ZodEffects<z.ZodDefault<z.ZodOptional<z
|
|
|
26
26
|
/**
|
|
27
27
|
* Astro DB LibSQL Viewer App Config
|
|
28
28
|
*/
|
|
29
|
-
libSQLViewer: z.
|
|
29
|
+
libSQLViewer: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
30
|
+
endpoint: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
endpoint: string;
|
|
33
|
+
}, {
|
|
34
|
+
endpoint?: string | undefined;
|
|
35
|
+
}>]>;
|
|
30
36
|
/**
|
|
31
37
|
* StudioCMS WP API Importer App Config
|
|
32
38
|
*/
|
|
@@ -38,28 +44,35 @@ export declare const AppsConfigSchema: z.ZodEffects<z.ZodDefault<z.ZodOptional<z
|
|
|
38
44
|
endpoint?: string | undefined;
|
|
39
45
|
}>]>;
|
|
40
46
|
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
libSQLViewer: boolean
|
|
47
|
+
libSQLViewer: boolean | {
|
|
48
|
+
endpoint: string;
|
|
49
|
+
};
|
|
42
50
|
wpImporter: boolean | {
|
|
43
51
|
endpoint: string;
|
|
44
52
|
};
|
|
45
53
|
}, {
|
|
54
|
+
libSQLViewer: boolean | {
|
|
55
|
+
endpoint?: string | undefined;
|
|
56
|
+
};
|
|
46
57
|
wpImporter: boolean | {
|
|
47
58
|
endpoint?: string | undefined;
|
|
48
59
|
};
|
|
49
|
-
libSQLViewer?: boolean | undefined;
|
|
50
60
|
}>>>, {
|
|
51
61
|
libSQLViewer: {
|
|
52
62
|
enabled: boolean;
|
|
63
|
+
endpoint: string;
|
|
53
64
|
};
|
|
54
65
|
wpImporter: {
|
|
55
66
|
enabled: boolean;
|
|
56
67
|
endpoint: string;
|
|
57
68
|
};
|
|
58
69
|
}, {
|
|
70
|
+
libSQLViewer: boolean | {
|
|
71
|
+
endpoint?: string | undefined;
|
|
72
|
+
};
|
|
59
73
|
wpImporter: boolean | {
|
|
60
74
|
endpoint?: string | undefined;
|
|
61
75
|
};
|
|
62
|
-
libSQLViewer?: boolean | undefined;
|
|
63
76
|
} | undefined>;
|
|
64
77
|
/**
|
|
65
78
|
* Schema definition for StudioCMS development applications configuration.
|
|
@@ -82,7 +95,13 @@ export declare const StudioCMSDevAppsSchema: z.ZodDefault<z.ZodOptional<z.ZodObj
|
|
|
82
95
|
/**
|
|
83
96
|
* Astro DB LibSQL Viewer App Config
|
|
84
97
|
*/
|
|
85
|
-
libSQLViewer: z.
|
|
98
|
+
libSQLViewer: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
99
|
+
endpoint: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
endpoint: string;
|
|
102
|
+
}, {
|
|
103
|
+
endpoint?: string | undefined;
|
|
104
|
+
}>]>;
|
|
86
105
|
/**
|
|
87
106
|
* StudioCMS WP API Importer App Config
|
|
88
107
|
*/
|
|
@@ -94,28 +113,35 @@ export declare const StudioCMSDevAppsSchema: z.ZodDefault<z.ZodOptional<z.ZodObj
|
|
|
94
113
|
endpoint?: string | undefined;
|
|
95
114
|
}>]>;
|
|
96
115
|
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
libSQLViewer: boolean
|
|
116
|
+
libSQLViewer: boolean | {
|
|
117
|
+
endpoint: string;
|
|
118
|
+
};
|
|
98
119
|
wpImporter: boolean | {
|
|
99
120
|
endpoint: string;
|
|
100
121
|
};
|
|
101
122
|
}, {
|
|
123
|
+
libSQLViewer: boolean | {
|
|
124
|
+
endpoint?: string | undefined;
|
|
125
|
+
};
|
|
102
126
|
wpImporter: boolean | {
|
|
103
127
|
endpoint?: string | undefined;
|
|
104
128
|
};
|
|
105
|
-
libSQLViewer?: boolean | undefined;
|
|
106
129
|
}>>>, {
|
|
107
130
|
libSQLViewer: {
|
|
108
131
|
enabled: boolean;
|
|
132
|
+
endpoint: string;
|
|
109
133
|
};
|
|
110
134
|
wpImporter: {
|
|
111
135
|
enabled: boolean;
|
|
112
136
|
endpoint: string;
|
|
113
137
|
};
|
|
114
138
|
}, {
|
|
139
|
+
libSQLViewer: boolean | {
|
|
140
|
+
endpoint?: string | undefined;
|
|
141
|
+
};
|
|
115
142
|
wpImporter: boolean | {
|
|
116
143
|
endpoint?: string | undefined;
|
|
117
144
|
};
|
|
118
|
-
libSQLViewer?: boolean | undefined;
|
|
119
145
|
} | undefined>;
|
|
120
146
|
}, "strip", z.ZodTypeAny, {
|
|
121
147
|
endpoint: string;
|
|
@@ -123,6 +149,7 @@ export declare const StudioCMSDevAppsSchema: z.ZodDefault<z.ZodOptional<z.ZodObj
|
|
|
123
149
|
appsConfig: {
|
|
124
150
|
libSQLViewer: {
|
|
125
151
|
enabled: boolean;
|
|
152
|
+
endpoint: string;
|
|
126
153
|
};
|
|
127
154
|
wpImporter: {
|
|
128
155
|
enabled: boolean;
|
|
@@ -133,10 +160,12 @@ export declare const StudioCMSDevAppsSchema: z.ZodDefault<z.ZodOptional<z.ZodObj
|
|
|
133
160
|
endpoint?: string | undefined;
|
|
134
161
|
verbose?: boolean | undefined;
|
|
135
162
|
appsConfig?: {
|
|
163
|
+
libSQLViewer: boolean | {
|
|
164
|
+
endpoint?: string | undefined;
|
|
165
|
+
};
|
|
136
166
|
wpImporter: boolean | {
|
|
137
167
|
endpoint?: string | undefined;
|
|
138
168
|
};
|
|
139
|
-
libSQLViewer?: boolean | undefined;
|
|
140
169
|
} | undefined;
|
|
141
170
|
}>>>;
|
|
142
171
|
/**
|
package/dist/schema/index.js
CHANGED
|
@@ -3,7 +3,12 @@ const AppsConfigSchema = z.object({
|
|
|
3
3
|
/**
|
|
4
4
|
* Astro DB LibSQL Viewer App Config
|
|
5
5
|
*/
|
|
6
|
-
libSQLViewer: z.
|
|
6
|
+
libSQLViewer: z.union([
|
|
7
|
+
z.boolean(),
|
|
8
|
+
z.object({
|
|
9
|
+
endpoint: z.string().optional().default("outerbase")
|
|
10
|
+
})
|
|
11
|
+
]),
|
|
7
12
|
/**
|
|
8
13
|
* StudioCMS WP API Importer App Config
|
|
9
14
|
*/
|
|
@@ -15,14 +20,14 @@ const AppsConfigSchema = z.object({
|
|
|
15
20
|
])
|
|
16
21
|
}).optional().default({
|
|
17
22
|
wpImporter: { endpoint: "wp-api-importer" },
|
|
18
|
-
libSQLViewer:
|
|
23
|
+
libSQLViewer: { endpoint: "outerbase" }
|
|
19
24
|
}).transform((val) => {
|
|
20
25
|
let libSQL;
|
|
21
26
|
let wpAPI;
|
|
22
27
|
if (typeof val.libSQLViewer === "boolean") {
|
|
23
|
-
libSQL = { enabled: val.libSQLViewer };
|
|
28
|
+
libSQL = { enabled: val.libSQLViewer, endpoint: "outerbase" };
|
|
24
29
|
} else {
|
|
25
|
-
libSQL = { enabled: true };
|
|
30
|
+
libSQL = { enabled: true, endpoint: val.libSQLViewer.endpoint };
|
|
26
31
|
}
|
|
27
32
|
if (typeof val.wpImporter === "boolean") {
|
|
28
33
|
wpAPI = { enabled: val.wpImporter, endpoint: "wp-api-importer" };
|
package/dist/schema/wp-api.d.ts
CHANGED
|
@@ -87,10 +87,6 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
87
87
|
title: {
|
|
88
88
|
rendered: string;
|
|
89
89
|
};
|
|
90
|
-
content: {
|
|
91
|
-
rendered: string;
|
|
92
|
-
protected: boolean;
|
|
93
|
-
};
|
|
94
90
|
id: number;
|
|
95
91
|
date_gmt: Date;
|
|
96
92
|
guid: {
|
|
@@ -99,6 +95,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
99
95
|
modified: Date;
|
|
100
96
|
modified_gmt: Date;
|
|
101
97
|
slug: string;
|
|
98
|
+
content: {
|
|
99
|
+
rendered: string;
|
|
100
|
+
protected: boolean;
|
|
101
|
+
};
|
|
102
102
|
excerpt: {
|
|
103
103
|
rendered: string;
|
|
104
104
|
protected: boolean;
|
|
@@ -118,10 +118,6 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
118
118
|
title: {
|
|
119
119
|
rendered: string;
|
|
120
120
|
};
|
|
121
|
-
content: {
|
|
122
|
-
rendered: string;
|
|
123
|
-
protected: boolean;
|
|
124
|
-
};
|
|
125
121
|
id: number;
|
|
126
122
|
date_gmt: Date;
|
|
127
123
|
guid: {
|
|
@@ -130,6 +126,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
130
126
|
modified: Date;
|
|
131
127
|
modified_gmt: Date;
|
|
132
128
|
slug: string;
|
|
129
|
+
content: {
|
|
130
|
+
rendered: string;
|
|
131
|
+
protected: boolean;
|
|
132
|
+
};
|
|
133
133
|
excerpt: {
|
|
134
134
|
rendered: string;
|
|
135
135
|
protected: boolean;
|
|
@@ -224,10 +224,6 @@ export declare const PostSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
224
224
|
title: {
|
|
225
225
|
rendered: string;
|
|
226
226
|
};
|
|
227
|
-
content: {
|
|
228
|
-
rendered: string;
|
|
229
|
-
protected: boolean;
|
|
230
|
-
};
|
|
231
227
|
id: number;
|
|
232
228
|
date_gmt: Date;
|
|
233
229
|
guid: {
|
|
@@ -236,6 +232,10 @@ export declare const PostSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
236
232
|
modified: Date;
|
|
237
233
|
modified_gmt: Date;
|
|
238
234
|
slug: string;
|
|
235
|
+
content: {
|
|
236
|
+
rendered: string;
|
|
237
|
+
protected: boolean;
|
|
238
|
+
};
|
|
239
239
|
excerpt: {
|
|
240
240
|
rendered: string;
|
|
241
241
|
protected: boolean;
|
|
@@ -258,10 +258,6 @@ export declare const PostSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
258
258
|
title: {
|
|
259
259
|
rendered: string;
|
|
260
260
|
};
|
|
261
|
-
content: {
|
|
262
|
-
rendered: string;
|
|
263
|
-
protected: boolean;
|
|
264
|
-
};
|
|
265
261
|
id: number;
|
|
266
262
|
date_gmt: Date;
|
|
267
263
|
guid: {
|
|
@@ -270,6 +266,10 @@ export declare const PostSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
270
266
|
modified: Date;
|
|
271
267
|
modified_gmt: Date;
|
|
272
268
|
slug: string;
|
|
269
|
+
content: {
|
|
270
|
+
rendered: string;
|
|
271
|
+
protected: boolean;
|
|
272
|
+
};
|
|
273
273
|
excerpt: {
|
|
274
274
|
rendered: string;
|
|
275
275
|
protected: boolean;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
downloadAndUpdateImages,
|
|
11
11
|
downloadPostImage,
|
|
12
12
|
stripHtml
|
|
13
|
-
} from "./utils";
|
|
13
|
+
} from "./utils.js";
|
|
14
14
|
const ASTROPUBLICFOLDER = path.resolve(userProjectRoot, "public");
|
|
15
15
|
const WPImportFolder = path.resolve(ASTROPUBLICFOLDER, "wp-import");
|
|
16
16
|
const pagesImagesFolder = path.resolve(WPImportFolder, "pages");
|
package/dist/virt.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
declare module 'virtual:studiocms-devapps/endpoints' {
|
|
4
4
|
export const wpAPIEndpoint: string;
|
|
5
|
+
export const libsqlEndpoint: string;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
declare module 'virtual:studiocms-devapps/config' {
|
|
@@ -11,3 +12,8 @@ declare module 'virtual:studiocms-devapps/config' {
|
|
|
11
12
|
token: string;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
|
|
16
|
+
declare module 'virtual:studiocms-devapps/db' {
|
|
17
|
+
const client: import('@libsql/client/web').Client;
|
|
18
|
+
export { client };
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/devapps",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.12",
|
|
4
4
|
"description": "A dedicated CMS for Astro DB. Built from the ground up by the Astro community.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Adam Matthiesen | Jacob Jenkins | Paul Valladares",
|
|
@@ -54,11 +54,9 @@
|
|
|
54
54
|
"type": "module",
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"astro-integration-kit": "^0.18",
|
|
57
|
-
"@libsql/client": "^0.14.0",
|
|
58
57
|
"cheerio": "^1.0.0",
|
|
59
58
|
"turndown": "^7.2.0",
|
|
60
|
-
"html-entities": "^2.5.2"
|
|
61
|
-
"@outerbase/sdk-transform": "^1.0.5"
|
|
59
|
+
"html-entities": "^2.5.2"
|
|
62
60
|
},
|
|
63
61
|
"devDependencies": {
|
|
64
62
|
"@types/cheerio": "^0.22.35",
|
|
@@ -67,9 +65,9 @@
|
|
|
67
65
|
},
|
|
68
66
|
"peerDependencies": {
|
|
69
67
|
"@astrojs/db": "^0.14.7",
|
|
70
|
-
"astro": "^5.4.
|
|
68
|
+
"astro": "^5.4.3",
|
|
71
69
|
"vite": "^6.2.0",
|
|
72
|
-
"studiocms": "0.1.0-beta.
|
|
70
|
+
"studiocms": "0.1.0-beta.12"
|
|
73
71
|
},
|
|
74
72
|
"peerDependenciesMeta": {
|
|
75
73
|
"studiocms": {
|