@bernierllc/contentful-suite 1.0.3
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/.eslintrc.cjs +16 -0
- package/LICENSE +5 -0
- package/README.md +497 -0
- package/__mocks__/@bernierllc/contentful-cache-service.ts +12 -0
- package/__mocks__/@bernierllc/contentful-gateway-service.ts +21 -0
- package/__mocks__/@bernierllc/contentful-migration-service.ts +13 -0
- package/__mocks__/@bernierllc/contentful-sync-service.ts +14 -0
- package/__mocks__/@bernierllc/contentful-webhook-service.ts +15 -0
- package/__mocks__/@bernierllc/logger.ts +27 -0
- package/__mocks__/@bernierllc/neverhub-adapter.ts +17 -0
- package/coverage/clover.xml +192 -0
- package/coverage/coverage-final.json +5 -0
- package/coverage/coverage-summary.json +6 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/ContentfulSuite.ts.html +1330 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/storage/InMemoryContentStorage.ts.html +394 -0
- package/coverage/lcov-report/src/storage/InMemoryMigrationStorage.ts.html +304 -0
- package/coverage/lcov-report/src/storage/InMemorySyncStateStorage.ts.html +211 -0
- package/coverage/lcov-report/src/storage/index.html +146 -0
- package/coverage/lcov.info +349 -0
- package/dist/ContentfulSuite.d.ts +85 -0
- package/dist/ContentfulSuite.d.ts.map +1 -0
- package/dist/ContentfulSuite.js +352 -0
- package/dist/ContentfulSuite.js.map +1 -0
- package/dist/__tests__/ContentfulSuite.test.d.ts +2 -0
- package/dist/__tests__/ContentfulSuite.test.d.ts.map +1 -0
- package/dist/__tests__/ContentfulSuite.test.js +347 -0
- package/dist/__tests__/ContentfulSuite.test.js.map +1 -0
- package/dist/__tests__/storage.test.d.ts +2 -0
- package/dist/__tests__/storage.test.d.ts.map +1 -0
- package/dist/__tests__/storage.test.js +343 -0
- package/dist/__tests__/storage.test.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/storage/InMemoryContentStorage.d.ts +41 -0
- package/dist/storage/InMemoryContentStorage.d.ts.map +1 -0
- package/dist/storage/InMemoryContentStorage.js +88 -0
- package/dist/storage/InMemoryContentStorage.js.map +1 -0
- package/dist/storage/InMemoryMigrationStorage.d.ts +21 -0
- package/dist/storage/InMemoryMigrationStorage.d.ts.map +1 -0
- package/dist/storage/InMemoryMigrationStorage.js +61 -0
- package/dist/storage/InMemoryMigrationStorage.js.map +1 -0
- package/dist/storage/InMemorySyncStateStorage.d.ts +19 -0
- package/dist/storage/InMemorySyncStateStorage.d.ts.map +1 -0
- package/dist/storage/InMemorySyncStateStorage.js +41 -0
- package/dist/storage/InMemorySyncStateStorage.js.map +1 -0
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/jest.config.cjs +45 -0
- package/package.json +67 -0
- package/src/ContentfulSuite.ts +415 -0
- package/src/__tests__/ContentfulSuite.test.ts +424 -0
- package/src/__tests__/storage.test.ts +405 -0
- package/src/index.ts +60 -0
- package/src/storage/InMemoryContentStorage.ts +103 -0
- package/src/storage/InMemoryMigrationStorage.ts +73 -0
- package/src/storage/InMemorySyncStateStorage.ts +42 -0
- package/src/storage/index.ts +11 -0
- package/src/types.ts +158 -0
- package/tsconfig.json +21 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { TokenStorage } from '@bernierllc/contentful-auth';
|
|
10
|
+
import type { ContentStorage, SyncStateStorage } from '@bernierllc/contentful-sync-service';
|
|
11
|
+
import type { MigrationStorage } from '@bernierllc/contentful-migration-service';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* OAuth configuration for Contentful
|
|
15
|
+
*/
|
|
16
|
+
export interface OAuthConfig {
|
|
17
|
+
clientId: string;
|
|
18
|
+
clientSecret: string;
|
|
19
|
+
redirectUri: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Space configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface SpaceConfig {
|
|
26
|
+
spaceId: string;
|
|
27
|
+
environmentId: string;
|
|
28
|
+
accessToken: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gateway configuration
|
|
33
|
+
*/
|
|
34
|
+
export interface GatewayConfig {
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
port: number;
|
|
37
|
+
apiKeys: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Sync configuration
|
|
42
|
+
*/
|
|
43
|
+
export interface SyncConfig {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
interval?: number;
|
|
46
|
+
spaces: SpaceConfig[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Webhooks configuration
|
|
51
|
+
*/
|
|
52
|
+
export interface WebhooksConfig {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
port: number;
|
|
55
|
+
secret: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Cache configuration
|
|
60
|
+
*/
|
|
61
|
+
export interface CacheConfig {
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
backend: 'redis' | 'memory';
|
|
64
|
+
ttl: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Migration configuration
|
|
69
|
+
*/
|
|
70
|
+
export interface MigrationConfig {
|
|
71
|
+
enabled: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Storage configuration
|
|
76
|
+
*/
|
|
77
|
+
export interface StorageConfig {
|
|
78
|
+
/**
|
|
79
|
+
* Token storage for OAuth tokens (required if gateway enabled)
|
|
80
|
+
*/
|
|
81
|
+
tokenStorage?: TokenStorage;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Content storage for synced content (required if sync enabled)
|
|
85
|
+
*/
|
|
86
|
+
contentStorage?: ContentStorage;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Sync state storage for sync tokens (required if sync enabled)
|
|
90
|
+
*/
|
|
91
|
+
syncStateStorage?: SyncStateStorage;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Migration storage for migration history (required if migrations enabled)
|
|
95
|
+
*/
|
|
96
|
+
migrationStorage?: MigrationStorage;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Complete Contentful Suite configuration
|
|
101
|
+
*/
|
|
102
|
+
export interface ContentfulSuiteConfig {
|
|
103
|
+
/**
|
|
104
|
+
* OAuth configuration for Contentful API authentication
|
|
105
|
+
*/
|
|
106
|
+
oauth: OAuthConfig;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* API gateway configuration
|
|
110
|
+
*/
|
|
111
|
+
gateway: GatewayConfig;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Content sync configuration
|
|
115
|
+
*/
|
|
116
|
+
sync: SyncConfig;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Webhook receiving configuration
|
|
120
|
+
*/
|
|
121
|
+
webhooks: WebhooksConfig;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Response caching configuration
|
|
125
|
+
*/
|
|
126
|
+
cache: CacheConfig;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Migration configuration
|
|
130
|
+
*/
|
|
131
|
+
migration: MigrationConfig;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Storage implementations
|
|
135
|
+
*/
|
|
136
|
+
storage: StorageConfig;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Suite service status
|
|
141
|
+
*/
|
|
142
|
+
export interface ServiceStatus {
|
|
143
|
+
gateway: boolean;
|
|
144
|
+
sync: boolean;
|
|
145
|
+
webhooks: boolean;
|
|
146
|
+
cache: boolean;
|
|
147
|
+
migration: boolean;
|
|
148
|
+
neverhub: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Suite health status
|
|
153
|
+
*/
|
|
154
|
+
export interface SuiteHealth {
|
|
155
|
+
status: 'ok' | 'degraded' | 'down';
|
|
156
|
+
timestamp: string;
|
|
157
|
+
services: ServiceStatus;
|
|
158
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020"],
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"downlevelIteration": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src/**/*", "src/__tests__/**/*.ts"],
|
|
20
|
+
"exclude": ["node_modules", "dist"]
|
|
21
|
+
}
|