@easyling/sanity-connector 0.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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +482 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/actions/bulkTranslate.d.ts +7 -0
  5. package/dist/actions/bulkTranslate.d.ts.map +1 -0
  6. package/dist/actions/bulkTranslate.js +543 -0
  7. package/dist/actions/bulkTranslate.js.map +1 -0
  8. package/dist/actions/manageDNTFields.d.ts +12 -0
  9. package/dist/actions/manageDNTFields.d.ts.map +1 -0
  10. package/dist/actions/manageDNTFields.js +100 -0
  11. package/dist/actions/manageDNTFields.js.map +1 -0
  12. package/dist/actions/translateDocument.d.ts +7 -0
  13. package/dist/actions/translateDocument.d.ts.map +1 -0
  14. package/dist/actions/translateDocument.js +256 -0
  15. package/dist/actions/translateDocument.js.map +1 -0
  16. package/dist/components/RadioWithDefault.d.ts +17 -0
  17. package/dist/components/RadioWithDefault.d.ts.map +1 -0
  18. package/dist/components/RadioWithDefault.js +29 -0
  19. package/dist/components/RadioWithDefault.js.map +1 -0
  20. package/dist/components/auth/AuthNavbar.d.ts +18 -0
  21. package/dist/components/auth/AuthNavbar.d.ts.map +1 -0
  22. package/dist/components/auth/AuthNavbar.js +15 -0
  23. package/dist/components/auth/AuthNavbar.js.map +1 -0
  24. package/dist/components/auth/AuthStatus.d.ts +27 -0
  25. package/dist/components/auth/AuthStatus.d.ts.map +1 -0
  26. package/dist/components/auth/AuthStatus.js +82 -0
  27. package/dist/components/auth/AuthStatus.js.map +1 -0
  28. package/dist/components/auth/AuthStatusWrapper.d.ts +15 -0
  29. package/dist/components/auth/AuthStatusWrapper.d.ts.map +1 -0
  30. package/dist/components/auth/AuthStatusWrapper.js +39 -0
  31. package/dist/components/auth/AuthStatusWrapper.js.map +1 -0
  32. package/dist/components/auth/MigrationPrompt.d.ts +20 -0
  33. package/dist/components/auth/MigrationPrompt.d.ts.map +1 -0
  34. package/dist/components/auth/MigrationPrompt.js +16 -0
  35. package/dist/components/auth/MigrationPrompt.js.map +1 -0
  36. package/dist/components/auth/MigrationPromptWrapper.d.ts +14 -0
  37. package/dist/components/auth/MigrationPromptWrapper.d.ts.map +1 -0
  38. package/dist/components/auth/MigrationPromptWrapper.js +16 -0
  39. package/dist/components/auth/MigrationPromptWrapper.js.map +1 -0
  40. package/dist/components/auth/OAuthCallback.d.ts +20 -0
  41. package/dist/components/auth/OAuthCallback.d.ts.map +1 -0
  42. package/dist/components/auth/OAuthCallback.js +12 -0
  43. package/dist/components/auth/OAuthCallback.js.map +1 -0
  44. package/dist/components/auth/index.d.ts +15 -0
  45. package/dist/components/auth/index.d.ts.map +1 -0
  46. package/dist/components/auth/index.js +12 -0
  47. package/dist/components/auth/index.js.map +1 -0
  48. package/dist/components/config/LocaleConfigTool.d.ts +17 -0
  49. package/dist/components/config/LocaleConfigTool.d.ts.map +1 -0
  50. package/dist/components/config/LocaleConfigTool.js +186 -0
  51. package/dist/components/config/LocaleConfigTool.js.map +1 -0
  52. package/dist/components/config/LocaleConfigToolWrapper.d.ts +13 -0
  53. package/dist/components/config/LocaleConfigToolWrapper.d.ts.map +1 -0
  54. package/dist/components/config/LocaleConfigToolWrapper.js +26 -0
  55. package/dist/components/config/LocaleConfigToolWrapper.js.map +1 -0
  56. package/dist/components/config/OAuthConfig.d.ts +26 -0
  57. package/dist/components/config/OAuthConfig.d.ts.map +1 -0
  58. package/dist/components/config/OAuthConfig.js +152 -0
  59. package/dist/components/config/OAuthConfig.js.map +1 -0
  60. package/dist/components/config/OAuthConfigWrapper.d.ts +13 -0
  61. package/dist/components/config/OAuthConfigWrapper.d.ts.map +1 -0
  62. package/dist/components/config/OAuthConfigWrapper.js +41 -0
  63. package/dist/components/config/OAuthConfigWrapper.js.map +1 -0
  64. package/dist/components/config/PasswordInput.d.ts +14 -0
  65. package/dist/components/config/PasswordInput.d.ts.map +1 -0
  66. package/dist/components/config/PasswordInput.js +23 -0
  67. package/dist/components/config/PasswordInput.js.map +1 -0
  68. package/dist/components/config/index.d.ts +9 -0
  69. package/dist/components/config/index.d.ts.map +1 -0
  70. package/dist/components/config/index.js +8 -0
  71. package/dist/components/config/index.js.map +1 -0
  72. package/dist/components/config/localeConfigToolDefinition.d.ts +13 -0
  73. package/dist/components/config/localeConfigToolDefinition.d.ts.map +1 -0
  74. package/dist/components/config/localeConfigToolDefinition.js +19 -0
  75. package/dist/components/config/localeConfigToolDefinition.js.map +1 -0
  76. package/dist/components/config/oauthConfigToolDefinition.d.ts +13 -0
  77. package/dist/components/config/oauthConfigToolDefinition.d.ts.map +1 -0
  78. package/dist/components/config/oauthConfigToolDefinition.js +19 -0
  79. package/dist/components/config/oauthConfigToolDefinition.js.map +1 -0
  80. package/dist/components/dialogs/ConfirmationDialog.d.ts +21 -0
  81. package/dist/components/dialogs/ConfirmationDialog.d.ts.map +1 -0
  82. package/dist/components/dialogs/ConfirmationDialog.js +28 -0
  83. package/dist/components/dialogs/ConfirmationDialog.js.map +1 -0
  84. package/dist/components/dialogs/ErrorDialog.d.ts +21 -0
  85. package/dist/components/dialogs/ErrorDialog.d.ts.map +1 -0
  86. package/dist/components/dialogs/ErrorDialog.js +28 -0
  87. package/dist/components/dialogs/ErrorDialog.js.map +1 -0
  88. package/dist/components/dialogs/LocaleSelectionDialog.d.ts +41 -0
  89. package/dist/components/dialogs/LocaleSelectionDialog.d.ts.map +1 -0
  90. package/dist/components/dialogs/LocaleSelectionDialog.js +117 -0
  91. package/dist/components/dialogs/LocaleSelectionDialog.js.map +1 -0
  92. package/dist/components/dialogs/SuccessDialog.d.ts +19 -0
  93. package/dist/components/dialogs/SuccessDialog.d.ts.map +1 -0
  94. package/dist/components/dialogs/SuccessDialog.js +37 -0
  95. package/dist/components/dialogs/SuccessDialog.js.map +1 -0
  96. package/dist/components/dialogs/index.d.ts +12 -0
  97. package/dist/components/dialogs/index.d.ts.map +1 -0
  98. package/dist/components/dialogs/index.js +8 -0
  99. package/dist/components/dialogs/index.js.map +1 -0
  100. package/dist/components/dnt/DNTFieldBadge.d.ts +16 -0
  101. package/dist/components/dnt/DNTFieldBadge.d.ts.map +1 -0
  102. package/dist/components/dnt/DNTFieldBadge.js +56 -0
  103. package/dist/components/dnt/DNTFieldBadge.js.map +1 -0
  104. package/dist/components/dnt/DNTFieldComponent.d.ts +17 -0
  105. package/dist/components/dnt/DNTFieldComponent.d.ts.map +1 -0
  106. package/dist/components/dnt/DNTFieldComponent.js +21 -0
  107. package/dist/components/dnt/DNTFieldComponent.js.map +1 -0
  108. package/dist/components/dnt/DNTFieldInput.d.ts +14 -0
  109. package/dist/components/dnt/DNTFieldInput.d.ts.map +1 -0
  110. package/dist/components/dnt/DNTFieldInput.js +76 -0
  111. package/dist/components/dnt/DNTFieldInput.js.map +1 -0
  112. package/dist/components/dnt/index.d.ts +7 -0
  113. package/dist/components/dnt/index.d.ts.map +1 -0
  114. package/dist/components/dnt/index.js +7 -0
  115. package/dist/components/dnt/index.js.map +1 -0
  116. package/dist/config/index.d.ts +6 -0
  117. package/dist/config/index.d.ts.map +1 -0
  118. package/dist/config/index.js +6 -0
  119. package/dist/config/index.js.map +1 -0
  120. package/dist/config/pluginConfig.d.ts +163 -0
  121. package/dist/config/pluginConfig.d.ts.map +1 -0
  122. package/dist/config/pluginConfig.js +548 -0
  123. package/dist/config/pluginConfig.js.map +1 -0
  124. package/dist/index.d.ts +12 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +12 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/plugin.d.ts +3 -0
  129. package/dist/plugin.d.ts.map +1 -0
  130. package/dist/plugin.js +137 -0
  131. package/dist/plugin.js.map +1 -0
  132. package/dist/services/authStateManager.d.ts +94 -0
  133. package/dist/services/authStateManager.d.ts.map +1 -0
  134. package/dist/services/authStateManager.js +208 -0
  135. package/dist/services/authStateManager.js.map +1 -0
  136. package/dist/services/contentExtractor.d.ts +95 -0
  137. package/dist/services/contentExtractor.d.ts.map +1 -0
  138. package/dist/services/contentExtractor.js +516 -0
  139. package/dist/services/contentExtractor.js.map +1 -0
  140. package/dist/services/dialogService.d.ts +96 -0
  141. package/dist/services/dialogService.d.ts.map +1 -0
  142. package/dist/services/dialogService.js +244 -0
  143. package/dist/services/dialogService.js.map +1 -0
  144. package/dist/services/dntServiceManager.d.ts +44 -0
  145. package/dist/services/dntServiceManager.d.ts.map +1 -0
  146. package/dist/services/dntServiceManager.js +74 -0
  147. package/dist/services/dntServiceManager.js.map +1 -0
  148. package/dist/services/dntStorageAdapter.d.ts +73 -0
  149. package/dist/services/dntStorageAdapter.d.ts.map +1 -0
  150. package/dist/services/dntStorageAdapter.js +192 -0
  151. package/dist/services/dntStorageAdapter.js.map +1 -0
  152. package/dist/services/documentCreationService.d.ts +139 -0
  153. package/dist/services/documentCreationService.d.ts.map +1 -0
  154. package/dist/services/documentCreationService.js +938 -0
  155. package/dist/services/documentCreationService.js.map +1 -0
  156. package/dist/services/localeService.d.ts +160 -0
  157. package/dist/services/localeService.d.ts.map +1 -0
  158. package/dist/services/localeService.js +300 -0
  159. package/dist/services/localeService.js.map +1 -0
  160. package/dist/services/localeStorageAdapter.d.ts +42 -0
  161. package/dist/services/localeStorageAdapter.d.ts.map +1 -0
  162. package/dist/services/localeStorageAdapter.js +107 -0
  163. package/dist/services/localeStorageAdapter.js.map +1 -0
  164. package/dist/services/oauthConfigStorage.d.ts +46 -0
  165. package/dist/services/oauthConfigStorage.d.ts.map +1 -0
  166. package/dist/services/oauthConfigStorage.js +122 -0
  167. package/dist/services/oauthConfigStorage.js.map +1 -0
  168. package/dist/services/oauthService.d.ts +48 -0
  169. package/dist/services/oauthService.d.ts.map +1 -0
  170. package/dist/services/oauthService.js +71 -0
  171. package/dist/services/oauthService.js.map +1 -0
  172. package/dist/services/oauthServiceManager.d.ts +189 -0
  173. package/dist/services/oauthServiceManager.d.ts.map +1 -0
  174. package/dist/services/oauthServiceManager.js +380 -0
  175. package/dist/services/oauthServiceManager.js.map +1 -0
  176. package/dist/services/tokenStorage.d.ts +54 -0
  177. package/dist/services/tokenStorage.d.ts.map +1 -0
  178. package/dist/services/tokenStorage.js +140 -0
  179. package/dist/services/tokenStorage.js.map +1 -0
  180. package/dist/services/translationService.d.ts +374 -0
  181. package/dist/services/translationService.d.ts.map +1 -0
  182. package/dist/services/translationService.js +687 -0
  183. package/dist/services/translationService.js.map +1 -0
  184. package/dist/services/unifiedConfigStorage.d.ts +124 -0
  185. package/dist/services/unifiedConfigStorage.d.ts.map +1 -0
  186. package/dist/services/unifiedConfigStorage.js +304 -0
  187. package/dist/services/unifiedConfigStorage.js.map +1 -0
  188. package/dist/test-utils.d.ts +9 -0
  189. package/dist/test-utils.d.ts.map +1 -0
  190. package/dist/test-utils.js +13 -0
  191. package/dist/test-utils.js.map +1 -0
  192. package/dist/types/dialog.d.ts +107 -0
  193. package/dist/types/dialog.d.ts.map +1 -0
  194. package/dist/types/dialog.js +6 -0
  195. package/dist/types/dialog.js.map +1 -0
  196. package/dist/types/dnt.d.ts +84 -0
  197. package/dist/types/dnt.d.ts.map +1 -0
  198. package/dist/types/dnt.js +5 -0
  199. package/dist/types/dnt.js.map +1 -0
  200. package/dist/types/index.d.ts +12 -0
  201. package/dist/types/index.d.ts.map +1 -0
  202. package/dist/types/index.js +6 -0
  203. package/dist/types/index.js.map +1 -0
  204. package/dist/types/locale.d.ts +116 -0
  205. package/dist/types/locale.d.ts.map +1 -0
  206. package/dist/types/locale.js +189 -0
  207. package/dist/types/locale.js.map +1 -0
  208. package/dist/types/oauth.d.ts +90 -0
  209. package/dist/types/oauth.d.ts.map +1 -0
  210. package/dist/types/oauth.js +62 -0
  211. package/dist/types/oauth.js.map +1 -0
  212. package/dist/types/pluginConfig.d.ts +45 -0
  213. package/dist/types/pluginConfig.d.ts.map +1 -0
  214. package/dist/types/pluginConfig.js +6 -0
  215. package/dist/types/pluginConfig.js.map +1 -0
  216. package/dist/types/translation.d.ts +122 -0
  217. package/dist/types/translation.d.ts.map +1 -0
  218. package/dist/types/translation.js +6 -0
  219. package/dist/types/translation.js.map +1 -0
  220. package/dist/utils/htmlFormatter.d.ts +66 -0
  221. package/dist/utils/htmlFormatter.d.ts.map +1 -0
  222. package/dist/utils/htmlFormatter.js +191 -0
  223. package/dist/utils/htmlFormatter.js.map +1 -0
  224. package/dist/utils/index.d.ts +15 -0
  225. package/dist/utils/index.d.ts.map +1 -0
  226. package/dist/utils/index.js +16 -0
  227. package/dist/utils/index.js.map +1 -0
  228. package/dist/utils/logger.d.ts +105 -0
  229. package/dist/utils/logger.d.ts.map +1 -0
  230. package/dist/utils/logger.js +229 -0
  231. package/dist/utils/logger.js.map +1 -0
  232. package/dist/utils/oauthErrorFeedback.d.ts +76 -0
  233. package/dist/utils/oauthErrorFeedback.d.ts.map +1 -0
  234. package/dist/utils/oauthErrorFeedback.js +134 -0
  235. package/dist/utils/oauthErrorFeedback.js.map +1 -0
  236. package/dist/utils/oauthLogger.d.ts +176 -0
  237. package/dist/utils/oauthLogger.d.ts.map +1 -0
  238. package/dist/utils/oauthLogger.js +282 -0
  239. package/dist/utils/oauthLogger.js.map +1 -0
  240. package/dist/utils/validator.d.ts +67 -0
  241. package/dist/utils/validator.d.ts.map +1 -0
  242. package/dist/utils/validator.js +390 -0
  243. package/dist/utils/validator.js.map +1 -0
  244. package/package.json +80 -0
@@ -0,0 +1,84 @@
1
+ /**
2
+ * DNT (Do Not Translate) field preferences types
3
+ */
4
+ export interface DNTFieldPreference {
5
+ /** Field path (e.g., 'title', 'content.description') */
6
+ fieldPath: string;
7
+ /** Whether this field should not be translated */
8
+ dnt: boolean;
9
+ /** Timestamp when preference was set */
10
+ updatedAt?: string;
11
+ }
12
+ /**
13
+ * Legacy document-specific DNT preferences (deprecated)
14
+ * @deprecated Use document-type-based DNT configuration instead
15
+ */
16
+ export interface DNTPreferences {
17
+ /** Document ID these preferences apply to */
18
+ documentId: string;
19
+ /** Document type */
20
+ documentType: string;
21
+ /** Field-level DNT preferences */
22
+ fields: Record<string, boolean>;
23
+ /** Last updated timestamp */
24
+ updatedAt: string;
25
+ }
26
+ /**
27
+ * Document-type-based DNT field configuration
28
+ * When a field is marked DNT for a document type, it applies to ALL documents of that type
29
+ */
30
+ export interface DNTTypeConfig {
31
+ /** Document type (e.g., 'product', 'article', 'page') */
32
+ documentType: string;
33
+ /** Field-level DNT preferences: { [fieldPath]: dnt } */
34
+ fields: Record<string, boolean>;
35
+ }
36
+ /**
37
+ * DNT Storage interface - supports document-type-based configuration
38
+ */
39
+ export interface DNTStorage {
40
+ /**
41
+ * Get DNT field configuration for a document type
42
+ * @param documentType - The type of document (e.g., 'product', 'article')
43
+ * @returns Map of field paths to DNT status
44
+ */
45
+ getFieldsForType(documentType: string): Promise<Record<string, boolean>>;
46
+ /**
47
+ * Set DNT status for a specific field in a document type
48
+ * @param documentType - The type of document
49
+ * @param fieldPath - The field path
50
+ * @param dnt - Whether the field should not be translated
51
+ */
52
+ setFieldDNT(documentType: string, fieldPath: string, dnt: boolean): Promise<void>;
53
+ /**
54
+ * Toggle DNT status for a field in a document type
55
+ * @param documentType - The type of document
56
+ * @param fieldPath - The field path
57
+ * @returns The new DNT status
58
+ */
59
+ toggleFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
60
+ /**
61
+ * Get DNT status for a specific field in a document type
62
+ * @param documentType - The type of document
63
+ * @param fieldPath - The field path
64
+ * @returns Whether the field is marked as DNT
65
+ */
66
+ getFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
67
+ /**
68
+ * Clear all DNT fields for a document type
69
+ * @param documentType - The type of document
70
+ */
71
+ clearFieldsForType(documentType: string): Promise<void>;
72
+ /**
73
+ * Get all DNT configurations (all document types)
74
+ * @returns Map of document types to their field DNT configurations
75
+ */
76
+ getAllDNTFields(): Promise<Record<string, Record<string, boolean>>>;
77
+ /** @deprecated Use getFieldsForType instead */
78
+ getPreferences?(documentId: string): Promise<DNTPreferences | null>;
79
+ /** @deprecated Use setFieldDNT instead */
80
+ savePreferences?(preferences: DNTPreferences): Promise<void>;
81
+ /** @deprecated Use clearFieldsForType instead */
82
+ clearPreferences?(documentId: string): Promise<void>;
83
+ }
84
+ //# sourceMappingURL=dnt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnt.d.ts","sourceRoot":"","sources":["../../src/types/dnt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,GAAG,EAAE,OAAO,CAAC;IACb,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzE;;;;;OAKG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElF;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1E;;;;;OAKG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvE;;;OAGG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;OAGG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAGpE,+CAA+C;IAC/C,cAAc,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpE,0CAA0C;IAC1C,eAAe,CAAC,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,iDAAiD;IACjD,gBAAgB,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * DNT (Do Not Translate) field preferences types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=dnt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnt.js","sourceRoot":"","sources":["../../src/types/dnt.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type definitions index
3
+ * Centralized exports for all plugin types
4
+ */
5
+ export type { LocaleDefinition, LocaleConfig, LocaleValidationResult, LocaleSelectionOptions } from './locale';
6
+ export type { BaseDialogOptions, ConfirmationDialogOptions, SuccessDialogOptions, ErrorDialogOptions, LocaleSelectionDialogOptions, DialogResult, DialogManager } from './dialog';
7
+ export type { EnhancedTranslationRequest, EnhancedTranslationResponse, TranslationProgress, BulkTranslationRequest, EnhancedBulkTranslationSummary, TranslationRequestPayload, TranslationResponse, TranslatableField } from './translation';
8
+ export type { OAuthConfig, AuthenticationResult, StoredAuthData, AuthState, AuthStateData } from './oauth';
9
+ export { OAuthErrorType, OAuthError } from './oauth';
10
+ export type { DNTFieldPreference, DNTPreferences, DNTTypeConfig, DNTStorage } from './dnt';
11
+ export type { PluginConfiguration, DocumentCreationMode, ContentType } from './pluginConfig';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrD,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,UAAU,EACX,MAAM,OAAO,CAAC;AAGf,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACZ,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Type definitions index
3
+ * Centralized exports for all plugin types
4
+ */
5
+ export { OAuthErrorType, OAuthError } from './oauth';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0CH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Locale configuration type definitions
3
+ * Requirements: 5.1, 5.2, 5.3
4
+ */
5
+ /**
6
+ * Individual locale definition with metadata
7
+ */
8
+ export interface LocaleDefinition {
9
+ /** Locale code in ISO 639-1 + ISO 3166-1 format (e.g., "en-US", "fr-FR") */
10
+ code: string;
11
+ /** Human-readable display name (e.g., "English (United States)") */
12
+ displayName: string;
13
+ /** Whether this locale is enabled for translation */
14
+ enabled: boolean;
15
+ /** Timestamp when this locale was created */
16
+ createdAt: string;
17
+ /** Timestamp when this locale was last updated */
18
+ updatedAt: string;
19
+ }
20
+ /**
21
+ * Complete locale configuration for the plugin
22
+ */
23
+ export interface LocaleConfig {
24
+ /** Array of configured locales */
25
+ locales: LocaleDefinition[];
26
+ /** Optional default locale code */
27
+ defaultLocale?: string;
28
+ /** Timestamp when configuration was last updated */
29
+ lastUpdated: string;
30
+ /** Configuration version for migration purposes */
31
+ version: string;
32
+ }
33
+ /**
34
+ * Validation result for locale operations
35
+ */
36
+ export interface LocaleValidationResult {
37
+ /** Whether the validation passed */
38
+ isValid: boolean;
39
+ /** Array of validation error messages */
40
+ errors: string[];
41
+ /** Array of validation warning messages */
42
+ warnings: string[];
43
+ }
44
+ /**
45
+ * Options for locale selection operations
46
+ */
47
+ export interface LocaleSelectionOptions {
48
+ /** Available locales to choose from */
49
+ availableLocales: LocaleDefinition[];
50
+ /** Currently selected locale codes */
51
+ selectedLocales: string[];
52
+ /** Whether multiple locales can be selected */
53
+ allowMultiple: boolean;
54
+ /** Whether selection is required (cannot be empty) */
55
+ required: boolean;
56
+ }
57
+ /**
58
+ * Locale code validation regex (ISO 639-1 + ISO 3166-1 format)
59
+ * Format: two lowercase letters, hyphen, two uppercase letters (e.g., en-US, fr-FR)
60
+ */
61
+ export declare const LOCALE_CODE_REGEX: RegExp;
62
+ /**
63
+ * Validates a locale code format
64
+ * Requirements: 1.2, 1.3
65
+ *
66
+ * @param code - The locale code to validate
67
+ * @returns True if the code matches ISO 639-1 + ISO 3166-1 format
68
+ *
69
+ * @example
70
+ * validateLocaleCode('en-US') // true
71
+ * validateLocaleCode('fr-FR') // true
72
+ * validateLocaleCode('en_US') // false
73
+ * validateLocaleCode('EN-US') // false
74
+ * validateLocaleCode('e-US') // false
75
+ */
76
+ export declare function validateLocaleCode(code: string): boolean;
77
+ /**
78
+ * Validates a locale definition object
79
+ * Requirements: 1.2, 1.3
80
+ *
81
+ * @param locale - The locale definition to validate
82
+ * @returns Validation result with errors and warnings
83
+ */
84
+ export declare function validateLocaleDefinition(locale: Partial<LocaleDefinition>): LocaleValidationResult;
85
+ /**
86
+ * Validates a locale configuration object
87
+ * Requirements: 1.2, 1.3
88
+ *
89
+ * @param config - The locale configuration to validate
90
+ * @returns Validation result with errors and warnings
91
+ */
92
+ export declare function validateLocaleConfig(config: Partial<LocaleConfig>): LocaleValidationResult;
93
+ /**
94
+ * Checks if a locale code exists in a locale configuration
95
+ *
96
+ * @param config - The locale configuration to search
97
+ * @param code - The locale code to find
98
+ * @returns True if the locale code exists in the configuration
99
+ */
100
+ export declare function localeExists(config: LocaleConfig, code: string): boolean;
101
+ /**
102
+ * Gets enabled locales from a configuration
103
+ *
104
+ * @param config - The locale configuration
105
+ * @returns Array of enabled locale definitions
106
+ */
107
+ export declare function getEnabledLocales(config: LocaleConfig): LocaleDefinition[];
108
+ /**
109
+ * Finds a locale definition by code
110
+ *
111
+ * @param config - The locale configuration to search
112
+ * @param code - The locale code to find
113
+ * @returns The locale definition or undefined if not found
114
+ */
115
+ export declare function findLocaleByCode(config: LocaleConfig, code: string): LocaleDefinition | undefined;
116
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/types/locale.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/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BAAsB,CAwE1F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAE1E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEjG"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Locale configuration type definitions
3
+ * Requirements: 5.1, 5.2, 5.3
4
+ */
5
+ /**
6
+ * Locale code validation regex (ISO 639-1 + ISO 3166-1 format)
7
+ * Format: two lowercase letters, hyphen, two uppercase letters (e.g., en-US, fr-FR)
8
+ */
9
+ export const LOCALE_CODE_REGEX = /^[a-z]{2}-[A-Z]{2}$/;
10
+ /**
11
+ * Validates a locale code format
12
+ * Requirements: 1.2, 1.3
13
+ *
14
+ * @param code - The locale code to validate
15
+ * @returns True if the code matches ISO 639-1 + ISO 3166-1 format
16
+ *
17
+ * @example
18
+ * validateLocaleCode('en-US') // true
19
+ * validateLocaleCode('fr-FR') // true
20
+ * validateLocaleCode('en_US') // false
21
+ * validateLocaleCode('EN-US') // false
22
+ * validateLocaleCode('e-US') // false
23
+ */
24
+ export function validateLocaleCode(code) {
25
+ if (!code || typeof code !== 'string') {
26
+ return false;
27
+ }
28
+ return LOCALE_CODE_REGEX.test(code);
29
+ }
30
+ /**
31
+ * Validates a locale definition object
32
+ * Requirements: 1.2, 1.3
33
+ *
34
+ * @param locale - The locale definition to validate
35
+ * @returns Validation result with errors and warnings
36
+ */
37
+ export function validateLocaleDefinition(locale) {
38
+ const errors = [];
39
+ const warnings = [];
40
+ // Validate code
41
+ if (!locale.code) {
42
+ errors.push('Locale code is required');
43
+ }
44
+ else if (!validateLocaleCode(locale.code)) {
45
+ errors.push('Locale code must be in format: xx-XX (e.g., en-US, fr-FR)');
46
+ }
47
+ // Validate display name
48
+ if (!locale.displayName) {
49
+ errors.push('Display name is required');
50
+ }
51
+ else if (locale.displayName.trim().length === 0) {
52
+ errors.push('Display name cannot be empty');
53
+ }
54
+ else if (locale.displayName.length > 100) {
55
+ warnings.push('Display name is very long (over 100 characters)');
56
+ }
57
+ // Validate enabled flag
58
+ if (locale.enabled !== undefined && typeof locale.enabled !== 'boolean') {
59
+ errors.push('Enabled flag must be a boolean value');
60
+ }
61
+ // Validate timestamps if present
62
+ if (locale.createdAt && !isValidISODate(locale.createdAt)) {
63
+ errors.push('createdAt must be a valid ISO 8601 date string');
64
+ }
65
+ if (locale.updatedAt && !isValidISODate(locale.updatedAt)) {
66
+ errors.push('updatedAt must be a valid ISO 8601 date string');
67
+ }
68
+ return {
69
+ isValid: errors.length === 0,
70
+ errors,
71
+ warnings
72
+ };
73
+ }
74
+ /**
75
+ * Validates a locale configuration object
76
+ * Requirements: 1.2, 1.3
77
+ *
78
+ * @param config - The locale configuration to validate
79
+ * @returns Validation result with errors and warnings
80
+ */
81
+ export function validateLocaleConfig(config) {
82
+ const errors = [];
83
+ const warnings = [];
84
+ // Validate locales array
85
+ if (!config.locales) {
86
+ errors.push('Locales array is required');
87
+ }
88
+ else if (!Array.isArray(config.locales)) {
89
+ errors.push('Locales must be an array');
90
+ }
91
+ else {
92
+ // Validate each locale definition
93
+ const localeCodes = new Set();
94
+ config.locales.forEach((locale, index) => {
95
+ const localeValidation = validateLocaleDefinition(locale);
96
+ if (!localeValidation.isValid) {
97
+ errors.push(`Locale at index ${index}: ${localeValidation.errors.join(', ')}`);
98
+ }
99
+ if (localeValidation.warnings.length > 0) {
100
+ warnings.push(`Locale at index ${index}: ${localeValidation.warnings.join(', ')}`);
101
+ }
102
+ // Check for duplicate locale codes
103
+ if (locale.code) {
104
+ if (localeCodes.has(locale.code)) {
105
+ errors.push(`Duplicate locale code: ${locale.code}`);
106
+ }
107
+ localeCodes.add(locale.code);
108
+ }
109
+ });
110
+ // Warn if no locales are configured
111
+ if (config.locales.length === 0) {
112
+ warnings.push('No locales configured - users will not be able to translate content');
113
+ }
114
+ }
115
+ // Validate default locale if present
116
+ if (config.defaultLocale) {
117
+ if (!validateLocaleCode(config.defaultLocale)) {
118
+ errors.push('Default locale must be in format: xx-XX (e.g., en-US)');
119
+ }
120
+ else if (config.locales && Array.isArray(config.locales)) {
121
+ const defaultLocaleExists = config.locales.some(locale => locale.code === config.defaultLocale);
122
+ if (!defaultLocaleExists) {
123
+ warnings.push('Default locale is not in the configured locales list');
124
+ }
125
+ }
126
+ }
127
+ // Validate version
128
+ if (!config.version) {
129
+ errors.push('Configuration version is required');
130
+ }
131
+ else if (typeof config.version !== 'string') {
132
+ errors.push('Configuration version must be a string');
133
+ }
134
+ // Validate lastUpdated
135
+ if (!config.lastUpdated) {
136
+ errors.push('lastUpdated timestamp is required');
137
+ }
138
+ else if (!isValidISODate(config.lastUpdated)) {
139
+ errors.push('lastUpdated must be a valid ISO 8601 date string');
140
+ }
141
+ return {
142
+ isValid: errors.length === 0,
143
+ errors,
144
+ warnings
145
+ };
146
+ }
147
+ /**
148
+ * Checks if a locale code exists in a locale configuration
149
+ *
150
+ * @param config - The locale configuration to search
151
+ * @param code - The locale code to find
152
+ * @returns True if the locale code exists in the configuration
153
+ */
154
+ export function localeExists(config, code) {
155
+ return config.locales.some(locale => locale.code === code);
156
+ }
157
+ /**
158
+ * Gets enabled locales from a configuration
159
+ *
160
+ * @param config - The locale configuration
161
+ * @returns Array of enabled locale definitions
162
+ */
163
+ export function getEnabledLocales(config) {
164
+ return config.locales.filter(locale => locale.enabled);
165
+ }
166
+ /**
167
+ * Finds a locale definition by code
168
+ *
169
+ * @param config - The locale configuration to search
170
+ * @param code - The locale code to find
171
+ * @returns The locale definition or undefined if not found
172
+ */
173
+ export function findLocaleByCode(config, code) {
174
+ return config.locales.find(locale => locale.code === code);
175
+ }
176
+ /**
177
+ * Helper function to validate ISO 8601 date strings
178
+ *
179
+ * @param dateString - The date string to validate
180
+ * @returns True if the string is a valid ISO 8601 date
181
+ */
182
+ function isValidISODate(dateString) {
183
+ if (!dateString || typeof dateString !== 'string') {
184
+ return false;
185
+ }
186
+ const date = new Date(dateString);
187
+ return date instanceof Date && !isNaN(date.getTime()) && date.toISOString() === dateString;
188
+ }
189
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/types/locale.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0DH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiC;IACxE,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,gBAAgB;IAChB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC;SAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC3E,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC1C,CAAC;SAAM,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;Q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AAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAoB,EAAE,IAAY;IACjE,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,UAAkB;IACxC,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,IAAI,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Easyling Authentication Type Definitions
3
+ *
4
+ * This file contains all TypeScript interfaces, types, and enums
5
+ * for Easyling authentication implementation in the Sanity Translation Plugin.
6
+ */
7
+ /**
8
+ * Easyling configuration for connecting to the translation service
9
+ */
10
+ export interface OAuthConfig {
11
+ /** Project ID for the Easyling project */
12
+ projectId: string;
13
+ /** Long-lived access token provided by Easyling */
14
+ accessToken: string;
15
+ }
16
+ /**
17
+ * Result of the authentication process
18
+ */
19
+ export interface AuthenticationResult {
20
+ /** Whether authentication was successful */
21
+ success: boolean;
22
+ /** Access token if authentication succeeded */
23
+ accessToken?: string;
24
+ /** Selected project ID if authentication succeeded */
25
+ projectId?: string;
26
+ /** Error message if authentication failed */
27
+ error?: string;
28
+ }
29
+ /**
30
+ * Stored authentication data persisted in storage
31
+ */
32
+ export interface StoredAuthData {
33
+ /** Access token for API requests */
34
+ accessToken: string;
35
+ /** Selected project ID */
36
+ projectId: string;
37
+ /** Optional project name for display purposes */
38
+ projectName?: string;
39
+ /** Timestamp when data was stored (Unix timestamp in milliseconds) */
40
+ storedAt: number;
41
+ }
42
+ /**
43
+ * Authentication state enumeration
44
+ */
45
+ export type AuthState = 'unauthenticated' | 'authenticated' | 'error';
46
+ /**
47
+ * Authentication state data with additional context
48
+ */
49
+ export interface AuthStateData {
50
+ /** Current authentication state */
51
+ state: AuthState;
52
+ /** Selected project ID if authenticated */
53
+ projectId?: string;
54
+ /** Project name for display if available */
55
+ projectName?: string;
56
+ /** Error message if state is 'error' */
57
+ error?: string;
58
+ }
59
+ /**
60
+ * Authentication error types for categorizing failures
61
+ */
62
+ export declare enum OAuthErrorType {
63
+ /** Invalid configuration */
64
+ INVALID_CONFIG = "invalid_config",
65
+ /** Network error during API request */
66
+ NETWORK_ERROR = "network_error",
67
+ /** Authentication failed */
68
+ AUTH_FAILED = "auth_failed",
69
+ /** Storage operation failed */
70
+ STORAGE_ERROR = "storage_error"
71
+ }
72
+ /**
73
+ * Custom error class for OAuth-related errors
74
+ */
75
+ export declare class OAuthError extends Error {
76
+ /** Error type for categorization */
77
+ readonly type: OAuthErrorType;
78
+ /** Additional error details */
79
+ readonly details?: unknown;
80
+ constructor(type: OAuthErrorType, message: string, details?: unknown);
81
+ /**
82
+ * Get a user-friendly error message based on error type
83
+ */
84
+ getUserMessage(): string;
85
+ /**
86
+ * Check if this error is recoverable (user can retry)
87
+ */
88
+ isRecoverable(): boolean;
89
+ }
90
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/types/oauth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAElB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAA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;IACH,aAAa,IAAI,OAAO;CAMzB"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Easyling Authentication Type Definitions
3
+ *
4
+ * This file contains all TypeScript interfaces, types, and enums
5
+ * for Easyling authentication implementation in the Sanity Translation Plugin.
6
+ */
7
+ /**
8
+ * Authentication error types for categorizing failures
9
+ */
10
+ export var OAuthErrorType;
11
+ (function (OAuthErrorType) {
12
+ /** Invalid configuration */
13
+ OAuthErrorType["INVALID_CONFIG"] = "invalid_config";
14
+ /** Network error during API request */
15
+ OAuthErrorType["NETWORK_ERROR"] = "network_error";
16
+ /** Authentication failed */
17
+ OAuthErrorType["AUTH_FAILED"] = "auth_failed";
18
+ /** Storage operation failed */
19
+ OAuthErrorType["STORAGE_ERROR"] = "storage_error";
20
+ })(OAuthErrorType || (OAuthErrorType = {}));
21
+ /**
22
+ * Custom error class for OAuth-related errors
23
+ */
24
+ export class OAuthError extends Error {
25
+ constructor(type, message, details) {
26
+ super(message);
27
+ this.name = 'OAuthError';
28
+ this.type = type;
29
+ this.details = details;
30
+ // Maintains proper stack trace for where error was thrown (V8 only)
31
+ if (Error.captureStackTrace) {
32
+ Error.captureStackTrace(this, OAuthError);
33
+ }
34
+ }
35
+ /**
36
+ * Get a user-friendly error message based on error type
37
+ */
38
+ getUserMessage() {
39
+ switch (this.type) {
40
+ case OAuthErrorType.INVALID_CONFIG:
41
+ return 'Configuration is invalid. Please check your access token and project ID.';
42
+ case OAuthErrorType.NETWORK_ERROR:
43
+ return 'Network error. Please check your connection.';
44
+ case OAuthErrorType.AUTH_FAILED:
45
+ return 'Authentication failed. Please check your access token.';
46
+ case OAuthErrorType.STORAGE_ERROR:
47
+ return 'Failed to save authentication data. Please try again.';
48
+ default:
49
+ return 'An unexpected error occurred. Please try again.';
50
+ }
51
+ }
52
+ /**
53
+ * Check if this error is recoverable (user can retry)
54
+ */
55
+ isRecoverable() {
56
+ return [
57
+ OAuthErrorType.NETWORK_ERROR,
58
+ OAuthErrorType.STORAGE_ERROR
59
+ ].includes(this.type);
60
+ }
61
+ }
62
+ //# sourceMappingURL=oauth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/types/oauth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwEH;;GAEG;AACH,MAAM,CAAN,IAAY,cAYX;AAZD,WAAY,cAAc;IACxB,4BAA4B;IAC5B,mDAAiC,CAAA;IAEjC,uCAAuC;IACvC,iDAA+B,CAAA;IAE/B,4BAA4B;IAC5B,6CAA2B,CAAA;IAE3B,+BAA+B;IAC/B,iDAA+B,CAAA;AACjC,CAAC,EAZW,cAAc,KAAd,cAAc,QAYzB;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAOnC,YAAY,IAAoB,EAAE,OAAe,EAAE,OAAiB;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,oEAAoE;QACpE,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,cAAc,CAAC,cAAc;gBAChC,OAAO,0EAA0E,CAAC;YACpF,KAAK,cAAc,CAAC,aAAa;gBAC/B,OAAO,8CAA8C,CAAC;YACxD,KAAK,cAAc,CAAC,WAAW;gBAC7B,OAAO,wDAAwD,CAAC;YAClE,KAAK,cAAc,CAAC,aAAa;gBAC/B,OAAO,uDAAuD,CAAC;YACjE;gBACE,OAAO,iDAAiD,CAAC;QAC7D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO;YACL,cAAc,CAAC,aAAa;YAC5B,cAAc,CAAC,aAAa;SAC7B,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Plugin configuration type definitions
3
+ * Requirements: 1.1, 1.5, 2.3, 3.3, 4.2
4
+ */
5
+ import { LocaleDefinition } from './locale';
6
+ import { DNTTypeConfig } from './dnt';
7
+ /**
8
+ * Document creation mode options
9
+ * Determines whether translated documents are created as drafts or published
10
+ */
11
+ export type DocumentCreationMode = 'draft' | 'published';
12
+ /**
13
+ * Content type options for requests/responses
14
+ * Specifies the serialization format for translation API communication
15
+ */
16
+ export type ContentType = 'application/json' | 'application/x-protobuf';
17
+ /**
18
+ * Complete plugin configuration interface
19
+ * Represents all configurable settings for the Easyling Translation Plugin
20
+ */
21
+ export interface PluginConfiguration {
22
+ /** Easyling project ID */
23
+ projectId?: string;
24
+ /** Long-lived access token for API authentication */
25
+ accessToken?: string;
26
+ /** URL endpoint where translation requests are sent */
27
+ translationApiEndpoint?: string;
28
+ /** Content-Type header for translation request payloads */
29
+ requestContentType?: ContentType;
30
+ /** Accept header for translation response format negotiation */
31
+ responseAcceptHeader?: ContentType;
32
+ /** Default mode for creating translated documents (draft or published) */
33
+ defaultDocumentCreationMode?: DocumentCreationMode;
34
+ /** Array of configured locales for translation */
35
+ locales?: LocaleDefinition[];
36
+ /** Default source locale code */
37
+ defaultLocale?: string;
38
+ /** Document-type-based DNT field configurations */
39
+ dntFieldConfigurations?: DNTTypeConfig[];
40
+ /** Configuration schema version for migration purposes */
41
+ version?: string;
42
+ /** ISO 8601 timestamp of last configuration update */
43
+ lastUpdated?: string;
44
+ }
45
+ //# sourceMappingURL=pluginConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginConfig.d.ts","sourceRoot":"","sources":["../../src/types/pluginConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,wBAAwB,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAElC,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,uDAAuD;IACvD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,2DAA2D;IAC3D,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,gEAAgE;IAChE,oBAAoB,CAAC,EAAE,WAAW,CAAC;IACnC,0EAA0E;IAC1E,2BAA2B,CAAC,EAAE,oBAAoB,CAAC;IAGnD,kDAAkD;IAClD,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,aAAa,EAAE,CAAC;IAGzC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}