kizlo 0.7.0 → 0.8.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/category/error.js +14 -0
- package/dist/category/index.js +77 -0
- package/dist/category/schema.js +40 -0
- package/dist/category/utils.js +20 -0
- package/dist/cli/banner.js +1 -1
- package/dist/cli/commands/_setup.js +342 -0
- package/dist/cli/commands/create.js +152 -0
- package/dist/cli/commands/dev.js +1 -1
- package/dist/cli/commands/init.js +53 -300
- package/dist/cli/index.js +2 -1
- package/dist/cli/presets/generated/templates.js +59 -0
- package/dist/cli/presets/nextjs.js +3 -95
- package/dist/cli/presets/patch.js +133 -0
- package/dist/cli/presets/template.js +36 -0
- package/dist/comment/index.js +4 -4
- package/dist/context.d.ts +25 -8
- package/dist/context.js +15 -5
- package/dist/email/service.d.ts +4 -3
- package/dist/email/service.js +4 -4
- package/dist/index.d.ts +15 -11
- package/dist/index.js +10 -4
- package/dist/integrations/nextjs/metadata.js +6 -3
- package/dist/integrations/nextjs/sitemap.d.ts +8 -7
- package/dist/integrations/nextjs/sitemap.js +3 -3
- package/dist/menu/index.js +19 -14
- package/dist/menu/schema.d.ts +14 -0
- package/dist/menu/schema.js +35 -40
- package/dist/menu/utils.js +23 -14
- package/dist/nextjs/server.d.ts +2 -1
- package/dist/nextjs/server.js +2 -1
- package/dist/package.js +1 -1
- package/dist/page/error.js +20 -0
- package/dist/page/index.js +128 -0
- package/dist/page/schema.js +75 -0
- package/dist/page/utils.js +43 -0
- package/dist/post/error.js +4 -14
- package/dist/post/index.js +17 -9
- package/dist/post/schema.js +37 -66
- package/dist/post/utils.js +27 -24
- package/dist/router.d.ts +1006 -185
- package/dist/router.js +6 -0
- package/dist/seo/index.js +7 -44
- package/dist/seo/schema.d.ts +10 -6
- package/dist/seo/schema.js +7 -5
- package/dist/seo/sitemap.d.ts +9 -1
- package/dist/seo/sitemap.js +17 -1
- package/dist/seo/types.d.ts +17 -20
- package/dist/seo/utils.js +9 -7
- package/dist/settings/index.js +27 -24
- package/dist/settings/service.d.ts +14 -13
- package/dist/settings/service.interface.d.ts +2 -2
- package/dist/settings/service.js +9 -9
- package/dist/shared/middleware.d.ts +4 -4
- package/dist/shared/procedure.d.ts +6 -7
- package/dist/tag/error.js +14 -0
- package/dist/tag/index.js +76 -0
- package/dist/tag/schema.js +38 -0
- package/dist/tag/utils.js +19 -0
- package/dist/taxonomy/service.js +48 -0
- package/dist/test/fixtures.d.ts +1 -1
- package/dist/test/fixtures.js +1 -1
- package/dist/webhook/index.d.ts +2 -2
- package/dist/wordpress/category/service.d.ts +28 -0
- package/dist/wordpress/category/service.js +55 -0
- package/dist/wordpress/category/types.d.ts +120 -0
- package/dist/wordpress/category/types.js +15 -0
- package/dist/wordpress/comment/service.d.ts +1 -1
- package/dist/wordpress/index.d.ts +9 -4
- package/dist/wordpress/menu/items/types.d.ts +7 -4
- package/dist/wordpress/menu/items/types.js +22 -0
- package/dist/wordpress/page/service.d.ts +28 -0
- package/dist/wordpress/page/service.js +55 -0
- package/dist/wordpress/page/types.d.ts +270 -0
- package/dist/wordpress/page/types.js +27 -0
- package/dist/wordpress/post/types.d.ts +9 -5
- package/dist/wordpress/post/types.js +41 -0
- package/dist/wordpress/service.d.ts +7 -1
- package/dist/wordpress/service.js +6 -0
- package/dist/wordpress/tag/service.d.ts +28 -0
- package/dist/wordpress/tag/service.js +55 -0
- package/dist/wordpress/tag/types.d.ts +113 -0
- package/dist/wordpress/tag/types.js +15 -0
- package/package.json +5 -3
- package/dist/service.d.ts +0 -19
- package/dist/service.js +0 -20
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { TEMPLATE_PATCHES } from "./generated/templates.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { builders, detectCodeFormat, generateCode, parseModule } from "magicast";
|
|
5
|
+
|
|
6
|
+
//#region src/cli/presets/patch.ts
|
|
7
|
+
/** Extensions a patch target might really use, in preference order. The template names files `.tsx`,
|
|
8
|
+
* but a JS project's layout may be `.js`/`.jsx`, so init probes these to find the actual file. */
|
|
9
|
+
const PATCH_TARGET_EXTS = [
|
|
10
|
+
".tsx",
|
|
11
|
+
".jsx",
|
|
12
|
+
".ts",
|
|
13
|
+
".js",
|
|
14
|
+
".mjs",
|
|
15
|
+
".cjs"
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a patch's tokenized target to the real file on disk, trying the common component
|
|
19
|
+
* extensions so a JS project's `layout.js`/`layout.jsx` is found — not just the template's `.tsx`.
|
|
20
|
+
* Returns undefined when no candidate exists.
|
|
21
|
+
*/
|
|
22
|
+
function resolvePatchTargetPath(cwd, relPath) {
|
|
23
|
+
const direct = path.join(cwd, relPath);
|
|
24
|
+
if (fs.existsSync(direct)) return direct;
|
|
25
|
+
const base = relPath.replace(/\.[^./]+$/, "");
|
|
26
|
+
for (const ext of PATCH_TARGET_EXTS) {
|
|
27
|
+
const candidate = path.join(cwd, `${base}${ext}`);
|
|
28
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The Kizlo-wiring patches for a framework (files init merges into rather than writes). */
|
|
32
|
+
function templatePatches(framework) {
|
|
33
|
+
return TEMPLATE_PATCHES[framework] ?? [];
|
|
34
|
+
}
|
|
35
|
+
/** Substitute the path/import tokens for a patch against the project's real directories. */
|
|
36
|
+
function resolvePatch(patch, ctx) {
|
|
37
|
+
const relPath = patch.tokenizedFile.replaceAll("{{kizloDir}}", ctx.kizloDir).replaceAll("{{appDir}}", ctx.appDir);
|
|
38
|
+
const fromDir = path.posix.dirname(relPath);
|
|
39
|
+
const imports = patch.imports.map((imp) => ({
|
|
40
|
+
module: imp.module.replaceAll("{{serverImport}}", ctx.serverImport(fromDir)),
|
|
41
|
+
names: imp.names
|
|
42
|
+
}));
|
|
43
|
+
return {
|
|
44
|
+
label: patch.label,
|
|
45
|
+
relPath,
|
|
46
|
+
imports,
|
|
47
|
+
exports: patch.exports
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** Whether a patch actually modified the file (vs. a no-op / kept outcome). */
|
|
51
|
+
function patchChanged(changes) {
|
|
52
|
+
return Boolean(changes.addedImports.length || changes.addedExports.length || changes.replacedExports.length);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Next.js pairs a dynamic `generateX` export with a static `x` export (e.g. `generateMetadata` and
|
|
56
|
+
* `metadata`) and rejects a file that declares both. When we add a `generateX`, its static
|
|
57
|
+
* counterpart is a conflict too — return `metadata` for `generateMetadata`, `viewport` for
|
|
58
|
+
* `generateViewport`, and so on; undefined for anything that isn't a `generate*` name.
|
|
59
|
+
*/
|
|
60
|
+
function staticCounterpart(name) {
|
|
61
|
+
const match = /^generate([A-Z]\w*)$/.exec(name);
|
|
62
|
+
if (!match) return void 0;
|
|
63
|
+
const rest = match[1] ?? "";
|
|
64
|
+
return rest.charAt(0).toLowerCase() + rest.slice(1);
|
|
65
|
+
}
|
|
66
|
+
/** Whitespace-insensitive equality, for telling "already our wiring" apart from a user's own export. */
|
|
67
|
+
function sameExpr(a, b) {
|
|
68
|
+
return a.replace(/\s+/g, "") === b.replace(/\s+/g, "");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Merge a resolved patch into `source` by parsing it with magicast (a real TS/JS/JSX parser via Babel,
|
|
72
|
+
* so declarations are bounded exactly — never by a text heuristic). Imports and absent exports are
|
|
73
|
+
* added; an export the file already defines is replaced surgically when `replaceConflicts` is set, else
|
|
74
|
+
* kept. A static Next counterpart (`metadata` for `generateMetadata`) is dropped as part of a replace.
|
|
75
|
+
* Idempotent: an export whose current value already equals ours is left untouched.
|
|
76
|
+
*
|
|
77
|
+
* Throws if the target cannot be parsed or regenerated. Callers must NOT swallow that — a file we can't
|
|
78
|
+
* parse is one we must not guess at, so wiring stops rather than writing a corrupted file.
|
|
79
|
+
*/
|
|
80
|
+
function applyPatchToSource(source, patch, opts) {
|
|
81
|
+
const format = detectCodeFormat(source);
|
|
82
|
+
const mod = parseModule(source, {
|
|
83
|
+
sourceFileName: "layout.tsx",
|
|
84
|
+
...format
|
|
85
|
+
});
|
|
86
|
+
const changes = {
|
|
87
|
+
addedImports: [],
|
|
88
|
+
addedExports: [],
|
|
89
|
+
replacedExports: [],
|
|
90
|
+
keptExports: []
|
|
91
|
+
};
|
|
92
|
+
for (const imp of patch.imports) for (const name of imp.names) {
|
|
93
|
+
if (mod.imports.$items.some((item) => item.from === imp.module && item.imported === name)) continue;
|
|
94
|
+
mod.imports.$append({
|
|
95
|
+
imported: name,
|
|
96
|
+
from: imp.module
|
|
97
|
+
});
|
|
98
|
+
changes.addedImports.push(name);
|
|
99
|
+
}
|
|
100
|
+
for (const exp of patch.exports) {
|
|
101
|
+
const exportNames = Object.keys(mod.exports);
|
|
102
|
+
if (exportNames.includes(exp.name)) {
|
|
103
|
+
if (sameExpr(generateCode(mod.exports[exp.name]).code, exp.value)) continue;
|
|
104
|
+
if (!opts.replaceConflicts) {
|
|
105
|
+
changes.keptExports.push(exp.name);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
mod.exports[exp.name] = builders.raw(exp.value);
|
|
109
|
+
changes.replacedExports.push(exp.name);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const counterpart = staticCounterpart(exp.name);
|
|
113
|
+
if (counterpart && exportNames.includes(counterpart)) {
|
|
114
|
+
if (!opts.replaceConflicts) {
|
|
115
|
+
changes.keptExports.push(exp.name);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
delete mod.exports[counterpart];
|
|
119
|
+
mod.exports[exp.name] = builders.raw(exp.value);
|
|
120
|
+
changes.replacedExports.push(exp.name);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
mod.exports[exp.name] = builders.raw(exp.value);
|
|
124
|
+
changes.addedExports.push(exp.name);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
text: generateCode(mod, { format }).code,
|
|
128
|
+
changes
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
export { applyPatchToSource, patchChanged, resolvePatch, resolvePatchTargetPath, templatePatches };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TEMPLATE_SUBSETS } from "./generated/templates.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/presets/template.ts
|
|
5
|
+
/** Role → the human label init uses in prompts and logs. Mirrors the old hardcoded labels. */
|
|
6
|
+
const ROLE_LABELS = {
|
|
7
|
+
"server-entry": "Kizlo server instance",
|
|
8
|
+
client: "Browser client",
|
|
9
|
+
"api-route": "API route",
|
|
10
|
+
robots: "robots.txt route",
|
|
11
|
+
sitemap: "sitemap route",
|
|
12
|
+
"sitemap-redirect": "sitemap.xml redirect route",
|
|
13
|
+
manifest: "web manifest route"
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Turn a framework's extracted template subset into the {@link ScaffoldFile}s init writes, by
|
|
17
|
+
* substituting the tokens the extractor left behind: the path prefixes (`{{kizloDir}}`, `{{appDir}}`)
|
|
18
|
+
* with the project's real directories, and `{{serverImport}}` with the import specifier resolved for
|
|
19
|
+
* each file's location (tsconfig alias or relative). The single source of these bodies is the
|
|
20
|
+
* template folder, so init and `create` can never drift.
|
|
21
|
+
*/
|
|
22
|
+
function materializeTemplate(framework, ctx) {
|
|
23
|
+
return (TEMPLATE_SUBSETS[framework] ?? []).map((file) => {
|
|
24
|
+
const relPath = file.tokenizedPath.replaceAll("{{kizloDir}}", ctx.kizloDir).replaceAll("{{appDir}}", ctx.appDir);
|
|
25
|
+
const fromDir = path.posix.dirname(relPath);
|
|
26
|
+
const contents = file.body.replaceAll("{{serverImport}}", ctx.serverImport(fromDir));
|
|
27
|
+
return {
|
|
28
|
+
label: ROLE_LABELS[file.role] ?? file.role,
|
|
29
|
+
relPath,
|
|
30
|
+
contents
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { materializeTemplate };
|
package/dist/comment/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const COMMENT_ROUTER_MAP = {
|
|
|
16
16
|
errors: GET_COMMENT_ERROR_MAP,
|
|
17
17
|
output: Comment
|
|
18
18
|
}, async ({ context, errors, input }) => {
|
|
19
|
-
const response = await context.
|
|
19
|
+
const response = await context.wordpress.get(`/comments/${input.params.id}`, {
|
|
20
20
|
base: WP_CORE_BASE,
|
|
21
21
|
searchParams: { password: input.query?.password }
|
|
22
22
|
});
|
|
@@ -42,7 +42,7 @@ const COMMENT_ROUTER_MAP = {
|
|
|
42
42
|
errors: LIST_COMMENT_ERROR_MAP,
|
|
43
43
|
output: CommentList
|
|
44
44
|
}, async ({ context, errors, input }) => {
|
|
45
|
-
const response = await context.
|
|
45
|
+
const response = await context.wordpress.get(`/comments`, {
|
|
46
46
|
base: WP_CORE_BASE,
|
|
47
47
|
searchParams: {
|
|
48
48
|
context: "edit",
|
|
@@ -74,7 +74,7 @@ const COMMENT_ROUTER_MAP = {
|
|
|
74
74
|
context.logger.error("List comments unhandled error", response.error, { code: response.error.code });
|
|
75
75
|
throw errors.INTERNAL_SERVER_ERROR();
|
|
76
76
|
}
|
|
77
|
-
const list = context.
|
|
77
|
+
const list = context.wordpress.resolveList({
|
|
78
78
|
data: response.data,
|
|
79
79
|
headers: response.headers,
|
|
80
80
|
searchParams: input.query
|
|
@@ -100,7 +100,7 @@ const COMMENT_ROUTER_MAP = {
|
|
|
100
100
|
if (!input.body.captchaToken) throw errors.COMMENT_CAPTCHA_REQUIRED();
|
|
101
101
|
if (!await context.verifyCaptcha(input.body.captchaToken)) throw errors.COMMENT_CAPTCHA_INVALID();
|
|
102
102
|
}
|
|
103
|
-
const response = await context.
|
|
103
|
+
const response = await context.wordpress.post(`/comments`, {
|
|
104
104
|
body: {
|
|
105
105
|
user_id: user?.id,
|
|
106
106
|
author_ip: connInfo.ip,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { WordPressCredentials } from "./wordpress/types.js";
|
|
2
|
+
import { WordPressService } from "./wordpress/service.js";
|
|
2
3
|
import "./wordpress/index.js";
|
|
3
4
|
import { AuthUser } from "./adapters/auth.js";
|
|
4
5
|
import { PreviewTokenPayload } from "./shared/schema.js";
|
|
5
6
|
import { ConnInfo } from "./adapters/geo.js";
|
|
6
7
|
import { Logger } from "./adapters/logger.js";
|
|
7
8
|
import { CookiesStorage } from "./cookie.js";
|
|
8
|
-
import {
|
|
9
|
+
import { EmailService } from "./email/service.js";
|
|
10
|
+
import { SettingsService } from "./settings/service.js";
|
|
9
11
|
import { ServiceAdapters } from "./kizlo.js";
|
|
10
12
|
|
|
11
13
|
//#region src/context.d.ts
|
|
@@ -18,15 +20,24 @@ type AuthUserFn = () => Promise<AuthUser | null>;
|
|
|
18
20
|
type ConnInfoFn = () => Promise<ConnInfo | null>;
|
|
19
21
|
type VerifyCaptchaFn = (token: string) => Promise<boolean>;
|
|
20
22
|
type VerifyPreviewTokenFn = (token: string) => Promise<PreviewTokenPayload | null>;
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The context every procedure, middleware, event, and webhook handler receives — the fixed base
|
|
25
|
+
* the server builds. A procedure's handler receives this base plus whatever its middleware injected
|
|
26
|
+
* via `next({ context })`.
|
|
27
|
+
*/
|
|
28
|
+
interface ProcedureContext {
|
|
22
29
|
/** The incoming HTTP `Request`, or `null` for server-side (non-HTTP) invocations. */
|
|
23
30
|
request: Request | null;
|
|
24
31
|
/** Response headers to be sent (e.g. `Set-Cookie`), or `null` server-side. */
|
|
25
32
|
headers: Headers | null;
|
|
26
33
|
/** The configured logger adapter. */
|
|
27
34
|
logger: Logger;
|
|
28
|
-
/** Typed
|
|
29
|
-
|
|
35
|
+
/** Typed WordPress REST client. */
|
|
36
|
+
wordpress: WordPressService;
|
|
37
|
+
/** Kizlo settings client. */
|
|
38
|
+
settings: SettingsService;
|
|
39
|
+
/** Transactional email client. */
|
|
40
|
+
email: EmailService;
|
|
30
41
|
/** The resolved context config: site secret, adapters, and WordPress credentials. */
|
|
31
42
|
config: ContextConfig;
|
|
32
43
|
/** Resolve the caller's connection info (IP, geo) via the geo adapter, or `null`. */
|
|
@@ -45,14 +56,18 @@ interface ServerContext {
|
|
|
45
56
|
declare class Context {
|
|
46
57
|
private readonly config;
|
|
47
58
|
private readonly logger;
|
|
48
|
-
private readonly
|
|
59
|
+
private readonly wordpress;
|
|
60
|
+
private readonly settings;
|
|
61
|
+
private readonly email;
|
|
49
62
|
constructor(config: ContextConfig);
|
|
50
63
|
createRestContext(request: Request): {
|
|
51
64
|
headers: Headers;
|
|
52
65
|
request: Request;
|
|
53
66
|
config: ContextConfig;
|
|
54
67
|
logger: Logger;
|
|
55
|
-
|
|
68
|
+
wordpress: WordPressService;
|
|
69
|
+
settings: SettingsService;
|
|
70
|
+
email: EmailService;
|
|
56
71
|
getConnInfo: ConnInfoFn;
|
|
57
72
|
verifyCaptcha: VerifyCaptchaFn;
|
|
58
73
|
getAuthUser: AuthUserFn;
|
|
@@ -66,7 +81,9 @@ declare class Context {
|
|
|
66
81
|
request: null;
|
|
67
82
|
config: ContextConfig;
|
|
68
83
|
logger: Logger;
|
|
69
|
-
|
|
84
|
+
wordpress: WordPressService;
|
|
85
|
+
settings: SettingsService;
|
|
86
|
+
email: EmailService;
|
|
70
87
|
getAuthUser: AuthUserFn;
|
|
71
88
|
getConnInfo: ConnInfoFn;
|
|
72
89
|
verifyCaptcha: VerifyCaptchaFn;
|
|
@@ -81,4 +98,4 @@ declare class Context {
|
|
|
81
98
|
private createLogger;
|
|
82
99
|
}
|
|
83
100
|
//#endregion
|
|
84
|
-
export { AuthUserFn, ConnInfoFn, Context, ContextConfig,
|
|
101
|
+
export { AuthUserFn, ConnInfoFn, Context, ContextConfig, ProcedureContext, VerifyCaptchaFn, VerifyPreviewTokenFn };
|
package/dist/context.js
CHANGED
|
@@ -2,7 +2,9 @@ import { compare, hmac } from "./shared/crypto.js";
|
|
|
2
2
|
import { noopAdapter } from "./adapters/logger.js";
|
|
3
3
|
import { PreviewTokenData } from "./shared/schema.js";
|
|
4
4
|
import { CookiesStorage } from "./cookie.js";
|
|
5
|
-
import {
|
|
5
|
+
import { WordPressService } from "./wordpress/service.js";
|
|
6
|
+
import { EmailService } from "./email/service.js";
|
|
7
|
+
import { SettingsService } from "./settings/service.js";
|
|
6
8
|
import { base64Decode, tryCatchSync } from "@kizlo/shared";
|
|
7
9
|
import { serialize } from "cookie";
|
|
8
10
|
|
|
@@ -10,10 +12,14 @@ import { serialize } from "cookie";
|
|
|
10
12
|
var Context = class {
|
|
11
13
|
config;
|
|
12
14
|
logger;
|
|
13
|
-
|
|
15
|
+
wordpress;
|
|
16
|
+
settings;
|
|
17
|
+
email;
|
|
14
18
|
constructor(config) {
|
|
15
19
|
this.config = config;
|
|
16
|
-
this.
|
|
20
|
+
this.wordpress = new WordPressService(config);
|
|
21
|
+
this.settings = new SettingsService(this.wordpress);
|
|
22
|
+
this.email = new EmailService(this.wordpress);
|
|
17
23
|
this.logger = this.createLogger();
|
|
18
24
|
}
|
|
19
25
|
createRestContext(request) {
|
|
@@ -23,7 +29,9 @@ var Context = class {
|
|
|
23
29
|
request: request.clone(),
|
|
24
30
|
config: this.config,
|
|
25
31
|
logger: this.logger,
|
|
26
|
-
|
|
32
|
+
wordpress: this.wordpress,
|
|
33
|
+
settings: this.settings,
|
|
34
|
+
email: this.email,
|
|
27
35
|
getConnInfo: this.createConnInfoFn(request),
|
|
28
36
|
verifyCaptcha: this.createVerifyCaptchaFn(request),
|
|
29
37
|
getAuthUser: this.createGetUserFn(request),
|
|
@@ -39,7 +47,9 @@ var Context = class {
|
|
|
39
47
|
request: null,
|
|
40
48
|
config: this.config,
|
|
41
49
|
logger: this.logger,
|
|
42
|
-
|
|
50
|
+
wordpress: this.wordpress,
|
|
51
|
+
settings: this.settings,
|
|
52
|
+
email: this.email,
|
|
43
53
|
getAuthUser: this.createGetUserFn(null),
|
|
44
54
|
getConnInfo: this.createConnInfoFn(null),
|
|
45
55
|
verifyCaptcha: this.createVerifyCaptchaFn(null),
|
package/dist/email/service.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { WordPressService } from "../wordpress/service.js";
|
|
2
|
+
import "../wordpress/index.js";
|
|
1
3
|
import { EmailSendParams } from "./service.interface.js";
|
|
2
|
-
import { Service } from "../service.js";
|
|
3
4
|
|
|
4
5
|
//#region src/email/service.d.ts
|
|
5
6
|
declare class EmailService {
|
|
6
|
-
private readonly
|
|
7
|
-
constructor(
|
|
7
|
+
private readonly wordpress;
|
|
8
|
+
constructor(wordpress: WordPressService);
|
|
8
9
|
send(params: EmailSendParams): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
//#endregion
|
package/dist/email/service.js
CHANGED
|
@@ -2,12 +2,12 @@ import { WP_KIZLO_BASE } from "../wordpress/constants.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/email/service.ts
|
|
4
4
|
var EmailService = class {
|
|
5
|
-
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
5
|
+
wordpress;
|
|
6
|
+
constructor(wordpress) {
|
|
7
|
+
this.wordpress = wordpress;
|
|
8
8
|
}
|
|
9
9
|
async send(params) {
|
|
10
|
-
const { data, error } = await this.
|
|
10
|
+
const { data, error } = await this.wordpress.post("/email/send", {
|
|
11
11
|
body: params,
|
|
12
12
|
base: WP_KIZLO_BASE
|
|
13
13
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { WP_Error } from "./wordpress/error.js";
|
|
2
2
|
import { WP_CommonErrorCode, WP_Context, WP_CurrencyFormat, WP_ErrorData, WP_Link, WP_List, WP_ListMetadata, WP_ListOrder, WP_RequestInput, WP_Result, WordPressCredentials } from "./wordpress/types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { 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 } from "./wordpress/comment/types.js";
|
|
4
|
+
import { CommentService } from "./wordpress/comment/service.js";
|
|
5
|
+
import { WP_MENU_ITEM_ORDER_BYES, WP_MENU_ITEM_TARGETS, WP_MENU_ITEM_TAX_RELATIONS, 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 } from "./wordpress/menu/items/types.js";
|
|
4
6
|
import { MenuItemService } from "./wordpress/menu/items/service.js";
|
|
5
7
|
import { WP_Menu, WP_MenuCreateErrorCode, WP_MenuCreateInput, WP_MenuDeleteErrorCode, WP_MenuDeleteInput, WP_MenuDeleteResponse, WP_MenuLinks, WP_MenuListErrorCode, WP_MenuListInput, WP_MenuOrderBy, WP_MenuRetrieveErrorCode, WP_MenuRetrieveInput, WP_MenuUpdateErrorCode, WP_MenuUpdateInput } from "./wordpress/menu/types.js";
|
|
6
8
|
import { MenuService } from "./wordpress/menu/service.js";
|
|
7
|
-
import {
|
|
9
|
+
import { WP_PAGE_ORDER_BYES, WP_PAGE_STATUSES, 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 } from "./wordpress/page/types.js";
|
|
10
|
+
import { PageService } from "./wordpress/page/service.js";
|
|
11
|
+
import { WP_POST_FORMATS, WP_POST_ORDER_BYES, WP_POST_STATUSES, WP_POST_TAX_RELATIONS, 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 } from "./wordpress/post/types.js";
|
|
8
12
|
import { PostService } from "./wordpress/post/service.js";
|
|
13
|
+
import { 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 } from "./wordpress/tag/types.js";
|
|
9
14
|
import { 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 } from "./wordpress/user/types.js";
|
|
10
15
|
import { UserService } from "./wordpress/user/service.js";
|
|
11
16
|
import { WordPressService } from "./wordpress/service.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
17
|
+
import { WP_CATEGORY_ORDER_BYS, 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 } from "./wordpress/category/types.js";
|
|
18
|
+
import { CategoryService } from "./wordpress/category/service.js";
|
|
14
19
|
import { CART_HASH_HEADER_KEY, SAFE_REQUEST_TIMEOUT, UNEXPECTED_BODY_SNIPPET_LENGTH, WC_CORE_BASE, WC_STORE_BASE, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_KIZLO_BASE } from "./wordpress/constants.js";
|
|
15
20
|
import { isWordPressResourceError } from "./wordpress/utils.js";
|
|
16
21
|
import "./wordpress/index.js";
|
|
@@ -27,25 +32,24 @@ import { AuthorsSettings, AuthorsSettingsInput, BrandSettings, BrandSettingsInpu
|
|
|
27
32
|
import { IconDescriptor, ManifestIcon, ResolvedIcons, resolveIcons } from "./brand/icons.js";
|
|
28
33
|
import { CookiesStorage } from "./cookie.js";
|
|
29
34
|
import { SettingsService } from "./settings/service.js";
|
|
30
|
-
import {
|
|
31
|
-
import { AuthUserFn, ConnInfoFn, Context, ContextConfig, ServerContext, VerifyCaptchaFn, VerifyPreviewTokenFn } from "./context.js";
|
|
35
|
+
import { AuthUserFn, ConnInfoFn, Context, ContextConfig, ProcedureContext, VerifyCaptchaFn, VerifyPreviewTokenFn } from "./context.js";
|
|
32
36
|
import { ROUTER_MAP, RouterMap } from "./router.js";
|
|
33
37
|
import { AnyEventSchema, AnyEvents, EventHandler, EventHandlerFn, InferEventUnion, WebhookOptions, createEventHandler, createWebhookRouter } from "./webhook/index.js";
|
|
34
38
|
import { COMMON_ERRORS, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, DefinedErrorMapLike, ErrorDefinition, KizloError, KizloErrorOptions, ThrowableErrorFn, ThrowableErrorMap, WithCommonErrorMap, createThrowableErrorMap, defineErrorMap, isKizloError, toKizloError } from "./shared/error.js";
|
|
35
|
-
import { AnyMiddleware, ExtractMiddlewareContextOutput,
|
|
36
|
-
import { AnyProcedure, AnyProcedureRouter, BaseHandlerOptions, ExtractParams, ExtractProcedureByScope, InvocationScope, OpenapiPart, Procedure,
|
|
39
|
+
import { AnyMiddleware, ExtractMiddlewareContextOutput, InferMiddlewares, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, createMiddleware } from "./shared/middleware.js";
|
|
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";
|
|
37
41
|
import { AnyExtension, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, InferExtensionRouter, createExtension } from "./shared/extension.js";
|
|
38
42
|
import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloTarget, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig } from "./kizlo.js";
|
|
39
43
|
import { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute } from "./brand/manifest.js";
|
|
40
44
|
import "./brand/index.js";
|
|
41
45
|
import { KizloClient, KizloClientConfig, createKizloClient } from "./client.js";
|
|
42
46
|
import { CONTENT_TYPES, ContentType, ListSitemapUrlInput, ListSitemapUrlInputBase, Robots, RobotsRule, Seo, SeoHead, SeoSchema, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList } from "./seo/schema.js";
|
|
43
|
-
import {
|
|
47
|
+
import { WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage } from "./seo/types.js";
|
|
44
48
|
import { SitemapIndexEntry, deserializeSeo, parseSitemapSlug, renderSitemapIndex, renderUrlSet, sitemapEntryPath, xmlResponse } from "./seo/utils.js";
|
|
45
|
-
import { CreateSitemapRouteOptions, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SitemapRouteExtra, createSitemapRoute } from "./seo/sitemap.js";
|
|
49
|
+
import { CreateSitemapRouteOptions, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SitemapRouteExtra, createSitemapRedirectRoute, createSitemapRoute } from "./seo/sitemap.js";
|
|
46
50
|
import { Contract, ContractProcedure, generateContract, isContractProcedure, restoreContract } from "./shared/contract.js";
|
|
47
51
|
import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
|
|
48
52
|
import { Identifier, parseIdentifier } from "./shared/identifier.js";
|
|
49
53
|
import { createOrpcRouter } from "./shared/router.js";
|
|
50
54
|
import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
|
|
51
|
-
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, 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,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -16,26 +16,32 @@ import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, M
|
|
|
16
16
|
import { KizloClient, createKizloClient } from "./client.js";
|
|
17
17
|
import { CookiesStorage } from "./cookie.js";
|
|
18
18
|
import { CART_HASH_HEADER_KEY, SAFE_REQUEST_TIMEOUT, UNEXPECTED_BODY_SNIPPET_LENGTH, WC_CORE_BASE, WC_STORE_BASE, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_KIZLO_BASE } from "./wordpress/constants.js";
|
|
19
|
+
import { CategoryService } from "./wordpress/category/service.js";
|
|
20
|
+
import { WP_CATEGORY_ORDER_BYS } from "./wordpress/category/types.js";
|
|
19
21
|
import { CommentService } from "./wordpress/comment/service.js";
|
|
20
22
|
import { WP_Error } from "./wordpress/error.js";
|
|
21
23
|
import { MenuItemService } from "./wordpress/menu/items/service.js";
|
|
24
|
+
import { WP_MENU_ITEM_ORDER_BYES, WP_MENU_ITEM_TARGETS, WP_MENU_ITEM_TAX_RELATIONS } from "./wordpress/menu/items/types.js";
|
|
22
25
|
import { MenuService } from "./wordpress/menu/service.js";
|
|
26
|
+
import { PageService } from "./wordpress/page/service.js";
|
|
27
|
+
import { WP_PAGE_ORDER_BYES, WP_PAGE_STATUSES } from "./wordpress/page/types.js";
|
|
23
28
|
import { PostService } from "./wordpress/post/service.js";
|
|
29
|
+
import { WP_POST_FORMATS, WP_POST_ORDER_BYES, WP_POST_STATUSES, WP_POST_TAX_RELATIONS } from "./wordpress/post/types.js";
|
|
24
30
|
import { UserService } from "./wordpress/user/service.js";
|
|
25
31
|
import { isWordPressResourceError } from "./wordpress/utils.js";
|
|
26
32
|
import { WordPressService } from "./wordpress/service.js";
|
|
33
|
+
import { WP_TAG_ORDER_BYS } from "./wordpress/tag/types.js";
|
|
27
34
|
import { SettingsService } from "./settings/service.js";
|
|
28
|
-
import { Service } from "./service.js";
|
|
29
35
|
import { Context } from "./context.js";
|
|
30
|
-
import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
|
|
31
36
|
import { parseIdentifier } from "./shared/identifier.js";
|
|
37
|
+
import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
|
|
32
38
|
import { CONTENT_TYPES, ContentType, ListSitemapUrlInput, ListSitemapUrlInputBase, Robots, RobotsRule, Seo, SeoHead, SeoSchema, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList } from "./seo/schema.js";
|
|
33
39
|
import { deserializeSeo, parseSitemapSlug, renderSitemapIndex, renderUrlSet, sitemapEntryPath, xmlResponse } from "./seo/utils.js";
|
|
34
40
|
import { ROUTER_MAP } from "./router.js";
|
|
35
41
|
import { createEventHandler, createWebhookRouter } from "./webhook/index.js";
|
|
36
42
|
import { Kizlo, createKizlo, resolveKizloConfig } from "./kizlo.js";
|
|
37
|
-
import { SITEMAP_BASE, SITEMAP_INDEX_SLUG, createSitemapRoute } from "./seo/sitemap.js";
|
|
43
|
+
import { SITEMAP_BASE, SITEMAP_INDEX_SLUG, createSitemapRedirectRoute, createSitemapRoute } from "./seo/sitemap.js";
|
|
38
44
|
import { createExtension } from "./shared/extension.js";
|
|
39
45
|
import { createMiddleware } from "./shared/middleware.js";
|
|
40
46
|
|
|
41
|
-
export { CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CommentService, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, Media, MenuItemService, MenuService, PostService, PreviewTokenData, PreviewTokenPayload, ROUTER_MAP, Robots, RobotsRule, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema,
|
|
47
|
+
export { CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CategoryService, CommentService, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, Media, MenuItemService, MenuService, PageService, PostService, PreviewTokenData, PreviewTokenPayload, ROUTER_MAP, Robots, RobotsRule, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, UNEXPECTED_BODY_SNIPPET_LENGTH, UserService, WC_CORE_BASE, WC_STORE_BASE, WEB_MANIFEST_ROUTE, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CATEGORY_ORDER_BYS, WP_CORE_BASE, WP_Error, WP_KIZLO_BASE, WP_MENU_ITEM_ORDER_BYES, WP_MENU_ITEM_TARGETS, WP_MENU_ITEM_TAX_RELATIONS, WP_PAGE_ORDER_BYES, WP_PAGE_STATUSES, WP_POST_FORMATS, WP_POST_ORDER_BYES, WP_POST_STATUSES, WP_POST_TAX_RELATIONS, WP_TAG_ORDER_BYS, 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 };
|
|
@@ -69,8 +69,8 @@ function createPageMetadata(head) {
|
|
|
69
69
|
locale: head.og.locale,
|
|
70
70
|
images: head.og.image ? [{
|
|
71
71
|
url: head.og.image.url,
|
|
72
|
-
width: head.og.image.width,
|
|
73
|
-
height: head.og.image.height,
|
|
72
|
+
width: head.og.image.width ?? void 0,
|
|
73
|
+
height: head.og.image.height ?? void 0,
|
|
74
74
|
alt: head.og.image.alt ?? void 0
|
|
75
75
|
}] : void 0
|
|
76
76
|
},
|
|
@@ -80,7 +80,10 @@ function createPageMetadata(head) {
|
|
|
80
80
|
description: head.twitter.description || void 0,
|
|
81
81
|
site: head.twitter.site ?? void 0,
|
|
82
82
|
creator: head.twitter.creator ?? void 0,
|
|
83
|
-
images: head.twitter.image ? [
|
|
83
|
+
images: head.twitter.image ? [{
|
|
84
|
+
url: head.twitter.image,
|
|
85
|
+
alt: head.twitter.imageAlt ?? void 0
|
|
86
|
+
}] : void 0
|
|
84
87
|
}
|
|
85
88
|
};
|
|
86
89
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { S2SClient } from "../../kizlo.js";
|
|
2
|
-
import { CreateSitemapRouteOptions } from "../../seo/sitemap.js";
|
|
2
|
+
import { CreateSitemapRouteOptions, createSitemapRedirectRoute } from "../../seo/sitemap.js";
|
|
3
3
|
|
|
4
4
|
//#region src/integrations/nextjs/sitemap.d.ts
|
|
5
5
|
declare const SITEMAP_ROUTE: "/sitemaps/[sitemap]";
|
|
6
6
|
declare const SITEMAP_CACHE_TAG = "kizlo:sitemap";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Next's dynamic-route context for the `[sitemap]` segment. Typed to match the App Router's
|
|
9
|
+
* `RouteContext` (required, `params` a promise) so `next typegen` accepts the exported handler.
|
|
10
|
+
*/
|
|
8
11
|
interface NextRouteContext {
|
|
9
|
-
params
|
|
10
|
-
sitemap
|
|
11
|
-
} | Promise<{
|
|
12
|
-
sitemap?: string;
|
|
12
|
+
params: Promise<{
|
|
13
|
+
sitemap: string;
|
|
13
14
|
}>;
|
|
14
15
|
}
|
|
15
|
-
declare function createSitemapRoute(client: S2SClient<[]>, options?: CreateSitemapRouteOptions): (request: Request, ctx
|
|
16
|
+
declare function createSitemapRoute(client: S2SClient<[]>, options?: CreateSitemapRouteOptions): (request: Request, ctx: NextRouteContext) => Promise<Response>;
|
|
16
17
|
//#endregion
|
|
17
18
|
export { SITEMAP_CACHE_TAG, SITEMAP_ROUTE, createSitemapRoute };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { xmlResponse } from "../../seo/utils.js";
|
|
2
|
-
import { SITEMAP_BASE, createSitemapRoute } from "../../seo/sitemap.js";
|
|
2
|
+
import { SITEMAP_BASE, createSitemapRedirectRoute, createSitemapRoute } from "../../seo/sitemap.js";
|
|
3
3
|
|
|
4
4
|
//#region src/integrations/nextjs/sitemap.ts
|
|
5
5
|
const SITEMAP_ROUTE = `${SITEMAP_BASE}/[sitemap]`;
|
|
@@ -8,8 +8,8 @@ function createSitemapRoute$1(client, options) {
|
|
|
8
8
|
const handler = createSitemapRoute(client, options);
|
|
9
9
|
let getCached;
|
|
10
10
|
return async function GET(request, ctx) {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
11
|
+
const { sitemap } = await ctx.params;
|
|
12
|
+
if (sitemap === void 0) throw new Error(`createSitemapRoute must be mounted at "${SITEMAP_ROUTE}". The dynamic segment must be named [sitemap].`);
|
|
13
13
|
if (!getCached) {
|
|
14
14
|
const { unstable_cache } = await import("next/cache");
|
|
15
15
|
getCached = unstable_cache(async (url) => {
|