@dawntech/dwntbots-services 0.0.90 → 0.0.92

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 (187) hide show
  1. package/package.json +14 -9
  2. package/src/lib/blip/BlipBuilder/BlipBuilderTranspilation.js +4 -2
  3. package/src/lib/blip/BlipBuilder/BlipBuilderTranspilation.js.map +1 -1
  4. package/src/lib/blip/BlipBuilder/features/Feature.js.map +1 -1
  5. package/src/lib/blip/BlipBuilder/features/InactivityFeature.js +1 -1
  6. package/src/lib/blip/BlipBuilder/features/InactivityFeature.js.map +1 -1
  7. package/src/lib/blip/BlipBuilder/features/PositionFeature.js +2 -2
  8. package/src/lib/blip/BlipBuilder/features/PositionFeature.js.map +1 -1
  9. package/src/lib/blip/BlipBuilder/features/SDKFeature.js +12 -9
  10. package/src/lib/blip/BlipBuilder/features/SDKFeature.js.map +1 -1
  11. package/src/lib/blip/BlipBuilder/features/actions/entrypoint.js +1 -1
  12. package/src/lib/blip/BlipBuilder/features/actions/entrypoint.js.map +1 -1
  13. package/src/lib/blip/BlipBuilder/features/actions/fallback.d.ts +2 -2
  14. package/src/lib/blip/BlipBuilder/features/actions/fallback.js +12 -25
  15. package/src/lib/blip/BlipBuilder/features/actions/fallback.js.map +1 -1
  16. package/src/lib/blip/BlipBuilder/features/actions/global.d.ts +1 -1
  17. package/src/lib/blip/BlipBuilder/features/actions/global.js +9 -17
  18. package/src/lib/blip/BlipBuilder/features/actions/global.js.map +1 -1
  19. package/src/lib/blip/BlipBuilder/features/actions/onboarding.js +1 -1
  20. package/src/lib/blip/BlipBuilder/features/actions/onboarding.js.map +1 -1
  21. package/src/lib/blip/BlipBuilder/index.d.ts +3 -3
  22. package/src/lib/blip/BlipBuilder/index.js +2 -3
  23. package/src/lib/blip/BlipBuilder/index.js.map +1 -1
  24. package/src/lib/blip/BlipBuilder/models/_base.js +3 -3
  25. package/src/lib/blip/BlipBuilder/models/_base.js.map +1 -1
  26. package/src/lib/blip/BlipBuilder/models/base.js +3 -3
  27. package/src/lib/blip/BlipBuilder/models/base.js.map +1 -1
  28. package/src/lib/blip/BlipBuilder/models/navigation.js.map +1 -1
  29. package/src/lib/blip/BlipBuilder/models/tags.js +1 -1
  30. package/src/lib/blip/BlipBuilder/models/tags.js.map +1 -1
  31. package/src/lib/blip/BlipBuilder/utils.d.ts +1 -1
  32. package/src/lib/blip/BlipBuilder/utils.js.map +1 -1
  33. package/src/lib/blip/BlipService.d.ts +21 -4
  34. package/src/lib/blip/BlipService.js +161 -22
  35. package/src/lib/blip/BlipService.js.map +1 -1
  36. package/src/lib/blip/BlipTransport.d.ts +1 -0
  37. package/src/lib/blip/BlipTransport.js +16 -4
  38. package/src/lib/blip/BlipTransport.js.map +1 -1
  39. package/src/lib/blip/{BlipBuilder/BlipBotDiff.d.ts → BotDiff/BotDiff.d.ts} +24 -11
  40. package/src/lib/blip/{BlipBuilder/BlipBotDiff.js → BotDiff/BotDiff.js} +57 -23
  41. package/src/lib/blip/BotDiff/BotDiff.js.map +1 -0
  42. package/src/lib/blip/BotDiff/index.d.ts +2 -0
  43. package/src/lib/blip/BotDiff/index.js +8 -0
  44. package/src/lib/blip/BotDiff/index.js.map +1 -0
  45. package/src/lib/blip/{BlipBuilder → BuilderSanitize}/BlipBuilderSanitize.d.ts +1 -0
  46. package/src/lib/blip/{BlipBuilder → BuilderSanitize}/BlipBuilderSanitize.js +16 -10
  47. package/src/lib/blip/BuilderSanitize/BlipBuilderSanitize.js.map +1 -0
  48. package/src/lib/blip/BuilderSanitize/index.d.ts +1 -0
  49. package/src/lib/blip/BuilderSanitize/index.js +18 -0
  50. package/src/lib/blip/BuilderSanitize/index.js.map +1 -0
  51. package/src/lib/blip/DwnGridCompiler/BlipBuilder.d.ts +96 -0
  52. package/src/lib/blip/DwnGridCompiler/BlipBuilder.js +443 -0
  53. package/src/lib/blip/DwnGridCompiler/BlipBuilder.js.map +1 -0
  54. package/src/lib/blip/DwnGridCompiler/DwnGridCompiler.d.ts +61 -0
  55. package/src/lib/blip/DwnGridCompiler/DwnGridCompiler.js +255 -0
  56. package/src/lib/blip/DwnGridCompiler/DwnGridCompiler.js.map +1 -0
  57. package/src/lib/blip/DwnGridCompiler/ExecutionLogger.d.ts +24 -0
  58. package/src/lib/blip/DwnGridCompiler/ExecutionLogger.js +48 -0
  59. package/src/lib/blip/DwnGridCompiler/ExecutionLogger.js.map +1 -0
  60. package/src/lib/blip/DwnGridCompiler/features/CoreFeature.d.ts +65 -0
  61. package/src/lib/blip/DwnGridCompiler/features/CoreFeature.js +408 -0
  62. package/src/lib/blip/DwnGridCompiler/features/CoreFeature.js.map +1 -0
  63. package/src/lib/blip/DwnGridCompiler/features/Feature.d.ts +149 -0
  64. package/src/lib/blip/DwnGridCompiler/features/Feature.js +160 -0
  65. package/src/lib/blip/DwnGridCompiler/features/Feature.js.map +1 -0
  66. package/src/lib/blip/DwnGridCompiler/features/InactivityFeature.d.ts +13 -0
  67. package/src/lib/blip/DwnGridCompiler/features/InactivityFeature.js +56 -0
  68. package/src/lib/blip/DwnGridCompiler/features/InactivityFeature.js.map +1 -0
  69. package/src/lib/blip/DwnGridCompiler/features/LinterFeature.d.ts +38 -0
  70. package/src/lib/blip/DwnGridCompiler/features/LinterFeature.js +77 -0
  71. package/src/lib/blip/DwnGridCompiler/features/LinterFeature.js.map +1 -0
  72. package/src/lib/blip/DwnGridCompiler/features/ScriptsFeature.d.ts +14 -0
  73. package/src/lib/blip/DwnGridCompiler/features/ScriptsFeature.js +46 -0
  74. package/src/lib/blip/DwnGridCompiler/features/ScriptsFeature.js.map +1 -0
  75. package/src/lib/blip/DwnGridCompiler/features/TagsFeature.d.ts +30 -0
  76. package/src/lib/blip/DwnGridCompiler/features/TagsFeature.js +221 -0
  77. package/src/lib/blip/DwnGridCompiler/features/TagsFeature.js.map +1 -0
  78. package/src/lib/blip/DwnGridCompiler/features/TemplatesFeature.d.ts +14 -0
  79. package/src/lib/blip/DwnGridCompiler/features/TemplatesFeature.js +31 -0
  80. package/src/lib/blip/DwnGridCompiler/features/TemplatesFeature.js.map +1 -0
  81. package/src/lib/blip/DwnGridCompiler/features/entities/conditions.d.ts +2 -0
  82. package/src/lib/blip/DwnGridCompiler/features/entities/conditions.js +45 -0
  83. package/src/lib/blip/DwnGridCompiler/features/entities/conditions.js.map +1 -0
  84. package/src/lib/blip/DwnGridCompiler/features/entities/contact.d.ts +5 -0
  85. package/src/lib/blip/DwnGridCompiler/features/entities/contact.js +112 -0
  86. package/src/lib/blip/DwnGridCompiler/features/entities/contact.js.map +1 -0
  87. package/src/lib/blip/DwnGridCompiler/features/entities/content.d.ts +7 -0
  88. package/src/lib/blip/DwnGridCompiler/features/entities/content.js +183 -0
  89. package/src/lib/blip/DwnGridCompiler/features/entities/content.js.map +1 -0
  90. package/src/lib/blip/DwnGridCompiler/features/entities/events.d.ts +21 -0
  91. package/src/lib/blip/DwnGridCompiler/features/entities/events.js +827 -0
  92. package/src/lib/blip/DwnGridCompiler/features/entities/events.js.map +1 -0
  93. package/src/lib/blip/DwnGridCompiler/features/entities/redirect.d.ts +3 -0
  94. package/src/lib/blip/DwnGridCompiler/features/entities/redirect.js +77 -0
  95. package/src/lib/blip/DwnGridCompiler/features/entities/redirect.js.map +1 -0
  96. package/src/lib/blip/DwnGridCompiler/features/entities/scripts.d.ts +14 -0
  97. package/src/lib/blip/DwnGridCompiler/features/entities/scripts.js +292 -0
  98. package/src/lib/blip/DwnGridCompiler/features/entities/scripts.js.map +1 -0
  99. package/src/lib/blip/DwnGridCompiler/features/index.d.ts +8 -0
  100. package/src/lib/blip/DwnGridCompiler/features/index.js +67 -0
  101. package/src/lib/blip/DwnGridCompiler/features/index.js.map +1 -0
  102. package/src/lib/blip/DwnGridCompiler/features/scripts/__definitions.d.ts +830 -0
  103. package/src/lib/blip/DwnGridCompiler/features/scripts/__definitions.js +364 -0
  104. package/src/lib/blip/DwnGridCompiler/features/scripts/__definitions.js.map +1 -0
  105. package/src/lib/blip/DwnGridCompiler/features/scripts/__scripts.template.d.ts +14 -0
  106. package/src/lib/blip/DwnGridCompiler/features/scripts/__scripts.template.js +292 -0
  107. package/src/lib/blip/DwnGridCompiler/features/scripts/__scripts.template.js.map +1 -0
  108. package/src/lib/blip/DwnGridCompiler/features/scripts/_bindings.d.ts +24 -0
  109. package/src/lib/blip/DwnGridCompiler/features/scripts/_bindings.js +25 -0
  110. package/src/lib/blip/DwnGridCompiler/features/scripts/_bindings.js.map +1 -0
  111. package/src/lib/blip/DwnGridCompiler/features/scripts/_build.d.ts +2 -0
  112. package/src/lib/blip/DwnGridCompiler/features/scripts/_build.js +8 -0
  113. package/src/lib/blip/DwnGridCompiler/features/scripts/_build.js.map +1 -0
  114. package/src/lib/blip/DwnGridCompiler/features/scripts/_types.d.ts +14 -0
  115. package/src/lib/blip/DwnGridCompiler/features/scripts/_types.js +3 -0
  116. package/src/lib/blip/DwnGridCompiler/features/scripts/_types.js.map +1 -0
  117. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_error_message.d.ts +1 -0
  118. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_error_message.js +46 -0
  119. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_error_message.js.map +1 -0
  120. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_create.d.ts +1 -0
  121. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_create.js +178 -0
  122. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_create.js.map +1 -0
  123. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_process.d.ts +1 -0
  124. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_process.js +225 -0
  125. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_fallback_process.js.map +1 -0
  126. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_config_pt_br.d.ts +19 -0
  127. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_config_pt_br.js +165 -0
  128. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_config_pt_br.js.map +1 -0
  129. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_core.d.ts +1 -0
  130. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_core.js +411 -0
  131. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_core.js.map +1 -0
  132. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_dwn.d.ts +1 -0
  133. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_dwn.js +1195 -0
  134. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_gactions_dwn.js.map +1 -0
  135. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_onboarding_reset.d.ts +1 -0
  136. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_onboarding_reset.js +109 -0
  137. package/src/lib/blip/DwnGridCompiler/features/scripts/grid_onboarding_reset.js.map +1 -0
  138. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_console.d.ts +29 -0
  139. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_console.js +61 -0
  140. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_console.js.map +1 -0
  141. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_datetime.d.ts +5 -0
  142. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_datetime.js +24 -0
  143. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_datetime.js.map +1 -0
  144. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_enforcesate.d.ts +2 -0
  145. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_enforcesate.js +28 -0
  146. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_enforcesate.js.map +1 -0
  147. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_http.d.ts +139 -0
  148. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_http.js +270 -0
  149. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_http.js.map +1 -0
  150. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_kebabcase.d.ts +1 -0
  151. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_kebabcase.js +16 -0
  152. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_kebabcase.js.map +1 -0
  153. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_merge.d.ts +1 -0
  154. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_merge.js +64 -0
  155. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_merge.js.map +1 -0
  156. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_script.d.ts +2 -0
  157. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_script.js +148 -0
  158. package/src/lib/blip/DwnGridCompiler/features/scripts/libs_script.js.map +1 -0
  159. package/src/lib/blip/DwnGridCompiler/features/scripts/template_intent.d.ts +1 -0
  160. package/src/lib/blip/DwnGridCompiler/features/scripts/template_intent.js +148 -0
  161. package/src/lib/blip/DwnGridCompiler/features/scripts/template_intent.js.map +1 -0
  162. package/src/lib/blip/DwnGridCompiler/features/scripts/template_prepare.d.ts +33 -0
  163. package/src/lib/blip/DwnGridCompiler/features/scripts/template_prepare.js +165 -0
  164. package/src/lib/blip/DwnGridCompiler/features/scripts/template_prepare.js.map +1 -0
  165. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_basic.d.ts +1 -0
  166. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_basic.js +31 -0
  167. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_basic.js.map +1 -0
  168. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_complete.d.ts +1 -0
  169. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_complete.js +31 -0
  170. package/src/lib/blip/DwnGridCompiler/features/scripts/template_script_complete.js.map +1 -0
  171. package/src/lib/blip/DwnGridCompiler/index.d.ts +1 -0
  172. package/src/lib/blip/DwnGridCompiler/index.js +18 -0
  173. package/src/lib/blip/DwnGridCompiler/index.js.map +1 -0
  174. package/src/lib/blip/WhatsAppBlipService.js +0 -2
  175. package/src/lib/blip/WhatsAppBlipService.js.map +1 -1
  176. package/src/lib/new-relic/NewRelicIngest.d.ts +17 -4
  177. package/src/lib/new-relic/NewRelicIngest.js +2 -0
  178. package/src/lib/new-relic/NewRelicIngest.js.map +1 -1
  179. package/src/lib/storage/Driver.js +1 -1
  180. package/src/lib/storage/Driver.js.map +1 -1
  181. package/src/lib/storage/ScopedStorage.js.map +1 -1
  182. package/src/lib/whatsapp-flow/index.js.map +1 -1
  183. package/src/lib/blip/BlipBuilder/BlipBotDiff.js.map +0 -1
  184. package/src/lib/blip/BlipBuilder/BlipBuilderSanitize.js.map +0 -1
  185. package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.d.ts +0 -49
  186. package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.js +0 -317
  187. package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.js.map +0 -1
@@ -0,0 +1,830 @@
1
+ import { DeepRequired } from "./_types";
2
+ export declare enum PREDEFINED_INTENTS {
3
+ CHECKPOINT_BACK = "CHECKPOINT_BACK",
4
+ CLOSE = "CLOSE"
5
+ }
6
+ export declare enum PREDEFINED_ERRORS {
7
+ INTENT = "INTENT",
8
+ PROPAGATE = "PROPAGATE",
9
+ GOTO = "GOTO",
10
+ INACTIVITY = "INACTIVITY",
11
+ BLOCKED_CONTACT = "BLOCKED_CONTACT",
12
+ UNEXPECTED_OPTION = "UNEXPECTED_OPTION",
13
+ UNEXPECTED_INPUT = "UNEXPECTED_INPUT",
14
+ RESOLVED = "RESOLVED",
15
+ DEBUG = "DEBUG",
16
+ HTTP_ERROR = "HTTP_ERROR",
17
+ SCRIPT_ERROR = "SCRIPT_ERROR",
18
+ MISCONFIGURATION_ERROR = "MISCONFIGURATION_ERROR",
19
+ RUNTIME_ERROR = "RUNTIME_ERROR",
20
+ RECURRENT_ERROR = "RECURRENT_ERROR"
21
+ }
22
+ export declare enum PREDEFINED_LABELS {
23
+ UNEXPECTED = "UNEXPECTED",
24
+ ABANDONED = "ABANDONED",
25
+ RESOLVED = "RESOLVED",
26
+ ERROR = "ERROR"
27
+ }
28
+ export declare enum FINALIZATION_STATUS {
29
+ RESOLVED = "RESOLVED",
30
+ ABANDONED = "ABANDONED",
31
+ ERROR = "ERROR"
32
+ }
33
+ export declare enum VARIABLES {
34
+ DWN = "dwn",
35
+ CORE = "dwnCore",
36
+ STATES = "dwnStates",
37
+ ERROR = "dwnError",
38
+ PREPARE = "dwnPrepare",
39
+ MESSAGE = "dwnMessage",
40
+ BYPASS = "dwnBypass",
41
+ SETUP = "config.dwnSetup",
42
+ CONFIG = "dwnConfig",
43
+ LOGS = "dwnLogger",
44
+ SCRIPT = "dwnScript",
45
+ LOCAL_CONFIG = "dwnLocalConfig",
46
+ GLOBAL_CONFIG = "resource.dwnGlobalConfig",
47
+ LIST_CONFIG = "resource.dwnListConfig"
48
+ }
49
+ export declare enum DAYPART {
50
+ MORNING = "MORNING",
51
+ AFTERNOON = "AFTERNOON",
52
+ EVENING = "EVENING",
53
+ NIGHT = "NIGHT"
54
+ }
55
+ export declare enum INTENT_SCOPE {
56
+ CONFIG = "config",
57
+ STACK = "stack",
58
+ CONTACT = "contact",
59
+ REDIRECT = "redirect",
60
+ PREPARE = "prepare"
61
+ }
62
+ export declare enum INTENT_TYPE {
63
+ REGEX = "regex",
64
+ FUZZY = "fuzzy",
65
+ STATIC = "static"
66
+ }
67
+ export declare enum USER_SOURCE {
68
+ BLIP_CHAT = "BLIP_CHAT",
69
+ E_MAIL = "E_MAIL",
70
+ MESSENGER = "MESSENGER",
71
+ SKYPE = "SKYPE",
72
+ SMS_TAKE = "SMS_TAKE",
73
+ SMS_TANGRAM = "SMS_TANGRAM",
74
+ TELEGRAM = "TELEGRAM",
75
+ WHATSAPP = "WHATSAPP",
76
+ INSTAGRAM = "INSTAGRAM",
77
+ GOOGLE_RCS = "GOOGLE_RCS",
78
+ MICROSOFT_TEAMS = "MICROSOFT_TEAMS",
79
+ APPLE_BUSINESS_CHAT = "APPLE_BUSINESS_CHAT",
80
+ WORKPLACE = "WORKPLACE",
81
+ OUTRO = "OUTRO"
82
+ }
83
+ export declare enum INPUT_TYPE {
84
+ FLOWS = "FLOWS",
85
+ TEXT = "TEXT",
86
+ CART = "CART",
87
+ IMAGE = "IMAGE",
88
+ STICKER = "STICKER",
89
+ VIDEO = "VIDEO",
90
+ AUDIO = "AUDIO",
91
+ DOCUMENT = "DOCUMENT",
92
+ LOCATION = "LOCATION",
93
+ CTWA = "CTWA",
94
+ INACTIVITY = "INACTIVITY"
95
+ }
96
+ export declare enum INPUT_MODEL {
97
+ GOTO = "GOTO",
98
+ DEBUG = "DEBUG",
99
+ CEP = "CEP",
100
+ CPF = "CPF",
101
+ CNPJ = "CNPJ",
102
+ BIRTH_DAY = "BIRTH_DAY",
103
+ NAME = "NAME",
104
+ FULL_NAME = "FULL_NAME",
105
+ EMAIL = "EMAIL",
106
+ PHONE = "PHONE",
107
+ CAR_PLATE = "CAR_PLATE",
108
+ CTWA = "CTWA",
109
+ FLOWS = "FLOWS",
110
+ CART = "CART",
111
+ LOCATION = "LOCATION"
112
+ }
113
+ /**
114
+ * Specification for defining an intent that can be matched against user input.
115
+ * Supports pattern matching, custom payloads, and state transitions.
116
+ */
117
+ export interface IntentSpec {
118
+ /** Unique identifier for the intent (e.g., "dwn@intent.id") */
119
+ id: string;
120
+ /** Human-readable label describing the intent's purpose */
121
+ label: string;
122
+ /** Type of intent matching. Defaults to static */
123
+ type?: INTENT_TYPE;
124
+ /** Array of patterns to match against user input (regex patterns or words) */
125
+ patterns?: string[];
126
+ /** Custom payload data to associate with this intent (maps to dwn@input.payload) */
127
+ payload?: any | null;
128
+ /** Target state to transition to when this intent is matched */
129
+ goto?: State | null;
130
+ }
131
+ /**
132
+ * Groups related intents together for organized processing and scoped execution.
133
+ * Allows for logical grouping of intents based on context or functionality.
134
+ */
135
+ export interface IntentsGroup {
136
+ /** Unique identifier for the intent group */
137
+ id: string;
138
+ /** Array of intent specifications that belong to this group */
139
+ intents: DeepRequired<IntentSpec>[];
140
+ /** Scope context for when this group should be active */
141
+ scope: INTENT_SCOPE;
142
+ /** Event identifier for event tracking purposes */
143
+ event: string;
144
+ }
145
+ /**
146
+ * Active intent instance that has been matched against user input.
147
+ * Contains the matched pattern, confidence score, and execution context.
148
+ */
149
+ export interface Intent {
150
+ /** Identifier for the matched intent - When no intent matched, it is undefined */
151
+ id?: string;
152
+ /** Type of intent matching that was used (regex, fuzzy, or static) */
153
+ type: INTENT_TYPE;
154
+ /** Scope defined to identify where this intent is from */
155
+ scope: INTENT_SCOPE;
156
+ /** Human-readable label describing the intent's purpose */
157
+ label: string;
158
+ /** Event identifier for event tracking purposes */
159
+ event: string;
160
+ /** The actual pattern that matched the user input */
161
+ pattern: string;
162
+ /** Confidence score (0-1) indicating how well the input matched this intent (only present if type is fuzzy) */
163
+ score: number;
164
+ }
165
+ /**
166
+ * Additional context information for contact-related intents.
167
+ * Provides scheduling and expiration metadata for intent processing.
168
+ */
169
+ export interface ContactIntentExtras {
170
+ /** Due date for the intent in ISO format */
171
+ dueDate?: string;
172
+ /** Event identifier for event tracking purposes */
173
+ event?: string;
174
+ /** Custom payload data associated with the intent */
175
+ payload?: any | null;
176
+ /** Configuration for handling expired intents */
177
+ expired?: {
178
+ /** Event action to trigger when intent expires */
179
+ event?: string;
180
+ /** Intent ID to use for expired intent handling */
181
+ intent?: string;
182
+ };
183
+ }
184
+ /**
185
+ * User/contact information and configuration for the flow.
186
+ * Contains user identification, permissions, and contact details.
187
+ */
188
+ export interface User {
189
+ /** Local contact identifier */
190
+ id: string;
191
+ /** Source platform where the user originated */
192
+ source: USER_SOURCE;
193
+ /** Whether this is a new contact without a name */
194
+ new?: boolean;
195
+ /** Whether the contact is blocked from using the service */
196
+ blocked: boolean;
197
+ /** Whether the contact is allowed to use the service */
198
+ allowed: boolean;
199
+ /** Contact group identifier for A/B testing (A/B/C/...) */
200
+ group: string;
201
+ /** Number of active sessions for this user */
202
+ sessions: number;
203
+ /** Whether debug mode is enabled for this contact */
204
+ debug?: boolean;
205
+ /** Contact's phone number without area code (DDD) */
206
+ cellphone?: string;
207
+ /** Contact's complete phone number with area code */
208
+ phone?: string;
209
+ /** Area code (DDD) for the contact's phone number */
210
+ DDD?: string;
211
+ }
212
+ /**
213
+ * User input data structure for processing in the flow.
214
+ * Contains the raw content, type classification, and associated metadata.
215
+ */
216
+ export interface Input {
217
+ /** Raw content of the user's input */
218
+ content: string;
219
+ /** Type classification of the input */
220
+ type: INPUT_TYPE;
221
+ /** AI model to use for processing this input type */
222
+ model?: INPUT_MODEL;
223
+ /** Additional data payload associated with the input */
224
+ payload: any | null;
225
+ }
226
+ /**
227
+ * Represents a flow state with optional service and name information.
228
+ * Used for state transitions and flow navigation.
229
+ */
230
+ export interface State {
231
+ /** Unique identifier for the state */
232
+ id: string;
233
+ /** Service context for this state */
234
+ service?: string;
235
+ /** Human-readable name for the state */
236
+ name?: string;
237
+ }
238
+ /**
239
+ * Comprehensive datetime information with multiple format representations.
240
+ * Provides both formatted strings and parsed components for flexible usage.
241
+ */
242
+ export interface Datetime {
243
+ /** Complete datetime in ISO format */
244
+ datetime: string;
245
+ /** Date portion in YYYY-MM-DD format */
246
+ date: string;
247
+ /** Time portion in HH:mm:ss format */
248
+ time: string;
249
+ /** Hour component (0-23, 24-hour format) */
250
+ hour: number;
251
+ /** Minute component (0-59) */
252
+ minute: number;
253
+ /** GMT offset in hours (e.g., -3 for UTC-3) */
254
+ GMT: number;
255
+ }
256
+ /**
257
+ * Configuration for system messages displayed to users.
258
+ * Supports contextual messages based on time of day, intent types, and error conditions.
259
+ */
260
+ export interface ConfigMessages {
261
+ /** Messages organized by input type */
262
+ type?: Record<string, string[]>;
263
+ /** Messages organized by intent category */
264
+ intent?: Record<string, string[]>;
265
+ /** Error messages organized by error type */
266
+ error?: Record<string, string[]>;
267
+ /** Time-based greeting messages */
268
+ greeting?: {
269
+ /** Morning greeting message (typically 6:00 AM - 11:59 AM) */
270
+ MORNING: string;
271
+ /** Afternoon greeting message (typically 12:00 PM - 5:59 PM) */
272
+ AFTERNOON: string;
273
+ /** Evening greeting message (typically 6:00 PM - 8:59 PM) */
274
+ EVENING: string;
275
+ /** Night greeting message (typically 9:00 PM - 5:59 AM) */
276
+ NIGHT: string;
277
+ };
278
+ }
279
+ export interface ConfigError {
280
+ /** Default error type */
281
+ type?: string;
282
+ /** Custom error messages to override default configuration messages. Set to null to disable messages */
283
+ messages?: string[];
284
+ /** Custom state to transition to after the error */
285
+ goto?: State | null;
286
+ }
287
+ /**
288
+ * Global configuration for the DanwtechGrid flow execution.
289
+ * Controls service behavior, thresholds, stack sizes, and system-wide settings.
290
+ */
291
+ export interface Configuration {
292
+ /** Service configuration settings */
293
+ service?: {
294
+ /** Current active service identifier (e.g., "main") */
295
+ current?: string;
296
+ /** Main service identifier (e.g., "main") */
297
+ main?: string;
298
+ };
299
+ /** Connection configuration */
300
+ connection?: {
301
+ /** Connection contract */
302
+ contract?: string;
303
+ /** Connection key */
304
+ key?: string;
305
+ };
306
+ /** GMT offset in hours (e.g., -3 for UTC-3) */
307
+ gmt?: number;
308
+ /** List management configuration */
309
+ list?: {
310
+ /** Whether to enable block list functionality on "resource.dwnBlockList" */
311
+ block?: boolean;
312
+ /** Whether to enable allow list functionality on "resource.dwnAllowList" */
313
+ allow?: boolean;
314
+ };
315
+ /** Threshold settings for flow execution */
316
+ threshold?: {
317
+ /** Minimum confidence score to consider intent matched. Default: 0.75 */
318
+ minScore?: number;
319
+ /** Maximum number of intents to stack in a single operation. Default: 3 */
320
+ maxStack?: number;
321
+ };
322
+ /** Stack size configurations for various system components */
323
+ stackSize?: {
324
+ /** Size of the HTTP request stack. Default: 3 */
325
+ requests?: number;
326
+ /** Size of the logs stack. Default: 10 */
327
+ logs?: number;
328
+ /** Size of the intents stack. Default: 3 */
329
+ intents?: number;
330
+ /** Size of the errors stack. Default: 5 */
331
+ errors?: number;
332
+ /** Size of the checkpoints stack. Default: 5 */
333
+ checkpoints?: number;
334
+ };
335
+ /** Configuration intents for the flow */
336
+ intents?: IntentSpec[];
337
+ /** Feature disable configurations */
338
+ disabled?: {
339
+ /** Whether to disable inactivity timeout handling. Default: false */
340
+ inactivity?: boolean;
341
+ /** Array of intent IDs to disable during execution */
342
+ intents?: string[];
343
+ };
344
+ /** Default messages for specific types, intents, errors, and greetings */
345
+ messages?: ConfigMessages;
346
+ /** Time-based daypart configuration with hour ranges */
347
+ daypart?: {
348
+ /** Morning hours (typically 6:00 AM - 11:59 AM) */
349
+ MORNING?: number[];
350
+ /** Afternoon hours (typically 12:00 PM - 5:59 PM) */
351
+ AFTERNOON?: number[];
352
+ /** Evening hours (typically 6:00 PM - 8:59 PM) */
353
+ EVENING?: number[];
354
+ /** Night hours (typically 9:00 PM - 5:59 AM) */
355
+ NIGHT?: number[];
356
+ };
357
+ /** Default error configurations when reaching the fallback state */
358
+ error?: ConfigError;
359
+ /** Custom inactivity error message. Default: 'INACTIVITY' */
360
+ inactivity?: string;
361
+ /** Flow label aliases for state references. Format: ALIAS: labelId {FALLBACK: "fallback"} */
362
+ label?: Record<string, string>;
363
+ /** Password for enabling debug mode */
364
+ password?: string;
365
+ /** Service name to propagate errors to. Use only when it's necessary to propagate errors to a single bot (e.g. Exceptions Bot) Default: null */
366
+ propagate?: string | null;
367
+ /** Contact groups for A/B testing (A/B/C/...) */
368
+ groups?: number[];
369
+ /** Whether to enable debug mode for all operations. Default: false */
370
+ debug?: boolean;
371
+ }
372
+ /**
373
+ * Supported language codes for internationalization.
374
+ * Controls the language used for system messages and user interface elements.
375
+ */
376
+ export declare type LANGUAGE = "pt_br" | "es" | "en";
377
+ /**
378
+ * Service configuration for Dawntech Grid execution.
379
+ * Defines the current and main service identifiers for flow management.
380
+ */
381
+ export interface Services {
382
+ /** Current active service identifier */
383
+ current: string;
384
+ /** Main service identifier (fallback/primary service) */
385
+ main: string;
386
+ }
387
+ /**
388
+ * Connection configuration for external service integration.
389
+ * Contains authentication and contract information for API connections.
390
+ */
391
+ export interface Connection {
392
+ /** Service contract identifier for API access */
393
+ contract: string;
394
+ /** Authentication key for secure service communication */
395
+ key: string;
396
+ }
397
+ /**
398
+ * Initial setup configuration for Dawntech Grid initialization.
399
+ * Contains essential system settings and connection parameters for flow startup.
400
+ */
401
+ export interface SetupConfig {
402
+ /** Framework version identifier (e.g., "2.0.0") */
403
+ version: string;
404
+ /** Configuration expiration timestamp (Unix timestamp) */
405
+ expiration: number;
406
+ /** Service configuration settings */
407
+ services: Services;
408
+ /** GMT offset in hours (e.g., -3 for UTC-3) */
409
+ gmt: number;
410
+ /** Default language for system messages and interface */
411
+ language: LANGUAGE;
412
+ /** Connection configuration for external services */
413
+ connection: Connection;
414
+ }
415
+ /**
416
+ * Configuration for lists of identities.
417
+ * Used for block and allow users.
418
+ */
419
+ export interface ListsConfiguration {
420
+ /** Allow list of identities */
421
+ allow: string[];
422
+ /** Block list of identities */
423
+ block: string[];
424
+ }
425
+ /**
426
+ * Tracks error recurrence patterns across different contexts.
427
+ * Used for error analysis and potential retry logic.
428
+ */
429
+ export interface ErrorRecurrence {
430
+ /** Number of times this error type has occurred */
431
+ type: number;
432
+ /** Number of times this error has occurred in the current state */
433
+ state: number;
434
+ /** Total combined count of all error occurrences (Minimum of type and state recurrences) */
435
+ combined: number;
436
+ }
437
+ /**
438
+ * Error information structure for flow execution failures.
439
+ * Contains details about the error, its location, and recovery options.
440
+ */
441
+ export interface Error {
442
+ /** Type/category of the error */
443
+ type: string;
444
+ /** Human-readable description of what went wrong */
445
+ description: string;
446
+ /** Location or context where the error occurred */
447
+ at: string;
448
+ /** User content when the error occurred */
449
+ content: string;
450
+ /** Flow state where the error occurred */
451
+ state: State;
452
+ /** Information about error recurrence patterns */
453
+ recurrence: ErrorRecurrence;
454
+ /** Target state to redirect to on error. null means terminate the flow */
455
+ goto?: State | null;
456
+ /** Primary error message for user display */
457
+ message?: string;
458
+ /** Array of error messages to rotate through when the error is the same */
459
+ messages: string[];
460
+ /** Associated intent that caused the error, if any */
461
+ intent?: string | null;
462
+ /** Stack trace or execution context information */
463
+ stack?: string;
464
+ }
465
+ /**
466
+ * Structure representing a user's reply or input to the flow.
467
+ * Contains the content, type, and any associated metadata.
468
+ */
469
+ export interface Reply {
470
+ /** Raw content of the user's reply e.g. input.content */
471
+ content: string;
472
+ /** Type of the reply e.g. input.type */
473
+ type: string;
474
+ /** Raw message content e.g. input.message */
475
+ message: string;
476
+ /** Additional data payload associated with the reply (from intents or redirects) */
477
+ payload?: any;
478
+ }
479
+ /**
480
+ * Configuration interface for preparing the Dawntech Gridflow execution.
481
+ * This interface allows users to customize flow behavior, intent handling, and error management.
482
+ */
483
+ export interface PrepareV0 {
484
+ /** Unique identifier for the preparation configuration */
485
+ id: string;
486
+ /** Whether to add a checkpoint to the flow for potential rollback. Default: false */
487
+ checkpoint?: boolean;
488
+ /** Number of times to push the intent to the execution stack. Default: 0 */
489
+ stack?: number;
490
+ /** Confidence score threshold for intent matching. Default: 0.75 */
491
+ score?: number;
492
+ /** Configuration for disabling specific flow features */
493
+ disabled?: {
494
+ /** Whether to disable inactivity timeout handling. Default: false */
495
+ inactivity?: boolean;
496
+ /** Array of intent IDs to disable during execution */
497
+ intents?: string[];
498
+ };
499
+ /** Default error configurations when reaching the fallback state */
500
+ error?: {
501
+ /** Default error type */
502
+ default?: string;
503
+ /** Custom inactivity error message. Default: 'INACTIVITY' */
504
+ inactivity?: string;
505
+ };
506
+ /** Custom messages to override default configuration messages. Set to null to disable messages */
507
+ messages?: string[];
508
+ /** Custom labels for flow states */
509
+ label?: {
510
+ /** Custom label for unexpected input handling */
511
+ unexpected?: string;
512
+ };
513
+ /** Array of intent specifications for the flow */
514
+ intents?: IntentSpec[];
515
+ /** Input types to be processed in the flow */
516
+ types?: INPUT_TYPE[];
517
+ /** AI models to be used for intent processing in the flow */
518
+ models?: INPUT_MODEL[];
519
+ }
520
+ /**
521
+ * Configuration interface for preparing the Dawntech Gridflow execution.
522
+ * This interface allows users to customize flow behavior, intent handling, and error management.
523
+ */
524
+ export interface Prepare {
525
+ /** Unique identifier for the preparation configuration */
526
+ id: string;
527
+ /** Whether to add a checkpoint to the flow for potential rollback. Default: false */
528
+ checkpoint?: boolean;
529
+ /** Number of times to push the intent to the execution stack. Default: 0 */
530
+ stack?: number;
531
+ /** Confidence score threshold for intent matching. Default: 0.75 */
532
+ score?: number;
533
+ /** Configuration for disabling specific flow features */
534
+ disabled?: {
535
+ /** Whether to disable inactivity timeout handling. Default: false */
536
+ inactivity?: boolean;
537
+ /** Array of intent IDs to disable during execution */
538
+ intents?: string[];
539
+ };
540
+ /** Default error configurations when reaching the fallback state */
541
+ error?: ConfigError;
542
+ /** Custom inactivity error message. Default: 'INACTIVITY' */
543
+ inactivity?: string;
544
+ /** Custom labels for flow states */
545
+ label?: {
546
+ /** Custom label for unexpected input handling */
547
+ unexpected?: string;
548
+ };
549
+ /** Array of intent specifications for the flow */
550
+ intents?: IntentSpec[];
551
+ /** Input types to be processed in the flow */
552
+ types?: INPUT_TYPE[];
553
+ /** AI models to be used for intent processing in the flow */
554
+ models?: INPUT_MODEL[];
555
+ }
556
+ /**
557
+ * Internal core state interface for the Dawntech Gridflow execution.
558
+ * This interface contains runtime state information and is read-only for external users.
559
+ */
560
+ export interface Core {
561
+ /** Current version of the Dawntech Grid(e.g., "1.0.0") */
562
+ version: string;
563
+ /** Current error state during flow execution */
564
+ error: Error | null;
565
+ /** History of the last 5 errors thrown during the flow */
566
+ errors: Error[];
567
+ /** Whether checkpoint functionality is currently enabled */
568
+ checkpoint: boolean;
569
+ /** Array of saved checkpoint states for potential rollback */
570
+ checkpoints: State[];
571
+ /** Stack of service names in the current execution context */
572
+ services: string[];
573
+ /** Currently active intent, if any */
574
+ intent: Intent | null;
575
+ /** Intent management and grouping configuration */
576
+ intents: {
577
+ /** Stack of intent groups for the current flow */
578
+ stack: IntentsGroup[];
579
+ /** Combined groups (prepare + stack + config) for the flow */
580
+ groups: IntentsGroup[];
581
+ };
582
+ /** Prepared configuration for the next Dawntech Gridstep */
583
+ prepare: DeepRequired<Prepare>;
584
+ /** Current flow state identifier (e.g., "main") */
585
+ state: State;
586
+ /** User's most recent reply/input */
587
+ reply: Reply;
588
+ /** Contact group identifier for A/B testing (A/B/C/...) */
589
+ group: string;
590
+ /** Unique journey identifier, reset when user starts a new flow */
591
+ journey: string;
592
+ /** Number of active sessions in the current flow */
593
+ sessions: number;
594
+ /** Human-readable service name (e.g., "main") */
595
+ service: string;
596
+ /** Array of specific blocks/features the user has visited */
597
+ visits: string[];
598
+ /** Identifier for the fallback state */
599
+ fallback: "fallback";
600
+ /** Internal Warnings */
601
+ warnings: string[];
602
+ /** Whether the current service is the main service */
603
+ main?: boolean;
604
+ /** Service name to propagate errors to */
605
+ propagate?: string;
606
+ /** Whether a redirect is currently active */
607
+ redirect?: boolean;
608
+ }
609
+ /**
610
+ * Public Dawntech Gridinterface providing access to flow state and user information.
611
+ * This interface is read-only and exposes safe information for external consumption.
612
+ */
613
+ export interface DWN {
614
+ /** Unique journey identifier, reset when user starts a new flow */
615
+ journey: string;
616
+ /** Current time period of the day (MORNING, AFTERNOON, EVENING, NIGHT) */
617
+ daypart: DAYPART;
618
+ /** Contextual greeting message based on current time of day */
619
+ greeting: string;
620
+ /** Current date and time in ISO format */
621
+ calendar: Datetime;
622
+ /** User's current input data */
623
+ input: Input;
624
+ /** User profile and context information */
625
+ user: User;
626
+ /** Current service identifier (e.g., "main") */
627
+ service: string;
628
+ /** Whether this is the main service in the flow */
629
+ main: boolean;
630
+ /** Currently active intent, if any */
631
+ intent?: Intent;
632
+ /** Current error state, if any errors occurred during flow execution */
633
+ error?: Error;
634
+ /** Framework Warnings */
635
+ warnings?: string;
636
+ }
637
+ /**
638
+ * Configuration for redirecting flow execution to different states or services.
639
+ * Supports both state transitions and error propagation scenarios.
640
+ */
641
+ export interface Redirect {
642
+ /** Framework type, this should always be "dwn" */
643
+ type: "dwn";
644
+ /** Target state to redirect to */
645
+ state: string;
646
+ /** Target service to redirect to */
647
+ service: string;
648
+ /** Optional data payload to pass during redirect */
649
+ payload?: any;
650
+ /** Error handling strategy: "PROPAGATE" to forward errors, "GOTO" for direct navigation, or custom error message */
651
+ error?: "PROPAGATE" | "GOTO" | string;
652
+ /** Optional intent to trigger during redirect */
653
+ intent?: string;
654
+ }
655
+ export declare const REDIRECT_PROPAGATE: Redirect;
656
+ export declare const REDIRECT_GOTO: Redirect;
657
+ export declare const REDIRECT_INTENT: Redirect;
658
+ export declare const REDIRECT_ERROR: Redirect;
659
+ export declare const REDIRECT_CONTENT: Redirect;
660
+ /**
661
+ * Optional extras for Dawntech Griderror instances.
662
+ * Provides additional context and configuration for error handling.
663
+ */
664
+ export interface DwnErrorExtras {
665
+ /** Primary error message for user display */
666
+ message?: string;
667
+ /** Array of error messages for different contexts */
668
+ messages?: string[];
669
+ /** Stack trace or execution context information */
670
+ stack?: string;
671
+ /** Target state to redirect to on error. null means terminate the flow */
672
+ goto?: State | null;
673
+ /** Flow state where the error occurred */
674
+ state?: State;
675
+ /** Location or context where the error occurred */
676
+ at?: string;
677
+ /** Associated intent that caused the error, if any */
678
+ intent?: string | null;
679
+ /** Additional error content or context */
680
+ content?: string;
681
+ /** Information about error recurrence patterns */
682
+ recurrence?: ErrorRecurrence;
683
+ /** Error code for programmatic error handling */
684
+ code?: string | null;
685
+ /** Finalization status indicating how the error was resolved */
686
+ status?: FINALIZATION_STATUS;
687
+ }
688
+ /**
689
+ * Custom error class for Dawntech Grid system errors.
690
+ *
691
+ * Extends the native Error class to provide additional context and metadata
692
+ * for error handling within the DWN Grid framework.
693
+ */
694
+ export declare class DwnError extends Error {
695
+ /** The error type identifier */
696
+ type: string;
697
+ /** Human-readable description of the error */
698
+ description: string;
699
+ /** Optional error message override */
700
+ message?: string;
701
+ /** Stack trace of the error */
702
+ stack?: string | undefined;
703
+ /** Array of error messages for multi-step errors */
704
+ messages: string[];
705
+ /** Target state to navigate to when handling this error */
706
+ goto?: State | null;
707
+ /** Current state context when the error occurred */
708
+ state: State;
709
+ /** ISO timestamp when the error was created */
710
+ at: string;
711
+ /** Intent that was being processed when the error occurred */
712
+ intent?: string | null;
713
+ /** Content that caused the error */
714
+ content: string;
715
+ /** Error recurrence tracking information */
716
+ recurrence: ErrorRecurrence;
717
+ /** Optional error code for programmatic handling */
718
+ code?: string;
719
+ /** Finalization status of the error */
720
+ status?: FINALIZATION_STATUS;
721
+ /**
722
+ * Creates a new DwnError instance.
723
+ *
724
+ * @param {string} type The error type identifier (e.g., "VALIDATION_ERROR", "SCRIPT_ERROR")
725
+ * @param {string} description Human-readable description of what went wrong
726
+ * @param {{message?: string, messages?: string[], stack?: string, goto?: State | null, state?: State, at?: string, intent?: string | null, content?: string, recurrence?: ErrorRecurrence, code?: string | null, status?: FINALIZATION_STATUS}} [extras] Optional additional error context and metadata:
727
+ * - `message`: Primary error message for user display
728
+ * - `messages`: Array of error messages for different contexts
729
+ * - `stack`: Stack trace or execution context information
730
+ * - `goto`: Target state to redirect to on error (null means terminate)
731
+ * - `state`: Flow state where the error occurred
732
+ * - `at`: Location or context where the error occurred
733
+ * - `intent`: Associated intent that caused the error
734
+ * - `content`: Additional error content or context
735
+ * - `recurrence`: Information about error recurrence patterns
736
+ * - `code`: Error code for programmatic error handling
737
+ * - `status`: Finalization status indicating how the error was resolved
738
+ *
739
+ * @example
740
+ * ```typescript
741
+ * const error = new DwnError("VALIDATION_ERROR", "Invalid input provided");
742
+ *
743
+ * const contextError = new DwnError("SCRIPT_ERROR", "Script execution failed", {
744
+ * state: { id: "state-123", service: "main" },
745
+ * intent: "user-input",
746
+ * content: "invalid data",
747
+ * messages: ["First attempt failed", "Retry failed"],
748
+ * goto: { id: "error-handler", service: "main" }
749
+ * });
750
+ * ```
751
+ */
752
+ constructor(type: string, description: string, extras?: DwnErrorExtras);
753
+ /**
754
+ * Creates a DwnError instance from a serialized error string.
755
+ *
756
+ * Parses a DWN error string in the format "TYPE -|- DESCRIPTION -|- EXTRAS_JSON"
757
+ * and reconstructs the original DwnError instance.
758
+ *
759
+ * @param {string} dwnErrorString Serialized error string from toString() method
760
+ * @returns {DwnError | undefined} DwnError instance or undefined if parsing fails
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * const errorString = "SCRIPT_ERROR -|- Execution failed -|- {...}";
765
+ * const error = DwnError.fromDwnError(errorString);
766
+ * ```
767
+ */
768
+ static fromDwnError(dwnErrorString: string): DwnError | undefined;
769
+ /**
770
+ * Creates a DwnError instance from a JSON object.
771
+ *
772
+ * Converts a generic Error object or JSON representation into a properly
773
+ * structured DwnError instance with all required properties.
774
+ *
775
+ * @param {Error} data Error object or JSON data to convert
776
+ * @returns {DwnError} New DwnError instance
777
+ *
778
+ * @example
779
+ * ```typescript
780
+ * const jsonData = { type: "API_ERROR", description: "Request failed" };
781
+ * const error = DwnError.fromJson(jsonData);
782
+ * ```
783
+ */
784
+ static fromJson(data: Error): DwnError;
785
+ /**
786
+ * Normalizes and validates error extras properties.
787
+ *
788
+ * Ensures all optional properties have default values and validates the structure
789
+ * of the extras object. Used internally to maintain consistency across error instances.
790
+ *
791
+ * @param {DwnError | DwnErrorExtras} [entity] Error entity or extras object to normalize
792
+ * @returns {Required<DwnErrorExtras>} Normalized extras object with all required properties
793
+ *
794
+ * @internal
795
+ */
796
+ static enforceExtras(entity?: DwnError | DwnErrorExtras): Required<DwnErrorExtras>;
797
+ /**
798
+ * Serializes the error to a string format.
799
+ *
800
+ * Converts the DwnError instance into a parseable string format using the pattern
801
+ * "TYPE -|- DESCRIPTION -|- EXTRAS_JSON" for storage or transmission.
802
+ *
803
+ * @returns {string} Serialized error string
804
+ *
805
+ * @example
806
+ * ```typescript
807
+ * const error = new DwnError("API_ERROR", "Request failed");
808
+ * const serialized = error.toString();
809
+ * // "API_ERROR -|- Request failed -|- {...}"
810
+ * ```
811
+ */
812
+ toString(): string;
813
+ /**
814
+ * Converts the error to a JSON object.
815
+ *
816
+ * Serializes all error properties into a plain JavaScript object suitable
817
+ * for JSON serialization, API responses, or logging.
818
+ *
819
+ * @returns {Error} Plain object representation of the error
820
+ *
821
+ * @example
822
+ * ```typescript
823
+ * const error = new DwnError("VALIDATION_ERROR", "Invalid data");
824
+ * const json = error.toJson();
825
+ * console.log(JSON.stringify(json, null, 2));
826
+ * ```
827
+ */
828
+ toJson(): Error;
829
+ }
830
+ export declare const SYSTEM_DWN_ERRORS: string[];