@magicpages/ghost-typesense-config 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +130 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @magicpages/ghost-typesense-config
2
+
3
+ Configuration types and utilities for Ghost-Typesense integration. This package provides type-safe configuration management for Ghost CMS and Typesense integration.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @magicpages/ghost-typesense-config
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import type { Config } from '@magicpages/ghost-typesense-config';
15
+ import { validateConfig } from '@magicpages/ghost-typesense-config';
16
+
17
+ const config: Config = {
18
+ ghost: {
19
+ url: 'https://your-ghost-blog.com',
20
+ key: 'your-content-api-key',
21
+ version: 'v5.0'
22
+ },
23
+ typesense: {
24
+ nodes: [{
25
+ host: 'your-typesense-host',
26
+ port: 443,
27
+ protocol: 'https'
28
+ }],
29
+ apiKey: 'your-typesense-api-key',
30
+ connectionTimeoutSeconds: 10,
31
+ retryIntervalSeconds: 0.1
32
+ },
33
+ collection: {
34
+ name: 'posts',
35
+ fields: [
36
+ { name: 'id', type: 'string' },
37
+ { name: 'title', type: 'string', index: true, sort: true },
38
+ { name: 'slug', type: 'string', index: true },
39
+ { name: 'html', type: 'string', index: true },
40
+ { name: 'excerpt', type: 'string', index: true },
41
+ { name: 'feature_image', type: 'string', index: false, optional: true },
42
+ { name: 'published_at', type: 'int64', sort: true },
43
+ { name: 'updated_at', type: 'int64', sort: true },
44
+ { name: 'tags', type: 'string[]', facet: true, optional: true },
45
+ { name: 'authors', type: 'string[]', facet: true, optional: true }
46
+ ]
47
+ }
48
+ };
49
+
50
+ // Validate configuration
51
+ const result = validateConfig(config);
52
+ if (!result.success) {
53
+ console.error('Invalid configuration:', result.error);
54
+ }
55
+ ```
56
+
57
+ ## Type Definitions
58
+
59
+ ### `Config`
60
+
61
+ The main configuration type that includes all settings for Ghost and Typesense integration.
62
+
63
+ ```typescript
64
+ interface Config {
65
+ ghost: GhostConfig;
66
+ typesense: TypesenseConfig;
67
+ collection: CollectionConfig;
68
+ }
69
+ ```
70
+
71
+ ### `GhostConfig`
72
+
73
+ Configuration for connecting to Ghost CMS.
74
+
75
+ ```typescript
76
+ interface GhostConfig {
77
+ url: string;
78
+ key: string;
79
+ version: string;
80
+ }
81
+ ```
82
+
83
+ ### `TypesenseConfig`
84
+
85
+ Configuration for connecting to Typesense.
86
+
87
+ ```typescript
88
+ interface TypesenseConfig {
89
+ nodes: {
90
+ host: string;
91
+ port: number;
92
+ protocol: 'http' | 'https';
93
+ }[];
94
+ apiKey: string;
95
+ connectionTimeoutSeconds?: number;
96
+ retryIntervalSeconds?: number;
97
+ }
98
+ ```
99
+
100
+ ### `CollectionConfig`
101
+
102
+ Configuration for the Typesense collection schema.
103
+
104
+ ```typescript
105
+ interface CollectionConfig {
106
+ name: string;
107
+ fields: FieldConfig[];
108
+ }
109
+
110
+ interface FieldConfig {
111
+ name: string;
112
+ type: 'string' | 'int32' | 'int64' | 'float' | 'bool' | 'string[]' | 'int32[]' | 'int64[]' | 'float[]' | 'bool[]';
113
+ index?: boolean;
114
+ sort?: boolean;
115
+ facet?: boolean;
116
+ optional?: boolean;
117
+ }
118
+ ```
119
+
120
+ ## Validation
121
+
122
+ The package uses Zod for runtime type validation of configuration objects. The `validateConfig` function returns a type-safe result that indicates whether the configuration is valid.
123
+
124
+ ## TypeScript Support
125
+
126
+ This package is written in TypeScript and includes full type definitions. It uses strict type checking and provides comprehensive type safety for all configuration options.
127
+
128
+ ## License
129
+
130
+ MIT - see the [LICENSE](../../LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicpages/ghost-typesense-config",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Configuration types and utilities for Ghost-Typesense integration",
5
5
  "author": "MagicPages",
6
6
  "license": "MIT",