@bernierllc/contentful-sync-service 1.4.2 → 1.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/contentful-sync-service",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Full export + incremental webhook sync to local storage for Contentful content",
5
5
  "keywords": [
6
6
  "contentful",
@@ -20,13 +20,13 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@bernierllc/contentful-export-adapter": "1.5.1",
24
- "@bernierllc/contentful-cda-client": "1.5.1",
25
- "@bernierllc/contentful-types": "1.5.0",
26
- "@bernierllc/contentful-webhook-handler": "1.3.1",
27
- "@bernierllc/logger": "1.7.1",
28
- "@bernierllc/message-queue": "1.5.1",
29
- "@bernierllc/neverhub-adapter": "0.4.1"
23
+ "@bernierllc/contentful-types": "^1.5.0",
24
+ "@bernierllc/contentful-export-adapter": "^1.5.2",
25
+ "@bernierllc/logger": "^2.0.0",
26
+ "@bernierllc/message-queue": "^1.5.2",
27
+ "@bernierllc/neverhub-adapter": "^0.4.1",
28
+ "@bernierllc/contentful-webhook-handler": "^1.3.2",
29
+ "@bernierllc/contentful-cda-client": "^1.5.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/jest": "^29.5.14",
@@ -1,51 +0,0 @@
1
- import type { SyncServiceConfig, SyncResult } from './types';
2
- /**
3
- * ContentfulSyncService
4
- *
5
- * Syncs Contentful content to local storage for ML training pipelines.
6
- * Performs initial full export, then maintains sync via CDA Sync API + webhook processing.
7
- */
8
- export declare class ContentfulSyncService {
9
- private readonly config;
10
- private readonly exportAdapter;
11
- private readonly cdaClient;
12
- private readonly webhookHandler?;
13
- private readonly queue;
14
- private readonly logger;
15
- private neverhub?;
16
- private syncIntervalId?;
17
- constructor(config: SyncServiceConfig);
18
- /**
19
- * Initialize the service
20
- */
21
- initialize(): Promise<void>;
22
- /**
23
- * Perform initial full sync
24
- *
25
- * @param managementToken - Contentful Management API token for export
26
- */
27
- initialSync(managementToken: string): Promise<SyncResult>;
28
- /**
29
- * Perform incremental sync using CDA Sync API
30
- */
31
- incrementalSync(): Promise<SyncResult>;
32
- /**
33
- * Process webhook event
34
- *
35
- * @param body - Webhook request body
36
- * @param headers - Webhook request headers
37
- */
38
- processWebhook(body: string, headers: Record<string, string>): Promise<void>;
39
- /**
40
- * Start automatic sync at configured interval
41
- */
42
- startAutoSync(): void;
43
- /**
44
- * Stop automatic sync
45
- */
46
- stopAutoSync(): void;
47
- /**
48
- * Shutdown the service
49
- */
50
- shutdown(): Promise<void>;
51
- }
@@ -1,285 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ContentfulSyncService = void 0;
11
- const contentful_export_adapter_1 = require("@bernierllc/contentful-export-adapter");
12
- const contentful_cda_client_1 = require("@bernierllc/contentful-cda-client");
13
- const contentful_webhook_handler_1 = require("@bernierllc/contentful-webhook-handler");
14
- const message_queue_1 = require("@bernierllc/message-queue");
15
- const logger_1 = require("@bernierllc/logger");
16
- const neverhub_adapter_1 = require("@bernierllc/neverhub-adapter");
17
- /**
18
- * ContentfulSyncService
19
- *
20
- * Syncs Contentful content to local storage for ML training pipelines.
21
- * Performs initial full export, then maintains sync via CDA Sync API + webhook processing.
22
- */
23
- class ContentfulSyncService {
24
- config;
25
- exportAdapter;
26
- cdaClient;
27
- webhookHandler;
28
- queue;
29
- logger;
30
- neverhub;
31
- syncIntervalId;
32
- constructor(config) {
33
- this.config = {
34
- syncInterval: 300000, // 5 minutes default
35
- ...config
36
- };
37
- this.exportAdapter = new contentful_export_adapter_1.ContentfulExportAdapter();
38
- this.cdaClient = new contentful_cda_client_1.ContentfulCDAClient({
39
- space: config.spaceId,
40
- accessToken: config.accessToken,
41
- environment: config.environmentId
42
- });
43
- if (config.webhookSecret) {
44
- this.webhookHandler = new contentful_webhook_handler_1.ContentfulWebhookHandler({ webhookSecret: config.webhookSecret });
45
- }
46
- this.queue = new message_queue_1.MessageQueue({ name: 'contentful-sync' });
47
- this.logger = (0, logger_1.createLogger)({
48
- context: {
49
- service: 'ContentfulSyncService',
50
- version: '1.0.0',
51
- environment: process.env.NODE_ENV || 'development'
52
- }
53
- });
54
- }
55
- /**
56
- * Initialize the service
57
- */
58
- async initialize() {
59
- this.logger.info('Initializing ContentfulSyncService');
60
- // Initialize NeverHub if enabled
61
- if (this.config.neverhubEnabled) {
62
- try {
63
- if (await neverhub_adapter_1.NeverHubAdapter.detect()) {
64
- this.neverhub = new neverhub_adapter_1.NeverHubAdapter();
65
- await this.neverhub.register({
66
- type: 'service',
67
- name: '@bernierllc/contentful-sync-service',
68
- version: '1.0.0',
69
- dependencies: [
70
- '@bernierllc/contentful-export-adapter',
71
- '@bernierllc/contentful-cda-client',
72
- '@bernierllc/contentful-webhook-handler'
73
- ],
74
- capabilities: [
75
- { type: 'data', name: 'sync', version: '1.0.0' },
76
- { type: 'webhook', name: 'webhook-processing', version: '1.0.0' }
77
- ]
78
- });
79
- this.logger.info('NeverHub integration enabled');
80
- }
81
- }
82
- catch (error) {
83
- this.logger.warn('NeverHub initialization failed', { error });
84
- }
85
- }
86
- this.logger.info('ContentfulSyncService initialized');
87
- }
88
- /**
89
- * Perform initial full sync
90
- *
91
- * @param managementToken - Contentful Management API token for export
92
- */
93
- async initialSync(managementToken) {
94
- const startTime = Date.now();
95
- this.logger.info('Starting initial full sync', { spaceId: this.config.spaceId });
96
- try {
97
- // Clear existing content
98
- await this.config.contentStorage.clearSpace(this.config.spaceId);
99
- await this.config.syncStateStorage.clearSyncToken(this.config.spaceId);
100
- // Export space
101
- const exportResult = await this.exportAdapter.exportSpace({
102
- spaceId: this.config.spaceId,
103
- managementToken,
104
- downloadAssets: true
105
- });
106
- // Store content types
107
- if (exportResult.contentTypes && exportResult.contentTypes.length > 0) {
108
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
- await this.config.contentStorage.storeContentTypes(exportResult.contentTypes);
110
- this.logger.info('Stored content types', { count: exportResult.contentTypes.length });
111
- }
112
- // Store entries
113
- if (exportResult.entries && exportResult.entries.length > 0) {
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- await this.config.contentStorage.storeEntries(exportResult.entries);
116
- this.logger.info('Stored entries', { count: exportResult.entries.length });
117
- }
118
- // Store assets
119
- if (exportResult.assets && exportResult.assets.length > 0) {
120
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
- await this.config.contentStorage.storeAssets(exportResult.assets);
122
- this.logger.info('Stored assets', { count: exportResult.assets.length });
123
- }
124
- // Get initial sync token from CDA
125
- const syncResult = await this.cdaClient.initialSync();
126
- const syncToken = syncResult.nextSyncUrl || '';
127
- await this.config.syncStateStorage.setSyncToken(this.config.spaceId, syncToken);
128
- const duration = Date.now() - startTime;
129
- const stats = {
130
- entriesSynced: exportResult.entries?.length || 0,
131
- assetsSynced: exportResult.assets?.length || 0,
132
- itemsDeleted: 0,
133
- duration,
134
- timestamp: new Date()
135
- };
136
- this.logger.info('Initial sync completed', stats);
137
- return {
138
- success: true,
139
- stats
140
- };
141
- }
142
- catch (error) {
143
- const duration = Date.now() - startTime;
144
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
145
- const errorObj = error instanceof Error ? error : new Error(errorMessage);
146
- this.logger.error('Initial sync failed', errorObj);
147
- return {
148
- success: false,
149
- stats: {
150
- entriesSynced: 0,
151
- assetsSynced: 0,
152
- itemsDeleted: 0,
153
- duration,
154
- timestamp: new Date()
155
- },
156
- error: errorMessage
157
- };
158
- }
159
- }
160
- /**
161
- * Perform incremental sync using CDA Sync API
162
- */
163
- async incrementalSync() {
164
- const startTime = Date.now();
165
- this.logger.info('Starting incremental sync', { spaceId: this.config.spaceId });
166
- try {
167
- const syncToken = await this.config.syncStateStorage.getSyncToken(this.config.spaceId);
168
- if (!syncToken) {
169
- throw new Error('No sync token found - run initialSync first');
170
- }
171
- const syncResult = await this.cdaClient.deltaSync(syncToken);
172
- let entriesSynced = 0;
173
- let assetsSynced = 0;
174
- let itemsDeleted = 0;
175
- // Process sync items
176
- const items = syncResult.items || [];
177
- for (const item of items) {
178
- if (item.sys.type === 'Entry') {
179
- await this.config.contentStorage.updateEntry(item);
180
- entriesSynced++;
181
- }
182
- else if (item.sys.type === 'Asset') {
183
- await this.config.contentStorage.updateAsset(item);
184
- assetsSynced++;
185
- }
186
- else if (item.sys.type === 'DeletedEntry') {
187
- await this.config.contentStorage.deleteEntry(item.sys.id);
188
- itemsDeleted++;
189
- }
190
- else if (item.sys.type === 'DeletedAsset') {
191
- await this.config.contentStorage.deleteAsset(item.sys.id);
192
- itemsDeleted++;
193
- }
194
- }
195
- // Update sync token
196
- const newSyncToken = syncResult.nextSyncUrl || '';
197
- await this.config.syncStateStorage.setSyncToken(this.config.spaceId, newSyncToken);
198
- const duration = Date.now() - startTime;
199
- const stats = {
200
- entriesSynced,
201
- assetsSynced,
202
- itemsDeleted,
203
- duration,
204
- timestamp: new Date()
205
- };
206
- this.logger.info('Incremental sync completed', stats);
207
- return {
208
- success: true,
209
- stats
210
- };
211
- }
212
- catch (error) {
213
- const duration = Date.now() - startTime;
214
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
215
- const errorObj = error instanceof Error ? error : new Error(errorMessage);
216
- this.logger.error('Incremental sync failed', errorObj);
217
- return {
218
- success: false,
219
- stats: {
220
- entriesSynced: 0,
221
- assetsSynced: 0,
222
- itemsDeleted: 0,
223
- duration,
224
- timestamp: new Date()
225
- },
226
- error: errorMessage
227
- };
228
- }
229
- }
230
- /**
231
- * Process webhook event
232
- *
233
- * @param body - Webhook request body
234
- * @param headers - Webhook request headers
235
- */
236
- async processWebhook(body, headers) {
237
- if (!this.webhookHandler) {
238
- throw new Error('Webhook handler not configured - provide webhookSecret in config');
239
- }
240
- this.logger.info('Processing webhook event');
241
- const result = this.webhookHandler.parseWebhook(body, headers);
242
- if (!result.valid || !result.payload) {
243
- throw new Error('Invalid webhook signature or payload');
244
- }
245
- // Queue for processing
246
- await this.queue.addMessage({
247
- topic: result.topic,
248
- payload: result.payload
249
- });
250
- this.logger.info('Webhook event queued', { topic: result.topic });
251
- }
252
- /**
253
- * Start automatic sync at configured interval
254
- */
255
- startAutoSync() {
256
- if (this.syncIntervalId) {
257
- this.logger.warn('Auto-sync already running');
258
- return;
259
- }
260
- this.logger.info('Starting auto-sync', { interval: this.config.syncInterval });
261
- this.syncIntervalId = setInterval(async () => {
262
- await this.incrementalSync();
263
- }, this.config.syncInterval);
264
- }
265
- /**
266
- * Stop automatic sync
267
- */
268
- stopAutoSync() {
269
- if (this.syncIntervalId) {
270
- clearInterval(this.syncIntervalId);
271
- this.syncIntervalId = undefined;
272
- this.logger.info('Auto-sync stopped');
273
- }
274
- }
275
- /**
276
- * Shutdown the service
277
- */
278
- async shutdown() {
279
- this.logger.info('Shutting down ContentfulSyncService');
280
- this.stopAutoSync();
281
- // Note: MessageQueue doesn't expose a close() method in current version
282
- this.logger.info('ContentfulSyncService shutdown complete');
283
- }
284
- }
285
- exports.ContentfulSyncService = ContentfulSyncService;
package/dist/errors.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export type ContentfulSyncServiceErrorCode = 'CONTENTFUL_SYNC_SERVICE_ERROR' | 'INVALID_INPUT' | 'OPERATION_FAILED';
2
- export interface ContentfulSyncServiceErrorOptions {
3
- cause?: Error;
4
- code?: ContentfulSyncServiceErrorCode;
5
- context?: Record<string, unknown>;
6
- }
7
- export declare class ContentfulSyncServiceError extends Error {
8
- readonly code: ContentfulSyncServiceErrorCode;
9
- readonly context?: Record<string, unknown>;
10
- constructor(message: string, options?: ContentfulSyncServiceErrorOptions);
11
- }
package/dist/errors.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ContentfulSyncServiceError = void 0;
11
- class ContentfulSyncServiceError extends Error {
12
- code;
13
- context;
14
- constructor(message, options) {
15
- super(message, options?.cause ? { cause: options.cause } : undefined);
16
- this.name = 'ContentfulSyncServiceError';
17
- this.code = options?.code ?? 'CONTENTFUL_SYNC_SERVICE_ERROR';
18
- if (options?.context !== undefined) {
19
- this.context = options.context;
20
- }
21
- Error.captureStackTrace?.(this, this.constructor);
22
- }
23
- }
24
- exports.ContentfulSyncServiceError = ContentfulSyncServiceError;
@@ -1,37 +0,0 @@
1
- import type { ContentfulEntry as Entry, ContentfulAsset as Asset, ContentfulContentType as ContentType } from '@bernierllc/contentful-types';
2
- import type { ContentStorage, SyncStateStorage } from './types';
3
- /**
4
- * In-memory implementation of ContentStorage for testing
5
- */
6
- export declare class InMemoryContentStorage implements ContentStorage {
7
- private contentTypes;
8
- private entries;
9
- private assets;
10
- storeContentTypes(contentTypes: ContentType[]): Promise<void>;
11
- storeEntries(entries: Entry[]): Promise<void>;
12
- storeAssets(assets: Asset[]): Promise<void>;
13
- updateEntry(entry: Entry): Promise<void>;
14
- updateAsset(asset: Asset): Promise<void>;
15
- deleteEntry(entryId: string): Promise<void>;
16
- deleteAsset(assetId: string): Promise<void>;
17
- getEntry(entryId: string): Promise<Entry | null>;
18
- getAsset(assetId: string): Promise<Asset | null>;
19
- clearSpace(_spaceId: string): Promise<void>;
20
- getContentTypeCount(): number;
21
- getEntryCount(): number;
22
- getAssetCount(): number;
23
- getAllEntries(): Entry[];
24
- getAllAssets(): Asset[];
25
- getAllContentTypes(): ContentType[];
26
- }
27
- /**
28
- * In-memory implementation of SyncStateStorage for testing
29
- */
30
- export declare class InMemorySyncStateStorage implements SyncStateStorage {
31
- private syncTokens;
32
- getSyncToken(spaceId: string): Promise<string | null>;
33
- setSyncToken(spaceId: string, token: string): Promise<void>;
34
- clearSyncToken(spaceId: string): Promise<void>;
35
- getAllTokens(): Map<string, string>;
36
- clear(): void;
37
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.InMemorySyncStateStorage = exports.InMemoryContentStorage = void 0;
11
- /**
12
- * In-memory implementation of ContentStorage for testing
13
- */
14
- class InMemoryContentStorage {
15
- contentTypes = new Map();
16
- entries = new Map();
17
- assets = new Map();
18
- async storeContentTypes(contentTypes) {
19
- for (const contentType of contentTypes) {
20
- this.contentTypes.set(contentType.sys.id, contentType);
21
- }
22
- }
23
- async storeEntries(entries) {
24
- for (const entry of entries) {
25
- this.entries.set(entry.sys.id, entry);
26
- }
27
- }
28
- async storeAssets(assets) {
29
- for (const asset of assets) {
30
- this.assets.set(asset.sys.id, asset);
31
- }
32
- }
33
- async updateEntry(entry) {
34
- this.entries.set(entry.sys.id, entry);
35
- }
36
- async updateAsset(asset) {
37
- this.assets.set(asset.sys.id, asset);
38
- }
39
- async deleteEntry(entryId) {
40
- this.entries.delete(entryId);
41
- }
42
- async deleteAsset(assetId) {
43
- this.assets.delete(assetId);
44
- }
45
- async getEntry(entryId) {
46
- return this.entries.get(entryId) || null;
47
- }
48
- async getAsset(assetId) {
49
- return this.assets.get(assetId) || null;
50
- }
51
- async clearSpace(_spaceId) {
52
- this.contentTypes.clear();
53
- this.entries.clear();
54
- this.assets.clear();
55
- }
56
- // Test helper methods
57
- getContentTypeCount() {
58
- return this.contentTypes.size;
59
- }
60
- getEntryCount() {
61
- return this.entries.size;
62
- }
63
- getAssetCount() {
64
- return this.assets.size;
65
- }
66
- getAllEntries() {
67
- return Array.from(this.entries.values());
68
- }
69
- getAllAssets() {
70
- return Array.from(this.assets.values());
71
- }
72
- getAllContentTypes() {
73
- return Array.from(this.contentTypes.values());
74
- }
75
- }
76
- exports.InMemoryContentStorage = InMemoryContentStorage;
77
- /**
78
- * In-memory implementation of SyncStateStorage for testing
79
- */
80
- class InMemorySyncStateStorage {
81
- syncTokens = new Map();
82
- async getSyncToken(spaceId) {
83
- return this.syncTokens.get(spaceId) || null;
84
- }
85
- async setSyncToken(spaceId, token) {
86
- this.syncTokens.set(spaceId, token);
87
- }
88
- async clearSyncToken(spaceId) {
89
- this.syncTokens.delete(spaceId);
90
- }
91
- // Test helper methods
92
- getAllTokens() {
93
- return new Map(this.syncTokens);
94
- }
95
- clear() {
96
- this.syncTokens.clear();
97
- }
98
- }
99
- exports.InMemorySyncStateStorage = InMemorySyncStateStorage;
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { ContentfulSyncService } from './contentful-sync-service';
2
- export { ContentfulSyncServiceError, type ContentfulSyncServiceErrorCode, type ContentfulSyncServiceErrorOptions } from './errors';
3
- export { InMemoryContentStorage, InMemorySyncStateStorage } from './in-memory-storage';
4
- export type { ContentStorage, SyncStateStorage, SyncServiceConfig, SyncStats, SyncResult } from './types';
package/dist/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.InMemorySyncStateStorage = exports.InMemoryContentStorage = exports.ContentfulSyncServiceError = exports.ContentfulSyncService = void 0;
11
- var contentful_sync_service_1 = require("./contentful-sync-service");
12
- Object.defineProperty(exports, "ContentfulSyncService", { enumerable: true, get: function () { return contentful_sync_service_1.ContentfulSyncService; } });
13
- var errors_1 = require("./errors");
14
- Object.defineProperty(exports, "ContentfulSyncServiceError", { enumerable: true, get: function () { return errors_1.ContentfulSyncServiceError; } });
15
- var in_memory_storage_1 = require("./in-memory-storage");
16
- Object.defineProperty(exports, "InMemoryContentStorage", { enumerable: true, get: function () { return in_memory_storage_1.InMemoryContentStorage; } });
17
- Object.defineProperty(exports, "InMemorySyncStateStorage", { enumerable: true, get: function () { return in_memory_storage_1.InMemorySyncStateStorage; } });
package/dist/types.d.ts DELETED
@@ -1,142 +0,0 @@
1
- import type { ContentfulEntry as Entry, ContentfulAsset as Asset, ContentfulContentType as ContentType } from '@bernierllc/contentful-types';
2
- /**
3
- * Storage interface for synced content
4
- */
5
- export interface ContentStorage {
6
- /**
7
- * Store content types
8
- */
9
- storeContentTypes(contentTypes: ContentType[]): Promise<void>;
10
- /**
11
- * Store entries
12
- */
13
- storeEntries(entries: Entry[]): Promise<void>;
14
- /**
15
- * Store assets
16
- */
17
- storeAssets(assets: Asset[]): Promise<void>;
18
- /**
19
- * Update a single entry
20
- */
21
- updateEntry(entry: Entry): Promise<void>;
22
- /**
23
- * Update a single asset
24
- */
25
- updateAsset(asset: Asset): Promise<void>;
26
- /**
27
- * Delete an entry by ID
28
- */
29
- deleteEntry(entryId: string): Promise<void>;
30
- /**
31
- * Delete an asset by ID
32
- */
33
- deleteAsset(assetId: string): Promise<void>;
34
- /**
35
- * Get an entry by ID
36
- */
37
- getEntry(entryId: string): Promise<Entry | null>;
38
- /**
39
- * Get an asset by ID
40
- */
41
- getAsset(assetId: string): Promise<Asset | null>;
42
- /**
43
- * Clear all content for a space
44
- */
45
- clearSpace(spaceId: string): Promise<void>;
46
- }
47
- /**
48
- * Storage interface for sync state (tokens)
49
- */
50
- export interface SyncStateStorage {
51
- /**
52
- * Get the sync token for a space
53
- */
54
- getSyncToken(spaceId: string): Promise<string | null>;
55
- /**
56
- * Set the sync token for a space
57
- */
58
- setSyncToken(spaceId: string, token: string): Promise<void>;
59
- /**
60
- * Clear sync token for a space
61
- */
62
- clearSyncToken(spaceId: string): Promise<void>;
63
- }
64
- /**
65
- * Configuration for ContentfulSyncService
66
- */
67
- export interface SyncServiceConfig {
68
- /**
69
- * Contentful space ID
70
- */
71
- spaceId: string;
72
- /**
73
- * Contentful environment ID
74
- */
75
- environmentId: string;
76
- /**
77
- * Contentful CDA access token
78
- */
79
- accessToken: string;
80
- /**
81
- * Content storage implementation
82
- */
83
- contentStorage: ContentStorage;
84
- /**
85
- * Sync state storage implementation
86
- */
87
- syncStateStorage: SyncStateStorage;
88
- /**
89
- * Webhook secret for validation (optional)
90
- */
91
- webhookSecret?: string;
92
- /**
93
- * Sync interval in milliseconds (default: 300000 = 5 minutes)
94
- */
95
- syncInterval?: number;
96
- /**
97
- * Enable NeverHub integration (optional)
98
- */
99
- neverhubEnabled?: boolean;
100
- }
101
- /**
102
- * Sync statistics
103
- */
104
- export interface SyncStats {
105
- /**
106
- * Total entries synced
107
- */
108
- entriesSynced: number;
109
- /**
110
- * Total assets synced
111
- */
112
- assetsSynced: number;
113
- /**
114
- * Total items deleted
115
- */
116
- itemsDeleted: number;
117
- /**
118
- * Sync duration in milliseconds
119
- */
120
- duration: number;
121
- /**
122
- * Sync timestamp
123
- */
124
- timestamp: Date;
125
- }
126
- /**
127
- * Sync result
128
- */
129
- export interface SyncResult {
130
- /**
131
- * Whether the sync was successful
132
- */
133
- success: boolean;
134
- /**
135
- * Sync statistics
136
- */
137
- stats: SyncStats;
138
- /**
139
- * Error message if sync failed
140
- */
141
- error?: string;
142
- }
package/dist/types.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });