kizlo 0.15.2 → 0.17.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.
- package/dist/adapters/logger.d.ts +2 -5
- package/dist/adapters/logger.js +1 -1
- package/dist/adapters/types.d.ts +19 -0
- package/dist/adapters/types.js +17 -0
- package/dist/astro/server.d.ts +2 -2
- package/dist/astro/server.js +2 -2
- package/dist/category/index.js +2 -2
- package/dist/category/schema.js +2 -1
- package/dist/category/utils.js +1 -0
- package/dist/cli/commands/_setup.js +10 -10
- package/dist/cli/commands/dev.js +7 -7
- package/dist/cli/daemon/generate.js +19 -9
- package/dist/cli/daemon/jiti.js +4 -5
- package/dist/cli/daemon/watch.js +3 -2
- package/dist/cli/presets/template.js +1 -1
- package/dist/cli/utils.js +6 -6
- package/dist/cli/wp/bootstrap.js +15 -11
- package/dist/cli/wp/constants.js +1 -1
- package/dist/cli/wp/dev.js +6 -23
- package/dist/cli/wp/types.d.ts +2 -2
- package/dist/cli/wp/utils.d.ts +1 -1
- package/dist/cli/wp/utils.js +1 -1
- package/dist/client.d.ts +7 -7
- package/dist/client.js +1 -1
- package/dist/comment/index.js +2 -2
- package/dist/comment/schema.js +3 -3
- package/dist/comment/utils.js +4 -14
- package/dist/config.d.ts +8 -8
- package/dist/context.d.ts +5 -5
- package/dist/context.js +5 -5
- package/dist/index.d.ts +8 -7
- package/dist/index.js +6 -5
- package/dist/integrations/astro/integration.d.ts +12 -0
- package/dist/integrations/astro/integration.js +14 -0
- package/dist/integrations/astro/kizlo.client.d.ts +4 -4
- package/dist/integrations/astro/utils.d.ts +4 -5
- package/dist/integrations/astro/utils.js +5 -6
- package/dist/integrations/nextjs/integration.d.ts +15 -0
- package/dist/integrations/nextjs/integration.js +18 -0
- package/dist/integrations/nextjs/kizlo.client.d.ts +2 -2
- package/dist/integrations/nextjs/revalidate.d.ts +2 -3
- package/dist/integrations/nextjs/revalidate.js +4 -4
- package/dist/integrations/nextjs/utils.js +2 -2
- package/dist/integrations/node/integration.d.ts +12 -0
- package/dist/integrations/node/integration.js +14 -0
- package/dist/integrations/runtime-env.js +25 -0
- package/dist/integrations/tanstack-start/api.d.ts +1 -1
- package/dist/integrations/tanstack-start/integration.d.ts +12 -0
- package/dist/integrations/tanstack-start/integration.js +14 -0
- package/dist/integrations/tanstack-start/kizlo.client.d.ts +4 -4
- package/dist/integrations/tanstack-start/utils.d.ts +1 -1
- package/dist/integrations/tanstack-start/utils.js +3 -3
- package/dist/kizlo.d.ts +33 -70
- package/dist/kizlo.js +91 -75
- package/dist/menu/index.js +2 -2
- package/dist/nextjs/server.d.ts +2 -2
- package/dist/nextjs/server.js +2 -2
- package/dist/node.d.ts +2 -0
- package/dist/node.js +3 -0
- package/dist/package.js +1 -1
- package/dist/page/index.js +2 -2
- package/dist/page/schema.js +5 -4
- package/dist/page/utils.js +5 -9
- package/dist/post/index.js +2 -2
- package/dist/post/schema.js +5 -4
- package/dist/post/utils.js +5 -9
- package/dist/{router.d.ts → procedures.d.ts} +42 -125
- package/dist/procedures.js +23 -0
- package/dist/seo/index.js +2 -2
- package/dist/seo/schema.d.ts +5 -5
- package/dist/settings/index.js +2 -2
- package/dist/shared/constants.js +1 -9
- package/dist/shared/contract-generation.js +14 -0
- package/dist/shared/contract.d.ts +2 -2
- package/dist/shared/contract.js +2 -2
- package/dist/shared/integration.d.ts +91 -0
- package/dist/shared/integration.js +59 -0
- package/dist/shared/procedure.d.ts +8 -8
- package/dist/shared/result.d.ts +2 -2
- package/dist/shared/router.d.ts +2 -2
- package/dist/shared/router.js +2 -2
- package/dist/shared/schema.d.ts +3 -1
- package/dist/shared/schema.js +3 -1
- package/dist/tag/index.js +2 -2
- package/dist/tag/schema.js +2 -1
- package/dist/tag/utils.js +1 -0
- package/dist/tanstack-start/server.d.ts +2 -2
- package/dist/tanstack-start/server.js +2 -2
- package/package.json +8 -2
- package/dist/integrations/astro/kizlo.server.d.ts +0 -10
- package/dist/integrations/astro/kizlo.server.js +0 -12
- package/dist/integrations/nextjs/kizlo.server.d.ts +0 -11
- package/dist/integrations/nextjs/kizlo.server.js +0 -15
- package/dist/integrations/tanstack-start/kizlo.server.d.ts +0 -14
- package/dist/integrations/tanstack-start/kizlo.server.js +0 -15
- package/dist/router.js +0 -23
- package/dist/shared/extension.d.ts +0 -58
- package/dist/shared/extension.js +0 -37
|
@@ -4,8 +4,8 @@ import { Procedure } from "./shared/procedure.js";
|
|
|
4
4
|
import "./index.js";
|
|
5
5
|
import * as _kizlo_shared0 from "@kizlo/shared";
|
|
6
6
|
|
|
7
|
-
//#region src/
|
|
8
|
-
declare const
|
|
7
|
+
//#region src/procedures.d.ts
|
|
8
|
+
declare const CORE_PROCEDURES: {
|
|
9
9
|
posts: {
|
|
10
10
|
get: Procedure<"api", {
|
|
11
11
|
params: {
|
|
@@ -33,27 +33,14 @@ declare const ROUTER_MAP: {
|
|
|
33
33
|
id: number;
|
|
34
34
|
name: string;
|
|
35
35
|
slug: string;
|
|
36
|
-
|
|
37
|
-
id: number;
|
|
38
|
-
name: string;
|
|
39
|
-
alt: string;
|
|
40
|
-
src: string;
|
|
41
|
-
mime?: string | undefined;
|
|
42
|
-
width?: number | undefined;
|
|
43
|
-
height?: number | undefined;
|
|
44
|
-
variants?: {
|
|
45
|
-
src: string;
|
|
46
|
-
width: number;
|
|
47
|
-
height: number;
|
|
48
|
-
}[] | undefined;
|
|
49
|
-
srcset?: string | undefined;
|
|
50
|
-
} | null;
|
|
36
|
+
avatarUrl: string | null;
|
|
51
37
|
} | null;
|
|
52
38
|
featuredMedia: {
|
|
53
39
|
id: number;
|
|
54
40
|
name: string;
|
|
55
|
-
alt: string;
|
|
56
41
|
src: string;
|
|
42
|
+
type: "image";
|
|
43
|
+
alt: string;
|
|
57
44
|
mime?: string | undefined;
|
|
58
45
|
width?: number | undefined;
|
|
59
46
|
height?: number | undefined;
|
|
@@ -125,6 +112,7 @@ declare const ROUTER_MAP: {
|
|
|
125
112
|
}[];
|
|
126
113
|
};
|
|
127
114
|
} | null;
|
|
115
|
+
custom: never;
|
|
128
116
|
createdAt: number;
|
|
129
117
|
updatedAt: number;
|
|
130
118
|
meta: {
|
|
@@ -179,7 +167,7 @@ declare const ROUTER_MAP: {
|
|
|
179
167
|
include?: string | number | (string | number)[] | undefined;
|
|
180
168
|
offset?: string | number | undefined;
|
|
181
169
|
order?: "asc" | "desc" | undefined;
|
|
182
|
-
orderby?: "
|
|
170
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | undefined;
|
|
183
171
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
184
172
|
slug?: string | string[] | undefined;
|
|
185
173
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -208,27 +196,14 @@ declare const ROUTER_MAP: {
|
|
|
208
196
|
id: number;
|
|
209
197
|
name: string;
|
|
210
198
|
slug: string;
|
|
211
|
-
|
|
212
|
-
id: number;
|
|
213
|
-
name: string;
|
|
214
|
-
alt: string;
|
|
215
|
-
src: string;
|
|
216
|
-
mime?: string | undefined;
|
|
217
|
-
width?: number | undefined;
|
|
218
|
-
height?: number | undefined;
|
|
219
|
-
variants?: {
|
|
220
|
-
src: string;
|
|
221
|
-
width: number;
|
|
222
|
-
height: number;
|
|
223
|
-
}[] | undefined;
|
|
224
|
-
srcset?: string | undefined;
|
|
225
|
-
} | null;
|
|
199
|
+
avatarUrl: string | null;
|
|
226
200
|
} | null;
|
|
227
201
|
featuredMedia: {
|
|
228
202
|
id: number;
|
|
229
203
|
name: string;
|
|
230
|
-
alt: string;
|
|
231
204
|
src: string;
|
|
205
|
+
type: "image";
|
|
206
|
+
alt: string;
|
|
232
207
|
mime?: string | undefined;
|
|
233
208
|
width?: number | undefined;
|
|
234
209
|
height?: number | undefined;
|
|
@@ -300,6 +275,7 @@ declare const ROUTER_MAP: {
|
|
|
300
275
|
}[];
|
|
301
276
|
};
|
|
302
277
|
} | null;
|
|
278
|
+
custom: never;
|
|
303
279
|
createdAt: number;
|
|
304
280
|
updatedAt: number;
|
|
305
281
|
meta: {
|
|
@@ -375,27 +351,14 @@ declare const ROUTER_MAP: {
|
|
|
375
351
|
id: number;
|
|
376
352
|
name: string;
|
|
377
353
|
slug: string;
|
|
378
|
-
|
|
379
|
-
id: number;
|
|
380
|
-
name: string;
|
|
381
|
-
alt: string;
|
|
382
|
-
src: string;
|
|
383
|
-
mime?: string | undefined;
|
|
384
|
-
width?: number | undefined;
|
|
385
|
-
height?: number | undefined;
|
|
386
|
-
variants?: {
|
|
387
|
-
src: string;
|
|
388
|
-
width: number;
|
|
389
|
-
height: number;
|
|
390
|
-
}[] | undefined;
|
|
391
|
-
srcset?: string | undefined;
|
|
392
|
-
} | null;
|
|
354
|
+
avatarUrl: string | null;
|
|
393
355
|
} | null;
|
|
394
356
|
featuredMedia: {
|
|
395
357
|
id: number;
|
|
396
358
|
name: string;
|
|
397
|
-
alt: string;
|
|
398
359
|
src: string;
|
|
360
|
+
type: "image";
|
|
361
|
+
alt: string;
|
|
399
362
|
mime?: string | undefined;
|
|
400
363
|
width?: number | undefined;
|
|
401
364
|
height?: number | undefined;
|
|
@@ -457,6 +420,7 @@ declare const ROUTER_MAP: {
|
|
|
457
420
|
}[];
|
|
458
421
|
};
|
|
459
422
|
} | null;
|
|
423
|
+
custom: never;
|
|
460
424
|
createdAt: number;
|
|
461
425
|
updatedAt: number;
|
|
462
426
|
meta: {
|
|
@@ -511,7 +475,7 @@ declare const ROUTER_MAP: {
|
|
|
511
475
|
include?: string | number | (string | number)[] | undefined;
|
|
512
476
|
offset?: string | number | undefined;
|
|
513
477
|
order?: "asc" | "desc" | undefined;
|
|
514
|
-
orderby?: "
|
|
478
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
515
479
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
516
480
|
slug?: string | string[] | undefined;
|
|
517
481
|
parent?: string | number | (string | number)[] | undefined;
|
|
@@ -537,27 +501,14 @@ declare const ROUTER_MAP: {
|
|
|
537
501
|
id: number;
|
|
538
502
|
name: string;
|
|
539
503
|
slug: string;
|
|
540
|
-
|
|
541
|
-
id: number;
|
|
542
|
-
name: string;
|
|
543
|
-
alt: string;
|
|
544
|
-
src: string;
|
|
545
|
-
mime?: string | undefined;
|
|
546
|
-
width?: number | undefined;
|
|
547
|
-
height?: number | undefined;
|
|
548
|
-
variants?: {
|
|
549
|
-
src: string;
|
|
550
|
-
width: number;
|
|
551
|
-
height: number;
|
|
552
|
-
}[] | undefined;
|
|
553
|
-
srcset?: string | undefined;
|
|
554
|
-
} | null;
|
|
504
|
+
avatarUrl: string | null;
|
|
555
505
|
} | null;
|
|
556
506
|
featuredMedia: {
|
|
557
507
|
id: number;
|
|
558
508
|
name: string;
|
|
559
|
-
alt: string;
|
|
560
509
|
src: string;
|
|
510
|
+
type: "image";
|
|
511
|
+
alt: string;
|
|
561
512
|
mime?: string | undefined;
|
|
562
513
|
width?: number | undefined;
|
|
563
514
|
height?: number | undefined;
|
|
@@ -619,6 +570,7 @@ declare const ROUTER_MAP: {
|
|
|
619
570
|
}[];
|
|
620
571
|
};
|
|
621
572
|
} | null;
|
|
573
|
+
custom: never;
|
|
622
574
|
createdAt: number;
|
|
623
575
|
updatedAt: number;
|
|
624
576
|
meta: {
|
|
@@ -731,6 +683,7 @@ declare const ROUTER_MAP: {
|
|
|
731
683
|
}[];
|
|
732
684
|
};
|
|
733
685
|
} | null;
|
|
686
|
+
custom: never;
|
|
734
687
|
meta: {
|
|
735
688
|
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
736
689
|
[x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
@@ -772,7 +725,7 @@ declare const ROUTER_MAP: {
|
|
|
772
725
|
exclude?: string | number | (string | number)[] | undefined;
|
|
773
726
|
include?: string | number | (string | number)[] | undefined;
|
|
774
727
|
order?: "asc" | "desc" | undefined;
|
|
775
|
-
orderBy?: "id" | "
|
|
728
|
+
orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
|
|
776
729
|
hideEmpty?: string | boolean | undefined;
|
|
777
730
|
parent?: string | number | undefined;
|
|
778
731
|
post?: string | number | undefined;
|
|
@@ -838,6 +791,7 @@ declare const ROUTER_MAP: {
|
|
|
838
791
|
}[];
|
|
839
792
|
};
|
|
840
793
|
} | null;
|
|
794
|
+
custom: never;
|
|
841
795
|
meta: {
|
|
842
796
|
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
843
797
|
[x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
@@ -947,6 +901,7 @@ declare const ROUTER_MAP: {
|
|
|
947
901
|
}[];
|
|
948
902
|
};
|
|
949
903
|
} | null;
|
|
904
|
+
custom: never;
|
|
950
905
|
meta: {
|
|
951
906
|
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
952
907
|
[x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
@@ -988,7 +943,7 @@ declare const ROUTER_MAP: {
|
|
|
988
943
|
exclude?: string | number | (string | number)[] | undefined;
|
|
989
944
|
include?: string | number | (string | number)[] | undefined;
|
|
990
945
|
order?: "asc" | "desc" | undefined;
|
|
991
|
-
orderBy?: "id" | "
|
|
946
|
+
orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
|
|
992
947
|
hideEmpty?: string | boolean | undefined;
|
|
993
948
|
post?: string | number | undefined;
|
|
994
949
|
slug?: string | string[] | undefined;
|
|
@@ -1052,6 +1007,7 @@ declare const ROUTER_MAP: {
|
|
|
1052
1007
|
}[];
|
|
1053
1008
|
};
|
|
1054
1009
|
} | null;
|
|
1010
|
+
custom: never;
|
|
1055
1011
|
meta: {
|
|
1056
1012
|
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
1057
1013
|
[x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
@@ -1151,7 +1107,7 @@ declare const ROUTER_MAP: {
|
|
|
1151
1107
|
sitemaps: {
|
|
1152
1108
|
list: Procedure<"internal", {}, {
|
|
1153
1109
|
key: string;
|
|
1154
|
-
type: "
|
|
1110
|
+
type: "author" | "post_type" | "taxonomy";
|
|
1155
1111
|
pages: number;
|
|
1156
1112
|
lastmod: string;
|
|
1157
1113
|
}[], DefinedErrorMapLike>;
|
|
@@ -1159,7 +1115,7 @@ declare const ROUTER_MAP: {
|
|
|
1159
1115
|
origin: string;
|
|
1160
1116
|
sitemaps: {
|
|
1161
1117
|
key: string;
|
|
1162
|
-
type: "
|
|
1118
|
+
type: "author" | "post_type" | "taxonomy";
|
|
1163
1119
|
pages: number;
|
|
1164
1120
|
lastmod: string;
|
|
1165
1121
|
}[];
|
|
@@ -1202,7 +1158,7 @@ declare const ROUTER_MAP: {
|
|
|
1202
1158
|
include?: string | number | (string | number)[] | undefined;
|
|
1203
1159
|
offset?: string | number | undefined;
|
|
1204
1160
|
order?: "asc" | "desc" | undefined;
|
|
1205
|
-
orderby?: "
|
|
1161
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
1206
1162
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
1207
1163
|
slug?: string | string[] | undefined;
|
|
1208
1164
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -1281,7 +1237,7 @@ declare const ROUTER_MAP: {
|
|
|
1281
1237
|
include?: string | number | (string | number)[] | undefined;
|
|
1282
1238
|
offset?: string | number | undefined;
|
|
1283
1239
|
order?: "asc" | "desc" | undefined;
|
|
1284
|
-
orderby?: "
|
|
1240
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
1285
1241
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
1286
1242
|
slug?: string | string[] | undefined;
|
|
1287
1243
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -1367,21 +1323,7 @@ declare const ROUTER_MAP: {
|
|
|
1367
1323
|
author: {
|
|
1368
1324
|
id: number;
|
|
1369
1325
|
name: string;
|
|
1370
|
-
|
|
1371
|
-
id: number;
|
|
1372
|
-
name: string;
|
|
1373
|
-
alt: string;
|
|
1374
|
-
src: string;
|
|
1375
|
-
mime?: string | undefined;
|
|
1376
|
-
width?: number | undefined;
|
|
1377
|
-
height?: number | undefined;
|
|
1378
|
-
variants?: {
|
|
1379
|
-
src: string;
|
|
1380
|
-
width: number;
|
|
1381
|
-
height: number;
|
|
1382
|
-
}[] | undefined;
|
|
1383
|
-
srcset?: string | undefined;
|
|
1384
|
-
} | null;
|
|
1326
|
+
avatarUrl: string | null;
|
|
1385
1327
|
} | null;
|
|
1386
1328
|
content: string;
|
|
1387
1329
|
post: {
|
|
@@ -1391,8 +1333,9 @@ declare const ROUTER_MAP: {
|
|
|
1391
1333
|
image: {
|
|
1392
1334
|
id: number;
|
|
1393
1335
|
name: string;
|
|
1394
|
-
alt: string;
|
|
1395
1336
|
src: string;
|
|
1337
|
+
type: "image";
|
|
1338
|
+
alt: string;
|
|
1396
1339
|
mime?: string | undefined;
|
|
1397
1340
|
width?: number | undefined;
|
|
1398
1341
|
height?: number | undefined;
|
|
@@ -1430,7 +1373,7 @@ declare const ROUTER_MAP: {
|
|
|
1430
1373
|
include?: string | number | (string | number)[] | undefined;
|
|
1431
1374
|
offset?: string | number | undefined;
|
|
1432
1375
|
order?: "asc" | "desc" | undefined;
|
|
1433
|
-
orderby?: "
|
|
1376
|
+
orderby?: "date" | "id" | "parent" | "post" | "include" | undefined;
|
|
1434
1377
|
parent?: string | number | (string | number)[] | undefined;
|
|
1435
1378
|
parentExclude?: string | number | (string | number)[] | undefined;
|
|
1436
1379
|
post?: string | number | (string | number)[] | undefined;
|
|
@@ -1443,21 +1386,7 @@ declare const ROUTER_MAP: {
|
|
|
1443
1386
|
author: {
|
|
1444
1387
|
id: number;
|
|
1445
1388
|
name: string;
|
|
1446
|
-
|
|
1447
|
-
id: number;
|
|
1448
|
-
name: string;
|
|
1449
|
-
alt: string;
|
|
1450
|
-
src: string;
|
|
1451
|
-
mime?: string | undefined;
|
|
1452
|
-
width?: number | undefined;
|
|
1453
|
-
height?: number | undefined;
|
|
1454
|
-
variants?: {
|
|
1455
|
-
src: string;
|
|
1456
|
-
width: number;
|
|
1457
|
-
height: number;
|
|
1458
|
-
}[] | undefined;
|
|
1459
|
-
srcset?: string | undefined;
|
|
1460
|
-
} | null;
|
|
1389
|
+
avatarUrl: string | null;
|
|
1461
1390
|
} | null;
|
|
1462
1391
|
content: string;
|
|
1463
1392
|
post: {
|
|
@@ -1467,8 +1396,9 @@ declare const ROUTER_MAP: {
|
|
|
1467
1396
|
image: {
|
|
1468
1397
|
id: number;
|
|
1469
1398
|
name: string;
|
|
1470
|
-
alt: string;
|
|
1471
1399
|
src: string;
|
|
1400
|
+
type: "image";
|
|
1401
|
+
alt: string;
|
|
1472
1402
|
mime?: string | undefined;
|
|
1473
1403
|
width?: number | undefined;
|
|
1474
1404
|
height?: number | undefined;
|
|
@@ -1519,21 +1449,7 @@ declare const ROUTER_MAP: {
|
|
|
1519
1449
|
author: {
|
|
1520
1450
|
id: number;
|
|
1521
1451
|
name: string;
|
|
1522
|
-
|
|
1523
|
-
id: number;
|
|
1524
|
-
name: string;
|
|
1525
|
-
alt: string;
|
|
1526
|
-
src: string;
|
|
1527
|
-
mime?: string | undefined;
|
|
1528
|
-
width?: number | undefined;
|
|
1529
|
-
height?: number | undefined;
|
|
1530
|
-
variants?: {
|
|
1531
|
-
src: string;
|
|
1532
|
-
width: number;
|
|
1533
|
-
height: number;
|
|
1534
|
-
}[] | undefined;
|
|
1535
|
-
srcset?: string | undefined;
|
|
1536
|
-
} | null;
|
|
1452
|
+
avatarUrl: string | null;
|
|
1537
1453
|
} | null;
|
|
1538
1454
|
content: string;
|
|
1539
1455
|
post: {
|
|
@@ -1543,8 +1459,9 @@ declare const ROUTER_MAP: {
|
|
|
1543
1459
|
image: {
|
|
1544
1460
|
id: number;
|
|
1545
1461
|
name: string;
|
|
1546
|
-
alt: string;
|
|
1547
1462
|
src: string;
|
|
1463
|
+
type: "image";
|
|
1464
|
+
alt: string;
|
|
1548
1465
|
mime?: string | undefined;
|
|
1549
1466
|
width?: number | undefined;
|
|
1550
1467
|
height?: number | undefined;
|
|
@@ -1690,6 +1607,6 @@ declare const ROUTER_MAP: {
|
|
|
1690
1607
|
};
|
|
1691
1608
|
};
|
|
1692
1609
|
};
|
|
1693
|
-
type
|
|
1610
|
+
type CoreProcedures = typeof CORE_PROCEDURES;
|
|
1694
1611
|
//#endregion
|
|
1695
|
-
export {
|
|
1612
|
+
export { CORE_PROCEDURES, CoreProcedures };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CATEGORY_PROCEDURES } from "./category/index.js";
|
|
2
|
+
import { COMMENT_PROCEDURES } from "./comment/index.js";
|
|
3
|
+
import { MENU_PROCEDURES } from "./menu/index.js";
|
|
4
|
+
import { PAGE_PROCEDURES } from "./page/index.js";
|
|
5
|
+
import { POST_PROCEDURES } from "./post/index.js";
|
|
6
|
+
import { SEO_PROCEDURES } from "./seo/index.js";
|
|
7
|
+
import { SETTINGS_PROCEDURES } from "./settings/index.js";
|
|
8
|
+
import { TAG_PROCEDURES } from "./tag/index.js";
|
|
9
|
+
|
|
10
|
+
//#region src/procedures.ts
|
|
11
|
+
const CORE_PROCEDURES = {
|
|
12
|
+
posts: POST_PROCEDURES,
|
|
13
|
+
pages: PAGE_PROCEDURES,
|
|
14
|
+
categories: CATEGORY_PROCEDURES,
|
|
15
|
+
tags: TAG_PROCEDURES,
|
|
16
|
+
seo: SEO_PROCEDURES,
|
|
17
|
+
menus: MENU_PROCEDURES,
|
|
18
|
+
comments: COMMENT_PROCEDURES,
|
|
19
|
+
settings: SETTINGS_PROCEDURES
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CORE_PROCEDURES };
|
package/dist/seo/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function deserializeSitemapUrls(urls) {
|
|
|
23
23
|
}))
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const SEO_PROCEDURES = {
|
|
27
27
|
homepage: createProcedure({
|
|
28
28
|
scope: "internal",
|
|
29
29
|
output: Seo
|
|
@@ -111,4 +111,4 @@ const SEO_ROUTER_MAP = {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
//#endregion
|
|
114
|
-
export {
|
|
114
|
+
export { SEO_PROCEDURES };
|
package/dist/seo/schema.d.ts
CHANGED
|
@@ -108,17 +108,17 @@ declare const Seo: z.ZodObject<{
|
|
|
108
108
|
type Seo = z.infer<typeof Seo>;
|
|
109
109
|
declare const CONTENT_TYPES: readonly ["post_type", "taxonomy", "author"];
|
|
110
110
|
declare const ContentType: z.ZodEnum<{
|
|
111
|
+
author: "author";
|
|
111
112
|
post_type: "post_type";
|
|
112
113
|
taxonomy: "taxonomy";
|
|
113
|
-
author: "author";
|
|
114
114
|
}>;
|
|
115
115
|
type ContentType = z.infer<typeof ContentType>;
|
|
116
116
|
declare const Sitemap: z.ZodObject<{
|
|
117
117
|
key: z.ZodString;
|
|
118
118
|
type: z.ZodEnum<{
|
|
119
|
+
author: "author";
|
|
119
120
|
post_type: "post_type";
|
|
120
121
|
taxonomy: "taxonomy";
|
|
121
|
-
author: "author";
|
|
122
122
|
}>;
|
|
123
123
|
pages: z.ZodNumber;
|
|
124
124
|
lastmod: z.ZodString;
|
|
@@ -127,9 +127,9 @@ type Sitemap = z.infer<typeof Sitemap>;
|
|
|
127
127
|
declare const SitemapList: z.ZodArray<z.ZodObject<{
|
|
128
128
|
key: z.ZodString;
|
|
129
129
|
type: z.ZodEnum<{
|
|
130
|
+
author: "author";
|
|
130
131
|
post_type: "post_type";
|
|
131
132
|
taxonomy: "taxonomy";
|
|
132
|
-
author: "author";
|
|
133
133
|
}>;
|
|
134
134
|
pages: z.ZodNumber;
|
|
135
135
|
lastmod: z.ZodString;
|
|
@@ -140,9 +140,9 @@ declare const SitemapIndex: z.ZodObject<{
|
|
|
140
140
|
sitemaps: z.ZodArray<z.ZodObject<{
|
|
141
141
|
key: z.ZodString;
|
|
142
142
|
type: z.ZodEnum<{
|
|
143
|
+
author: "author";
|
|
143
144
|
post_type: "post_type";
|
|
144
145
|
taxonomy: "taxonomy";
|
|
145
|
-
author: "author";
|
|
146
146
|
}>;
|
|
147
147
|
pages: z.ZodNumber;
|
|
148
148
|
lastmod: z.ZodString;
|
|
@@ -174,9 +174,9 @@ declare const SitemapUrlList: z.ZodArray<z.ZodObject<{
|
|
|
174
174
|
type SitemapUrlList = z.infer<typeof SitemapUrlList>;
|
|
175
175
|
declare const ListSitemapUrlInputBase: z.ZodObject<{
|
|
176
176
|
type: z.ZodEnum<{
|
|
177
|
+
author: "author";
|
|
177
178
|
post_type: "post_type";
|
|
178
179
|
taxonomy: "taxonomy";
|
|
179
|
-
author: "author";
|
|
180
180
|
}>;
|
|
181
181
|
page: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
182
182
|
}, z.core.$strip>;
|
package/dist/settings/index.js
CHANGED
|
@@ -12,7 +12,7 @@ function resolveUpdate(response, context, errors, label) {
|
|
|
12
12
|
}
|
|
13
13
|
return response.data;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const SETTINGS_PROCEDURES = {
|
|
16
16
|
get: createProcedure({
|
|
17
17
|
scope: "internal",
|
|
18
18
|
output: schemaType()
|
|
@@ -73,4 +73,4 @@ const SETTINGS_ROUTER_MAP = {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
//#endregion
|
|
76
|
-
export {
|
|
76
|
+
export { SETTINGS_PROCEDURES };
|
package/dist/shared/constants.js
CHANGED
|
@@ -5,14 +5,6 @@ import { milliseconds } from "@kizlo/shared";
|
|
|
5
5
|
const VERSION = version;
|
|
6
6
|
const RPC_PROTOCOL_HEADER = "x-rpc-protocol";
|
|
7
7
|
const SESSION_EXPIRY_MARGIN_MS = milliseconds("5 minutes");
|
|
8
|
-
/**
|
|
9
|
-
* Set in `process.env` by the CLI daemon while it imports the server module solely to read the
|
|
10
|
-
* router's *shape* for contract generation. No request is served in that mode, so `requireEnv`
|
|
11
|
-
* returns a placeholder instead of aborting the import when connection env vars are absent — the
|
|
12
|
-
* router shape doesn't depend on any env value, and framework virtual modules (e.g. Astro's
|
|
13
|
-
* `getSecret`) are stubbed to `undefined` during the shape-only import anyway.
|
|
14
|
-
*/
|
|
15
|
-
const CONTRACT_GENERATION_ENV = "KIZLO_CONTRACT_GENERATION";
|
|
16
8
|
|
|
17
9
|
//#endregion
|
|
18
|
-
export {
|
|
10
|
+
export { RPC_PROTOCOL_HEADER };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/shared/contract-generation.ts
|
|
2
|
+
const CONTRACT_GENERATION = Symbol.for("kizlo.contract-generation");
|
|
3
|
+
function state() {
|
|
4
|
+
return globalThis;
|
|
5
|
+
}
|
|
6
|
+
function isContractGeneration() {
|
|
7
|
+
return state()[CONTRACT_GENERATION] === true;
|
|
8
|
+
}
|
|
9
|
+
function setContractGeneration(value) {
|
|
10
|
+
state()[CONTRACT_GENERATION] = value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isContractGeneration, setContractGeneration };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTPMethod } from "./types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AnyProcedureTree, InvocationScope } from "./procedure.js";
|
|
3
3
|
import { AnyContractRouter } from "@orpc/contract";
|
|
4
4
|
import { Pathname } from "@kizlo/shared";
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ type ContractProcedure = {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
declare function isContractProcedure$1(node: unknown): node is ContractProcedure;
|
|
18
|
-
declare function generateContract<
|
|
18
|
+
declare function generateContract<TProcedures extends AnyProcedureTree>(procedures: TProcedures): Promise<Contract>;
|
|
19
19
|
declare function restoreContract(contract: Contract): AnyContractRouter;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { Contract, ContractProcedure, generateContract, isContractProcedure$1 as isContractProcedure, restoreContract };
|
package/dist/shared/contract.js
CHANGED
|
@@ -6,8 +6,8 @@ function isContractProcedure$1(node) {
|
|
|
6
6
|
if (!node || typeof node !== "object") return false;
|
|
7
7
|
return "route" in node || "meta" in node;
|
|
8
8
|
}
|
|
9
|
-
async function generateContract(
|
|
10
|
-
const contract = minifyContractRouter(createOrpcRouter(
|
|
9
|
+
async function generateContract(procedures) {
|
|
10
|
+
const contract = minifyContractRouter(createOrpcRouter(procedures));
|
|
11
11
|
const walk = (node) => {
|
|
12
12
|
const out = {};
|
|
13
13
|
for (const [key, value] of Object.entries(node)) if (isContractProcedure(value)) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ServiceAdapters } from "../adapters/types.js";
|
|
2
|
+
import { EventHandler } from "../webhook/index.js";
|
|
3
|
+
import { AnyProcedureTree } from "./procedure.js";
|
|
4
|
+
import { IntegrationPluginRequirement, UnionToIntersection } from "@kizlo/shared";
|
|
5
|
+
|
|
6
|
+
//#region src/shared/integration.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What an integration needs to work at all.
|
|
10
|
+
*
|
|
11
|
+
* An integration can ship in two halves that update separately: this package, and the WordPress plugin
|
|
12
|
+
* that serves the endpoints it calls. Environment values and endpoints are checked when the server starts.
|
|
13
|
+
* Plugin versions are checked from the headers WordPress returns.
|
|
14
|
+
*/
|
|
15
|
+
interface IntegrationRequirements {
|
|
16
|
+
/** WordPress plugins serving this integration's endpoints, checked against what the site reports. */
|
|
17
|
+
plugins?: IntegrationPluginRequirement[];
|
|
18
|
+
/** Resolved environment values this integration needs, checked after every integration's `env` contribution is composed. */
|
|
19
|
+
env?: readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* Endpoint subtrees this integration calls, dotted from the root of the generated tree, e.g.
|
|
22
|
+
* `"woocommerce.store.cart"`. Naming the subtree rather than every leaf keeps this a statement about
|
|
23
|
+
* which contract has to be present, not a second copy of the call sites.
|
|
24
|
+
*/
|
|
25
|
+
endpoints?: string[];
|
|
26
|
+
}
|
|
27
|
+
/** Reads a scalar environment value by name. */
|
|
28
|
+
type EnvReader = (name: string) => string | undefined;
|
|
29
|
+
/** A nested environment record. Leaf values are strings supplied by the owning runtime. */
|
|
30
|
+
interface EnvRecord {
|
|
31
|
+
readonly [name: string]: string | EnvRecord | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** One WordPress connection profile contributed by a runtime integration. */
|
|
34
|
+
interface WordPressEnv extends EnvRecord {
|
|
35
|
+
readonly siteSecret?: string;
|
|
36
|
+
readonly wordpressUrl?: string;
|
|
37
|
+
readonly wordpressUsername?: string;
|
|
38
|
+
readonly wordpressPassword?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Runtime-neutral values Kizlo consumes. Runtime integrations map their environment system onto
|
|
42
|
+
* these camel-case keys. The open string index also lets integrations contribute provider values.
|
|
43
|
+
*/
|
|
44
|
+
interface KizloEnv extends EnvRecord {
|
|
45
|
+
/** Public URL of the mounted Kizlo handler. */
|
|
46
|
+
readonly baseUrl?: string;
|
|
47
|
+
/** WordPress profile to use. Defaults to `remote`. */
|
|
48
|
+
readonly mode?: string;
|
|
49
|
+
/** Values used when `mode` is absent or `remote`. */
|
|
50
|
+
readonly remote?: WordPressEnv;
|
|
51
|
+
/** Values used when `mode` is `local`. */
|
|
52
|
+
readonly local?: WordPressEnv;
|
|
53
|
+
}
|
|
54
|
+
/** Environment values an integration contributes, either as a typed record or a lazy reader. */
|
|
55
|
+
type EnvSource = KizloEnv | EnvReader;
|
|
56
|
+
/** Read one scalar value by dotted path from an environment record or reader. */
|
|
57
|
+
declare function readEnv(source: EnvSource, name: string): string | undefined;
|
|
58
|
+
/** Required environment values the composed source does not provide. */
|
|
59
|
+
declare function missingEnv(source: EnvSource, required: readonly string[]): string[];
|
|
60
|
+
interface Integration<TId extends string, TProcedures extends AnyProcedureTree = Record<never, never>> {
|
|
61
|
+
id: TId;
|
|
62
|
+
/** Procedures the integration exposes. Each entry or nested group becomes a client method under its `id`. */
|
|
63
|
+
procedures?: TProcedures;
|
|
64
|
+
/** Webhook event handlers, built with `createEventHandler`, run when WordPress emits a matching event. */
|
|
65
|
+
events?: EventHandler[];
|
|
66
|
+
/** Auth, captcha, geo, logger, or cookies adapters the integration supplies. */
|
|
67
|
+
adapters?: ServiceAdapters;
|
|
68
|
+
/** Runtime-neutral environment values the integration contributes. Later concrete values replace earlier ones. */
|
|
69
|
+
env?: EnvSource;
|
|
70
|
+
/** Environment, endpoint, and WordPress plugin requirements checked at their documented lifecycle points. */
|
|
71
|
+
requires?: IntegrationRequirements;
|
|
72
|
+
}
|
|
73
|
+
type AnyIntegration = Integration<any, AnyProcedureTree>;
|
|
74
|
+
type ExtractIntegrationProcedures<TIntegration extends AnyIntegration> = TIntegration extends Integration<infer Name, infer Procedures> ? [keyof Procedures] extends [never] ? never : string extends keyof Procedures ? never : Record<Name, Procedures> : never;
|
|
75
|
+
type InferIntegrationProcedures<TIntegrations extends readonly AnyIntegration[]> = TIntegrations extends readonly [] ? Record<never, never> : ExtractIntegrationProcedures<TIntegrations[number]> extends infer R ? [R] extends [never] ? Record<never, never> : UnionToIntersection<R> : never;
|
|
76
|
+
declare function createIntegration<TId extends string, TProcedures extends AnyProcedureTree = Record<never, never>>(integration: Integration<TId, TProcedures>): Integration<TId, TProcedures>;
|
|
77
|
+
/** The declared subtrees the generated tree does not have. */
|
|
78
|
+
declare function missingEndpoints(endpoints: object, required: readonly string[]): string[];
|
|
79
|
+
/**
|
|
80
|
+
* Fail at startup when an integration's endpoints are not in the generated tree, naming the plugins that
|
|
81
|
+
* would have put them there.
|
|
82
|
+
*
|
|
83
|
+
* Absent endpoints mean the WordPress half is missing, too old to describe its routes, or the tree was
|
|
84
|
+
* generated against a different WordPress. Left alone it surfaces as a property access on `undefined`
|
|
85
|
+
* inside whichever procedure ran first, which says nothing about any of that.
|
|
86
|
+
*/
|
|
87
|
+
declare function assertIntegrationEndpoints(integration: AnyIntegration, endpoints: object): void;
|
|
88
|
+
/** Fail at startup when an integration's required environment values are absent. */
|
|
89
|
+
declare function assertIntegrationEnv(integration: AnyIntegration, env: EnvSource): void;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { AnyIntegration, EnvReader, EnvRecord, EnvSource, ExtractIntegrationProcedures, InferIntegrationProcedures, Integration, IntegrationRequirements, KizloEnv, WordPressEnv, assertIntegrationEndpoints, assertIntegrationEnv, createIntegration, missingEndpoints, missingEnv, readEnv };
|