kizlo 0.9.1 → 0.10.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.
@@ -3,9 +3,8 @@ import { DEFAULT_PLUGINS, TEST_ADMIN } from "./constants.js";
3
3
  import { compose, composePull, composeUp, wpCli } from "./docker.js";
4
4
  import { ensurePlugins } from "./utils.js";
5
5
  import { createAdminAppPassword, seedUsers } from "./bootstrap.js";
6
- import { prepareByo } from "./byo.js";
7
6
  import { join } from "node:path";
8
- import { existsSync, rmSync } from "node:fs";
7
+ import { existsSync } from "node:fs";
9
8
  import { networkInterfaces } from "node:os";
10
9
  import { randomBytes } from "node:crypto";
11
10
 
@@ -19,7 +18,7 @@ function lanAddress() {
19
18
  for (const ifaces of Object.values(networkInterfaces())) for (const iface of ifaces ?? []) if (iface.family === "IPv4" && !iface.internal) return iface.address;
20
19
  }
21
20
  /**
22
- * The URL the dev stack is provisioned at. We prefer the router-assigned LAN address over `localhost`
21
+ * The URL local WordPress is provisioned at. We prefer the router-assigned LAN address over `localhost`
23
22
  * so it's reachable from off the host (the app in a container or on another device). Serving WordPress
24
23
  * under the request host is already handled by the container's `WORDPRESS_CONFIG_EXTRA` (it derives
25
24
  * `WP_HOME`/`WP_SITEURL` from `HTTP_HOST` per request), so this is only the address we write into `.env`
@@ -29,7 +28,7 @@ function devUrl(port) {
29
28
  return `http://${lanAddress() ?? "localhost"}:${port}`;
30
29
  }
31
30
  /**
32
- * Seed `dev.fixtures` into a freshly installed dev stack, reusing the test seeding
31
+ * Seed `dev.fixtures` into freshly installed local WordPress, reusing the test seeding
33
32
  * primitives: seed the default subscriber so `ctx.userId` exists, then run each `seed`
34
33
  * over REST. Plugins are already active (`bootstrapDev` ensures them before seeding).
35
34
  * The application password is minted only to drive seeding here — it's never printed
@@ -61,22 +60,18 @@ async function seedDevFixtures(cfg, url) {
61
60
  return seeded;
62
61
  }
63
62
  /**
64
- * Boot the dev stack via docker + wp-cli. A fresh stack is provisioned one of two ways:
65
- * a default `wp core install`, or — when `dev.byo` points at an archive — hydrated from
66
- * that existing site (files + database). Either way it then sets permalinks and ensures
67
- * the `dev.fixtures` plugins (installed sources + bind-mounted locals). An already-provisioned
68
- * stack is left untouched (idempotent reruns).
63
+ * Boot local WordPress via docker + wp-cli. A fresh install is provisioned with a default
64
+ * `wp core install`, then sets permalinks and ensures the `dev.fixtures` plugins (installed
65
+ * sources + bind-mounted locals). An already-provisioned install is left untouched
66
+ * (idempotent reruns).
69
67
  *
70
- * Credentials are an output, not a stored file: a default fresh install mints a random
71
- * admin password and returns it once (to log into wp-admin); a BYO install uses the
72
- * imported site's own users. No application password is minted — that's a test-stack
73
- * concern.
68
+ * Credentials are an output, not a stored file: a fresh install mints a random admin
69
+ * password and returns it once (to log into wp-admin). No application password is minted —
70
+ * that's a test concern.
74
71
  */
75
72
  async function bootstrapDev(cfg) {
76
73
  const url = devUrl(cfg.port);
77
- const fresh = !existsSync(join(cfg.wordpressDir, "wp-includes", "version.php"));
78
- const byo = fresh && cfg.byo ? await prepareByo(cfg.byo, cfg.wordpressDir, cfg.configDir) : void 0;
79
- if (fresh && !byo) await composePull(["wordpress", "wp-cli"]).catch(() => void 0);
74
+ if (!existsSync(join(cfg.wordpressDir, "wp-includes", "version.php"))) await composePull(["wordpress", "wp-cli"]).catch(() => void 0);
80
75
  await composeUp();
81
76
  const installed = (await compose([
82
77
  "exec",
@@ -87,46 +82,7 @@ async function bootstrapDev(cfg) {
87
82
  "is-installed"
88
83
  ])).code === 0;
89
84
  let password;
90
- let imported = false;
91
- if (!installed && byo) {
92
- imported = true;
93
- if (byo.prefix !== "wp_") await wpCli([
94
- "config",
95
- "set",
96
- "table_prefix",
97
- byo.prefix,
98
- "--type=variable"
99
- ]);
100
- const imp = await compose([
101
- "exec",
102
- "-T",
103
- "mysql",
104
- "mysql",
105
- "-uwordpress",
106
- "-pwppass",
107
- "wordpress"
108
- ], { inputFile: byo.sqlPath });
109
- if (imp.code !== 0) throw new Error(`importing dev.byo database failed:\n${imp.stderr || imp.stdout}`);
110
- rmSync(byo.sqlPath, { force: true });
111
- const oldUrl = await wpCli([
112
- "option",
113
- "get",
114
- "siteurl"
115
- ]).catch(() => "");
116
- if (oldUrl && oldUrl !== url) await wpCli([
117
- "search-replace",
118
- oldUrl,
119
- url,
120
- "--all-tables",
121
- "--skip-columns=guid",
122
- "--report-changed-only"
123
- ]);
124
- await wpCli([
125
- "rewrite",
126
- "flush",
127
- "--hard"
128
- ]);
129
- } else if (!installed) {
85
+ if (!installed) {
130
86
  password = generatePassword();
131
87
  await wpCli([
132
88
  "core",
@@ -146,13 +102,12 @@ async function bootstrapDev(cfg) {
146
102
  ]);
147
103
  }
148
104
  await ensurePlugins([...DEFAULT_PLUGINS, ...cfg.fixtures.flatMap((fixture) => fixture.plugins ?? [])]);
149
- const seeded = !installed && !byo && cfg.fixtures.length ? await seedDevFixtures(cfg, url) : 0;
105
+ const seeded = !installed && cfg.fixtures.length ? await seedDevFixtures(cfg, url) : 0;
150
106
  const appPassword = password ? await createAdminAppPassword("kizlo-dev") : void 0;
151
107
  return {
152
108
  url,
153
109
  username: TEST_ADMIN.username,
154
110
  dbPort: cfg.dbPort,
155
- imported,
156
111
  seeded,
157
112
  appPassword,
158
113
  secrets: password ? { password } : void 0
@@ -41,10 +41,22 @@ interface RunResult {
41
41
  stderr: string;
42
42
  }
43
43
  /**
44
- * Whether the Docker daemon is reachable. `docker version` contacts the server (not just
45
- * the client), so a non-zero exit means the daemon is down or Docker isn't installed —
46
- * the early check before a command that needs a stack (e.g. `init`'s local setup).
44
+ * Docker's readiness in three states, so callers can tell "not installed" from "installed but not
45
+ * running" and say the right thing:
46
+ * - `missing` — the `docker` binary isn't on PATH (`docker --version` errors).
47
+ * - `stopped` — the client is installed but the daemon is unreachable (`docker version` fails).
48
+ * - `running` — the daemon answered, so a stack can boot.
47
49
  */
50
+ type DockerStatus = "missing" | "stopped" | "running";
51
+ /**
52
+ * Probe Docker in two steps: `docker --version` only touches the client (is it installed?), then
53
+ * `docker version` contacts the server (is the daemon up?). Used before any command that needs local
54
+ * WordPress, so the caller can distinguish an install problem from a "start Docker" problem.
55
+ */
56
+ declare function dockerStatus(): Promise<DockerStatus>;
57
+ /** The one-line fix to print when Docker isn't ready — install it, or start the daemon. */
58
+ declare function dockerHint(status: "missing" | "stopped"): string;
59
+ /** Whether the Docker daemon is reachable — the early check before a command that needs a stack. */
48
60
  declare function dockerAvailable(): Promise<boolean>;
49
61
  /** Build a stack-bound docker helper and mark it active for the bare helpers below. */
50
62
  declare function createStack(stack: Stack): DockerStack;
@@ -65,4 +77,4 @@ declare const composeStop: (opts?: {
65
77
  /** Run a wp-cli command against the active stack's warm `wp-cli` container. */
66
78
  declare const wpCli: (args: string[]) => Promise<string>;
67
79
  //#endregion
68
- export { DockerStack, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli };
80
+ export { DockerStack, DockerStatus, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, wpCli };
@@ -33,17 +33,30 @@ function run(cmd, args, env, opts) {
33
33
  });
34
34
  }
35
35
  /**
36
- * Whether the Docker daemon is reachable. `docker version` contacts the server (not just
37
- * the client), so a non-zero exit means the daemon is down or Docker isn't installed —
38
- * the early check before a command that needs a stack (e.g. `init`'s local setup).
36
+ * Probe Docker in two steps: `docker --version` only touches the client (is it installed?), then
37
+ * `docker version` contacts the server (is the daemon up?). Used before any command that needs local
38
+ * WordPress, so the caller can distinguish an install problem from a "start Docker" problem.
39
39
  */
40
- async function dockerAvailable() {
40
+ async function dockerStatus() {
41
+ try {
42
+ if ((await run("docker", ["--version"], process.env)).code !== 0) return "missing";
43
+ } catch {
44
+ return "missing";
45
+ }
41
46
  try {
42
- return (await run("docker", ["version"], process.env)).code === 0;
47
+ return (await run("docker", ["version"], process.env)).code === 0 ? "running" : "stopped";
43
48
  } catch {
44
- return false;
49
+ return "stopped";
45
50
  }
46
51
  }
52
+ /** The one-line fix to print when Docker isn't ready — install it, or start the daemon. */
53
+ function dockerHint(status) {
54
+ return status === "missing" ? "Docker isn't installed. Install it from https://docs.docker.com/get-docker/, then re-run." : "Docker is installed but not running. Start Docker (Docker Desktop, or `sudo systemctl start docker`) and re-run.";
55
+ }
56
+ /** Whether the Docker daemon is reachable — the early check before a command that needs a stack. */
57
+ async function dockerAvailable() {
58
+ return await dockerStatus() === "running";
59
+ }
47
60
  function bind(stack) {
48
61
  const base = [
49
62
  "compose",
@@ -131,4 +144,4 @@ const composeStop = (opts) => activeStack().composeStop(opts);
131
144
  const wpCli = (args) => activeStack().wpCli(args);
132
145
 
133
146
  //#endregion
134
- export { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli };
147
+ export { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, wpCli };
@@ -18,7 +18,7 @@ function originOf(url) {
18
18
  }
19
19
  }
20
20
  /**
21
- * Rewrite a loopback host to `host.docker.internal` so the dockerized WordPress dev stack can reach a
21
+ * Rewrite a loopback host to `host.docker.internal` so the dockerized local WordPress can reach a
22
22
  * Kizlo server on the host (the container's own `localhost` is not the host). Non-loopback hosts (real
23
23
  * deployments) and unparseable URLs are returned unchanged.
24
24
  */
@@ -8,7 +8,7 @@ import { mkdirSync, writeFileSync } from "node:fs";
8
8
  /**
9
9
  * Phase 2 — after bootstrap, build a `SeedContext` and run each `Fixture.seed`
10
10
  * over REST, collecting namespaced fixtures, then write the credentials artifact
11
- * at `<config-dir>/.kizlo/test-credentials.json`. Returns a teardown that runs
11
+ * at `<config-dir>/.kizlo/test.json`. Returns a teardown that runs
12
12
  * each fixture's `cleanup`.
13
13
  */
14
14
  async function runSeeds(config) {
@@ -10,7 +10,7 @@ function localMounts(fixtures) {
10
10
  /**
11
11
  * The test stack: the base compose file under a `<name>-test` project, plus a generated
12
12
  * mount override when any fixture carries a local (`{ path }`) plugin — so the same
13
- * fixtures bind-mount their live plugin source here exactly as in the dev stack.
13
+ * fixtures bind-mount their live plugin source here exactly as in local WordPress.
14
14
  */
15
15
  function testStack(cfg) {
16
16
  const mounts = localMounts(cfg.fixtures);
@@ -36,9 +36,9 @@ function detectHostUser() {
36
36
  };
37
37
  }
38
38
  /**
39
- * The dev stack: the base compose file plus the generated mount override, under a
40
- * `<name>-dev` project. Building the stack (re)writes the override so it always
41
- * matches the current `dev.path` and the `dev.fixtures` local plugins.
39
+ * Local WordPress: the base compose file plus the generated mount override, under a
40
+ * `<name>-dev` project. Building it (re)writes the override so it always matches the
41
+ * install folder (`.kizlo/local`) and the `dev.fixtures` local plugins.
42
42
  */
43
43
  function devStack(cfg) {
44
44
  const override = writeDevOverride(cfg.configDir, {
package/dist/config.d.ts CHANGED
@@ -4,44 +4,41 @@ import "./test.js";
4
4
  //#region src/config.d.ts
5
5
  interface KizloDevConfig {
6
6
  /**
7
- * Folder where your local WordPress install lives, relative to the config dir.
8
- * The entire install (core, themes, uploads, plugins) is bind-mounted here, so
9
- * you browse and edit every file from your file manager and your changes are
10
- * live. This is your persistent dev site — pick a real, visible folder (e.g.
11
- * `"wordpress"`), not a hidden one, and don't delete it. `reset` wipes it.
7
+ * Run local WordPress under `kizlo dev`. When `true`, `kizlo dev` boots a Docker WordPress in
8
+ * `.kizlo/local` alongside the contract watcher; when unset or `false`, it runs the watcher alone
9
+ * (for a project pointing at your own WordPress). Set for you by `kizlo create` / `kizlo init`
10
+ * when you choose local WordPress.
12
11
  */
13
- path: string;
12
+ local?: boolean;
14
13
  /** Published WP port (default 8080). */
15
14
  port?: number;
16
15
  /**
17
- * Adopt an existing WordPress site instead of provisioning a blank one. Points at a
18
- * `.tar.gz` archive (path relative to the config dir) whose root holds a `wordpress/`
19
- * directory (the install) and a single `.sql` dump (the database). Applied when the
20
- * stack is fresh — the first `kizlo dev`, or after a `kizlo dev reset` — and ignored
21
- * once the stack is provisioned. Keep the archive outside `path` (reset wipes that).
22
- */
23
- byo?: string;
24
- /**
25
- * Host port the dev MySQL is published on (default 3307), bound to `127.0.0.1` so
16
+ * Host port the local WordPress MySQL is published on (default 3307), bound to `127.0.0.1` so
26
17
  * you can point a SQL client (TablePlus, DBeaver, `mysql`) at the database to
27
18
  * inspect or edit tables directly. Connect with db `wordpress`, user `wordpress`,
28
- * password `wppass`. Pick a port that's free — change it if you run multiple stacks
19
+ * password `wppass`. Pick a port that's free — change it if you run multiple projects
29
20
  * or already have MySQL on the default.
30
21
  */
31
22
  dbPort?: number;
32
23
  /**
33
- * Code-defined seed data for a **fresh** dev stack — the same {@link Fixture}s the
34
- * test stack uses, so you can populate your dev site from versioned code instead of a
24
+ * Code-defined seed data for a **fresh** local WordPress — the same {@link Fixture}s the
25
+ * test environment uses, so you can populate your local site from versioned code instead of a
35
26
  * blank install. Each fixture also declares the plugins it needs — wp.org slugs / zip
36
27
  * sources to install, or `{ path }` local directories bind-mounted live so your edits
37
- * show up without a reinstall — which the dev stack ensures every run. Each fixture's
28
+ * show up without a reinstall — which `kizlo dev` ensures every run. Each fixture's
38
29
  * `seed` runs once over REST (and may drop to wp-cli) on the first `kizlo dev` and
39
- * after `kizlo dev reset`; existing stacks are left alone. Mutually exclusive with
40
- * {@link byo} (which brings its own data).
30
+ * after `kizlo dev reset`; an existing install is left alone.
41
31
  */
42
32
  fixtures?: Fixture[];
43
33
  }
44
34
  interface KizloTestConfig {
35
+ /**
36
+ * Run local WordPress under `kizlo test`. When `true`, `kizlo test` boots a disposable Docker
37
+ * WordPress, seeds it, and runs your suite against it; when unset or `false`, `kizlo test` just
38
+ * runs your project's test script. Set for you by `kizlo create` / `kizlo init` when you choose
39
+ * local WordPress.
40
+ */
41
+ local?: boolean;
45
42
  /** Published WP port (default 8889). */
46
43
  port?: number;
47
44
  /** Extension fixtures to install + seed. */
@@ -75,9 +72,9 @@ interface KizloGlobalConfig {
75
72
  * to the sanitized `package.json` name, falling back to the config dir basename.
76
73
  */
77
74
  name?: string;
78
- /** Local WordPress dev stack used by `kizlo dev`. */
75
+ /** Local WordPress and contract watcher run by `kizlo dev`. */
79
76
  dev?: KizloDevConfig;
80
- /** WordPress test environment used by `kizlo test`. */
77
+ /** WordPress test environment run by `kizlo test`. */
81
78
  test?: KizloTestConfig;
82
79
  }
83
80
  declare function defineConfig(config: KizloGlobalConfig): KizloGlobalConfig;
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ import { COMMON_ERRORS, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, Def
39
39
  import { AnyMiddleware, ExtractMiddlewareContextOutput, InferMiddlewares, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, createMiddleware } from "./shared/middleware.js";
40
40
  import { AnyProcedure, AnyProcedureRouter, BaseHandlerOptions, ExtractParams, ExtractProcedureByScope, InvocationScope, OpenapiPart, Procedure, ProcedureErrors, ProcedureHandler, ProcedureOptions, ResolveParamsPart, ResolvedSchemaInput, ResolvedSchemaOutput, RouterDepthTuple, SchemaIO, buildProcedure, combineDetailed, createProcedure, handleUnexpectedError, schemaType } from "./shared/procedure.js";
41
41
  import { AnyExtension, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, InferExtensionRouter, createExtension } from "./shared/extension.js";
42
- import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloTarget, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig } from "./kizlo.js";
42
+ import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloConnect, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig } from "./kizlo.js";
43
43
  import { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute } from "./brand/manifest.js";
44
44
  import "./brand/index.js";
45
45
  import { KizloClient, KizloClientConfig, createKizloClient } from "./client.js";
@@ -52,4 +52,4 @@ import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
52
52
  import { Identifier, parseIdentifier } from "./shared/identifier.js";
53
53
  import { createOrpcRouter } from "./shared/router.js";
54
54
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
55
- export { AnyContext, AnyEventSchema, AnyEvents, AnyExtension, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureRouter, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CaptchaAdapter, CategoryService, CommentService, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, Environment, ErrorDefinition, EventHandler, EventHandlerFn, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferExtensionRouter, InferMiddlewares, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloError, KizloErrorOptions, KizloTarget, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeOptionalOptions, Media, MenuItemService, MenuService, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PageService, PersonSettings, PersonSettingsInput, PluginSource, PostService, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, ROUTER_MAP, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootRouter, RouterDepthTuple, RouterMap, S2SClient, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, Settings, SettingsService, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UNEXPECTED_BODY_SNIPPET_LENGTH, UploadsSettings, UploadsSettingsInput, UserService, VerifyCaptchaFn, VerifyPreviewTokenFn, WC_CORE_BASE, WC_STORE_BASE, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CATEGORY_ORDER_BYS, WP_CORE_BASE, WP_Category, WP_CategoryCreateErrorCode, WP_CategoryCreateInput, WP_CategoryDeleteErrorCode, WP_CategoryDeleteInput, WP_CategoryDeleteResponse, WP_CategoryLinks, WP_CategoryListErrorCode, WP_CategoryListInput, WP_CategoryOrderBy, WP_CategoryRetrieveErrorCode, WP_CategoryRetrieveInput, WP_CategoryTaxonomy, WP_CategoryUpdateErrorCode, WP_CategoryUpdateInput, WP_Comment, WP_CommentAvatarUrls, WP_CommentContent, WP_CommentContentInput, WP_CommentCreateErrorCode, WP_CommentCreateInput, WP_CommentDeleteErrorCode, WP_CommentDeleteInput, WP_CommentDeleteResponse, WP_CommentLinks, WP_CommentListErrorCode, WP_CommentListInput, WP_CommentOrderBy, WP_CommentRetrieveErrorCode, WP_CommentRetrieveInput, WP_CommentStatus, WP_CommentStatusFilter, WP_CommentStatusInput, WP_CommentType, WP_CommentUpdateErrorCode, WP_CommentUpdateInput, WP_CommonErrorCode, WP_Context, WP_CurrencyFormat, WP_Error, WP_ErrorData, WP_KIZLO_BASE, WP_Link, WP_List, WP_ListMetadata, WP_ListOrder, WP_MENU_ITEM_ORDER_BYES, WP_MENU_ITEM_TARGETS, WP_MENU_ITEM_TAX_RELATIONS, WP_Menu, WP_MenuCreateErrorCode, WP_MenuCreateInput, WP_MenuDeleteErrorCode, WP_MenuDeleteInput, WP_MenuDeleteResponse, WP_MenuItem, WP_MenuItemCreateErrorCode, WP_MenuItemCreateInput, WP_MenuItemDeleteErrorCode, WP_MenuItemDeleteInput, WP_MenuItemDeleteResponse, WP_MenuItemLinks, WP_MenuItemListErrorCode, WP_MenuItemListInput, WP_MenuItemOrderBy, WP_MenuItemRetrieveErrorCode, WP_MenuItemRetrieveInput, WP_MenuItemStatus, WP_MenuItemStatusFilter, WP_MenuItemTarget, WP_MenuItemTaxRelation, WP_MenuItemTitle, WP_MenuItemTitleInput, WP_MenuItemType, WP_MenuItemUpdateErrorCode, WP_MenuItemUpdateInput, WP_MenuLinks, WP_MenuListErrorCode, WP_MenuListInput, WP_MenuOrderBy, WP_MenuRetrieveErrorCode, WP_MenuRetrieveInput, WP_MenuUpdateErrorCode, WP_MenuUpdateInput, WP_PAGE_ORDER_BYES, WP_PAGE_STATUSES, WP_POST_FORMATS, WP_POST_ORDER_BYES, WP_POST_STATUSES, WP_POST_TAX_RELATIONS, WP_Page, WP_PageCommentStatus, WP_PageContent, WP_PageContentInput, WP_PageCreateErrorCode, WP_PageCreateInput, WP_PageDeleteErrorCode, WP_PageDeleteInput, WP_PageDeleteResponse, WP_PageExcerpt, WP_PageExcerptInput, WP_PageGuid, WP_PageLinks, WP_PageListErrorCode, WP_PageListInput, WP_PageOrderBy, WP_PageRetrieveErrorCode, WP_PageRetrieveInput, WP_PageStatus, WP_PageStatusFilter, WP_PageTitle, WP_PageTitleInput, WP_PageUpdateErrorCode, WP_PageUpdateInput, WP_Post, WP_PostCommentStatus, WP_PostContent, WP_PostContentInput, WP_PostCreateErrorCode, WP_PostCreateInput, WP_PostDeleteErrorCode, WP_PostDeleteInput, WP_PostDeleteResponse, WP_PostExcerpt, WP_PostExcerptInput, WP_PostFormat, WP_PostGuid, WP_PostLinks, WP_PostListErrorCode, WP_PostListInput, WP_PostOrderBy, WP_PostRetrieveErrorCode, WP_PostRetrieveInput, WP_PostStatus, WP_PostStatusFilter, WP_PostTaxRelation, WP_PostTitle, WP_PostTitleInput, WP_PostUpdateErrorCode, WP_PostUpdateInput, WP_RequestInput, WP_Result, WP_TAG_ORDER_BYS, WP_Tag, WP_TagCreateErrorCode, WP_TagCreateInput, WP_TagDeleteErrorCode, WP_TagDeleteInput, WP_TagDeleteResponse, WP_TagLinks, WP_TagListErrorCode, WP_TagListInput, WP_TagOrderBy, WP_TagRetrieveErrorCode, WP_TagRetrieveInput, WP_TagTaxonomy, WP_TagUpdateErrorCode, WP_TagUpdateInput, WP_User, WP_UserAvatarUrls, WP_UserCapabilities, WP_UserCreateErrorCode, WP_UserCreateInput, WP_UserDeleteErrorCode, WP_UserDeleteInput, WP_UserDeleteMeErrorCode, WP_UserDeleteMeInput, WP_UserDeleteMeResponse, WP_UserDeleteResponse, WP_UserLinks, WP_UserListErrorCode, WP_UserListInput, WP_UserOrderBy, WP_UserRetrieveErrorCode, WP_UserRetrieveInput, WP_UserRetrieveMeErrorCode, WP_UserRetrieveMeInput, WP_UserUpdateErrorCode, WP_UserUpdateInput, WP_UserUpdateMeErrorCode, WP_UserUpdateMeInput, WP_UserWho, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressCredentials, WordPressService, altcha, arkose, authMock, buildProcedure, buildWebManifest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, parseSitemapSlug, recaptcha, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, xmlResponse };
55
+ export { AnyContext, AnyEventSchema, AnyEvents, AnyExtension, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureRouter, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CaptchaAdapter, CategoryService, CommentService, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, Environment, ErrorDefinition, EventHandler, EventHandlerFn, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferExtensionRouter, InferMiddlewares, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloConnect, KizloError, KizloErrorOptions, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeOptionalOptions, Media, MenuItemService, MenuService, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PageService, PersonSettings, PersonSettingsInput, PluginSource, PostService, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, ROUTER_MAP, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootRouter, RouterDepthTuple, RouterMap, S2SClient, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, Settings, SettingsService, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UNEXPECTED_BODY_SNIPPET_LENGTH, UploadsSettings, UploadsSettingsInput, UserService, VerifyCaptchaFn, VerifyPreviewTokenFn, WC_CORE_BASE, WC_STORE_BASE, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CATEGORY_ORDER_BYS, WP_CORE_BASE, WP_Category, WP_CategoryCreateErrorCode, WP_CategoryCreateInput, WP_CategoryDeleteErrorCode, WP_CategoryDeleteInput, WP_CategoryDeleteResponse, WP_CategoryLinks, WP_CategoryListErrorCode, WP_CategoryListInput, WP_CategoryOrderBy, WP_CategoryRetrieveErrorCode, WP_CategoryRetrieveInput, WP_CategoryTaxonomy, WP_CategoryUpdateErrorCode, WP_CategoryUpdateInput, WP_Comment, WP_CommentAvatarUrls, WP_CommentContent, WP_CommentContentInput, WP_CommentCreateErrorCode, WP_CommentCreateInput, WP_CommentDeleteErrorCode, WP_CommentDeleteInput, WP_CommentDeleteResponse, WP_CommentLinks, WP_CommentListErrorCode, WP_CommentListInput, WP_CommentOrderBy, WP_CommentRetrieveErrorCode, WP_CommentRetrieveInput, WP_CommentStatus, WP_CommentStatusFilter, WP_CommentStatusInput, WP_CommentType, WP_CommentUpdateErrorCode, WP_CommentUpdateInput, WP_CommonErrorCode, WP_Context, WP_CurrencyFormat, WP_Error, WP_ErrorData, WP_KIZLO_BASE, WP_Link, WP_List, WP_ListMetadata, WP_ListOrder, WP_MENU_ITEM_ORDER_BYES, WP_MENU_ITEM_TARGETS, WP_MENU_ITEM_TAX_RELATIONS, WP_Menu, WP_MenuCreateErrorCode, WP_MenuCreateInput, WP_MenuDeleteErrorCode, WP_MenuDeleteInput, WP_MenuDeleteResponse, WP_MenuItem, WP_MenuItemCreateErrorCode, WP_MenuItemCreateInput, WP_MenuItemDeleteErrorCode, WP_MenuItemDeleteInput, WP_MenuItemDeleteResponse, WP_MenuItemLinks, WP_MenuItemListErrorCode, WP_MenuItemListInput, WP_MenuItemOrderBy, WP_MenuItemRetrieveErrorCode, WP_MenuItemRetrieveInput, WP_MenuItemStatus, WP_MenuItemStatusFilter, WP_MenuItemTarget, WP_MenuItemTaxRelation, WP_MenuItemTitle, WP_MenuItemTitleInput, WP_MenuItemType, WP_MenuItemUpdateErrorCode, WP_MenuItemUpdateInput, WP_MenuLinks, WP_MenuListErrorCode, WP_MenuListInput, WP_MenuOrderBy, WP_MenuRetrieveErrorCode, WP_MenuRetrieveInput, WP_MenuUpdateErrorCode, WP_MenuUpdateInput, WP_PAGE_ORDER_BYES, WP_PAGE_STATUSES, WP_POST_FORMATS, WP_POST_ORDER_BYES, WP_POST_STATUSES, WP_POST_TAX_RELATIONS, WP_Page, WP_PageCommentStatus, WP_PageContent, WP_PageContentInput, WP_PageCreateErrorCode, WP_PageCreateInput, WP_PageDeleteErrorCode, WP_PageDeleteInput, WP_PageDeleteResponse, WP_PageExcerpt, WP_PageExcerptInput, WP_PageGuid, WP_PageLinks, WP_PageListErrorCode, WP_PageListInput, WP_PageOrderBy, WP_PageRetrieveErrorCode, WP_PageRetrieveInput, WP_PageStatus, WP_PageStatusFilter, WP_PageTitle, WP_PageTitleInput, WP_PageUpdateErrorCode, WP_PageUpdateInput, WP_Post, WP_PostCommentStatus, WP_PostContent, WP_PostContentInput, WP_PostCreateErrorCode, WP_PostCreateInput, WP_PostDeleteErrorCode, WP_PostDeleteInput, WP_PostDeleteResponse, WP_PostExcerpt, WP_PostExcerptInput, WP_PostFormat, WP_PostGuid, WP_PostLinks, WP_PostListErrorCode, WP_PostListInput, WP_PostOrderBy, WP_PostRetrieveErrorCode, WP_PostRetrieveInput, WP_PostStatus, WP_PostStatusFilter, WP_PostTaxRelation, WP_PostTitle, WP_PostTitleInput, WP_PostUpdateErrorCode, WP_PostUpdateInput, WP_RequestInput, WP_Result, WP_TAG_ORDER_BYS, WP_Tag, WP_TagCreateErrorCode, WP_TagCreateInput, WP_TagDeleteErrorCode, WP_TagDeleteInput, WP_TagDeleteResponse, WP_TagLinks, WP_TagListErrorCode, WP_TagListInput, WP_TagOrderBy, WP_TagRetrieveErrorCode, WP_TagRetrieveInput, WP_TagTaxonomy, WP_TagUpdateErrorCode, WP_TagUpdateInput, WP_User, WP_UserAvatarUrls, WP_UserCapabilities, WP_UserCreateErrorCode, WP_UserCreateInput, WP_UserDeleteErrorCode, WP_UserDeleteInput, WP_UserDeleteMeErrorCode, WP_UserDeleteMeInput, WP_UserDeleteMeResponse, WP_UserDeleteResponse, WP_UserLinks, WP_UserListErrorCode, WP_UserListInput, WP_UserOrderBy, WP_UserRetrieveErrorCode, WP_UserRetrieveInput, WP_UserRetrieveMeErrorCode, WP_UserRetrieveMeInput, WP_UserUpdateErrorCode, WP_UserUpdateInput, WP_UserUpdateMeErrorCode, WP_UserUpdateMeInput, WP_UserWho, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressCredentials, WordPressService, altcha, arkose, authMock, buildProcedure, buildWebManifest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, parseSitemapSlug, recaptcha, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, xmlResponse };
@@ -8,7 +8,7 @@ function createKizlo(options) {
8
8
  return new Kizlo(resolveKizloConfig({
9
9
  ...options,
10
10
  extensions
11
- }, { baseUrlEnvKey: "NEXT_PUBLIC_KIZLO_BACKEND_URL" }));
11
+ }, { baseUrlEnvKey: "NEXT_PUBLIC_KIZLO_API_URL" }));
12
12
  }
13
13
 
14
14
  //#endregion
@@ -39,8 +39,8 @@ function createCachedTextRoute(handler, cacheTag, contentType) {
39
39
  };
40
40
  }
41
41
  function getServerBaseUrl() {
42
- const baseUrl = process.env.NEXT_PUBLIC_KIZLO_BACKEND_URL;
43
- if (!baseUrl) throw new KizloError("MISSING_ENV_VARIABLE", { message: "Please define NEXT_PUBLIC_KIZLO_BACKEND_URL in your .env file." });
42
+ const baseUrl = process.env.NEXT_PUBLIC_KIZLO_API_URL;
43
+ if (!baseUrl) throw new KizloError("MISSING_ENV_VARIABLE", { message: "Please define NEXT_PUBLIC_KIZLO_API_URL in your .env file." });
44
44
  return baseUrl;
45
45
  }
46
46
 
package/dist/kizlo.d.ts CHANGED
@@ -14,16 +14,16 @@ import { ResultClient } from "./shared/result.js";
14
14
  type AnyKizloConfig = KizloConfig<any>;
15
15
  /**
16
16
  * Which credential set to read from the environment. Independent of `environment`
17
- * (which carries logging semantics off `NODE_ENV`): `"dev"` reads the `KIZLO_DEV_WORDPRESS_*`
18
- * / `KIZLO_DEV_SITE_SECRET` keys the local stack manages, `"production"` reads `KIZLO_WORDPRESS_*` / `KIZLO_SITE_SECRET`.
17
+ * (which carries logging semantics off `NODE_ENV`): `"local"` reads the `KIZLO_LOCAL_WP_*`
18
+ * / `KIZLO_LOCAL_WP_SECRET` keys local WordPress manages, `"remote"` reads `KIZLO_WP_*` / `KIZLO_WP_SECRET`.
19
19
  */
20
- type KizloTarget = "dev" | "production";
20
+ type KizloConnect = "local" | "remote";
21
21
  interface KizloConfig<TExts extends readonly AnyExtension[]> {
22
22
  baseUrl: string;
23
23
  siteSecret: string;
24
24
  extensions?: TExts;
25
25
  environment: Environment;
26
- target: KizloTarget;
26
+ connect: KizloConnect;
27
27
  adapters?: ServiceAdapters;
28
28
  credentials: WordPressCredentials;
29
29
  }
@@ -50,26 +50,26 @@ declare class Kizlo<TExts extends readonly AnyExtension[] = []> {
50
50
  private registerExtensions;
51
51
  }
52
52
  interface CreateKizloOptions<TExts extends readonly AnyExtension[] = []> {
53
- /** Public base URL of your Kizlo server, used to route requests. Falls back to the `KIZLO_BACKEND_URL` env var. */
53
+ /** Public base URL of your Kizlo server, used to route requests. Falls back to the `KIZLO_API_URL` env var. */
54
54
  baseUrl?: string;
55
- /** Secret shared with the WordPress plugin to sign and verify webhooks. Falls back to the `KIZLO_SITE_SECRET` env var (target-selected). */
55
+ /** Secret shared with the WordPress plugin to sign and verify webhooks. Falls back to the `KIZLO_WP_SECRET` env var (connect-selected). */
56
56
  siteSecret?: string;
57
57
  /** Extensions to register, built with `createExtension` — mounts their namespaces on the client and their routes and event handlers on the handler. */
58
58
  extensions?: TExts;
59
59
  /** Runtime environment. Falls back to `NODE_ENV`, then `"development"`. */
60
60
  environment?: Environment;
61
61
  /**
62
- * Which credential set to use. Falls back to the `KIZLO_TARGET` env var, then `"production"`.
63
- * Independent of `environment`: `"dev"` reads `KIZLO_DEV_WORDPRESS_*` / `KIZLO_DEV_SITE_SECRET` (the keys the
64
- * local dev stack manages), `"production"` reads `KIZLO_WORDPRESS_*` / `KIZLO_SITE_SECRET`.
62
+ * Which credential set to use. Falls back to the `KIZLO_CONNECT` env var, then `"remote"`.
63
+ * Independent of `environment`: `"local"` reads `KIZLO_LOCAL_WP_*` / `KIZLO_LOCAL_WP_SECRET` (the keys
64
+ * local WordPress manages), `"remote"` reads `KIZLO_WP_*` / `KIZLO_WP_SECRET`.
65
65
  */
66
- target?: KizloTarget;
66
+ connect?: KizloConnect;
67
67
  /** Service adapters: auth, captcha, geo, logger, and cookies. */
68
68
  adapters?: ServiceAdapters;
69
69
  /**
70
- * WordPress connection. Each credential falls back to a target-selected env var: with the default
71
- * `"production"` target to `KIZLO_WORDPRESS_URL` / `KIZLO_WORDPRESS_USERNAME` / `KIZLO_WORDPRESS_APPLICATION_PASSWORD`,
72
- * and with the `"dev"` target to their `KIZLO_DEV_WORDPRESS_*` counterparts.
70
+ * WordPress connection. Each credential falls back to a connect-selected env var: with the default
71
+ * `"remote"` connect to `KIZLO_WP_URL` / `KIZLO_WP_USERNAME` / `KIZLO_WP_APP_PASSWORD`,
72
+ * and with the `"local"` connect to their `KIZLO_LOCAL_WP_*` counterparts.
73
73
  */
74
74
  wordpress?: {
75
75
  credentials?: Partial<WordPressCredentials>;
@@ -85,10 +85,10 @@ declare function resolveKizloConfig<TExts extends readonly AnyExtension[]>(optio
85
85
  adapters?: ServiceAdapters;
86
86
  }): KizloConfig<TExts>;
87
87
  /**
88
- * Creates a Kizlo server from the environment (`KIZLO_BACKEND_URL`, `KIZLO_SITE_SECRET`,
89
- * `KIZLO_WORDPRESS_*`), with options taking precedence. Framework packages wrap this
88
+ * Creates a Kizlo server from the environment (`KIZLO_API_URL`, `KIZLO_WP_SECRET`,
89
+ * `KIZLO_WP_*`), with options taking precedence. Framework packages wrap this
90
90
  * with their own URL convention and adapters.
91
91
  */
92
92
  declare function createKizlo<TExts extends readonly AnyExtension[] = []>(options?: CreateKizloOptions<TExts>): Kizlo<TExts>;
93
93
  //#endregion
94
- export { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloTarget, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig };
94
+ export { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloConnect, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig };
package/dist/kizlo.js CHANGED
@@ -105,17 +105,21 @@ function requireEnv(name) {
105
105
  if (!value) throw new KizloError("MISSING_ENV_VARIABLE", { message: `Please define ${name} in your .env file.` });
106
106
  return value;
107
107
  }
108
- function resolveTarget(option) {
109
- return option ?? (process.env.KIZLO_TARGET === "dev" ? "dev" : "production");
108
+ function resolveConnect(option) {
109
+ if (option) return option;
110
+ const value = process.env.KIZLO_CONNECT?.trim();
111
+ if (!value) return "remote";
112
+ if (value !== "local" && value !== "remote") throw new KizloError("INVALID_ENV_VARIABLE", { message: `KIZLO_CONNECT must be "local" or "remote", got "${value}".` });
113
+ return value;
110
114
  }
111
- /** Env var names for a credential set: `KIZLO_DEV_WORDPRESS_URL` / `KIZLO_DEV_SITE_SECRET` for dev, `KIZLO_WORDPRESS_URL` / `KIZLO_SITE_SECRET` for production. */
112
- function targetEnvKeys(target) {
113
- const prefix = target === "dev" ? "KIZLO_DEV_" : "KIZLO_";
115
+ /** Env var names for a credential set: `KIZLO_LOCAL_WP_URL` / `KIZLO_LOCAL_WP_SECRET` for local, `KIZLO_WP_URL` / `KIZLO_WP_SECRET` for remote. */
116
+ function connectEnvKeys(connect) {
117
+ const prefix = connect === "local" ? "KIZLO_LOCAL_" : "KIZLO_";
114
118
  return {
115
- siteSecret: `${prefix}SITE_SECRET`,
116
- url: `${prefix}WORDPRESS_URL`,
117
- username: `${prefix}WORDPRESS_USERNAME`,
118
- password: `${prefix}WORDPRESS_APPLICATION_PASSWORD`
119
+ siteSecret: `${prefix}WP_SECRET`,
120
+ url: `${prefix}WP_URL`,
121
+ username: `${prefix}WP_USERNAME`,
122
+ password: `${prefix}WP_APP_PASSWORD`
119
123
  };
120
124
  }
121
125
  /**
@@ -125,13 +129,13 @@ function targetEnvKeys(target) {
125
129
  */
126
130
  function resolveKizloConfig(options, defaults) {
127
131
  const credentials = options?.wordpress?.credentials;
128
- const target = resolveTarget(options?.target);
129
- const keys = targetEnvKeys(target);
132
+ const connect = resolveConnect(options?.connect);
133
+ const keys = connectEnvKeys(connect);
130
134
  return {
131
135
  baseUrl: options?.baseUrl ?? requireEnv(defaults.baseUrlEnvKey),
132
136
  siteSecret: options?.siteSecret ?? requireEnv(keys.siteSecret),
133
137
  environment: options?.environment ?? process.env.NODE_ENV ?? "development",
134
- target,
138
+ connect,
135
139
  extensions: options?.extensions,
136
140
  adapters: {
137
141
  ...defaults.adapters,
@@ -145,12 +149,12 @@ function resolveKizloConfig(options, defaults) {
145
149
  };
146
150
  }
147
151
  /**
148
- * Creates a Kizlo server from the environment (`KIZLO_BACKEND_URL`, `KIZLO_SITE_SECRET`,
149
- * `KIZLO_WORDPRESS_*`), with options taking precedence. Framework packages wrap this
152
+ * Creates a Kizlo server from the environment (`KIZLO_API_URL`, `KIZLO_WP_SECRET`,
153
+ * `KIZLO_WP_*`), with options taking precedence. Framework packages wrap this
150
154
  * with their own URL convention and adapters.
151
155
  */
152
156
  function createKizlo(options) {
153
- return new Kizlo(resolveKizloConfig(options, { baseUrlEnvKey: "KIZLO_BACKEND_URL" }));
157
+ return new Kizlo(resolveKizloConfig(options, { baseUrlEnvKey: "KIZLO_API_URL" }));
154
158
  }
155
159
 
156
160
  //#endregion
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.9.1";
2
+ var version = "0.10.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/router.d.ts CHANGED
@@ -764,7 +764,7 @@ declare const ROUTER_MAP: {
764
764
  exclude?: string | number | (string | number)[] | undefined;
765
765
  include?: string | number | (string | number)[] | undefined;
766
766
  order?: "asc" | "desc" | undefined;
767
- orderBy?: "name" | "id" | "slug" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
767
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
768
768
  hideEmpty?: string | boolean | undefined;
769
769
  parent?: string | number | undefined;
770
770
  post?: string | number | undefined;
@@ -976,7 +976,7 @@ declare const ROUTER_MAP: {
976
976
  exclude?: string | number | (string | number)[] | undefined;
977
977
  include?: string | number | (string | number)[] | undefined;
978
978
  order?: "asc" | "desc" | undefined;
979
- orderBy?: "name" | "id" | "slug" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
979
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
980
980
  hideEmpty?: string | boolean | undefined;
981
981
  post?: string | number | undefined;
982
982
  slug?: string | string[] | undefined;
@@ -1570,9 +1570,9 @@ declare const ROUTER_MAP: {
1570
1570
  site: {
1571
1571
  update: Procedure<"internal", {
1572
1572
  url?: string | null | undefined;
1573
+ name?: string | null | undefined;
1573
1574
  backend_url?: string | null | undefined;
1574
1575
  secret?: string | null | undefined;
1575
- name?: string | null | undefined;
1576
1576
  alternate_name?: string | null | undefined;
1577
1577
  tagline?: string | null | undefined;
1578
1578
  title_separator?: string | undefined;
@@ -1645,16 +1645,16 @@ declare const ROUTER_MAP: {
1645
1645
  update: Procedure<"internal", {
1646
1646
  key: string;
1647
1647
  data: {
1648
+ webpage_type?: string | undefined;
1649
+ article_type?: string | null | undefined;
1648
1650
  title_structure?: string | null | undefined;
1649
1651
  description_structure?: string | null | undefined;
1650
1652
  search_engine_visibility?: boolean | null | undefined;
1651
- webpage_type?: string | undefined;
1652
- article_type?: string | null | undefined;
1653
- seo_enabled?: boolean | undefined;
1653
+ breadcrumbs?: (string | number)[] | undefined;
1654
1654
  pathname_structure?: string | null | undefined;
1655
+ seo_enabled?: boolean | undefined;
1655
1656
  comment_action_structure?: string | null | undefined;
1656
1657
  rest_api_enabled?: boolean | undefined;
1657
- breadcrumbs?: (string | number)[] | undefined;
1658
1658
  };
1659
1659
  }, _kizlo_shared0.PostTypeSettings, DefinedErrorMapLike>;
1660
1660
  };
@@ -1665,10 +1665,10 @@ declare const ROUTER_MAP: {
1665
1665
  title_structure?: string | null | undefined;
1666
1666
  description_structure?: string | null | undefined;
1667
1667
  search_engine_visibility?: boolean | null | undefined;
1668
- seo_enabled?: boolean | undefined;
1668
+ breadcrumbs?: (string | number)[] | undefined;
1669
1669
  pathname_structure?: string | null | undefined;
1670
+ seo_enabled?: boolean | undefined;
1670
1671
  rest_api_enabled?: boolean | undefined;
1671
- breadcrumbs?: (string | number)[] | undefined;
1672
1672
  };
1673
1673
  }, _kizlo_shared0.TaxonomySettings, DefinedErrorMapLike>;
1674
1674
  };
@@ -18,7 +18,7 @@ function getKizloTestInstance(options) {
18
18
  baseUrl: "http://test.local",
19
19
  siteSecret: "test-secret",
20
20
  environment: "test",
21
- target: "production",
21
+ connect: "remote",
22
22
  credentials: {
23
23
  url: creds.url,
24
24
  username: creds.users.admin.username,
package/dist/test.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DevPluginSource, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, LocalPlugin, PluginSource, SeedContext, TestAdminUser, TestCredentials, TestUser, defineFixture, isLocalPlugin } from "./cli/wp/types.js";
2
- import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
- import { DockerStack, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli } from "./cli/wp/docker.js";
2
+ import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, LOCAL_DIR_REL, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
+ import { DockerStack, DockerStatus, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, dockerHint, dockerStatus, wpCli } from "./cli/wp/docker.js";
4
4
  import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource } from "./cli/wp/utils.js";
5
5
  import { TestAuthAdapterUser, toTestUser } from "./test/users.js";
6
6
  import { testAuthAdapter } from "./test/auth.js";
@@ -10,4 +10,4 @@ import { KizloClientTestInstance, getKizloClientTestInstance } from "./test/clie
10
10
  import { menuFixture } from "./menu/fixture.js";
11
11
  import { postFixture } from "./post/fixture.js";
12
12
  import { coreFixtures } from "./test/fixtures.js";
13
- export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DevPluginSource, DockerStack, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, KizloClientTestInstance, KizloTestInstance, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, Stack, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, ensurePlugin, ensurePlugins, findConfigDir, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };
13
+ export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DevPluginSource, DockerStack, DockerStatus, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, KizloClientTestInstance, KizloTestInstance, LOCAL_DIR_REL, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, Stack, 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, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };