kizlo 0.19.0 → 0.20.1
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/cli/daemon/generate.js +8 -8
- package/dist/cli/daemon/watch.js +1 -1
- package/dist/cli/wp/compose/apache-listen.conf +15 -0
- package/dist/cli/wp/compose/docker-compose.test.ts +66 -0
- package/dist/cli/wp/compose/docker-compose.yml +10 -0
- package/dist/cli/wp/compose/uploads.ini +12 -0
- package/dist/cli/wp/constants.d.ts +5 -1
- package/dist/cli/wp/constants.js +5 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +1 -1
- package/dist/kizlo.d.ts +6 -9
- package/dist/kizlo.js +8 -9
- package/dist/package.js +1 -1
- package/dist/procedures.d.ts +7 -7
- package/dist/test.d.ts +2 -2
- package/dist/test.js +2 -2
- package/dist/wordpress/generate.js +3 -3
- package/dist/wordpress/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,16 +14,16 @@ import fs from "node:fs";
|
|
|
14
14
|
|
|
15
15
|
//#region src/cli/daemon/generate.ts
|
|
16
16
|
/**
|
|
17
|
-
* The generated barrel is also written as a stub by `kizlo init`. It re-exports `
|
|
18
|
-
* than pre-wrapping it: a server entry passes `
|
|
19
|
-
*
|
|
17
|
+
* The generated barrel is also written as a stub by `kizlo init`. It re-exports `introspection`
|
|
18
|
+
* rather than pre-wrapping it: a server entry passes `createKizlo({ introspection })` itself, so the
|
|
19
|
+
* rest of the options stay visible at the call site instead of hiding inside a generated object.
|
|
20
20
|
*/
|
|
21
21
|
const CONTRACT_BARREL = [
|
|
22
22
|
`import type { procedures } from ".."`,
|
|
23
23
|
`import contractJson from "./contract.json"`,
|
|
24
24
|
``,
|
|
25
25
|
`export const contract = contractJson as unknown as typeof procedures`,
|
|
26
|
-
`export {
|
|
26
|
+
`export { introspection, type WordPressClient } from "./introspection"`,
|
|
27
27
|
``
|
|
28
28
|
].join("\n");
|
|
29
29
|
var LegacyRouterExportError = class extends Error {
|
|
@@ -42,13 +42,13 @@ var LegacyRouterExportError = class extends Error {
|
|
|
42
42
|
const INTROSPECTION_STUB = [
|
|
43
43
|
`import type { WP_Client } from "kizlo"`,
|
|
44
44
|
``,
|
|
45
|
-
`export const
|
|
45
|
+
`export const introspection = {} as any`,
|
|
46
46
|
``,
|
|
47
|
-
`export type WordPressClient = WP_Client<typeof
|
|
47
|
+
`export type WordPressClient = WP_Client<typeof introspection>`,
|
|
48
48
|
``,
|
|
49
49
|
`declare module "kizlo" {`,
|
|
50
50
|
`\tinterface WordPressClientRegistry {`,
|
|
51
|
-
`\t\
|
|
51
|
+
`\t\tintrospection: typeof introspection`,
|
|
52
52
|
`\t}`,
|
|
53
53
|
`\tinterface WordPressEndpointRegistry {`,
|
|
54
54
|
`\t\t[path: string]: any`,
|
|
@@ -177,7 +177,7 @@ function reportPluginVersion(installed) {
|
|
|
177
177
|
/** Fetch `/introspect`, reporting its diagnostics in the CLI's voice. Returns undefined on a 304. */
|
|
178
178
|
async function fetchDocument(cwd, options, etag) {
|
|
179
179
|
loadEnvFiles(cwd);
|
|
180
|
-
const result = await fetchIntrospection(options.credentials ?? resolveWordPressConnection(
|
|
180
|
+
const result = await fetchIntrospection(options.credentials ?? resolveWordPressConnection(integrationEnv([node()])).credentials, {
|
|
181
181
|
etag: options.strict ? void 0 : etag,
|
|
182
182
|
fetch: options.fetch
|
|
183
183
|
});
|
package/dist/cli/daemon/watch.js
CHANGED
|
@@ -140,7 +140,7 @@ async function startWatcher(cwd, opts) {
|
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
loadEnvFiles(cwd);
|
|
143
|
-
const { credentials } = resolveWordPressConnection(
|
|
143
|
+
const { credentials } = resolveWordPressConnection(integrationEnv([node()]));
|
|
144
144
|
try {
|
|
145
145
|
const result = await generateOnce(cfg, { credentials });
|
|
146
146
|
if (result.contract === "built") log.success("Contract generated");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Kizlo local WordPress — make same-site server requests reach Apache.
|
|
2
|
+
#
|
|
3
|
+
# WordPress builds internal, server-side requests (e.g. a plugin calling its own
|
|
4
|
+
# admin_url()) against the browser-facing URL, which carries the *published* host
|
|
5
|
+
# port — say http://localhost:8890. Inside the container that request loops back to
|
|
6
|
+
# localhost:8890, but Apache only listens on 80 (Docker maps the host port to 80),
|
|
7
|
+
# so the call fails with cURL error 7 and the plugin stalls.
|
|
8
|
+
#
|
|
9
|
+
# Listening on the published port as well makes localhost:<port> resolve inside the
|
|
10
|
+
# container exactly as it does from the browser. Apache keeps its port-80 listener
|
|
11
|
+
# for Docker's port mapping and the health check; this only adds a second one.
|
|
12
|
+
#
|
|
13
|
+
# WP_PORT is passed into the wordpress service by the CLI (and defaulted in the base
|
|
14
|
+
# Compose file), so Apache expands ${WP_PORT} from the container environment.
|
|
15
|
+
Listen ${WP_PORT}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import fs from "node:fs"
|
|
2
|
+
import { describe, expect, test } from "vitest"
|
|
3
|
+
import { parse } from "yaml"
|
|
4
|
+
import { APACHE_LISTEN_CONF, COMPOSE_FILE, UPLOADS_INI } from "../constants"
|
|
5
|
+
|
|
6
|
+
interface Service {
|
|
7
|
+
environment?: Record<string, string>
|
|
8
|
+
ports?: string[]
|
|
9
|
+
volumes?: string[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const wordpress = (): Service => parse(fs.readFileSync(COMPOSE_FILE, "utf8")).services.wordpress
|
|
13
|
+
|
|
14
|
+
/** Parse a `key=value` INI (comments/blank lines dropped) into a lookup. */
|
|
15
|
+
function ini(file: string): Record<string, string> {
|
|
16
|
+
const out: Record<string, string> = {}
|
|
17
|
+
for (const line of fs.readFileSync(file, "utf8").split("\n")) {
|
|
18
|
+
const trimmed = line.trim()
|
|
19
|
+
if (!trimmed || trimmed.startsWith(";")) continue
|
|
20
|
+
const eq = trimmed.indexOf("=")
|
|
21
|
+
if (eq !== -1) out[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim()
|
|
22
|
+
}
|
|
23
|
+
return out
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** PHP size shorthand (`2G`, `2100M`, `512K`) to bytes. */
|
|
27
|
+
function bytes(size: string): number {
|
|
28
|
+
const match = /^(\d+)([KMG]?)$/i.exec(size)
|
|
29
|
+
if (!match) throw new Error(`not a PHP size: ${size}`)
|
|
30
|
+
const scale = { "": 1, K: 1024, M: 1024 ** 2, G: 1024 ** 3 }[match[2]?.toUpperCase() ?? ""] ?? 1
|
|
31
|
+
return Number(match[1]) * scale
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("base compose wordpress service", () => {
|
|
35
|
+
test("receives the published port so Apache can listen on it", () => {
|
|
36
|
+
// Defaulted to the same value as the port mapping so a standalone `up` still parses.
|
|
37
|
+
// The `${...}` here are literal Compose interpolation tokens, not JS templates.
|
|
38
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: literal Compose interpolation
|
|
39
|
+
expect(wordpress().environment?.WP_PORT).toBe("${WP_PORT:-8080}")
|
|
40
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: literal Compose interpolation
|
|
41
|
+
expect(wordpress().ports).toContain("${WP_PORT:-8080}:80")
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test("mounts both local-only config assets read-only", () => {
|
|
45
|
+
const volumes = wordpress().volumes ?? []
|
|
46
|
+
expect(volumes).toContain("./uploads.ini:/usr/local/etc/php/conf.d/zz-kizlo-uploads.ini:ro")
|
|
47
|
+
expect(volumes).toContain("./apache-listen.conf:/etc/apache2/conf-enabled/zz-kizlo-listen.conf:ro")
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
describe("uploads.ini", () => {
|
|
52
|
+
test("raises the upload ceiling to 2 GB", () => {
|
|
53
|
+
expect(ini(UPLOADS_INI).upload_max_filesize).toBe("2G")
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test("allows POST overhead above the file limit for the multipart envelope", () => {
|
|
57
|
+
const values = ini(UPLOADS_INI)
|
|
58
|
+
expect(bytes(values.post_max_size ?? "")).toBeGreaterThan(bytes(values.upload_max_filesize ?? ""))
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe("apache-listen.conf", () => {
|
|
63
|
+
test("listens on the injected published port", () => {
|
|
64
|
+
expect(fs.readFileSync(APACHE_LISTEN_CONF, "utf8")).toMatch(/^\s*Listen\s+\$\{WP_PORT\}\s*$/m)
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -40,6 +40,11 @@ services:
|
|
|
40
40
|
WORDPRESS_DB_NAME: ${MYSQL_DATABASE:-wordpress}
|
|
41
41
|
WORDPRESS_DB_USER: ${MYSQL_USER:-wordpress}
|
|
42
42
|
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-wppass}
|
|
43
|
+
# Published host port, handed to Apache so `apache-listen.conf` can add a
|
|
44
|
+
# second listener on it (see that file). Defaulted here to match the port
|
|
45
|
+
# mapping above so a standalone `docker compose up` still parses the config;
|
|
46
|
+
# every path through the CLI supplies the resolved port as WP_PORT.
|
|
47
|
+
WP_PORT: ${WP_PORT:-8080}
|
|
43
48
|
# The wordpress image eval()s WORDPRESS_CONFIG_EXTRA at runtime, and Compose
|
|
44
49
|
# interpolates `$` in this file first — so every PHP variable below is written
|
|
45
50
|
# `$$` to survive Compose and reach PHP as a literal `$`.
|
|
@@ -56,6 +61,11 @@ services:
|
|
|
56
61
|
}
|
|
57
62
|
volumes:
|
|
58
63
|
- wp_data:/var/www/html
|
|
64
|
+
# Real PHP upload limits and the extra Apache listener, both shipped next to
|
|
65
|
+
# this file (relative binds resolve against the compose file's directory) and
|
|
66
|
+
# mounted read-only. In the base compose so dev and test stacks both get them.
|
|
67
|
+
- ./uploads.ini:/usr/local/etc/php/conf.d/zz-kizlo-uploads.ini:ro
|
|
68
|
+
- ./apache-listen.conf:/etc/apache2/conf-enabled/zz-kizlo-listen.conf:ro
|
|
59
69
|
healthcheck:
|
|
60
70
|
# wp-login.php always returns 200 unauthenticated; /wp-json can be gated to 401
|
|
61
71
|
# by plugins, so it's not a reliable liveness probe.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
; Kizlo local WordPress — raise PHP's upload ceiling for large imports.
|
|
2
|
+
;
|
|
3
|
+
; PHP rejects an oversized request before WordPress (or an upload plugin) ever
|
|
4
|
+
; sees it, so a WordPress hook that only changes the *displayed* limit is not
|
|
5
|
+
; enough. These are the real server limits the local stacks enforce.
|
|
6
|
+
;
|
|
7
|
+
; post_max_size is deliberately larger than upload_max_filesize: a file upload
|
|
8
|
+
; arrives as a multipart POST, so the whole request is a little bigger than the
|
|
9
|
+
; file itself. 2100M leaves headroom above the 2G (2048M) file limit for that
|
|
10
|
+
; envelope. Nothing else (memory_limit, execution time) is touched.
|
|
11
|
+
upload_max_filesize=2G
|
|
12
|
+
post_max_size=2100M
|
|
@@ -24,6 +24,10 @@ declare function kizloRelease(slug: string): string;
|
|
|
24
24
|
declare const COMPOSE_FILE: string;
|
|
25
25
|
/** PHP OPcache config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
26
26
|
declare const OPCACHE_INI: string;
|
|
27
|
+
/** PHP upload-limit config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
28
|
+
declare const UPLOADS_INI: string;
|
|
29
|
+
/** Apache extra-listener config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
30
|
+
declare const APACHE_LISTEN_CONF: string;
|
|
27
31
|
/** Linux-only entrypoint that retags www-data to the host user (see the script for why). */
|
|
28
32
|
declare const REMAP_ENTRYPOINT: string;
|
|
29
33
|
declare const CONFIG_FILES: string[];
|
|
@@ -54,4 +58,4 @@ declare const DEFAULT_PLUGINS: PluginSource[];
|
|
|
54
58
|
declare const TEST_ADMIN: Omit<TestAdminUser, "id" | "applicationPassword">;
|
|
55
59
|
declare const TEST_USER: Omit<TestUser, "id">;
|
|
56
60
|
//#endregion
|
|
57
|
-
export { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease };
|
|
61
|
+
export { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease };
|
package/dist/cli/wp/constants.js
CHANGED
|
@@ -30,6 +30,10 @@ const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
30
30
|
const COMPOSE_FILE = resolve(HERE, "compose/docker-compose.yml");
|
|
31
31
|
/** PHP OPcache config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
32
32
|
const OPCACHE_INI = resolve(HERE, "compose/opcache.ini");
|
|
33
|
+
/** PHP upload-limit config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
34
|
+
const UPLOADS_INI = resolve(HERE, "compose/uploads.ini");
|
|
35
|
+
/** Apache extra-listener config, shipped alongside this module and bind-mounted into the local WordPress. */
|
|
36
|
+
const APACHE_LISTEN_CONF = resolve(HERE, "compose/apache-listen.conf");
|
|
33
37
|
/** Linux-only entrypoint that retags www-data to the host user (see the script for why). */
|
|
34
38
|
const REMAP_ENTRYPOINT = resolve(HERE, "compose/remap-entrypoint.sh");
|
|
35
39
|
const CONFIG_FILES = [
|
|
@@ -81,4 +85,4 @@ const TEST_USER = {
|
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
//#endregion
|
|
84
|
-
export { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease };
|
|
88
|
+
export { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease };
|
package/dist/context.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface ContextConfig {
|
|
|
16
16
|
siteSecret: string;
|
|
17
17
|
adapters?: ServiceAdapters;
|
|
18
18
|
credentials: WordPressCredentials;
|
|
19
|
-
|
|
19
|
+
introspection?: object;
|
|
20
20
|
/** WordPress plugins the registered integrations need, checked against what each response reports. */
|
|
21
21
|
integrationPlugins?: IntegrationPluginRequirement[];
|
|
22
22
|
}
|
package/dist/context.js
CHANGED
|
@@ -55,7 +55,7 @@ var Context = class {
|
|
|
55
55
|
this.wordpress = createWordPressClient(new WordPressTransport({
|
|
56
56
|
credentials: config.credentials,
|
|
57
57
|
onResult: (result) => this.warnIfOutdated(result)
|
|
58
|
-
}), config.
|
|
58
|
+
}), config.introspection ?? {});
|
|
59
59
|
this.settings = new SettingsService(this.wordpress);
|
|
60
60
|
this.email = new EmailService(this.wordpress);
|
|
61
61
|
this.logger = this.createLogger();
|
package/dist/kizlo.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ interface KizloConfig<TIntegrations extends readonly AnyIntegration[]> {
|
|
|
14
14
|
integrations?: TIntegrations;
|
|
15
15
|
logging?: false | LogLevel;
|
|
16
16
|
credentials: WordPressCredentials;
|
|
17
|
-
|
|
17
|
+
introspection?: object;
|
|
18
18
|
}
|
|
19
19
|
type RootProcedures<TIntegrations extends readonly AnyIntegration[]> = InferIntegrationProcedures<TIntegrations> & CoreProcedures;
|
|
20
20
|
type S2SClient<TIntegrations extends readonly AnyIntegration[]> = ResultClient<RootProcedures<TIntegrations>>;
|
|
@@ -41,21 +41,18 @@ interface CreateKizloOptions<TIntegrations extends readonly AnyIntegration[] = [
|
|
|
41
41
|
/** Enable Kizlo's built-in console logger at this level. */
|
|
42
42
|
logging?: false | LogLevel;
|
|
43
43
|
/**
|
|
44
|
-
* The generated
|
|
45
|
-
* `
|
|
46
|
-
* `wordpressUsername`, and `wordpressPassword` values contributed by integrations.
|
|
44
|
+
* The generated WordPress introspection tree to run the typed client against. Pass the
|
|
45
|
+
* `introspection` export of your generated barrel. WordPress credentials resolve from the
|
|
46
|
+
* `wordpressUrl`, `wordpressUsername`, and `wordpressPassword` values contributed by integrations.
|
|
47
47
|
*/
|
|
48
|
-
|
|
49
|
-
endpoints?: object;
|
|
50
|
-
credentials?: Partial<WordPressCredentials>;
|
|
51
|
-
};
|
|
48
|
+
introspection?: object;
|
|
52
49
|
}
|
|
53
50
|
/**
|
|
54
51
|
* Compose environment sources without letting `undefined` erase an earlier value, then resolve
|
|
55
52
|
* Kizlo's active WordPress connection from the canonical `mode` value.
|
|
56
53
|
*/
|
|
57
54
|
declare function integrationEnv(integrations: readonly AnyIntegration[]): EnvReader;
|
|
58
|
-
declare function resolveWordPressConnection(
|
|
55
|
+
declare function resolveWordPressConnection(env: EnvReader): {
|
|
59
56
|
credentials: WordPressCredentials;
|
|
60
57
|
};
|
|
61
58
|
/**
|
package/dist/kizlo.js
CHANGED
|
@@ -30,7 +30,7 @@ var Kizlo = class {
|
|
|
30
30
|
adapters: integrations.adapters,
|
|
31
31
|
siteSecret: config.siteSecret,
|
|
32
32
|
credentials: config.credentials,
|
|
33
|
-
|
|
33
|
+
introspection: config.introspection,
|
|
34
34
|
integrationPlugins: integrations.plugins
|
|
35
35
|
});
|
|
36
36
|
this.procedures = Object.assign(Object.assign({}, {
|
|
@@ -105,7 +105,7 @@ var Kizlo = class {
|
|
|
105
105
|
if (reservedIds.has(integration.id)) throw new KizloError("INTEGRATION_ID_CONFLICT", { message: `The integration id "${integration.id}" is reserved by Kizlo. Choose a different integration id.` });
|
|
106
106
|
if (integrationIds.has(integration.id)) throw new KizloError("INTEGRATION_ID_CONFLICT", { message: `The integration id "${integration.id}" is registered more than once. Give every integration a unique id.` });
|
|
107
107
|
integrationIds.add(integration.id);
|
|
108
|
-
if (!generating) assertIntegrationEndpoints(integration, this.config.
|
|
108
|
+
if (!generating) assertIntegrationEndpoints(integration, this.config.introspection ?? {});
|
|
109
109
|
plugins.push(...integration.requires?.plugins ?? []);
|
|
110
110
|
if (integration.procedures && Object.keys(integration.procedures).length > 0) procedures[integration.id] = integration.procedures;
|
|
111
111
|
for (const handler of integration.events ?? []) events.push(handler);
|
|
@@ -161,12 +161,11 @@ function requireEnvValue(name, env) {
|
|
|
161
161
|
if (isContractGeneration()) return "";
|
|
162
162
|
throw new KizloError("MISSING_ENV_VALUE", { message: `Kizlo requires the "${name}" environment value. Provide it through an integration or an explicit createKizlo option.` });
|
|
163
163
|
}
|
|
164
|
-
function resolveWordPressConnection(
|
|
165
|
-
const credentials = options?.wordpress?.credentials;
|
|
164
|
+
function resolveWordPressConnection(env) {
|
|
166
165
|
return { credentials: {
|
|
167
|
-
url:
|
|
168
|
-
username:
|
|
169
|
-
password:
|
|
166
|
+
url: requireEnvValue("wordpressUrl", env),
|
|
167
|
+
username: requireEnvValue("wordpressUsername", env),
|
|
168
|
+
password: requireEnvValue("wordpressPassword", env)
|
|
170
169
|
} };
|
|
171
170
|
}
|
|
172
171
|
/**
|
|
@@ -176,14 +175,14 @@ function resolveKizloConfig(options) {
|
|
|
176
175
|
const integrations = options?.integrations ?? [];
|
|
177
176
|
const env = integrationEnv(integrations);
|
|
178
177
|
if (!isContractGeneration()) for (const integration of integrations) assertIntegrationEnv(integration, env);
|
|
179
|
-
const { credentials } = resolveWordPressConnection(
|
|
178
|
+
const { credentials } = resolveWordPressConnection(env);
|
|
180
179
|
return {
|
|
181
180
|
baseUrl: options?.baseUrl ?? requireEnvValue("baseUrl", env),
|
|
182
181
|
siteSecret: options?.siteSecret ?? requireEnvValue("siteSecret", env),
|
|
183
182
|
integrations,
|
|
184
183
|
logging: options?.logging,
|
|
185
184
|
credentials,
|
|
186
|
-
|
|
185
|
+
introspection: options?.introspection
|
|
187
186
|
};
|
|
188
187
|
}
|
|
189
188
|
/**
|
package/dist/package.js
CHANGED
package/dist/procedures.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ declare const CORE_PROCEDURES: {
|
|
|
44
44
|
include?: string | number | (string | number)[] | undefined;
|
|
45
45
|
offset?: string | number | undefined;
|
|
46
46
|
order?: "asc" | "desc" | undefined;
|
|
47
|
-
orderby?: "
|
|
47
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | undefined;
|
|
48
48
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
49
49
|
slug?: string | string[] | undefined;
|
|
50
50
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -99,7 +99,7 @@ declare const CORE_PROCEDURES: {
|
|
|
99
99
|
include?: string | number | (string | number)[] | undefined;
|
|
100
100
|
offset?: string | number | undefined;
|
|
101
101
|
order?: "asc" | "desc" | undefined;
|
|
102
|
-
orderby?: "
|
|
102
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
103
103
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
104
104
|
slug?: string | string[] | undefined;
|
|
105
105
|
parent?: string | number | (string | number)[] | undefined;
|
|
@@ -136,7 +136,7 @@ declare const CORE_PROCEDURES: {
|
|
|
136
136
|
exclude?: string | number | (string | number)[] | undefined;
|
|
137
137
|
include?: string | number | (string | number)[] | undefined;
|
|
138
138
|
order?: "asc" | "desc" | undefined;
|
|
139
|
-
orderBy?: "
|
|
139
|
+
orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
|
|
140
140
|
hideEmpty?: string | boolean | undefined;
|
|
141
141
|
parent?: string | number | undefined;
|
|
142
142
|
post?: string | number | undefined;
|
|
@@ -172,7 +172,7 @@ declare const CORE_PROCEDURES: {
|
|
|
172
172
|
exclude?: string | number | (string | number)[] | undefined;
|
|
173
173
|
include?: string | number | (string | number)[] | undefined;
|
|
174
174
|
order?: "asc" | "desc" | undefined;
|
|
175
|
-
orderBy?: "
|
|
175
|
+
orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
|
|
176
176
|
hideEmpty?: string | boolean | undefined;
|
|
177
177
|
post?: string | number | undefined;
|
|
178
178
|
slug?: string | string[] | undefined;
|
|
@@ -292,7 +292,7 @@ declare const CORE_PROCEDURES: {
|
|
|
292
292
|
include?: string | number | (string | number)[] | undefined;
|
|
293
293
|
offset?: string | number | undefined;
|
|
294
294
|
order?: "asc" | "desc" | undefined;
|
|
295
|
-
orderby?: "
|
|
295
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
296
296
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
297
297
|
slug?: string | string[] | undefined;
|
|
298
298
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -371,7 +371,7 @@ declare const CORE_PROCEDURES: {
|
|
|
371
371
|
include?: string | number | (string | number)[] | undefined;
|
|
372
372
|
offset?: string | number | undefined;
|
|
373
373
|
order?: "asc" | "desc" | undefined;
|
|
374
|
-
orderby?: "
|
|
374
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
375
375
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
376
376
|
slug?: string | string[] | undefined;
|
|
377
377
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -507,7 +507,7 @@ declare const CORE_PROCEDURES: {
|
|
|
507
507
|
include?: string | number | (string | number)[] | undefined;
|
|
508
508
|
offset?: string | number | undefined;
|
|
509
509
|
order?: "asc" | "desc" | undefined;
|
|
510
|
-
orderby?: "
|
|
510
|
+
orderby?: "date" | "id" | "parent" | "include" | "post" | undefined;
|
|
511
511
|
parent?: string | number | (string | number)[] | undefined;
|
|
512
512
|
parentExclude?: string | number | (string | number)[] | undefined;
|
|
513
513
|
post?: string | number | (string | number)[] | undefined;
|
package/dist/test.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DevPluginSource, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, JsonValue, LocalPlugin, PluginSource, SeedContext, SettleContext, TestAdminUser, TestCredentials, TestUser, defineFixture, isLocalPlugin } from "./cli/wp/types.js";
|
|
2
|
-
import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
|
|
2
|
+
import { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease } from "./cli/wp/constants.js";
|
|
3
3
|
import { DockerStack, DockerStatus, RunResult, Stack, StackStatus, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, runningProjectContainers, stackStatus, stopProjectContainers, wpCli, wpEval } from "./cli/wp/docker.js";
|
|
4
4
|
import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource, settleFixtures } from "./cli/wp/utils.js";
|
|
5
5
|
import { TestAuthAdapterUser, toTestUser } from "./test/users.js";
|
|
@@ -8,4 +8,4 @@ import { CAPTCHA_TEST_TOKEN_PASS, captchaMock } from "./test/captcha.js";
|
|
|
8
8
|
import { menuFixture } from "./menu/fixture.js";
|
|
9
9
|
import { postFixture } from "./post/fixture.js";
|
|
10
10
|
import { coreFixtures } from "./test/fixtures.js";
|
|
11
|
-
export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, DevPluginSource, DockerStack, DockerStatus, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, INTROSPECTION_META_REL, JsonValue, LOCAL_DIR_REL, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, SettleContext, Stack, StackStatus, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
|
|
11
|
+
export { APACHE_LISTEN_CONF, CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, DevPluginSource, DockerStack, DockerStatus, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, INTROSPECTION_META_REL, JsonValue, LOCAL_DIR_REL, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, SettleContext, Stack, StackStatus, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, UPLOADS_INI, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
|
package/dist/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineFixture, isLocalPlugin } from "./cli/wp/types.js";
|
|
2
|
-
import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
|
|
2
|
+
import { APACHE_LISTEN_CONF, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, githubRelease, kizloRelease } from "./cli/wp/constants.js";
|
|
3
3
|
import { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, runningProjectContainers, stackStatus, stopProjectContainers, wpCli, wpEval } from "./cli/wp/docker.js";
|
|
4
4
|
import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource, settleFixtures } from "./cli/wp/utils.js";
|
|
5
5
|
import { testAuthAdapter } from "./test/auth.js";
|
|
@@ -9,4 +9,4 @@ import { postFixture } from "./post/fixture.js";
|
|
|
9
9
|
import { coreFixtures } from "./test/fixtures.js";
|
|
10
10
|
import { toTestUser } from "./test/users.js";
|
|
11
11
|
|
|
12
|
-
export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
|
|
12
|
+
export { APACHE_LISTEN_CONF, CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DEFAULT_WORDPRESS_TAG, INTROSPECTION_META_REL, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, UPLOADS_INI, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, dockerHint, dockerStatus, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, runningProjectContainers, settleFixtures, stackStatus, stopProjectContainers, testAuthAdapter, toTestUser, wpCli, wpEval };
|
|
@@ -383,7 +383,7 @@ function renderRegistries(tree, document) {
|
|
|
383
383
|
return [
|
|
384
384
|
`declare module "kizlo" {`,
|
|
385
385
|
`\tinterface WordPressClientRegistry {`,
|
|
386
|
-
`\t\
|
|
386
|
+
`\t\tintrospection: typeof introspection`,
|
|
387
387
|
`\t}`,
|
|
388
388
|
`\tinterface WordPressEndpointRegistry {`,
|
|
389
389
|
...endpoints,
|
|
@@ -431,8 +431,8 @@ function generateWordPressModule(document) {
|
|
|
431
431
|
const endpointBody = renderEndpointNode(tree, " ");
|
|
432
432
|
const moduleBody = [
|
|
433
433
|
body,
|
|
434
|
-
`export const
|
|
435
|
-
`export type WordPressClient = WP_Client<typeof
|
|
434
|
+
`export const introspection = ${endpointBody}`,
|
|
435
|
+
`export type WordPressClient = WP_Client<typeof introspection>`,
|
|
436
436
|
renderRegistries(tree, document)
|
|
437
437
|
].join(DECLARATION_SEPARATOR);
|
|
438
438
|
const imports = `import { ${kizloImports(moduleBody, endpointBody !== "{}")} } from "kizlo"`;
|
|
@@ -48,7 +48,7 @@ interface WordPressCustomFieldsRegistry {}
|
|
|
48
48
|
* so a freshly scaffolded project compiles against endpoints it has not described yet.
|
|
49
49
|
*/
|
|
50
50
|
type ActiveWordPressClient = WordPressClientRegistry extends {
|
|
51
|
-
|
|
51
|
+
introspection: infer TEndpoints extends object;
|
|
52
52
|
} ? WP_Client<TEndpoints> & WordPressTransport : WordPressTransport;
|
|
53
53
|
/** Every raw WordPress operation path generated for the active project. */
|
|
54
54
|
type WP_EndpointPath = keyof WordPressEndpointRegistry extends never ? string : Extract<keyof WordPressEndpointRegistry, string>;
|