@revealui/core 0.3.0 → 0.5.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 (155) hide show
  1. package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
  2. package/dist/client/admin/components/AdminDashboard.js +20 -3
  3. package/dist/client/richtext/index.d.ts.map +1 -1
  4. package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +1 -3
  5. package/dist/collections/operations/create.d.ts +2 -1
  6. package/dist/collections/operations/create.d.ts.map +1 -1
  7. package/dist/collections/operations/create.js +28 -1
  8. package/dist/database/type-adapter.d.ts.map +1 -1
  9. package/dist/features.d.ts +7 -3
  10. package/dist/features.d.ts.map +1 -1
  11. package/dist/features.js +2 -0
  12. package/dist/globals/GlobalOperations.d.ts.map +1 -1
  13. package/dist/globals/GlobalOperations.js +12 -2
  14. package/dist/index.d.ts +11 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +11 -1
  17. package/dist/license.d.ts +6 -0
  18. package/dist/license.d.ts.map +1 -1
  19. package/dist/license.js +14 -1
  20. package/dist/monitoring/alerts.d.ts +4 -4
  21. package/dist/monitoring/alerts.d.ts.map +1 -1
  22. package/dist/plugins/nested-docs.d.ts.map +1 -1
  23. package/dist/plugins/nested-docs.js +0 -1
  24. package/dist/queries/queryBuilder.d.ts.map +1 -1
  25. package/dist/queries/queryBuilder.js +4 -3
  26. package/dist/richtext/index.d.ts.map +1 -1
  27. package/dist/storage/vercel-blob.d.ts.map +1 -1
  28. package/dist/storage/vercel-blob.js +3 -0
  29. package/dist/types/api.d.ts.map +1 -1
  30. package/dist/types/config.d.ts.map +1 -1
  31. package/dist/types/core.d.ts +1 -1
  32. package/dist/types/core.d.ts.map +1 -1
  33. package/dist/types/extensions.d.ts.map +1 -1
  34. package/dist/types/frontend.d.ts.map +1 -1
  35. package/dist/types/legacy.d.ts.map +1 -1
  36. package/dist/types/query.d.ts.map +1 -1
  37. package/dist/types/runtime.d.ts +1 -0
  38. package/dist/types/runtime.d.ts.map +1 -1
  39. package/dist/utils/error-responses.d.ts.map +1 -1
  40. package/dist/utils/error-responses.js +2 -3
  41. package/package.json +23 -23
  42. package/dist/caching/app-cache.d.ts +0 -242
  43. package/dist/caching/app-cache.d.ts.map +0 -1
  44. package/dist/caching/app-cache.js +0 -438
  45. package/dist/caching/cdn-config.d.ts +0 -155
  46. package/dist/caching/cdn-config.d.ts.map +0 -1
  47. package/dist/caching/cdn-config.js +0 -415
  48. package/dist/caching/edge-cache.d.ts +0 -177
  49. package/dist/caching/edge-cache.d.ts.map +0 -1
  50. package/dist/caching/edge-cache.js +0 -414
  51. package/dist/caching/service-worker.d.ts +0 -157
  52. package/dist/caching/service-worker.d.ts.map +0 -1
  53. package/dist/caching/service-worker.js +0 -438
  54. package/dist/client/admin/utils/auth.d.ts +0 -23
  55. package/dist/client/admin/utils/auth.d.ts.map +0 -1
  56. package/dist/client/admin/utils/auth.js +0 -52
  57. package/dist/client/http/client.d.ts +0 -15
  58. package/dist/client/http/client.d.ts.map +0 -1
  59. package/dist/client/http/client.js +0 -49
  60. package/dist/client/http/fetchBanner.d.ts +0 -18
  61. package/dist/client/http/fetchBanner.d.ts.map +0 -1
  62. package/dist/client/http/fetchBanner.js +0 -44
  63. package/dist/client/http/fetchCard.d.ts +0 -18
  64. package/dist/client/http/fetchCard.d.ts.map +0 -1
  65. package/dist/client/http/fetchCard.js +0 -46
  66. package/dist/client/http/fetchEvents.d.ts +0 -18
  67. package/dist/client/http/fetchEvents.d.ts.map +0 -1
  68. package/dist/client/http/fetchEvents.js +0 -44
  69. package/dist/client/http/fetchHero.d.ts +0 -17
  70. package/dist/client/http/fetchHero.d.ts.map +0 -1
  71. package/dist/client/http/fetchHero.js +0 -55
  72. package/dist/client/http/fetchMainInfos.d.ts +0 -17
  73. package/dist/client/http/fetchMainInfos.d.ts.map +0 -1
  74. package/dist/client/http/fetchMainInfos.js +0 -44
  75. package/dist/client/http/fetchVideos.d.ts +0 -13
  76. package/dist/client/http/fetchVideos.d.ts.map +0 -1
  77. package/dist/client/http/fetchVideos.js +0 -36
  78. package/dist/client/http/index.d.ts +0 -19
  79. package/dist/client/http/index.d.ts.map +0 -1
  80. package/dist/client/http/index.js +0 -11
  81. package/dist/error-handling/circuit-breaker.d.ts +0 -262
  82. package/dist/error-handling/circuit-breaker.d.ts.map +0 -1
  83. package/dist/error-handling/circuit-breaker.js +0 -550
  84. package/dist/error-handling/retry.d.ts +0 -194
  85. package/dist/error-handling/retry.d.ts.map +0 -1
  86. package/dist/error-handling/retry.js +0 -455
  87. package/dist/errors/index.d.ts +0 -23
  88. package/dist/errors/index.d.ts.map +0 -1
  89. package/dist/errors/index.js +0 -40
  90. package/dist/generated/agents/index.d.ts +0 -8
  91. package/dist/generated/agents/index.d.ts.map +0 -1
  92. package/dist/generated/agents/index.js +0 -7
  93. package/dist/generated/components/index.d.ts +0 -8
  94. package/dist/generated/components/index.d.ts.map +0 -1
  95. package/dist/generated/components/index.js +0 -7
  96. package/dist/generated/functions/index.d.ts +0 -8
  97. package/dist/generated/functions/index.d.ts.map +0 -1
  98. package/dist/generated/functions/index.js +0 -7
  99. package/dist/generated/hooks/index.d.ts +0 -8
  100. package/dist/generated/hooks/index.d.ts.map +0 -1
  101. package/dist/generated/hooks/index.js +0 -7
  102. package/dist/generated/plans/index.d.ts +0 -8
  103. package/dist/generated/plans/index.d.ts.map +0 -1
  104. package/dist/generated/plans/index.js +0 -7
  105. package/dist/generated/prompts/index.d.ts +0 -8
  106. package/dist/generated/prompts/index.d.ts.map +0 -1
  107. package/dist/generated/prompts/index.js +0 -7
  108. package/dist/generated/tools/index.d.ts +0 -8
  109. package/dist/generated/tools/index.d.ts.map +0 -1
  110. package/dist/generated/tools/index.js +0 -7
  111. package/dist/generated/types/supabase.d.ts +0 -193
  112. package/dist/generated/types/supabase.d.ts.map +0 -1
  113. package/dist/generated/types/supabase.js +0 -5
  114. package/dist/optimization/asset-optimizer.d.ts +0 -206
  115. package/dist/optimization/asset-optimizer.d.ts.map +0 -1
  116. package/dist/optimization/asset-optimizer.js +0 -336
  117. package/dist/optimization/build-optimizer.d.ts +0 -202
  118. package/dist/optimization/build-optimizer.d.ts.map +0 -1
  119. package/dist/optimization/build-optimizer.js +0 -271
  120. package/dist/optimization/bundle-analyzer.d.ts +0 -98
  121. package/dist/optimization/bundle-analyzer.d.ts.map +0 -1
  122. package/dist/optimization/bundle-analyzer.js +0 -346
  123. package/dist/optimization/code-splitting.d.ts +0 -121
  124. package/dist/optimization/code-splitting.d.ts.map +0 -1
  125. package/dist/optimization/code-splitting.js +0 -261
  126. package/dist/plugin/index.d.ts +0 -12
  127. package/dist/plugin/index.d.ts.map +0 -1
  128. package/dist/plugin/index.js +0 -4
  129. package/dist/security/audit.d.ts +0 -188
  130. package/dist/security/audit.d.ts.map +0 -1
  131. package/dist/security/audit.js +0 -433
  132. package/dist/security/auth.d.ts +0 -110
  133. package/dist/security/auth.d.ts.map +0 -1
  134. package/dist/security/auth.js +0 -257
  135. package/dist/security/authorization.d.ts +0 -211
  136. package/dist/security/authorization.d.ts.map +0 -1
  137. package/dist/security/authorization.js +0 -492
  138. package/dist/security/encryption.d.ts +0 -226
  139. package/dist/security/encryption.d.ts.map +0 -1
  140. package/dist/security/encryption.js +0 -534
  141. package/dist/security/gdpr-storage.d.ts +0 -102
  142. package/dist/security/gdpr-storage.d.ts.map +0 -1
  143. package/dist/security/gdpr-storage.js +0 -65
  144. package/dist/security/gdpr.d.ts +0 -320
  145. package/dist/security/gdpr.d.ts.map +0 -1
  146. package/dist/security/gdpr.js +0 -531
  147. package/dist/security/headers.d.ts +0 -184
  148. package/dist/security/headers.d.ts.map +0 -1
  149. package/dist/security/headers.js +0 -420
  150. package/dist/utils/jwt-validation.d.ts +0 -14
  151. package/dist/utils/jwt-validation.d.ts.map +0 -1
  152. package/dist/utils/jwt-validation.js +0 -36
  153. package/dist/utils/request-headers.d.ts +0 -15
  154. package/dist/utils/request-headers.d.ts.map +0 -1
  155. package/dist/utils/request-headers.js +0 -31
@@ -1,46 +0,0 @@
1
- /**
2
- * Fetch cards from CMS
3
- * Returns cards from the 'cards' collection
4
- */
5
- import { logger } from '@revealui/core/utils/logger';
6
- import { fetchFromCMS } from './client.js';
7
- /**
8
- * Fetches cards from CMS
9
- * Maps Card collection data to CardData format
10
- */
11
- export default async function fetchCard() {
12
- try {
13
- const response = await fetchFromCMS('/api/collections/cards', {
14
- params: {
15
- depth: 1,
16
- limit: 10,
17
- },
18
- });
19
- return (response.docs || [])
20
- .map((doc) => {
21
- // Extract image URL
22
- let imageUrl = '';
23
- if (doc.image) {
24
- if (typeof doc.image === 'object' && 'url' in doc.image) {
25
- imageUrl = doc.image.url || '';
26
- }
27
- else if (typeof doc.image === 'string') {
28
- imageUrl = doc.image;
29
- }
30
- }
31
- return {
32
- name: doc.name || '',
33
- image: imageUrl,
34
- label: doc.label || '',
35
- cta: doc.cta || '',
36
- href: doc.href || '/',
37
- loading: doc.loading || 'eager',
38
- };
39
- })
40
- .filter((card) => card.name && card.image); // Filter out incomplete cards
41
- }
42
- catch (error) {
43
- logger.error('Error fetching cards', { error });
44
- return [];
45
- }
46
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Fetch events from CMS
3
- * Returns events from the 'events' collection
4
- */
5
- export interface EventData {
6
- id: number;
7
- title: string;
8
- name?: string;
9
- description?: string;
10
- image?: string;
11
- alt?: string;
12
- }
13
- /**
14
- * Fetches events from CMS
15
- * Maps Event collection data to EventData format
16
- */
17
- export default function fetchEvents(): Promise<EventData[]>;
18
- //# sourceMappingURL=fetchEvents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchEvents.d.ts","sourceRoot":"","sources":["../../../src/client/http/fetchEvents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,wBAA8B,WAAW,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAgDhE"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Fetch events from CMS
3
- * Returns events from the 'events' collection
4
- */
5
- import { logger } from '@revealui/core/utils/logger';
6
- import { fetchFromCMS } from './client.js';
7
- /**
8
- * Fetches events from CMS
9
- * Maps Event collection data to EventData format
10
- */
11
- export default async function fetchEvents() {
12
- try {
13
- const response = await fetchFromCMS('/api/collections/events', {
14
- params: {
15
- depth: 1,
16
- limit: 10,
17
- },
18
- });
19
- return (response.docs || []).map((doc) => {
20
- // Extract image URL
21
- let imageUrl = '';
22
- if (doc.image) {
23
- if (typeof doc.image === 'object' && 'url' in doc.image) {
24
- imageUrl = doc.image.url || '';
25
- }
26
- else if (typeof doc.image === 'string') {
27
- imageUrl = doc.image;
28
- }
29
- }
30
- return {
31
- id: doc.id,
32
- title: doc.title || doc.name || 'Untitled Event',
33
- name: doc.name || undefined,
34
- description: doc.description || undefined,
35
- image: imageUrl || undefined,
36
- alt: doc.alt || undefined,
37
- };
38
- });
39
- }
40
- catch (error) {
41
- logger.error('Error fetching events', { error });
42
- return [];
43
- }
44
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Fetch hero content from CMS
3
- * Returns heroes from the 'heros' collection
4
- */
5
- export interface HeroData {
6
- id: number;
7
- image: string;
8
- videos: string;
9
- altText: string;
10
- href: string;
11
- }
12
- /**
13
- * Fetches hero content from CMS
14
- * Maps Hero collection data to HeroData format
15
- */
16
- export default function fetchHero(): Promise<HeroData[]>;
17
- //# sourceMappingURL=fetchHero.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchHero.d.ts","sourceRoot":"","sources":["../../../src/client/http/fetchHero.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,wBAA8B,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgE7D"}
@@ -1,55 +0,0 @@
1
- /**
2
- * Fetch hero content from CMS
3
- * Returns heroes from the 'heros' collection
4
- */
5
- import { logger } from '@revealui/core/utils/logger';
6
- import { fetchFromCMS } from './client.js';
7
- /**
8
- * Fetches hero content from CMS
9
- * Maps Hero collection data to HeroData format
10
- */
11
- export default async function fetchHero() {
12
- try {
13
- const response = await fetchFromCMS('/api/collections/heros', {
14
- params: {
15
- depth: 1,
16
- limit: 10,
17
- },
18
- });
19
- return (response.docs || [])
20
- .map((doc) => {
21
- // Extract image URL
22
- let imageUrl = '';
23
- if (doc.image) {
24
- if (typeof doc.image === 'object' && 'url' in doc.image) {
25
- imageUrl = doc.image.url || '';
26
- }
27
- else if (typeof doc.image === 'string') {
28
- imageUrl = doc.image;
29
- }
30
- }
31
- // Extract video URL
32
- let videoUrl = '';
33
- if (doc.video) {
34
- if (typeof doc.video === 'object' && 'url' in doc.video) {
35
- videoUrl = doc.video.url || '';
36
- }
37
- else if (typeof doc.video === 'string') {
38
- videoUrl = doc.video;
39
- }
40
- }
41
- return {
42
- id: doc.id,
43
- image: imageUrl,
44
- videos: videoUrl,
45
- altText: doc.altText || '',
46
- href: doc.href || '/',
47
- };
48
- })
49
- .filter((hero) => hero.image || hero.videos); // Filter out incomplete heroes
50
- }
51
- catch (error) {
52
- logger.error('Error fetching heroes', { error });
53
- return [];
54
- }
55
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Fetch main info content from CMS
3
- * Returns content from the 'contents' collection
4
- */
5
- export interface MainInfo {
6
- id: number;
7
- title: string;
8
- subtitle: string;
9
- description: string;
10
- image: string;
11
- }
12
- /**
13
- * Fetches main info content from CMS
14
- * Maps Content collection data to MainInfo format
15
- */
16
- export default function fetchMainInfos(): Promise<MainInfo[]>;
17
- //# sourceMappingURL=fetchMainInfos.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchMainInfos.d.ts","sourceRoot":"","sources":["../../../src/client/http/fetchMainInfos.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAA8B,cAAc,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CA2ClE"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Fetch main info content from CMS
3
- * Returns content from the 'contents' collection
4
- */
5
- import { logger } from '@revealui/core/utils/logger';
6
- import { fetchFromCMS } from './client.js';
7
- /**
8
- * Fetches main info content from CMS
9
- * Maps Content collection data to MainInfo format
10
- */
11
- export default async function fetchMainInfos() {
12
- try {
13
- const response = await fetchFromCMS('/api/collections/contents', {
14
- params: {
15
- depth: 1,
16
- limit: 10,
17
- },
18
- });
19
- // Transform CMS Content to MainInfo format
20
- return (response.docs || []).map((doc) => {
21
- // Extract image URL - handle different possible structures
22
- let imageUrl = '';
23
- if (doc.image) {
24
- if (typeof doc.image === 'object' && 'url' in doc.image) {
25
- imageUrl = doc.image.url || '';
26
- }
27
- else if (typeof doc.image === 'string') {
28
- imageUrl = doc.image;
29
- }
30
- }
31
- return {
32
- id: doc.id,
33
- title: doc.name || 'Untitled',
34
- subtitle: doc.description?.split('.')[0] || '',
35
- description: doc.description || '',
36
- image: imageUrl,
37
- };
38
- });
39
- }
40
- catch (error) {
41
- logger.error('Error fetching main infos', { error });
42
- return [];
43
- }
44
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Fetch videos from CMS
3
- * Returns videos from the 'videos' collection
4
- */
5
- export interface Video {
6
- url: string;
7
- }
8
- /**
9
- * Fetches videos from CMS
10
- * Returns array of video URLs
11
- */
12
- export default function fetchVideos(): Promise<Video[]>;
13
- //# sourceMappingURL=fetchVideos.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchVideos.d.ts","sourceRoot":"","sources":["../../../src/client/http/fetchVideos.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;GAGG;AACH,wBAA8B,WAAW,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAkC5D"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Fetch videos from CMS
3
- * Returns videos from the 'videos' collection
4
- */
5
- import { logger } from '@revealui/core/utils/logger';
6
- import { fetchFromCMS } from './client.js';
7
- /**
8
- * Fetches videos from CMS
9
- * Returns array of video URLs
10
- */
11
- export default async function fetchVideos() {
12
- try {
13
- const response = await fetchFromCMS('/api/collections/videos', {
14
- params: {
15
- depth: 1,
16
- limit: 10,
17
- },
18
- });
19
- return (response.docs || [])
20
- .map((doc) => {
21
- // Extract video URL from different possible structures
22
- if (doc.url) {
23
- return { url: doc.url };
24
- }
25
- if (doc.file?.url) {
26
- return { url: doc.file.url };
27
- }
28
- return null;
29
- })
30
- .filter((video) => video !== null);
31
- }
32
- catch (error) {
33
- logger.error('Error fetching videos', { error });
34
- return [];
35
- }
36
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * HTTP fetch functions for RevealUI CMS
3
- * Exports all fetch functions for easy importing
4
- */
5
- export type { FetchOptions } from './client.js';
6
- export { fetchFromCMS } from './client.js';
7
- export type { BannerData } from './fetchBanner.js';
8
- export { default as fetchBanner } from './fetchBanner.js';
9
- export type { CardData } from './fetchCard.js';
10
- export { default as fetchCard } from './fetchCard.js';
11
- export type { EventData } from './fetchEvents.js';
12
- export { default as fetchEvents } from './fetchEvents.js';
13
- export type { HeroData } from './fetchHero.js';
14
- export { default as fetchHero } from './fetchHero.js';
15
- export type { MainInfo } from './fetchMainInfos.js';
16
- export { default as fetchMainInfos } from './fetchMainInfos.js';
17
- export type { Video } from './fetchVideos.js';
18
- export { default as fetchVideos } from './fetchVideos.js';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/http/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,11 +0,0 @@
1
- /**
2
- * HTTP fetch functions for RevealUI CMS
3
- * Exports all fetch functions for easy importing
4
- */
5
- export { fetchFromCMS } from './client.js';
6
- export { default as fetchBanner } from './fetchBanner.js';
7
- export { default as fetchCard } from './fetchCard.js';
8
- export { default as fetchEvents } from './fetchEvents.js';
9
- export { default as fetchHero } from './fetchHero.js';
10
- export { default as fetchMainInfos } from './fetchMainInfos.js';
11
- export { default as fetchVideos } from './fetchVideos.js';
@@ -1,262 +0,0 @@
1
- /**
2
- * Circuit Breaker Pattern
3
- *
4
- * Prevents cascading failures by stopping requests to failing services
5
- */
6
- export type CircuitState = 'closed' | 'open' | 'half-open';
7
- export interface CircuitBreakerConfig {
8
- failureThreshold?: number;
9
- successThreshold?: number;
10
- timeout?: number;
11
- resetTimeout?: number;
12
- volumeThreshold?: number;
13
- errorFilter?: (error: Error) => boolean;
14
- onStateChange?: (state: CircuitState) => void;
15
- onTrip?: () => void;
16
- onReset?: () => void;
17
- }
18
- export interface CircuitBreakerStats {
19
- [key: string]: unknown;
20
- state: CircuitState;
21
- failures: number;
22
- successes: number;
23
- consecutiveFailures: number;
24
- consecutiveSuccesses: number;
25
- totalCalls: number;
26
- totalFailures: number;
27
- totalSuccesses: number;
28
- lastFailureTime?: number;
29
- lastSuccessTime?: number;
30
- stateChangedAt: number;
31
- }
32
- /**
33
- * Circuit Breaker implementation
34
- */
35
- export declare class CircuitBreaker {
36
- private state;
37
- private failures;
38
- private successes;
39
- private consecutiveFailures;
40
- private consecutiveSuccesses;
41
- private totalCalls;
42
- private totalFailures;
43
- private totalSuccesses;
44
- private lastFailureTime?;
45
- private lastSuccessTime?;
46
- private stateChangedAt;
47
- private resetTimer?;
48
- protected config: Required<CircuitBreakerConfig>;
49
- constructor(config?: CircuitBreakerConfig);
50
- /**
51
- * Execute function with circuit breaker
52
- */
53
- execute<T>(fn: () => Promise<T>): Promise<T>;
54
- /**
55
- * Handle successful execution
56
- */
57
- private onSuccess;
58
- /**
59
- * Handle failed execution
60
- */
61
- private onFailure;
62
- /**
63
- * Transition to new state
64
- */
65
- private transitionTo;
66
- /**
67
- * Get current state
68
- */
69
- getState(): CircuitState;
70
- /**
71
- * Get statistics
72
- */
73
- getStats(): CircuitBreakerStats;
74
- /**
75
- * Manually open circuit
76
- */
77
- trip(): void;
78
- /**
79
- * Manually close circuit
80
- */
81
- reset(): void;
82
- /**
83
- * Force state to half-open
84
- */
85
- halfOpen(): void;
86
- /**
87
- * Check if circuit is open
88
- */
89
- isOpen(): boolean;
90
- /**
91
- * Check if circuit is closed
92
- */
93
- isClosed(): boolean;
94
- /**
95
- * Check if circuit is half-open
96
- */
97
- isHalfOpen(): boolean;
98
- /**
99
- * Get failure rate
100
- */
101
- getFailureRate(): number;
102
- /**
103
- * Get success rate
104
- */
105
- getSuccessRate(): number;
106
- /**
107
- * Cleanup
108
- */
109
- destroy(): void;
110
- }
111
- /**
112
- * Circuit breaker open error
113
- */
114
- export declare class CircuitBreakerOpenError extends Error {
115
- constructor(message?: string);
116
- }
117
- /**
118
- * Circuit breaker registry
119
- */
120
- export declare class CircuitBreakerRegistry {
121
- private breakers;
122
- /**
123
- * Get or create circuit breaker
124
- */
125
- get(name: string, config?: CircuitBreakerConfig): CircuitBreaker;
126
- /**
127
- * Check if breaker exists
128
- */
129
- has(name: string): boolean;
130
- /**
131
- * Remove circuit breaker
132
- */
133
- remove(name: string): boolean;
134
- /**
135
- * Get all breakers
136
- */
137
- getAll(): Map<string, CircuitBreaker>;
138
- /**
139
- * Get all statistics
140
- */
141
- getAllStats(): Record<string, CircuitBreakerStats>;
142
- /**
143
- * Reset all breakers
144
- */
145
- resetAll(): void;
146
- /**
147
- * Clear all breakers
148
- */
149
- clear(): void;
150
- }
151
- /**
152
- * Global circuit breaker registry
153
- */
154
- export declare const circuitBreakerRegistry: CircuitBreakerRegistry;
155
- /**
156
- * Create circuit breaker decorator
157
- */
158
- export declare function CircuitBreak(nameOrConfig?: string | CircuitBreakerConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
159
- /**
160
- * Execute with circuit breaker
161
- */
162
- export declare function withCircuitBreaker<T>(name: string, fn: () => Promise<T>, config?: CircuitBreakerConfig): Promise<T>;
163
- /**
164
- * Create circuit breaker middleware
165
- */
166
- export declare function createCircuitBreakerMiddleware<TRequest = unknown, TResponse = unknown>(name: string, config?: CircuitBreakerConfig): (_request: TRequest, next: () => Promise<TResponse>) => Promise<TResponse>;
167
- /**
168
- * Circuit breaker for fetch
169
- */
170
- export declare function fetchWithCircuitBreaker(name: string, url: string, init?: RequestInit, config?: CircuitBreakerConfig): Promise<Response>;
171
- /**
172
- * Adaptive circuit breaker with dynamic thresholds
173
- */
174
- export declare class AdaptiveCircuitBreaker extends CircuitBreaker {
175
- private errorRateWindow;
176
- private windowSize;
177
- private adaptiveThreshold;
178
- constructor(config?: CircuitBreakerConfig);
179
- /**
180
- * Execute with adaptive thresholds
181
- */
182
- execute<T>(fn: () => Promise<T>): Promise<T>;
183
- /**
184
- * Record success in window
185
- */
186
- private recordSuccess;
187
- /**
188
- * Record failure in window
189
- */
190
- private recordFailure;
191
- /**
192
- * Trim window to size
193
- */
194
- private trimWindow;
195
- /**
196
- * Adjust threshold based on error rate
197
- */
198
- private adjustThreshold;
199
- /**
200
- * Get error rate in window
201
- */
202
- private getWindowErrorRate;
203
- /**
204
- * Get adaptive threshold
205
- */
206
- getAdaptiveThreshold(): number;
207
- }
208
- /**
209
- * Bulkhead pattern - limit concurrent executions
210
- */
211
- export declare class Bulkhead {
212
- private activeRequests;
213
- private queue;
214
- private maxConcurrent;
215
- private maxQueue;
216
- constructor(maxConcurrent?: number, maxQueue?: number);
217
- /**
218
- * Execute with bulkhead
219
- */
220
- execute<T>(fn: () => Promise<T>): Promise<T>;
221
- /**
222
- * Get active requests
223
- */
224
- getActiveRequests(): number;
225
- /**
226
- * Get queue size
227
- */
228
- getQueueSize(): number;
229
- /**
230
- * Get statistics
231
- */
232
- getStats(): {
233
- activeRequests: number;
234
- queueSize: number;
235
- maxConcurrent: number;
236
- maxQueue: number;
237
- };
238
- }
239
- /**
240
- * Combined resilience wrapper
241
- */
242
- export declare class ResilientOperation<T> {
243
- private fn;
244
- private circuitBreaker?;
245
- private bulkhead?;
246
- constructor(fn: () => Promise<T>, circuitBreaker?: CircuitBreaker | undefined, bulkhead?: Bulkhead | undefined);
247
- /**
248
- * Execute with all resilience patterns
249
- */
250
- execute(): Promise<T>;
251
- }
252
- /**
253
- * Create resilient function
254
- */
255
- export declare function createResilientFunction<T>(fn: () => Promise<T>, options?: {
256
- circuitBreaker?: CircuitBreakerConfig;
257
- bulkhead?: {
258
- maxConcurrent: number;
259
- maxQueue: number;
260
- };
261
- }): () => Promise<T>;
262
- //# sourceMappingURL=circuit-breaker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../src/error-handling/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE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