@bagelink/sdk 1.8.3 → 1.8.7

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.
package/bin/index.ts CHANGED
@@ -24,24 +24,28 @@ export async function loadTypes() {
24
24
  await formatAndWriteCode(apiPath, code)
25
25
 
26
26
  // Copy streamClient utilities to generated directory
27
- const streamClientSource = join(__dirname, '../src/openAPITools/streamClient.ts')
28
- const streamClientDest = join(bagelinkDir, 'streamClient.ts')
27
+ const srcDir = join(__dirname, '..', 'src', 'openAPITools')
28
+ const streamClientSource = join(srcDir, 'streamClient.ts')
29
+ const streamControllerSource = join(srcDir, 'StreamController.ts')
30
+
29
31
  if (fs.existsSync(streamClientSource)) {
30
32
  const streamClientCode = fs.readFileSync(streamClientSource, 'utf-8')
33
+ const streamClientDest = join(bagelinkDir, 'streamClient.ts')
31
34
  await formatAndWriteCode(streamClientDest, streamClientCode)
35
+ console.log('✅ Generated streamClient.ts')
36
+ } else {
37
+ console.warn('⚠️ streamClient.ts not found at:', streamClientSource)
32
38
  }
33
39
 
34
- // Copy StreamController to generated directory
35
- const streamControllerSource = join(__dirname, '../src/openAPITools/StreamController.ts')
36
- const streamControllerDest = join(bagelinkDir, 'StreamController.ts')
37
40
  if (fs.existsSync(streamControllerSource)) {
38
41
  const streamControllerCode = fs.readFileSync(streamControllerSource, 'utf-8')
42
+ const streamControllerDest = join(bagelinkDir, 'StreamController.ts')
39
43
  await formatAndWriteCode(streamControllerDest, streamControllerCode)
44
+ console.log('✅ Generated StreamController.ts')
45
+ } else {
46
+ console.warn('⚠️ StreamController.ts not found at:', streamControllerSource)
40
47
  }
41
48
 
42
- const indexPath = join(bagelinkDir, 'index.ts')
43
- await formatAndWriteCode(indexPath, `export * from './api'\nexport * from './types.d'`)
44
-
45
49
  // Optionally split into organized files
46
50
  if (shouldSplitFiles) {
47
51
  try {
@@ -53,7 +57,6 @@ export async function loadTypes() {
53
57
  console.log('Cleaning up monolithic temporary files...')
54
58
  fs.rmSync(apiPath, { force: true })
55
59
  fs.rmSync(typesPath, { force: true })
56
- fs.rmSync(indexPath, { force: true })
57
60
  } catch (error) {
58
61
  console.error('Error splitting client code:', error)
59
62
  // Continue with monolithic files if splitting fails
package/dist/index.cjs CHANGED
@@ -70,7 +70,11 @@ function extractSSEEventInfo(operation) {
70
70
  const fields = [];
71
71
  const fieldMatches = section.matchAll(/^\s+[-*]\s+`([^`]+)`:\s*([^\n]+)/gm);
72
72
  for (const fieldMatch of fieldMatches) {
73
- const [, fieldName, fieldDescription] = fieldMatch;
73
+ let [, fieldName, fieldDescription] = fieldMatch;
74
+ if (fieldName.includes(".")) {
75
+ const parts = fieldName.split(".");
76
+ fieldName = parts[parts.length - 1];
77
+ }
74
78
  fields.push({
75
79
  name: fieldName,
76
80
  description: fieldDescription.trim()
package/dist/index.mjs CHANGED
@@ -64,7 +64,11 @@ function extractSSEEventInfo(operation) {
64
64
  const fields = [];
65
65
  const fieldMatches = section.matchAll(/^\s+[-*]\s+`([^`]+)`:\s*([^\n]+)/gm);
66
66
  for (const fieldMatch of fieldMatches) {
67
- const [, fieldName, fieldDescription] = fieldMatch;
67
+ let [, fieldName, fieldDescription] = fieldMatch;
68
+ if (fieldName.includes(".")) {
69
+ const parts = fieldName.split(".");
70
+ fieldName = parts[parts.length - 1];
71
+ }
68
72
  fields.push({
69
73
  name: fieldName,
70
74
  description: fieldDescription.trim()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/sdk",
3
3
  "type": "module",
4
- "version": "1.8.3",
4
+ "version": "1.8.7",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -154,7 +154,15 @@ export function extractSSEEventInfo(operation: OpenAPIOperation): SSEEventTypeIn
154
154
  const fieldMatches = section.matchAll(/^\s+[-*]\s+`([^`]+)`:\s*([^\n]+)/gm)
155
155
 
156
156
  for (const fieldMatch of fieldMatches) {
157
- const [, fieldName, fieldDescription] = fieldMatch
157
+ let [, fieldName, fieldDescription] = fieldMatch
158
+
159
+ // Handle nested field names like "error.code" → extract just "code"
160
+ // This handles documentation that shows nested object paths
161
+ if (fieldName.includes('.')) {
162
+ const parts = fieldName.split('.')
163
+ fieldName = parts[parts.length - 1] // Take the last part
164
+ }
165
+
158
166
  fields.push({
159
167
  name: fieldName,
160
168
  description: fieldDescription.trim(),