@magicpages/ghost-typesense-config 1.3.0 → 1.3.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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ declare const GhostConfigSchema: z.ZodObject<{
|
|
|
20
20
|
* Typesense node configuration schema
|
|
21
21
|
*/
|
|
22
22
|
declare const TypesenseNodeSchema: z.ZodObject<{
|
|
23
|
-
host: z.ZodString
|
|
23
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
24
24
|
port: z.ZodNumber;
|
|
25
25
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
26
26
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -40,7 +40,7 @@ declare const TypesenseNodeSchema: z.ZodObject<{
|
|
|
40
40
|
*/
|
|
41
41
|
declare const TypesenseConfigSchema: z.ZodObject<{
|
|
42
42
|
nodes: z.ZodArray<z.ZodObject<{
|
|
43
|
-
host: z.ZodString
|
|
43
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
44
44
|
port: z.ZodNumber;
|
|
45
45
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
46
46
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -253,7 +253,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
253
253
|
}>;
|
|
254
254
|
typesense: z.ZodObject<{
|
|
255
255
|
nodes: z.ZodArray<z.ZodObject<{
|
|
256
|
-
host: z.ZodString
|
|
256
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
257
257
|
port: z.ZodNumber;
|
|
258
258
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
259
259
|
path: z.ZodOptional<z.ZodString>;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare const GhostConfigSchema: z.ZodObject<{
|
|
|
20
20
|
* Typesense node configuration schema
|
|
21
21
|
*/
|
|
22
22
|
declare const TypesenseNodeSchema: z.ZodObject<{
|
|
23
|
-
host: z.ZodString
|
|
23
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
24
24
|
port: z.ZodNumber;
|
|
25
25
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
26
26
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -40,7 +40,7 @@ declare const TypesenseNodeSchema: z.ZodObject<{
|
|
|
40
40
|
*/
|
|
41
41
|
declare const TypesenseConfigSchema: z.ZodObject<{
|
|
42
42
|
nodes: z.ZodArray<z.ZodObject<{
|
|
43
|
-
host: z.ZodString
|
|
43
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
44
44
|
port: z.ZodNumber;
|
|
45
45
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
46
46
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -253,7 +253,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
253
253
|
}>;
|
|
254
254
|
typesense: z.ZodObject<{
|
|
255
255
|
nodes: z.ZodArray<z.ZodObject<{
|
|
256
|
-
host: z.ZodString
|
|
256
|
+
host: z.ZodEffects<z.ZodString, string, string>;
|
|
257
257
|
port: z.ZodNumber;
|
|
258
258
|
protocol: z.ZodEnum<["http", "https"]>;
|
|
259
259
|
path: z.ZodOptional<z.ZodString>;
|
package/dist/index.js
CHANGED
|
@@ -38,8 +38,12 @@ var GhostConfigSchema = import_zod.z.object({
|
|
|
38
38
|
key: import_zod.z.string().min(1),
|
|
39
39
|
version: import_zod.z.literal("v5.0").default("v5.0")
|
|
40
40
|
});
|
|
41
|
+
function cleanUrl(url) {
|
|
42
|
+
const withoutProtocol = url.replace(/^https?:\/\//i, "");
|
|
43
|
+
return withoutProtocol.replace(/\/+$/, "");
|
|
44
|
+
}
|
|
41
45
|
var TypesenseNodeSchema = import_zod.z.object({
|
|
42
|
-
host: import_zod.z.string(),
|
|
46
|
+
host: import_zod.z.string().transform(cleanUrl),
|
|
43
47
|
port: import_zod.z.number(),
|
|
44
48
|
protocol: import_zod.z.enum(["http", "https"]),
|
|
45
49
|
path: import_zod.z.string().optional()
|
|
@@ -126,6 +130,7 @@ var DEFAULT_COLLECTION_FIELDS = [
|
|
|
126
130
|
{ name: "authors", type: "string[]", facet: true, optional: true }
|
|
127
131
|
];
|
|
128
132
|
function createDefaultConfig(ghostUrl, ghostKey, typesenseHost, typesenseApiKey, collectionName = "posts") {
|
|
133
|
+
const cleanedHost = cleanUrl(typesenseHost);
|
|
129
134
|
return {
|
|
130
135
|
ghost: {
|
|
131
136
|
url: ghostUrl,
|
|
@@ -135,7 +140,7 @@ function createDefaultConfig(ghostUrl, ghostKey, typesenseHost, typesenseApiKey,
|
|
|
135
140
|
typesense: {
|
|
136
141
|
nodes: [
|
|
137
142
|
{
|
|
138
|
-
host:
|
|
143
|
+
host: cleanedHost,
|
|
139
144
|
port: 443,
|
|
140
145
|
protocol: "https"
|
|
141
146
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,12 @@ var GhostConfigSchema = z.object({
|
|
|
5
5
|
key: z.string().min(1),
|
|
6
6
|
version: z.literal("v5.0").default("v5.0")
|
|
7
7
|
});
|
|
8
|
+
function cleanUrl(url) {
|
|
9
|
+
const withoutProtocol = url.replace(/^https?:\/\//i, "");
|
|
10
|
+
return withoutProtocol.replace(/\/+$/, "");
|
|
11
|
+
}
|
|
8
12
|
var TypesenseNodeSchema = z.object({
|
|
9
|
-
host: z.string(),
|
|
13
|
+
host: z.string().transform(cleanUrl),
|
|
10
14
|
port: z.number(),
|
|
11
15
|
protocol: z.enum(["http", "https"]),
|
|
12
16
|
path: z.string().optional()
|
|
@@ -93,6 +97,7 @@ var DEFAULT_COLLECTION_FIELDS = [
|
|
|
93
97
|
{ name: "authors", type: "string[]", facet: true, optional: true }
|
|
94
98
|
];
|
|
95
99
|
function createDefaultConfig(ghostUrl, ghostKey, typesenseHost, typesenseApiKey, collectionName = "posts") {
|
|
100
|
+
const cleanedHost = cleanUrl(typesenseHost);
|
|
96
101
|
return {
|
|
97
102
|
ghost: {
|
|
98
103
|
url: ghostUrl,
|
|
@@ -102,7 +107,7 @@ function createDefaultConfig(ghostUrl, ghostKey, typesenseHost, typesenseApiKey,
|
|
|
102
107
|
typesense: {
|
|
103
108
|
nodes: [
|
|
104
109
|
{
|
|
105
|
-
host:
|
|
110
|
+
host: cleanedHost,
|
|
106
111
|
port: 443,
|
|
107
112
|
protocol: "https"
|
|
108
113
|
}
|