@everworker/oneringai 0.2.0 → 0.2.2
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/README.md +165 -3
- package/dist/capabilities/agents/index.d.cts +1 -1
- package/dist/capabilities/agents/index.d.ts +1 -1
- package/dist/capabilities/images/index.cjs +44 -4
- package/dist/capabilities/images/index.cjs.map +1 -1
- package/dist/capabilities/images/index.js +44 -4
- package/dist/capabilities/images/index.js.map +1 -1
- package/dist/{index-MJ14lkui.d.cts → index-D62LXWdW.d.cts} +9 -0
- package/dist/{index-B5UaeEvK.d.ts → index-DVb6vfA3.d.ts} +9 -0
- package/dist/index.cjs +3199 -610
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +840 -9
- package/dist/index.d.ts +840 -9
- package/dist/index.js +3165 -611
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +17 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js +17 -0
- package/dist/shared/index.js.map +1 -1
- package/package.json +14 -1
|
@@ -315,14 +315,32 @@ var AuthCodePKCEFlow = class {
|
|
|
315
315
|
if (this.config.usePKCE !== false && verifierData) {
|
|
316
316
|
params.append("code_verifier", verifierData.verifier);
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
let response = await fetch(this.config.tokenUrl, {
|
|
319
319
|
method: "POST",
|
|
320
320
|
headers: {
|
|
321
321
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
322
322
|
},
|
|
323
323
|
body: params
|
|
324
324
|
});
|
|
325
|
-
if (!response.ok) {
|
|
325
|
+
if (!response.ok && this.config.clientSecret) {
|
|
326
|
+
const errorText = await response.text();
|
|
327
|
+
if (isPublicClientError(errorText)) {
|
|
328
|
+
params.delete("client_secret");
|
|
329
|
+
response = await fetch(this.config.tokenUrl, {
|
|
330
|
+
method: "POST",
|
|
331
|
+
headers: {
|
|
332
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
333
|
+
},
|
|
334
|
+
body: params
|
|
335
|
+
});
|
|
336
|
+
if (!response.ok) {
|
|
337
|
+
const retryError = await response.text();
|
|
338
|
+
throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${retryError}`);
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
342
|
+
}
|
|
343
|
+
} else if (!response.ok) {
|
|
326
344
|
const error = await response.text();
|
|
327
345
|
throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${error}`);
|
|
328
346
|
}
|
|
@@ -368,14 +386,32 @@ var AuthCodePKCEFlow = class {
|
|
|
368
386
|
if (this.config.clientSecret) {
|
|
369
387
|
params.append("client_secret", this.config.clientSecret);
|
|
370
388
|
}
|
|
371
|
-
|
|
389
|
+
let response = await fetch(this.config.tokenUrl, {
|
|
372
390
|
method: "POST",
|
|
373
391
|
headers: {
|
|
374
392
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
375
393
|
},
|
|
376
394
|
body: params
|
|
377
395
|
});
|
|
378
|
-
if (!response.ok) {
|
|
396
|
+
if (!response.ok && this.config.clientSecret) {
|
|
397
|
+
const errorText = await response.text();
|
|
398
|
+
if (isPublicClientError(errorText)) {
|
|
399
|
+
params.delete("client_secret");
|
|
400
|
+
response = await fetch(this.config.tokenUrl, {
|
|
401
|
+
method: "POST",
|
|
402
|
+
headers: {
|
|
403
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
404
|
+
},
|
|
405
|
+
body: params
|
|
406
|
+
});
|
|
407
|
+
if (!response.ok) {
|
|
408
|
+
const retryError = await response.text();
|
|
409
|
+
throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${retryError}`);
|
|
410
|
+
}
|
|
411
|
+
} else {
|
|
412
|
+
throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
413
|
+
}
|
|
414
|
+
} else if (!response.ok) {
|
|
379
415
|
const error = await response.text();
|
|
380
416
|
throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${error}`);
|
|
381
417
|
}
|
|
@@ -430,6 +466,10 @@ var AuthCodePKCEFlow = class {
|
|
|
430
466
|
}
|
|
431
467
|
}
|
|
432
468
|
};
|
|
469
|
+
function isPublicClientError(responseBody) {
|
|
470
|
+
const lower = responseBody.toLowerCase();
|
|
471
|
+
return lower.includes("aadsts700025") || lower.includes("invalid_client") && lower.includes("public");
|
|
472
|
+
}
|
|
433
473
|
|
|
434
474
|
// src/connectors/oauth/flows/ClientCredentials.ts
|
|
435
475
|
var ClientCredentialsFlow = class {
|