@pvh-afl/core 1.0.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.
Files changed (154) hide show
  1. package/README.md +97 -0
  2. package/dist/cache/cache.module.d.ts +3 -0
  3. package/dist/cache/cache.module.d.ts.map +1 -0
  4. package/dist/cache/cache.module.js +17 -0
  5. package/dist/cache/cache.module.js.map +1 -0
  6. package/dist/cache/cache.service.d.ts +38 -0
  7. package/dist/cache/cache.service.d.ts.map +1 -0
  8. package/dist/cache/cache.service.js +173 -0
  9. package/dist/cache/cache.service.js.map +1 -0
  10. package/dist/cache/index.d.ts +3 -0
  11. package/dist/cache/index.d.ts.map +1 -0
  12. package/dist/cache/index.js +6 -0
  13. package/dist/cache/index.js.map +1 -0
  14. package/dist/common/guards/tenant.guard.d.ts +8 -0
  15. package/dist/common/guards/tenant.guard.d.ts.map +1 -0
  16. package/dist/common/guards/tenant.guard.js +44 -0
  17. package/dist/common/guards/tenant.guard.js.map +1 -0
  18. package/dist/common/index.d.ts +3 -0
  19. package/dist/common/index.d.ts.map +1 -0
  20. package/dist/common/index.js +6 -0
  21. package/dist/common/index.js.map +1 -0
  22. package/dist/common/logger.d.ts +7 -0
  23. package/dist/common/logger.d.ts.map +1 -0
  24. package/dist/common/logger.js +28 -0
  25. package/dist/common/logger.js.map +1 -0
  26. package/dist/config/config.module.d.ts +3 -0
  27. package/dist/config/config.module.d.ts.map +1 -0
  28. package/dist/config/config.module.js +17 -0
  29. package/dist/config/config.module.js.map +1 -0
  30. package/dist/config/config.service.d.ts +55 -0
  31. package/dist/config/config.service.d.ts.map +1 -0
  32. package/dist/config/config.service.js +212 -0
  33. package/dist/config/config.service.js.map +1 -0
  34. package/dist/config/index.d.ts +3 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +6 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +21 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/integrations/base-integration.service.d.ts +59 -0
  43. package/dist/integrations/base-integration.service.d.ts.map +1 -0
  44. package/dist/integrations/base-integration.service.js +227 -0
  45. package/dist/integrations/base-integration.service.js.map +1 -0
  46. package/dist/integrations/commerce/commerce.types.d.ts +301 -0
  47. package/dist/integrations/commerce/commerce.types.d.ts.map +1 -0
  48. package/dist/integrations/commerce/commerce.types.js +9 -0
  49. package/dist/integrations/commerce/commerce.types.js.map +1 -0
  50. package/dist/integrations/commerce/index.d.ts +4 -0
  51. package/dist/integrations/commerce/index.d.ts.map +1 -0
  52. package/dist/integrations/commerce/index.js +7 -0
  53. package/dist/integrations/commerce/index.js.map +1 -0
  54. package/dist/integrations/commerce/shopify-admin.service.d.ts +35 -0
  55. package/dist/integrations/commerce/shopify-admin.service.d.ts.map +1 -0
  56. package/dist/integrations/commerce/shopify-admin.service.js +269 -0
  57. package/dist/integrations/commerce/shopify-admin.service.js.map +1 -0
  58. package/dist/integrations/commerce/shopify.service.d.ts +43 -0
  59. package/dist/integrations/commerce/shopify.service.d.ts.map +1 -0
  60. package/dist/integrations/commerce/shopify.service.js +735 -0
  61. package/dist/integrations/commerce/shopify.service.js.map +1 -0
  62. package/dist/integrations/index.d.ts +9 -0
  63. package/dist/integrations/index.d.ts.map +1 -0
  64. package/dist/integrations/index.js +18 -0
  65. package/dist/integrations/index.js.map +1 -0
  66. package/dist/integrations/integration.factory.d.ts +23 -0
  67. package/dist/integrations/integration.factory.d.ts.map +1 -0
  68. package/dist/integrations/integration.factory.js +119 -0
  69. package/dist/integrations/integration.factory.js.map +1 -0
  70. package/dist/integrations/integration.types.d.ts +80 -0
  71. package/dist/integrations/integration.types.d.ts.map +1 -0
  72. package/dist/integrations/integration.types.js +9 -0
  73. package/dist/integrations/integration.types.js.map +1 -0
  74. package/dist/integrations/integrations.module.d.ts +3 -0
  75. package/dist/integrations/integrations.module.d.ts.map +1 -0
  76. package/dist/integrations/integrations.module.js +46 -0
  77. package/dist/integrations/integrations.module.js.map +1 -0
  78. package/dist/integrations/loyalty/capillary-auth.service.d.ts +30 -0
  79. package/dist/integrations/loyalty/capillary-auth.service.d.ts.map +1 -0
  80. package/dist/integrations/loyalty/capillary-auth.service.js +112 -0
  81. package/dist/integrations/loyalty/capillary-auth.service.js.map +1 -0
  82. package/dist/integrations/loyalty/capillary-coupon.service.d.ts +24 -0
  83. package/dist/integrations/loyalty/capillary-coupon.service.d.ts.map +1 -0
  84. package/dist/integrations/loyalty/capillary-coupon.service.js +383 -0
  85. package/dist/integrations/loyalty/capillary-coupon.service.js.map +1 -0
  86. package/dist/integrations/loyalty/capillary.types.d.ts +218 -0
  87. package/dist/integrations/loyalty/capillary.types.d.ts.map +1 -0
  88. package/dist/integrations/loyalty/capillary.types.js +21 -0
  89. package/dist/integrations/loyalty/capillary.types.js.map +1 -0
  90. package/dist/integrations/loyalty/index.d.ts +4 -0
  91. package/dist/integrations/loyalty/index.d.ts.map +1 -0
  92. package/dist/integrations/loyalty/index.js +7 -0
  93. package/dist/integrations/loyalty/index.js.map +1 -0
  94. package/dist/integrations/oms/index.d.ts +4 -0
  95. package/dist/integrations/oms/index.d.ts.map +1 -0
  96. package/dist/integrations/oms/index.js +7 -0
  97. package/dist/integrations/oms/index.js.map +1 -0
  98. package/dist/integrations/oms/omuni-auth.service.d.ts +29 -0
  99. package/dist/integrations/oms/omuni-auth.service.d.ts.map +1 -0
  100. package/dist/integrations/oms/omuni-auth.service.js +164 -0
  101. package/dist/integrations/oms/omuni-auth.service.js.map +1 -0
  102. package/dist/integrations/oms/omuni.service.d.ts +17 -0
  103. package/dist/integrations/oms/omuni.service.d.ts.map +1 -0
  104. package/dist/integrations/oms/omuni.service.js +128 -0
  105. package/dist/integrations/oms/omuni.service.js.map +1 -0
  106. package/dist/integrations/oms/omuni.types.d.ts +65 -0
  107. package/dist/integrations/oms/omuni.types.d.ts.map +1 -0
  108. package/dist/integrations/oms/omuni.types.js +3 -0
  109. package/dist/integrations/oms/omuni.types.js.map +1 -0
  110. package/dist/integrations/shopify-theme/index.d.ts +3 -0
  111. package/dist/integrations/shopify-theme/index.d.ts.map +1 -0
  112. package/dist/integrations/shopify-theme/index.js +6 -0
  113. package/dist/integrations/shopify-theme/index.js.map +1 -0
  114. package/dist/integrations/shopify-theme/shopify-theme.module.d.ts +3 -0
  115. package/dist/integrations/shopify-theme/shopify-theme.module.d.ts.map +1 -0
  116. package/dist/integrations/shopify-theme/shopify-theme.module.js +16 -0
  117. package/dist/integrations/shopify-theme/shopify-theme.module.js.map +1 -0
  118. package/dist/integrations/shopify-theme/shopify-theme.service.d.ts +35 -0
  119. package/dist/integrations/shopify-theme/shopify-theme.service.d.ts.map +1 -0
  120. package/dist/integrations/shopify-theme/shopify-theme.service.js +155 -0
  121. package/dist/integrations/shopify-theme/shopify-theme.service.js.map +1 -0
  122. package/dist/queue/index.d.ts +3 -0
  123. package/dist/queue/index.d.ts.map +1 -0
  124. package/dist/queue/index.js +8 -0
  125. package/dist/queue/index.js.map +1 -0
  126. package/dist/queue/queue.module.d.ts +3 -0
  127. package/dist/queue/queue.module.d.ts.map +1 -0
  128. package/dist/queue/queue.module.js +17 -0
  129. package/dist/queue/queue.module.js.map +1 -0
  130. package/dist/queue/queue.service.d.ts +20 -0
  131. package/dist/queue/queue.service.d.ts.map +1 -0
  132. package/dist/queue/queue.service.js +119 -0
  133. package/dist/queue/queue.service.js.map +1 -0
  134. package/dist/theme/header-content.service.d.ts +142 -0
  135. package/dist/theme/header-content.service.d.ts.map +1 -0
  136. package/dist/theme/header-content.service.js +626 -0
  137. package/dist/theme/header-content.service.js.map +1 -0
  138. package/dist/theme/index.d.ts +5 -0
  139. package/dist/theme/index.d.ts.map +1 -0
  140. package/dist/theme/index.js +17 -0
  141. package/dist/theme/index.js.map +1 -0
  142. package/dist/theme/theme-content.interfaces.d.ts +79 -0
  143. package/dist/theme/theme-content.interfaces.d.ts.map +1 -0
  144. package/dist/theme/theme-content.interfaces.js +14 -0
  145. package/dist/theme/theme-content.interfaces.js.map +1 -0
  146. package/dist/theme/theme-content.service.d.ts +125 -0
  147. package/dist/theme/theme-content.service.d.ts.map +1 -0
  148. package/dist/theme/theme-content.service.js +738 -0
  149. package/dist/theme/theme-content.service.js.map +1 -0
  150. package/dist/theme/theme.module.d.ts +46 -0
  151. package/dist/theme/theme.module.d.ts.map +1 -0
  152. package/dist/theme/theme.module.js +76 -0
  153. package/dist/theme/theme.module.js.map +1 -0
  154. package/package.json +62 -0
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShopifyThemeService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const config_service_1 = require("../../config/config.service");
7
+ const cache_service_1 = require("../../cache/cache.service");
8
+ const logger_1 = require("../../common/logger");
9
+ /**
10
+ * Shopify Theme Service
11
+ *
12
+ * Fetches content from Shopify theme assets (JSON files).
13
+ * Used for CMS-like content stored in theme files.
14
+ */
15
+ let ShopifyThemeService = class ShopifyThemeService {
16
+ configService;
17
+ cacheService;
18
+ constructor(configService, cacheService) {
19
+ this.configService = configService;
20
+ this.cacheService = cacheService;
21
+ }
22
+ /**
23
+ * Fetch a JSON asset from the Shopify theme.
24
+ */
25
+ async getThemeAsset(brand, assetKey) {
26
+ const cacheKey = `${brand}:theme:${assetKey}`;
27
+ // Check cache first
28
+ const cached = await this.cacheService.get(cacheKey);
29
+ if (cached && !cached.isStale) {
30
+ return cached.data;
31
+ }
32
+ const adminToken = this.configService.getShopifyAdminToken(brand);
33
+ const themeId = this.configService.getShopifyThemeId(brand);
34
+ const storeDomain = this.configService.getShopifyStoreDomain(brand);
35
+ if (!adminToken || !themeId || !storeDomain) {
36
+ logger_1.logger.warn('Shopify theme config missing', { brand, assetKey });
37
+ return cached?.data ?? null;
38
+ }
39
+ const url = `https://${storeDomain}/admin/api/2024-01/themes/${themeId}/assets.json?asset[key]=${encodeURIComponent(assetKey)}`;
40
+ try {
41
+ const response = await fetch(url, {
42
+ headers: {
43
+ 'X-Shopify-Access-Token': adminToken,
44
+ 'Content-Type': 'application/json',
45
+ },
46
+ });
47
+ if (!response.ok) {
48
+ logger_1.logger.error('Failed to fetch theme asset', {
49
+ brand,
50
+ assetKey,
51
+ status: response.status,
52
+ });
53
+ return cached?.data ?? null;
54
+ }
55
+ const data = (await response.json());
56
+ const assetValue = data.asset?.value;
57
+ if (!assetValue) {
58
+ logger_1.logger.warn('Theme asset empty', { brand, assetKey });
59
+ return cached?.data ?? null;
60
+ }
61
+ const parsed = JSON.parse(assetValue);
62
+ // Cache the result
63
+ const { defaultTTL, staleTTL } = this.configService.getCacheTTL(brand);
64
+ await this.cacheService.set(cacheKey, parsed, defaultTTL, staleTTL);
65
+ // If we had stale data, trigger background refresh
66
+ if (cached?.isStale) {
67
+ logger_1.logger.info('Theme asset refreshed', { brand, assetKey });
68
+ }
69
+ return parsed;
70
+ }
71
+ catch (error) {
72
+ logger_1.logger.error('Theme asset fetch error', {
73
+ brand,
74
+ assetKey,
75
+ error: error instanceof Error ? error.message : 'Unknown',
76
+ });
77
+ return cached?.data ?? null;
78
+ }
79
+ }
80
+ /**
81
+ * Invalidate cached theme asset.
82
+ */
83
+ async invalidateAsset(brand, assetKey) {
84
+ const cacheKey = `${brand}:theme:${assetKey}`;
85
+ await this.cacheService.delete(cacheKey);
86
+ logger_1.logger.info('Theme asset cache invalidated', { brand, assetKey });
87
+ }
88
+ /**
89
+ * Invalidate all theme assets for a brand.
90
+ */
91
+ async invalidateAllAssets(brand) {
92
+ const pattern = `${brand}:theme:*`;
93
+ const count = await this.cacheService.deletePattern(pattern);
94
+ logger_1.logger.info('All theme assets invalidated', { brand, count });
95
+ return count;
96
+ }
97
+ /**
98
+ * Build cache key for theme content.
99
+ */
100
+ buildCacheKey(brand, path) {
101
+ return `${brand}:theme:${path}`;
102
+ }
103
+ /**
104
+ * Fetch a theme file directly without caching.
105
+ * Used by services that handle their own caching logic.
106
+ */
107
+ async fetchThemeFile(brand, path) {
108
+ const adminToken = this.configService.getShopifyAdminToken(brand);
109
+ const themeId = this.configService.getShopifyThemeId(brand);
110
+ const storeDomain = this.configService.getShopifyStoreDomain(brand);
111
+ if (!adminToken || !themeId || !storeDomain) {
112
+ logger_1.logger.warn('Shopify theme config missing', { brand, path });
113
+ return null;
114
+ }
115
+ const url = `https://${storeDomain}/admin/api/2024-01/themes/${themeId}/assets.json?asset[key]=${encodeURIComponent(path)}`;
116
+ try {
117
+ const response = await fetch(url, {
118
+ headers: {
119
+ 'X-Shopify-Access-Token': adminToken,
120
+ 'Content-Type': 'application/json',
121
+ },
122
+ });
123
+ if (!response.ok) {
124
+ logger_1.logger.error('Failed to fetch theme file', {
125
+ brand,
126
+ path,
127
+ status: response.status,
128
+ });
129
+ return null;
130
+ }
131
+ const data = (await response.json());
132
+ const assetValue = data.asset?.value;
133
+ if (!assetValue) {
134
+ logger_1.logger.warn('Theme file empty', { brand, path });
135
+ return null;
136
+ }
137
+ return JSON.parse(assetValue);
138
+ }
139
+ catch (error) {
140
+ logger_1.logger.error('Theme file fetch error', {
141
+ brand,
142
+ path,
143
+ error: error instanceof Error ? error.message : 'Unknown',
144
+ });
145
+ return null;
146
+ }
147
+ }
148
+ };
149
+ exports.ShopifyThemeService = ShopifyThemeService;
150
+ exports.ShopifyThemeService = ShopifyThemeService = tslib_1.__decorate([
151
+ (0, common_1.Injectable)(),
152
+ tslib_1.__metadata("design:paramtypes", [config_service_1.ConfigService,
153
+ cache_service_1.CacheService])
154
+ ], ShopifyThemeService);
155
+ //# sourceMappingURL=shopify-theme.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify-theme.service.js","sourceRoot":"","sources":["../../../src/integrations/shopify-theme/shopify-theme.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,gEAA4D;AAC5D,6DAAyD;AACzD,gDAA6C;AAE7C;;;;;GAKG;AAEI,IAAM,mBAAmB,GAAzB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a;QACd,4BAAY;GAHlC,mBAAmB,CAyJ/B"}
@@ -0,0 +1,3 @@
1
+ export { QueueModule } from './queue.module';
2
+ export { QueueService, QueueItem } from './queue.service';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/queue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueService = exports.QueueModule = void 0;
4
+ var queue_module_1 = require("./queue.module");
5
+ Object.defineProperty(exports, "QueueModule", { enumerable: true, get: function () { return queue_module_1.QueueModule; } });
6
+ var queue_service_1 = require("./queue.service");
7
+ Object.defineProperty(exports, "QueueService", { enumerable: true, get: function () { return queue_service_1.QueueService; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/queue/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,iDAA0D;AAAjD,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,3 @@
1
+ export declare class QueueModule {
2
+ }
3
+ //# sourceMappingURL=queue.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.module.d.ts","sourceRoot":"","sources":["../../src/queue/queue.module.ts"],"names":[],"mappings":"AAGA,qBAKa,WAAW;CAAG"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const queue_service_1 = require("./queue.service");
7
+ let QueueModule = class QueueModule {
8
+ };
9
+ exports.QueueModule = QueueModule;
10
+ exports.QueueModule = QueueModule = tslib_1.__decorate([
11
+ (0, common_1.Global)(),
12
+ (0, common_1.Module)({
13
+ providers: [queue_service_1.QueueService],
14
+ exports: [queue_service_1.QueueService],
15
+ })
16
+ ], QueueModule);
17
+ //# sourceMappingURL=queue.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.module.js","sourceRoot":"","sources":["../../src/queue/queue.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAgD;AAChD,mDAA+C;AAOxC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IALvB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG"}
@@ -0,0 +1,20 @@
1
+ import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
+ import { ConfigService } from '../config/config.service';
3
+ export interface QueueItem<T = Record<string, unknown>> {
4
+ id: string;
5
+ payload: T;
6
+ createdAt: string;
7
+ }
8
+ export declare class QueueService implements OnModuleInit, OnModuleDestroy {
9
+ private readonly configService;
10
+ private redis;
11
+ private readonly defaultQueue;
12
+ constructor(configService: ConfigService);
13
+ onModuleInit(): void;
14
+ onModuleDestroy(): Promise<void>;
15
+ push<T = Record<string, unknown>>(payload: T, queueName?: string): Promise<string | null>;
16
+ pop<T = Record<string, unknown>>(queueName?: string): Promise<QueueItem<T> | null>;
17
+ length(queueName?: string): Promise<number>;
18
+ scanQueues(pattern: string): Promise<string[]>;
19
+ }
20
+ //# sourceMappingURL=queue.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.service.d.ts","sourceRoot":"","sources":["../../src/queue/queue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBACa,YAAa,YAAW,YAAY,EAAE,eAAe;IAIpD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAH1C,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAErB,aAAa,EAAE,aAAa;IAEzD,YAAY;IAoBN,eAAe;IAMf,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,EAAE,CAAC,EACV,SAAS,SAAoB,GAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAyBnB,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,SAAoB,GAC5B,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAiBzB,MAAM,CAAC,SAAS,SAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;IActD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CA4BrD"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const ioredis_1 = require("ioredis");
7
+ const config_service_1 = require("../config/config.service");
8
+ const logger_1 = require("../common/logger");
9
+ let QueueService = class QueueService {
10
+ configService;
11
+ redis = null;
12
+ defaultQueue = 'webhook:generic';
13
+ constructor(configService) {
14
+ this.configService = configService;
15
+ }
16
+ onModuleInit() {
17
+ const redisUrl = this.configService.getRedisUrl();
18
+ try {
19
+ this.redis = new ioredis_1.Redis(redisUrl);
20
+ this.redis.on('connect', () => {
21
+ logger_1.logger.info('Queue Redis connected');
22
+ });
23
+ this.redis.on('error', (err) => {
24
+ logger_1.logger.error('Queue Redis error', { error: err.message });
25
+ });
26
+ }
27
+ catch (error) {
28
+ logger_1.logger.warn('Queue Redis not available', {
29
+ error: error instanceof Error ? error.message : 'Unknown',
30
+ });
31
+ }
32
+ }
33
+ async onModuleDestroy() {
34
+ if (this.redis) {
35
+ await this.redis.quit();
36
+ }
37
+ }
38
+ async push(payload, queueName = this.defaultQueue) {
39
+ if (!this.redis) {
40
+ logger_1.logger.warn('Queue not available, payload not queued');
41
+ return null;
42
+ }
43
+ const item = {
44
+ id: `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
45
+ payload,
46
+ createdAt: new Date().toISOString(),
47
+ };
48
+ try {
49
+ await this.redis.lpush(queueName, JSON.stringify(item));
50
+ logger_1.logger.info('Payload pushed to queue', { queueName, id: item.id, payload });
51
+ return item.id;
52
+ }
53
+ catch (error) {
54
+ logger_1.logger.error('Failed to push to queue', {
55
+ queueName,
56
+ error: error instanceof Error ? error.message : 'Unknown',
57
+ });
58
+ return null;
59
+ }
60
+ }
61
+ async pop(queueName = this.defaultQueue) {
62
+ if (!this.redis)
63
+ return null;
64
+ try {
65
+ const raw = await this.redis.rpop(queueName);
66
+ if (!raw)
67
+ return null;
68
+ return JSON.parse(raw);
69
+ }
70
+ catch (error) {
71
+ logger_1.logger.error('Failed to pop from queue', {
72
+ queueName,
73
+ error: error instanceof Error ? error.message : 'Unknown',
74
+ });
75
+ return null;
76
+ }
77
+ }
78
+ async length(queueName = this.defaultQueue) {
79
+ if (!this.redis)
80
+ return 0;
81
+ try {
82
+ return await this.redis.llen(queueName);
83
+ }
84
+ catch (error) {
85
+ logger_1.logger.error('Failed to get queue length', {
86
+ queueName,
87
+ error: error instanceof Error ? error.message : 'Unknown',
88
+ });
89
+ return 0;
90
+ }
91
+ }
92
+ async scanQueues(pattern) {
93
+ if (!this.redis)
94
+ return [];
95
+ try {
96
+ const keys = [];
97
+ let cursor = '0';
98
+ do {
99
+ const [nextCursor, matchedKeys] = await this.redis.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
100
+ cursor = nextCursor;
101
+ keys.push(...matchedKeys);
102
+ } while (cursor !== '0');
103
+ return keys;
104
+ }
105
+ catch (error) {
106
+ logger_1.logger.error('Failed to scan queues', {
107
+ pattern,
108
+ error: error instanceof Error ? error.message : 'Unknown',
109
+ });
110
+ return [];
111
+ }
112
+ }
113
+ };
114
+ exports.QueueService = QueueService;
115
+ exports.QueueService = QueueService = tslib_1.__decorate([
116
+ (0, common_1.Injectable)(),
117
+ tslib_1.__metadata("design:paramtypes", [config_service_1.ConfigService])
118
+ ], QueueService);
119
+ //# sourceMappingURL=queue.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.service.js","sourceRoot":"","sources":["../../src/queue/queue.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA2E;AAC3E,qCAAgC;AAChC,6DAAyD;AACzD,6CAA0C;AASnC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAIM;IAHrB,KAAK,GAAiB,IAAI,CAAC;IAClB,YAAY,GAAG,iBAAiB,CAAC;IAElD,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE7D,YAAY;QACV,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;QAElD,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,QAAQ,CAAC,CAAC;YAEjC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;gBAC5B,eAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;gBACpC,eAAM,CAAC,KA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AS;aAC1D,CAAC,CAAC;YACH,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,IAAI,GAAa,EAAE,CAAC;YAC1B,IAAI,MAAM,GAAG,GAAG,CAAC;YAEjB,GAAG,CAAC;gBACF,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CACrD,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,GAAG,CACJ,CAAC;gBACF,MAAM,GAAG,UAAU,CAAC;gBACpB,IAAI,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;YAC5B,CAAC,QAAQ,MAAM,KAAK,GAAG,EAAE;YAEzB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE;gBACpC,OAAO;gBACP,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAC1D,CAAC,CAAC;YACH,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAA;AAzHY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;6CAKiC,8BAAa;GAJ9C,YAAY,CAyHxB"}
@@ -0,0 +1,142 @@
1
+ import { CacheService } from '../cache/cache.service';
2
+ import { ConfigService } from '../config/config.service';
3
+ import { ShopifyThemeService } from '../integrations/shopify-theme';
4
+ interface ParsedHeaderGroup {
5
+ sections: Record<string, {
6
+ type: string;
7
+ blocks?: Record<string, {
8
+ type: string;
9
+ settings?: Record<string, unknown>;
10
+ }>;
11
+ block_order?: string[];
12
+ settings?: Record<string, unknown>;
13
+ }>;
14
+ order: string[];
15
+ }
16
+ interface PromoCardData {
17
+ title: string;
18
+ link: string;
19
+ image?: {
20
+ url: string;
21
+ altText: string | null;
22
+ width: number;
23
+ height: number;
24
+ };
25
+ }
26
+ interface MegaMenuPromoData {
27
+ categoryTitle?: string;
28
+ cards: PromoCardData[];
29
+ }
30
+ interface MegaMenuData {
31
+ promos: MegaMenuPromoData[];
32
+ }
33
+ export interface CuratedMenuItem {
34
+ title: string;
35
+ url: string;
36
+ type: string;
37
+ resourceId: string | null;
38
+ sections?: string[];
39
+ megaMenu?: MegaMenuData;
40
+ items?: CuratedMenuItem[];
41
+ }
42
+ export interface CuratedHeaderContent {
43
+ headerSettings: Record<string, unknown>;
44
+ menu: {
45
+ handle: string;
46
+ items: CuratedMenuItem[];
47
+ };
48
+ }
49
+ export interface HeaderError {
50
+ code: string;
51
+ message: string;
52
+ }
53
+ export interface HeaderContentResult {
54
+ success: boolean;
55
+ data?: CuratedHeaderContent;
56
+ error?: HeaderError;
57
+ isStale: boolean;
58
+ triggeredRefresh: boolean;
59
+ }
60
+ export declare class HeaderContentService {
61
+ private readonly cacheService;
62
+ private readonly configService;
63
+ private readonly shopifyThemeService;
64
+ private refreshInProgress;
65
+ constructor(cacheService: CacheService, configService: ConfigService, shopifyThemeService: ShopifyThemeService);
66
+ /**
67
+ * Build cache key for header content.
68
+ * Pattern: ${brand}:header:${menuHandle}
69
+ */
70
+ buildCacheKey(brand: string, menuHandle: string): string;
71
+ /**
72
+ * Get header content with stale-while-revalidate semantics.
73
+ * Returns cached data immediately, triggers background refresh if stale.
74
+ * On cache miss, fetches on-demand (synchronously).
75
+ */
76
+ getHeaderContent(brand: string, menuHandle?: string): Promise<HeaderContentResult>;
77
+ /**
78
+ * Fetch header-group.json from Shopify and process header content.
79
+ * Used for both cache miss and background refresh.
80
+ */
81
+ private fetchHeaderContentFresh;
82
+ /**
83
+ * Background refresh with deduplication.
84
+ * Prevents concurrent refreshes for the same cache key.
85
+ */
86
+ private refreshHeaderInBackground;
87
+ /**
88
+ * Fetch menu items and metaobject, process, and cache the header content.
89
+ * Fails entirely if any API call fails - no partial caching.
90
+ */
91
+ fetchAndCacheHeaderContent(brand: string, rawHeaderGroup: ParsedHeaderGroup): Promise<CuratedHeaderContent | null>;
92
+ /**
93
+ * Fetch menu items from Storefront API
94
+ */
95
+ private fetchMenu;
96
+ /**
97
+ * Fetch menu metaobject from Storefront API
98
+ */
99
+ private fetchMenuMetaobject;
100
+ /**
101
+ * Parse section mappings from metaobject JSON field
102
+ */
103
+ private parseSectionMappings;
104
+ /**
105
+ * Process and merge header content
106
+ */
107
+ private processHeaderContent;
108
+ /**
109
+ * Recursively curate menu items and attach section mappings and mega menus
110
+ */
111
+ private curateMenuItems;
112
+ /**
113
+ * Curate a single menu item (without mega menu logic)
114
+ */
115
+ private curateMenuItem;
116
+ /**
117
+ * Extract handle from URL path
118
+ */
119
+ private extractHandleFromUrl;
120
+ /**
121
+ * Extract mega menu configuration from header-group.json blocks.
122
+ */
123
+ private extractMegaMenuConfig;
124
+ /**
125
+ * Fetch a single promo metaobject from Storefront API
126
+ */
127
+ private fetchPromoMetaobject;
128
+ /**
129
+ * Parse promo metaobject response into MegaMenuPromoData
130
+ */
131
+ private parsePromoMetaobject;
132
+ /**
133
+ * Parse a promo card from metaobject fields
134
+ */
135
+ private parsePromoCard;
136
+ /**
137
+ * Fetch all promo metaobjects in parallel
138
+ */
139
+ private fetchAllPromos;
140
+ }
141
+ export {};
142
+ //# sourceMappingURL=header-content.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-content.service.d.ts","sourceRoot":"","sources":["../../src/theme/header-content.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,UAAU,iBAAiB;IACzB,QAAQ,EAAE,MAAM,CACd,MAAM,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