@bagelink/sdk 0.0.1286 → 0.0.1290

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 (41) hide show
  1. package/bin/index.ts +0 -2
  2. package/bin/utils.ts +0 -66
  3. package/dist/index.cjs +669 -52
  4. package/dist/index.mjs +663 -46
  5. package/package.json +1 -1
  6. package/src/index.ts +1 -1
  7. package/src/openAPITools/openApiTypes.ts +1 -0
  8. package/src/openAPITools/typeGenerator.ts +9 -1
  9. package/src/utils.ts +65 -0
  10. package/dist/chunks/acorn.cjs +0 -20
  11. package/dist/chunks/acorn.mjs +0 -17
  12. package/dist/chunks/angular.cjs +0 -6
  13. package/dist/chunks/angular.mjs +0 -3
  14. package/dist/chunks/babel.cjs +0 -20
  15. package/dist/chunks/babel.mjs +0 -17
  16. package/dist/chunks/estree.cjs +0 -43
  17. package/dist/chunks/estree.mjs +0 -38
  18. package/dist/chunks/flow.cjs +0 -24
  19. package/dist/chunks/flow.mjs +0 -21
  20. package/dist/chunks/glimmer.cjs +0 -37
  21. package/dist/chunks/glimmer.mjs +0 -32
  22. package/dist/chunks/graphql.cjs +0 -37
  23. package/dist/chunks/graphql.mjs +0 -31
  24. package/dist/chunks/html.cjs +0 -30
  25. package/dist/chunks/html.mjs +0 -24
  26. package/dist/chunks/index.cjs +0 -1451
  27. package/dist/chunks/index.mjs +0 -1441
  28. package/dist/chunks/jiti.cjs +0 -371
  29. package/dist/chunks/jiti.mjs +0 -342
  30. package/dist/chunks/markdown.cjs +0 -71
  31. package/dist/chunks/markdown.mjs +0 -65
  32. package/dist/chunks/meriyah.cjs +0 -9
  33. package/dist/chunks/meriyah.mjs +0 -6
  34. package/dist/chunks/postcss.cjs +0 -62
  35. package/dist/chunks/postcss.mjs +0 -56
  36. package/dist/chunks/typescript.cjs +0 -25
  37. package/dist/chunks/typescript.mjs +0 -22
  38. package/dist/chunks/yaml.cjs +0 -169
  39. package/dist/chunks/yaml.mjs +0 -163
  40. package/dist/shared/sdk.BJ23wlaP.mjs +0 -182492
  41. package/dist/shared/sdk.UmZR6apR.cjs +0 -182547
package/bin/index.ts CHANGED
@@ -32,5 +32,3 @@ loadTypes().catch((error: unknown) => {
32
32
  console.error(error)
33
33
  proc.exit(1)
34
34
  })
35
-
36
- export { formatAPIErrorMessage } from './utils'
package/bin/utils.ts CHANGED
@@ -71,69 +71,3 @@ export async function handleAuthCode(_withAuth: boolean, _bagelinkDir: string) {
71
71
  await formatAndWriteCode(authPath, authCode)
72
72
  }
73
73
  }
74
-
75
- export function formatAPIErrorMessage(error: any) {
76
- // Handle case where error or response is undefined
77
- if (!error || !error.response) {
78
- return 'Network error occurred. Please check your connection.'
79
- }
80
-
81
- const { status, data } = error.response
82
-
83
- // Handle validation errors (422)
84
- if (data?.detail && Array.isArray(data.detail)) {
85
- return data.detail
86
- .map((err: any) => {
87
- // Handle nested field paths properly
88
- const fieldPath = err.loc.slice(1).join('.')
89
- const field = fieldPath
90
- .split('.')
91
- .map((part: string) => part.charAt(0).toUpperCase() + part.slice(1))
92
- .join(' ')
93
-
94
- const message = err.msg
95
- // Common validation messages
96
- .replace(/^(?:field|value|string|none) required$/i, 'is required')
97
- .replace(/^value is not a valid/i, 'must be a valid')
98
- .replace(/^ensure this value/i, 'this value must')
99
- .replace(/^str type expected$/i, 'must be text')
100
- .replace(/^value could not be parsed to/i, 'must be a')
101
- .replace(/^ensure this value has at least/i, 'must have at least')
102
- .replace(/^ensure this value has at most/i, 'must have at most')
103
- .replace(/^invalid datetime format/i, 'must be a valid date/time')
104
- .replace(/^value is not a valid email address/i, 'must be a valid email address')
105
- .replace(/^value is not a valid integer/i, 'must be a whole number')
106
- .replace(/^value is not a valid float/i, 'must be a valid number')
107
-
108
- return `${field} ${message.toLowerCase()}`
109
- })
110
- .join('\n')
111
- }
112
-
113
- // Handle specific HTTP status codes
114
- switch (status) {
115
- case 401:
116
- return 'Authentication required. Please log in.'
117
- case 403:
118
- return 'You do not have permission to perform this action.'
119
- case 404:
120
- return 'The requested resource was not found.'
121
- case 429:
122
- return 'Too many requests. Please try again later.'
123
- case 500:
124
- return 'An internal server error occurred. Please try again later.'
125
- }
126
-
127
- // Handle other errors with detail
128
- if (data?.detail && typeof data.detail === 'string') {
129
- return data.detail
130
- }
131
-
132
- // Handle errors with a message field
133
- if (data?.message) {
134
- return data.message
135
- }
136
-
137
- // Generic error fallback
138
- return `An error occurred (Status ${status}): ${error.message || 'Unknown error'}`
139
- }