orchestrated 0.1.14 → 0.1.16
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/index.d.ts +58 -5
- package/index.js +469 -298
- package/index.js.map +8 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -13968,17 +13968,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
13968
13968
|
visit.BREAK = BREAK;
|
|
13969
13969
|
visit.SKIP = SKIP;
|
|
13970
13970
|
visit.REMOVE = REMOVE;
|
|
13971
|
-
function visit_(key, node, visitor,
|
|
13972
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
13971
|
+
function visit_(key, node, visitor, path) {
|
|
13972
|
+
const ctrl = callVisitor(key, node, visitor, path);
|
|
13973
13973
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13974
|
-
replaceNode(key,
|
|
13975
|
-
return visit_(key, ctrl, visitor,
|
|
13974
|
+
replaceNode(key, path, ctrl);
|
|
13975
|
+
return visit_(key, ctrl, visitor, path);
|
|
13976
13976
|
}
|
|
13977
13977
|
if (typeof ctrl !== "symbol") {
|
|
13978
13978
|
if (identity.isCollection(node)) {
|
|
13979
|
-
|
|
13979
|
+
path = Object.freeze(path.concat(node));
|
|
13980
13980
|
for (let i = 0;i < node.items.length; ++i) {
|
|
13981
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
13981
|
+
const ci = visit_(i, node.items[i], visitor, path);
|
|
13982
13982
|
if (typeof ci === "number")
|
|
13983
13983
|
i = ci - 1;
|
|
13984
13984
|
else if (ci === BREAK)
|
|
@@ -13989,13 +13989,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
13989
13989
|
}
|
|
13990
13990
|
}
|
|
13991
13991
|
} else if (identity.isPair(node)) {
|
|
13992
|
-
|
|
13993
|
-
const ck = visit_("key", node.key, visitor,
|
|
13992
|
+
path = Object.freeze(path.concat(node));
|
|
13993
|
+
const ck = visit_("key", node.key, visitor, path);
|
|
13994
13994
|
if (ck === BREAK)
|
|
13995
13995
|
return BREAK;
|
|
13996
13996
|
else if (ck === REMOVE)
|
|
13997
13997
|
node.key = null;
|
|
13998
|
-
const cv = visit_("value", node.value, visitor,
|
|
13998
|
+
const cv = visit_("value", node.value, visitor, path);
|
|
13999
13999
|
if (cv === BREAK)
|
|
14000
14000
|
return BREAK;
|
|
14001
14001
|
else if (cv === REMOVE)
|
|
@@ -14016,17 +14016,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
14016
14016
|
visitAsync.BREAK = BREAK;
|
|
14017
14017
|
visitAsync.SKIP = SKIP;
|
|
14018
14018
|
visitAsync.REMOVE = REMOVE;
|
|
14019
|
-
async function visitAsync_(key, node, visitor,
|
|
14020
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
14019
|
+
async function visitAsync_(key, node, visitor, path) {
|
|
14020
|
+
const ctrl = await callVisitor(key, node, visitor, path);
|
|
14021
14021
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
14022
|
-
replaceNode(key,
|
|
14023
|
-
return visitAsync_(key, ctrl, visitor,
|
|
14022
|
+
replaceNode(key, path, ctrl);
|
|
14023
|
+
return visitAsync_(key, ctrl, visitor, path);
|
|
14024
14024
|
}
|
|
14025
14025
|
if (typeof ctrl !== "symbol") {
|
|
14026
14026
|
if (identity.isCollection(node)) {
|
|
14027
|
-
|
|
14027
|
+
path = Object.freeze(path.concat(node));
|
|
14028
14028
|
for (let i = 0;i < node.items.length; ++i) {
|
|
14029
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
14029
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
14030
14030
|
if (typeof ci === "number")
|
|
14031
14031
|
i = ci - 1;
|
|
14032
14032
|
else if (ci === BREAK)
|
|
@@ -14037,13 +14037,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
14037
14037
|
}
|
|
14038
14038
|
}
|
|
14039
14039
|
} else if (identity.isPair(node)) {
|
|
14040
|
-
|
|
14041
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
14040
|
+
path = Object.freeze(path.concat(node));
|
|
14041
|
+
const ck = await visitAsync_("key", node.key, visitor, path);
|
|
14042
14042
|
if (ck === BREAK)
|
|
14043
14043
|
return BREAK;
|
|
14044
14044
|
else if (ck === REMOVE)
|
|
14045
14045
|
node.key = null;
|
|
14046
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
14046
|
+
const cv = await visitAsync_("value", node.value, visitor, path);
|
|
14047
14047
|
if (cv === BREAK)
|
|
14048
14048
|
return BREAK;
|
|
14049
14049
|
else if (cv === REMOVE)
|
|
@@ -14070,23 +14070,23 @@ var require_visit = __commonJS((exports) => {
|
|
|
14070
14070
|
}
|
|
14071
14071
|
return visitor;
|
|
14072
14072
|
}
|
|
14073
|
-
function callVisitor(key, node, visitor,
|
|
14073
|
+
function callVisitor(key, node, visitor, path) {
|
|
14074
14074
|
if (typeof visitor === "function")
|
|
14075
|
-
return visitor(key, node,
|
|
14075
|
+
return visitor(key, node, path);
|
|
14076
14076
|
if (identity.isMap(node))
|
|
14077
|
-
return visitor.Map?.(key, node,
|
|
14077
|
+
return visitor.Map?.(key, node, path);
|
|
14078
14078
|
if (identity.isSeq(node))
|
|
14079
|
-
return visitor.Seq?.(key, node,
|
|
14079
|
+
return visitor.Seq?.(key, node, path);
|
|
14080
14080
|
if (identity.isPair(node))
|
|
14081
|
-
return visitor.Pair?.(key, node,
|
|
14081
|
+
return visitor.Pair?.(key, node, path);
|
|
14082
14082
|
if (identity.isScalar(node))
|
|
14083
|
-
return visitor.Scalar?.(key, node,
|
|
14083
|
+
return visitor.Scalar?.(key, node, path);
|
|
14084
14084
|
if (identity.isAlias(node))
|
|
14085
|
-
return visitor.Alias?.(key, node,
|
|
14085
|
+
return visitor.Alias?.(key, node, path);
|
|
14086
14086
|
return;
|
|
14087
14087
|
}
|
|
14088
|
-
function replaceNode(key,
|
|
14089
|
-
const parent =
|
|
14088
|
+
function replaceNode(key, path, node) {
|
|
14089
|
+
const parent = path[path.length - 1];
|
|
14090
14090
|
if (identity.isCollection(parent)) {
|
|
14091
14091
|
parent.items[key] = node;
|
|
14092
14092
|
} else if (identity.isPair(parent)) {
|
|
@@ -14643,10 +14643,10 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14643
14643
|
var createNode = require_createNode();
|
|
14644
14644
|
var identity = require_identity();
|
|
14645
14645
|
var Node = require_Node();
|
|
14646
|
-
function collectionFromPath(schema,
|
|
14646
|
+
function collectionFromPath(schema, path, value) {
|
|
14647
14647
|
let v = value;
|
|
14648
|
-
for (let i =
|
|
14649
|
-
const k =
|
|
14648
|
+
for (let i = path.length - 1;i >= 0; --i) {
|
|
14649
|
+
const k = path[i];
|
|
14650
14650
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
14651
14651
|
const a = [];
|
|
14652
14652
|
a[k] = v;
|
|
@@ -14665,7 +14665,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14665
14665
|
sourceObjects: new Map
|
|
14666
14666
|
});
|
|
14667
14667
|
}
|
|
14668
|
-
var isEmptyPath = (
|
|
14668
|
+
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
14669
14669
|
|
|
14670
14670
|
class Collection extends Node.NodeBase {
|
|
14671
14671
|
constructor(type, schema) {
|
|
@@ -14686,11 +14686,11 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14686
14686
|
copy.range = this.range.slice();
|
|
14687
14687
|
return copy;
|
|
14688
14688
|
}
|
|
14689
|
-
addIn(
|
|
14690
|
-
if (isEmptyPath(
|
|
14689
|
+
addIn(path, value) {
|
|
14690
|
+
if (isEmptyPath(path))
|
|
14691
14691
|
this.add(value);
|
|
14692
14692
|
else {
|
|
14693
|
-
const [key, ...rest] =
|
|
14693
|
+
const [key, ...rest] = path;
|
|
14694
14694
|
const node = this.get(key, true);
|
|
14695
14695
|
if (identity.isCollection(node))
|
|
14696
14696
|
node.addIn(rest, value);
|
|
@@ -14700,8 +14700,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14700
14700
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
14701
14701
|
}
|
|
14702
14702
|
}
|
|
14703
|
-
deleteIn(
|
|
14704
|
-
const [key, ...rest] =
|
|
14703
|
+
deleteIn(path) {
|
|
14704
|
+
const [key, ...rest] = path;
|
|
14705
14705
|
if (rest.length === 0)
|
|
14706
14706
|
return this.delete(key);
|
|
14707
14707
|
const node = this.get(key, true);
|
|
@@ -14710,8 +14710,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14710
14710
|
else
|
|
14711
14711
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
14712
14712
|
}
|
|
14713
|
-
getIn(
|
|
14714
|
-
const [key, ...rest] =
|
|
14713
|
+
getIn(path, keepScalar) {
|
|
14714
|
+
const [key, ...rest] = path;
|
|
14715
14715
|
const node = this.get(key, true);
|
|
14716
14716
|
if (rest.length === 0)
|
|
14717
14717
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -14726,15 +14726,15 @@ var require_Collection = __commonJS((exports) => {
|
|
|
14726
14726
|
return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
14727
14727
|
});
|
|
14728
14728
|
}
|
|
14729
|
-
hasIn(
|
|
14730
|
-
const [key, ...rest] =
|
|
14729
|
+
hasIn(path) {
|
|
14730
|
+
const [key, ...rest] = path;
|
|
14731
14731
|
if (rest.length === 0)
|
|
14732
14732
|
return this.has(key);
|
|
14733
14733
|
const node = this.get(key, true);
|
|
14734
14734
|
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
14735
14735
|
}
|
|
14736
|
-
setIn(
|
|
14737
|
-
const [key, ...rest] =
|
|
14736
|
+
setIn(path, value) {
|
|
14737
|
+
const [key, ...rest] = path;
|
|
14738
14738
|
if (rest.length === 0) {
|
|
14739
14739
|
this.set(key, value);
|
|
14740
14740
|
} else {
|
|
@@ -17116,9 +17116,9 @@ var require_Document = __commonJS((exports) => {
|
|
|
17116
17116
|
if (assertCollection(this.contents))
|
|
17117
17117
|
this.contents.add(value);
|
|
17118
17118
|
}
|
|
17119
|
-
addIn(
|
|
17119
|
+
addIn(path, value) {
|
|
17120
17120
|
if (assertCollection(this.contents))
|
|
17121
|
-
this.contents.addIn(
|
|
17121
|
+
this.contents.addIn(path, value);
|
|
17122
17122
|
}
|
|
17123
17123
|
createAlias(node, name) {
|
|
17124
17124
|
if (!node.anchor) {
|
|
@@ -17167,30 +17167,30 @@ var require_Document = __commonJS((exports) => {
|
|
|
17167
17167
|
delete(key) {
|
|
17168
17168
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
17169
17169
|
}
|
|
17170
|
-
deleteIn(
|
|
17171
|
-
if (Collection.isEmptyPath(
|
|
17170
|
+
deleteIn(path) {
|
|
17171
|
+
if (Collection.isEmptyPath(path)) {
|
|
17172
17172
|
if (this.contents == null)
|
|
17173
17173
|
return false;
|
|
17174
17174
|
this.contents = null;
|
|
17175
17175
|
return true;
|
|
17176
17176
|
}
|
|
17177
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
17177
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
|
|
17178
17178
|
}
|
|
17179
17179
|
get(key, keepScalar) {
|
|
17180
17180
|
return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
|
|
17181
17181
|
}
|
|
17182
|
-
getIn(
|
|
17183
|
-
if (Collection.isEmptyPath(
|
|
17182
|
+
getIn(path, keepScalar) {
|
|
17183
|
+
if (Collection.isEmptyPath(path))
|
|
17184
17184
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
17185
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
17185
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
|
|
17186
17186
|
}
|
|
17187
17187
|
has(key) {
|
|
17188
17188
|
return identity.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
17189
17189
|
}
|
|
17190
|
-
hasIn(
|
|
17191
|
-
if (Collection.isEmptyPath(
|
|
17190
|
+
hasIn(path) {
|
|
17191
|
+
if (Collection.isEmptyPath(path))
|
|
17192
17192
|
return this.contents !== undefined;
|
|
17193
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
17193
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
17194
17194
|
}
|
|
17195
17195
|
set(key, value) {
|
|
17196
17196
|
if (this.contents == null) {
|
|
@@ -17199,13 +17199,13 @@ var require_Document = __commonJS((exports) => {
|
|
|
17199
17199
|
this.contents.set(key, value);
|
|
17200
17200
|
}
|
|
17201
17201
|
}
|
|
17202
|
-
setIn(
|
|
17203
|
-
if (Collection.isEmptyPath(
|
|
17202
|
+
setIn(path, value) {
|
|
17203
|
+
if (Collection.isEmptyPath(path)) {
|
|
17204
17204
|
this.contents = value;
|
|
17205
17205
|
} else if (this.contents == null) {
|
|
17206
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
17206
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
17207
17207
|
} else if (assertCollection(this.contents)) {
|
|
17208
|
-
this.contents.setIn(
|
|
17208
|
+
this.contents.setIn(path, value);
|
|
17209
17209
|
}
|
|
17210
17210
|
}
|
|
17211
17211
|
setSchema(version2, options = {}) {
|
|
@@ -19094,9 +19094,9 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
19094
19094
|
visit.BREAK = BREAK;
|
|
19095
19095
|
visit.SKIP = SKIP;
|
|
19096
19096
|
visit.REMOVE = REMOVE;
|
|
19097
|
-
visit.itemAtPath = (cst,
|
|
19097
|
+
visit.itemAtPath = (cst, path) => {
|
|
19098
19098
|
let item = cst;
|
|
19099
|
-
for (const [field, index] of
|
|
19099
|
+
for (const [field, index] of path) {
|
|
19100
19100
|
const tok = item?.[field];
|
|
19101
19101
|
if (tok && "items" in tok) {
|
|
19102
19102
|
item = tok.items[index];
|
|
@@ -19105,23 +19105,23 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
19105
19105
|
}
|
|
19106
19106
|
return item;
|
|
19107
19107
|
};
|
|
19108
|
-
visit.parentCollection = (cst,
|
|
19109
|
-
const parent = visit.itemAtPath(cst,
|
|
19110
|
-
const field =
|
|
19108
|
+
visit.parentCollection = (cst, path) => {
|
|
19109
|
+
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
19110
|
+
const field = path[path.length - 1][0];
|
|
19111
19111
|
const coll = parent?.[field];
|
|
19112
19112
|
if (coll && "items" in coll)
|
|
19113
19113
|
return coll;
|
|
19114
19114
|
throw new Error("Parent collection not found");
|
|
19115
19115
|
};
|
|
19116
|
-
function _visit(
|
|
19117
|
-
let ctrl = visitor(item,
|
|
19116
|
+
function _visit(path, item, visitor) {
|
|
19117
|
+
let ctrl = visitor(item, path);
|
|
19118
19118
|
if (typeof ctrl === "symbol")
|
|
19119
19119
|
return ctrl;
|
|
19120
19120
|
for (const field of ["key", "value"]) {
|
|
19121
19121
|
const token = item[field];
|
|
19122
19122
|
if (token && "items" in token) {
|
|
19123
19123
|
for (let i = 0;i < token.items.length; ++i) {
|
|
19124
|
-
const ci = _visit(Object.freeze(
|
|
19124
|
+
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
|
19125
19125
|
if (typeof ci === "number")
|
|
19126
19126
|
i = ci - 1;
|
|
19127
19127
|
else if (ci === BREAK)
|
|
@@ -19132,10 +19132,10 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
19132
19132
|
}
|
|
19133
19133
|
}
|
|
19134
19134
|
if (typeof ctrl === "function" && field === "key")
|
|
19135
|
-
ctrl = ctrl(item,
|
|
19135
|
+
ctrl = ctrl(item, path);
|
|
19136
19136
|
}
|
|
19137
19137
|
}
|
|
19138
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
19138
|
+
return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
|
|
19139
19139
|
}
|
|
19140
19140
|
exports.visit = visit;
|
|
19141
19141
|
});
|
|
@@ -20404,14 +20404,14 @@ var require_parser = __commonJS((exports) => {
|
|
|
20404
20404
|
case "scalar":
|
|
20405
20405
|
case "single-quoted-scalar":
|
|
20406
20406
|
case "double-quoted-scalar": {
|
|
20407
|
-
const
|
|
20407
|
+
const fs = this.flowScalar(this.type);
|
|
20408
20408
|
if (atNextItem || it.value) {
|
|
20409
|
-
map2.items.push({ start, key:
|
|
20409
|
+
map2.items.push({ start, key: fs, sep: [] });
|
|
20410
20410
|
this.onKeyLine = true;
|
|
20411
20411
|
} else if (it.sep) {
|
|
20412
|
-
this.stack.push(
|
|
20412
|
+
this.stack.push(fs);
|
|
20413
20413
|
} else {
|
|
20414
|
-
Object.assign(it, { key:
|
|
20414
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
20415
20415
|
this.onKeyLine = true;
|
|
20416
20416
|
}
|
|
20417
20417
|
return;
|
|
@@ -20539,13 +20539,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
20539
20539
|
case "scalar":
|
|
20540
20540
|
case "single-quoted-scalar":
|
|
20541
20541
|
case "double-quoted-scalar": {
|
|
20542
|
-
const
|
|
20542
|
+
const fs = this.flowScalar(this.type);
|
|
20543
20543
|
if (!it || it.value)
|
|
20544
|
-
fc.items.push({ start: [], key:
|
|
20544
|
+
fc.items.push({ start: [], key: fs, sep: [] });
|
|
20545
20545
|
else if (it.sep)
|
|
20546
|
-
this.stack.push(
|
|
20546
|
+
this.stack.push(fs);
|
|
20547
20547
|
else
|
|
20548
|
-
Object.assign(it, { key:
|
|
20548
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
20549
20549
|
return;
|
|
20550
20550
|
}
|
|
20551
20551
|
case "flow-map-end":
|
|
@@ -20854,16 +20854,16 @@ __export(exports_config, {
|
|
|
20854
20854
|
loadConfig: () => loadConfig,
|
|
20855
20855
|
configExists: () => configExists
|
|
20856
20856
|
});
|
|
20857
|
-
import { existsSync
|
|
20858
|
-
import { join
|
|
20857
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
20858
|
+
import { join } from "node:path";
|
|
20859
20859
|
function parseYaml(content) {
|
|
20860
20860
|
return $parse(content);
|
|
20861
20861
|
}
|
|
20862
20862
|
function loadConfig(searchDir) {
|
|
20863
20863
|
const dir = searchDir || process.cwd();
|
|
20864
20864
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
20865
|
-
const configPath =
|
|
20866
|
-
if (
|
|
20865
|
+
const configPath = join(dir, fileName);
|
|
20866
|
+
if (existsSync(configPath)) {
|
|
20867
20867
|
try {
|
|
20868
20868
|
const content = readFileSync(configPath, "utf-8");
|
|
20869
20869
|
const parsed = parseYaml(content);
|
|
@@ -20879,8 +20879,8 @@ function loadConfig(searchDir) {
|
|
|
20879
20879
|
function configExists(searchDir) {
|
|
20880
20880
|
const dir = searchDir || process.cwd();
|
|
20881
20881
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
20882
|
-
const configPath =
|
|
20883
|
-
if (
|
|
20882
|
+
const configPath = join(dir, fileName);
|
|
20883
|
+
if (existsSync(configPath)) {
|
|
20884
20884
|
return true;
|
|
20885
20885
|
}
|
|
20886
20886
|
}
|
|
@@ -20888,11 +20888,11 @@ function configExists(searchDir) {
|
|
|
20888
20888
|
}
|
|
20889
20889
|
function saveConfig(config2, targetDir) {
|
|
20890
20890
|
const dir = targetDir || process.cwd();
|
|
20891
|
-
const configPath =
|
|
20891
|
+
const configPath = join(dir, "Orchestrated.yaml");
|
|
20892
20892
|
try {
|
|
20893
20893
|
const validated = OrchestralConfigSchema.parse(config2);
|
|
20894
20894
|
const yamlContent = $stringify(validated);
|
|
20895
|
-
|
|
20895
|
+
writeFileSync(configPath, yamlContent, "utf-8");
|
|
20896
20896
|
} catch (error48) {
|
|
20897
20897
|
throw new Error(`Failed to save config to ${configPath}: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
20898
20898
|
}
|
|
@@ -20910,7 +20910,12 @@ var init_config = __esm(() => {
|
|
|
20910
20910
|
appClientId: exports_external.string().optional().catch(undefined),
|
|
20911
20911
|
otelEndpoint: exports_external.string().optional().catch(undefined),
|
|
20912
20912
|
sendNoLogs: exports_external.boolean().optional().catch(undefined),
|
|
20913
|
-
disableBundleCache: exports_external.boolean().optional().catch(undefined)
|
|
20913
|
+
disableBundleCache: exports_external.boolean().optional().catch(undefined),
|
|
20914
|
+
bedrockServiceRoleArn: exports_external.string().optional().catch(undefined),
|
|
20915
|
+
bedrockModelId: exports_external.string().optional().catch(undefined),
|
|
20916
|
+
bedrockRegion: exports_external.string().optional().catch(undefined),
|
|
20917
|
+
bedrockApiKey: exports_external.string().optional().catch(undefined),
|
|
20918
|
+
bedrockS3Bucket: exports_external.string().optional().catch(undefined)
|
|
20914
20919
|
});
|
|
20915
20920
|
CONFIG_FILE_NAMES = [
|
|
20916
20921
|
"Orchestrated.yaml",
|
|
@@ -20932,22 +20937,22 @@ __export(exports_credentials, {
|
|
|
20932
20937
|
});
|
|
20933
20938
|
import {
|
|
20934
20939
|
chmodSync,
|
|
20935
|
-
existsSync as
|
|
20936
|
-
mkdirSync
|
|
20940
|
+
existsSync as existsSync2,
|
|
20941
|
+
mkdirSync,
|
|
20937
20942
|
readFileSync as readFileSync2,
|
|
20938
|
-
unlinkSync
|
|
20939
|
-
writeFileSync as
|
|
20943
|
+
unlinkSync,
|
|
20944
|
+
writeFileSync as writeFileSync2
|
|
20940
20945
|
} from "node:fs";
|
|
20941
20946
|
import { homedir } from "node:os";
|
|
20942
|
-
import { join as
|
|
20947
|
+
import { join as join2 } from "node:path";
|
|
20943
20948
|
function ensureCredentialsDir() {
|
|
20944
|
-
if (!
|
|
20945
|
-
|
|
20949
|
+
if (!existsSync2(CREDENTIALS_DIR)) {
|
|
20950
|
+
mkdirSync(CREDENTIALS_DIR, { recursive: true, mode: 448 });
|
|
20946
20951
|
}
|
|
20947
20952
|
}
|
|
20948
20953
|
function saveCredentials(credentials) {
|
|
20949
20954
|
ensureCredentialsDir();
|
|
20950
|
-
|
|
20955
|
+
writeFileSync2(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2), {
|
|
20951
20956
|
mode: 384
|
|
20952
20957
|
});
|
|
20953
20958
|
try {
|
|
@@ -20957,7 +20962,7 @@ function saveCredentials(credentials) {
|
|
|
20957
20962
|
}
|
|
20958
20963
|
}
|
|
20959
20964
|
function loadCredentials() {
|
|
20960
|
-
if (!
|
|
20965
|
+
if (!existsSync2(CREDENTIALS_FILE)) {
|
|
20961
20966
|
return null;
|
|
20962
20967
|
}
|
|
20963
20968
|
try {
|
|
@@ -20975,9 +20980,9 @@ function loadCredentials() {
|
|
|
20975
20980
|
}
|
|
20976
20981
|
}
|
|
20977
20982
|
function clearCredentials() {
|
|
20978
|
-
if (
|
|
20983
|
+
if (existsSync2(CREDENTIALS_FILE)) {
|
|
20979
20984
|
try {
|
|
20980
|
-
|
|
20985
|
+
unlinkSync(CREDENTIALS_FILE);
|
|
20981
20986
|
} catch (error48) {
|
|
20982
20987
|
console.error("Failed to clear credentials:", error48);
|
|
20983
20988
|
}
|
|
@@ -21062,11 +21067,18 @@ function decodeIdToken(idToken) {
|
|
|
21062
21067
|
}
|
|
21063
21068
|
var CREDENTIALS_DIR, CREDENTIALS_FILE;
|
|
21064
21069
|
var init_credentials = __esm(() => {
|
|
21065
|
-
CREDENTIALS_DIR =
|
|
21066
|
-
CREDENTIALS_FILE =
|
|
21070
|
+
CREDENTIALS_DIR = join2(homedir(), ".orcha");
|
|
21071
|
+
CREDENTIALS_FILE = join2(CREDENTIALS_DIR, "credentials.json");
|
|
21067
21072
|
});
|
|
21068
21073
|
|
|
21069
21074
|
// src/state/index.ts
|
|
21075
|
+
var exports_state = {};
|
|
21076
|
+
__export(exports_state, {
|
|
21077
|
+
resetState: () => resetState,
|
|
21078
|
+
isStateInitialized: () => isStateInitialized,
|
|
21079
|
+
initState: () => initState,
|
|
21080
|
+
getState: () => getState
|
|
21081
|
+
});
|
|
21070
21082
|
function parseUserFromToken(token) {
|
|
21071
21083
|
try {
|
|
21072
21084
|
const parts = token.split(".");
|
|
@@ -21140,7 +21152,12 @@ async function initState(partial2 = {}, skipAuth = false) {
|
|
|
21140
21152
|
awsAccessKeyId: partial2.awsAccessKeyId || process.env.AWS_ACCESS_KEY_ID || null,
|
|
21141
21153
|
awsSecretAccessKey: partial2.awsSecretAccessKey || process.env.AWS_SECRET_ACCESS_KEY || null,
|
|
21142
21154
|
awsSessionToken: partial2.awsSessionToken || process.env.AWS_SESSION_TOKEN || null,
|
|
21143
|
-
disableBundleCache: partial2.disableBundleCache ?? fileConfig?.disableBundleCache ?? false
|
|
21155
|
+
disableBundleCache: partial2.disableBundleCache ?? fileConfig?.disableBundleCache ?? false,
|
|
21156
|
+
bedrockServiceRoleArn: partial2.bedrockServiceRoleArn || process.env.ORCHESTRATED_BEDROCK_SERVICE_ROLE_ARN || fileConfig?.bedrockServiceRoleArn || null,
|
|
21157
|
+
bedrockModelId: partial2.bedrockModelId || process.env.ORCHESTRATED_BEDROCK_MODEL_ID || fileConfig?.bedrockModelId || null,
|
|
21158
|
+
bedrockRegion: partial2.bedrockRegion || process.env.ORCHESTRATED_BEDROCK_REGION || fileConfig?.bedrockRegion || null,
|
|
21159
|
+
bedrockApiKey: partial2.bedrockApiKey || process.env.ORCHESTRATED_BEDROCK_API_KEY || fileConfig?.bedrockApiKey || null,
|
|
21160
|
+
bedrockS3Bucket: partial2.bedrockS3Bucket || process.env.ORCHESTRATED_BEDROCK_S3_BUCKET || fileConfig?.bedrockS3Bucket || null
|
|
21144
21161
|
};
|
|
21145
21162
|
globalState = Object.freeze(state);
|
|
21146
21163
|
globalThis.__ORCHESTRATED_SHARED_STATE__ = globalState;
|
|
@@ -21165,90 +21182,6 @@ function isStateInitialized() {
|
|
|
21165
21182
|
}
|
|
21166
21183
|
var globalState = null, isInitialized = false;
|
|
21167
21184
|
|
|
21168
|
-
// src/serialization/data-source.ts
|
|
21169
|
-
async function getDataset(datasetName, source, options) {
|
|
21170
|
-
const state = getState();
|
|
21171
|
-
const accessToken = options.accessToken || state.accessToken;
|
|
21172
|
-
const apiKey = options.apiKey || state.apiKey;
|
|
21173
|
-
const headers = {
|
|
21174
|
-
"Content-Type": "application/json"
|
|
21175
|
-
};
|
|
21176
|
-
if (apiKey) {
|
|
21177
|
-
headers["x-api-key"] = apiKey;
|
|
21178
|
-
} else if (accessToken) {
|
|
21179
|
-
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
21180
|
-
} else {
|
|
21181
|
-
throw new Error("Authentication is required. Either provide accessToken, apiKey option, or set ORCHESTRATED_ACCESS_TOKEN/ORCHESTRATED_API_KEY environment variable. Run 'orcha login' to authenticate.");
|
|
21182
|
-
}
|
|
21183
|
-
const baseUrl = source.baseUrl.replace(/\/$/, "");
|
|
21184
|
-
let path2 = source.path.replace(/^\//, "");
|
|
21185
|
-
if (accessToken && !apiKey && !path2.startsWith("me/")) {
|
|
21186
|
-
path2 = `me/${path2}`;
|
|
21187
|
-
}
|
|
21188
|
-
const params = {
|
|
21189
|
-
...options,
|
|
21190
|
-
name: datasetName,
|
|
21191
|
-
tenantId: options.tenantId || state.tenantId,
|
|
21192
|
-
serviceName: options.serviceName || state.serviceName,
|
|
21193
|
-
environment: options.environment || state.environment
|
|
21194
|
-
};
|
|
21195
|
-
const timeout = options.timeout ?? 30000;
|
|
21196
|
-
const controller = new AbortController;
|
|
21197
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
21198
|
-
try {
|
|
21199
|
-
let url2;
|
|
21200
|
-
let fetchOptions;
|
|
21201
|
-
if (source.method === "GET") {
|
|
21202
|
-
const queryParams = new URLSearchParams(Object.entries(params).filter(([_, v]) => v !== undefined));
|
|
21203
|
-
url2 = `${baseUrl}/${path2}?${queryParams.toString()}`;
|
|
21204
|
-
fetchOptions = {
|
|
21205
|
-
method: "GET",
|
|
21206
|
-
headers,
|
|
21207
|
-
signal: controller.signal
|
|
21208
|
-
};
|
|
21209
|
-
} else {
|
|
21210
|
-
url2 = `${baseUrl}/${path2}`;
|
|
21211
|
-
fetchOptions = {
|
|
21212
|
-
method: "POST",
|
|
21213
|
-
headers,
|
|
21214
|
-
body: JSON.stringify(params),
|
|
21215
|
-
signal: controller.signal
|
|
21216
|
-
};
|
|
21217
|
-
}
|
|
21218
|
-
const response = await fetch(url2, fetchOptions);
|
|
21219
|
-
clearTimeout(timeoutId);
|
|
21220
|
-
if (!response.ok) {
|
|
21221
|
-
const errorText = await response.text();
|
|
21222
|
-
throw new Error(`API Gateway request failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
21223
|
-
}
|
|
21224
|
-
const rawData = await response.json();
|
|
21225
|
-
const data = DatasetResponseSchema.parse(rawData);
|
|
21226
|
-
return data.data;
|
|
21227
|
-
} catch (error48) {
|
|
21228
|
-
clearTimeout(timeoutId);
|
|
21229
|
-
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
21230
|
-
throw new Error(`API Gateway request timed out after ${timeout}ms`);
|
|
21231
|
-
}
|
|
21232
|
-
throw error48;
|
|
21233
|
-
}
|
|
21234
|
-
}
|
|
21235
|
-
var getApiUrl = () => {
|
|
21236
|
-
return getState().apiUrl;
|
|
21237
|
-
}, DatasetResponseSchema;
|
|
21238
|
-
var init_data_source = __esm(() => {
|
|
21239
|
-
init_zod();
|
|
21240
|
-
DatasetResponseSchema = exports_external.object({
|
|
21241
|
-
data: exports_external.array(exports_external.object({
|
|
21242
|
-
id: exports_external.string(),
|
|
21243
|
-
ctx: exports_external.object({
|
|
21244
|
-
systemPrompt: exports_external.string().optional()
|
|
21245
|
-
}).loose(),
|
|
21246
|
-
input: exports_external.string(),
|
|
21247
|
-
output: exports_external.string()
|
|
21248
|
-
}).loose())
|
|
21249
|
-
}).passthrough();
|
|
21250
|
-
});
|
|
21251
|
-
|
|
21252
21185
|
// node_modules/.pnpm/@smithy+types@4.12.0/node_modules/@smithy/types/dist-cjs/index.js
|
|
21253
21186
|
var require_dist_cjs = __commonJS((exports) => {
|
|
21254
21187
|
exports.HttpAuthLocation = undefined;
|
|
@@ -22583,12 +22516,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
22583
22516
|
const password = request.password ?? "";
|
|
22584
22517
|
auth = `${username}:${password}`;
|
|
22585
22518
|
}
|
|
22586
|
-
let
|
|
22519
|
+
let path = request.path;
|
|
22587
22520
|
if (queryString) {
|
|
22588
|
-
|
|
22521
|
+
path += `?${queryString}`;
|
|
22589
22522
|
}
|
|
22590
22523
|
if (request.fragment) {
|
|
22591
|
-
|
|
22524
|
+
path += `#${request.fragment}`;
|
|
22592
22525
|
}
|
|
22593
22526
|
let hostname3 = request.hostname ?? "";
|
|
22594
22527
|
if (hostname3[0] === "[" && hostname3.endsWith("]")) {
|
|
@@ -22600,7 +22533,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
22600
22533
|
headers: request.headers,
|
|
22601
22534
|
host: hostname3,
|
|
22602
22535
|
method: request.method,
|
|
22603
|
-
path
|
|
22536
|
+
path,
|
|
22604
22537
|
port: request.port,
|
|
22605
22538
|
agent,
|
|
22606
22539
|
auth
|
|
@@ -22858,16 +22791,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
22858
22791
|
reject(err);
|
|
22859
22792
|
};
|
|
22860
22793
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
22861
|
-
let
|
|
22794
|
+
let path = request.path;
|
|
22862
22795
|
if (queryString) {
|
|
22863
|
-
|
|
22796
|
+
path += `?${queryString}`;
|
|
22864
22797
|
}
|
|
22865
22798
|
if (request.fragment) {
|
|
22866
|
-
|
|
22799
|
+
path += `#${request.fragment}`;
|
|
22867
22800
|
}
|
|
22868
22801
|
const req = session.request({
|
|
22869
22802
|
...request.headers,
|
|
22870
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
22803
|
+
[http2.constants.HTTP2_HEADER_PATH]: path,
|
|
22871
22804
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
22872
22805
|
});
|
|
22873
22806
|
session.ref();
|
|
@@ -23054,13 +22987,13 @@ var require_dist_cjs13 = __commonJS((exports) => {
|
|
|
23054
22987
|
abortError.name = "AbortError";
|
|
23055
22988
|
return Promise.reject(abortError);
|
|
23056
22989
|
}
|
|
23057
|
-
let
|
|
22990
|
+
let path = request.path;
|
|
23058
22991
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
23059
22992
|
if (queryString) {
|
|
23060
|
-
|
|
22993
|
+
path += `?${queryString}`;
|
|
23061
22994
|
}
|
|
23062
22995
|
if (request.fragment) {
|
|
23063
|
-
|
|
22996
|
+
path += `#${request.fragment}`;
|
|
23064
22997
|
}
|
|
23065
22998
|
let auth = "";
|
|
23066
22999
|
if (request.username != null || request.password != null) {
|
|
@@ -23069,7 +23002,7 @@ var require_dist_cjs13 = __commonJS((exports) => {
|
|
|
23069
23002
|
auth = `${username}:${password}@`;
|
|
23070
23003
|
}
|
|
23071
23004
|
const { port, method } = request;
|
|
23072
|
-
const url2 = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
23005
|
+
const url2 = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path}`;
|
|
23073
23006
|
const body = method === "GET" || method === "HEAD" ? undefined : request.body;
|
|
23074
23007
|
const requestOptions = {
|
|
23075
23008
|
body,
|
|
@@ -24677,13 +24610,13 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
24677
24610
|
}
|
|
24678
24611
|
return next();
|
|
24679
24612
|
};
|
|
24680
|
-
__rewriteRelativeImportExtension = function(
|
|
24681
|
-
if (typeof
|
|
24682
|
-
return
|
|
24613
|
+
__rewriteRelativeImportExtension = function(path, preserveJsx) {
|
|
24614
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
24615
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
24683
24616
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
24684
24617
|
});
|
|
24685
24618
|
}
|
|
24686
|
-
return
|
|
24619
|
+
return path;
|
|
24687
24620
|
};
|
|
24688
24621
|
exporter("__extends", __extends);
|
|
24689
24622
|
exporter("__assign", __assign);
|
|
@@ -25839,11 +25772,11 @@ var require_protocols = __commonJS((exports) => {
|
|
|
25839
25772
|
const opTraits = schema.translateTraits(operationSchema.traits);
|
|
25840
25773
|
if (opTraits.http) {
|
|
25841
25774
|
request.method = opTraits.http[0];
|
|
25842
|
-
const [
|
|
25775
|
+
const [path, search] = opTraits.http[1].split("?");
|
|
25843
25776
|
if (request.path == "/") {
|
|
25844
|
-
request.path =
|
|
25777
|
+
request.path = path;
|
|
25845
25778
|
} else {
|
|
25846
|
-
request.path +=
|
|
25779
|
+
request.path += path;
|
|
25847
25780
|
}
|
|
25848
25781
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
25849
25782
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -26200,8 +26133,8 @@ var require_protocols = __commonJS((exports) => {
|
|
|
26200
26133
|
return this;
|
|
26201
26134
|
}
|
|
26202
26135
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
26203
|
-
this.resolvePathStack.push((
|
|
26204
|
-
this.path = resolvedPath(
|
|
26136
|
+
this.resolvePathStack.push((path) => {
|
|
26137
|
+
this.path = resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
26205
26138
|
});
|
|
26206
26139
|
return this;
|
|
26207
26140
|
}
|
|
@@ -26607,10 +26540,10 @@ var require_dist_cjs17 = __commonJS((exports) => {
|
|
|
26607
26540
|
const promisified = Promise.resolve(input);
|
|
26608
26541
|
return () => promisified;
|
|
26609
26542
|
};
|
|
26610
|
-
var makePagedClientRequest = async (CommandCtor,
|
|
26543
|
+
var makePagedClientRequest = async (CommandCtor, client, input, withCommand = (_) => _, ...args) => {
|
|
26611
26544
|
let command = new CommandCtor(input);
|
|
26612
26545
|
command = withCommand(command) ?? command;
|
|
26613
|
-
return await
|
|
26546
|
+
return await client.send(command, ...args);
|
|
26614
26547
|
};
|
|
26615
26548
|
function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) {
|
|
26616
26549
|
return async function* paginateOperation(config2, input, ...additionalArguments) {
|
|
@@ -26636,9 +26569,9 @@ var require_dist_cjs17 = __commonJS((exports) => {
|
|
|
26636
26569
|
return;
|
|
26637
26570
|
};
|
|
26638
26571
|
}
|
|
26639
|
-
var get = (fromObject,
|
|
26572
|
+
var get = (fromObject, path) => {
|
|
26640
26573
|
let cursor = fromObject;
|
|
26641
|
-
const pathComponents =
|
|
26574
|
+
const pathComponents = path.split(".");
|
|
26642
26575
|
for (const step of pathComponents) {
|
|
26643
26576
|
if (!cursor || typeof cursor !== "object") {
|
|
26644
26577
|
return;
|
|
@@ -27282,10 +27215,10 @@ ${longDate}
|
|
|
27282
27215
|
${credentialScope}
|
|
27283
27216
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
27284
27217
|
}
|
|
27285
|
-
getCanonicalPath({ path
|
|
27218
|
+
getCanonicalPath({ path }) {
|
|
27286
27219
|
if (this.uriEscapePath) {
|
|
27287
27220
|
const normalizedPathSegments = [];
|
|
27288
|
-
for (const pathSegment of
|
|
27221
|
+
for (const pathSegment of path.split("/")) {
|
|
27289
27222
|
if (pathSegment?.length === 0)
|
|
27290
27223
|
continue;
|
|
27291
27224
|
if (pathSegment === ".")
|
|
@@ -27296,11 +27229,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
27296
27229
|
normalizedPathSegments.push(pathSegment);
|
|
27297
27230
|
}
|
|
27298
27231
|
}
|
|
27299
|
-
const normalizedPath = `${
|
|
27232
|
+
const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
|
|
27300
27233
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
27301
27234
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
27302
27235
|
}
|
|
27303
|
-
return
|
|
27236
|
+
return path;
|
|
27304
27237
|
}
|
|
27305
27238
|
validateResolvedCredentials(credentials) {
|
|
27306
27239
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -28212,14 +28145,14 @@ var require_cbor = __commonJS((exports) => {
|
|
|
28212
28145
|
throw new Error("Malformed RPCv2 CBOR response, status: " + response.statusCode);
|
|
28213
28146
|
}
|
|
28214
28147
|
};
|
|
28215
|
-
var buildHttpRpcRequest = async (context, headers,
|
|
28148
|
+
var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
|
|
28216
28149
|
const { hostname: hostname3, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
28217
28150
|
const contents = {
|
|
28218
28151
|
protocol,
|
|
28219
28152
|
hostname: hostname3,
|
|
28220
28153
|
port,
|
|
28221
28154
|
method: "POST",
|
|
28222
|
-
path: basePath.endsWith("/") ? basePath.slice(0, -1) +
|
|
28155
|
+
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
|
28223
28156
|
headers: {
|
|
28224
28157
|
...headers
|
|
28225
28158
|
}
|
|
@@ -28463,11 +28396,11 @@ var require_cbor = __commonJS((exports) => {
|
|
|
28463
28396
|
} catch (e) {}
|
|
28464
28397
|
}
|
|
28465
28398
|
const { service, operation } = utilMiddleware.getSmithyContext(context);
|
|
28466
|
-
const
|
|
28399
|
+
const path = `/service/${service}/operation/${operation}`;
|
|
28467
28400
|
if (request.path.endsWith("/")) {
|
|
28468
|
-
request.path +=
|
|
28401
|
+
request.path += path.slice(1);
|
|
28469
28402
|
} else {
|
|
28470
|
-
request.path +=
|
|
28403
|
+
request.path += path;
|
|
28471
28404
|
}
|
|
28472
28405
|
return request;
|
|
28473
28406
|
}
|
|
@@ -30458,7 +30391,7 @@ var require_dist_cjs24 = __commonJS((exports) => {
|
|
|
30458
30391
|
var protocolHttp = require_dist_cjs2();
|
|
30459
30392
|
var core2 = require_dist_cjs17();
|
|
30460
30393
|
var propertyProvider = require_dist_cjs18();
|
|
30461
|
-
var
|
|
30394
|
+
var client = require_client();
|
|
30462
30395
|
var signatureV4 = require_dist_cjs19();
|
|
30463
30396
|
var cbor = require_cbor();
|
|
30464
30397
|
var schema = require_schema4();
|
|
@@ -30671,7 +30604,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
30671
30604
|
const creds = await boundProvider(options);
|
|
30672
30605
|
const attributedCreds = creds;
|
|
30673
30606
|
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
30674
|
-
return
|
|
30607
|
+
return client.setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
30675
30608
|
}
|
|
30676
30609
|
return attributedCreds;
|
|
30677
30610
|
};
|
|
@@ -34971,18 +34904,18 @@ var require_dist_cjs36 = __commonJS((exports) => {
|
|
|
34971
34904
|
}
|
|
34972
34905
|
}
|
|
34973
34906
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
34974
|
-
var getAttrPathList = (
|
|
34975
|
-
const parts =
|
|
34907
|
+
var getAttrPathList = (path) => {
|
|
34908
|
+
const parts = path.split(".");
|
|
34976
34909
|
const pathList = [];
|
|
34977
34910
|
for (const part of parts) {
|
|
34978
34911
|
const squareBracketIndex = part.indexOf("[");
|
|
34979
34912
|
if (squareBracketIndex !== -1) {
|
|
34980
34913
|
if (part.indexOf("]") !== part.length - 1) {
|
|
34981
|
-
throw new EndpointError(`Path: '${
|
|
34914
|
+
throw new EndpointError(`Path: '${path}' does not end with ']'`);
|
|
34982
34915
|
}
|
|
34983
34916
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
34984
34917
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
34985
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
34918
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
|
|
34986
34919
|
}
|
|
34987
34920
|
if (squareBracketIndex !== 0) {
|
|
34988
34921
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -34994,9 +34927,9 @@ var require_dist_cjs36 = __commonJS((exports) => {
|
|
|
34994
34927
|
}
|
|
34995
34928
|
return pathList;
|
|
34996
34929
|
};
|
|
34997
|
-
var getAttr = (value,
|
|
34930
|
+
var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
|
|
34998
34931
|
if (typeof acc !== "object") {
|
|
34999
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
34932
|
+
throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
|
35000
34933
|
} else if (Array.isArray(acc)) {
|
|
35001
34934
|
return acc[parseInt(index)];
|
|
35002
34935
|
}
|
|
@@ -35015,8 +34948,8 @@ var require_dist_cjs36 = __commonJS((exports) => {
|
|
|
35015
34948
|
return value;
|
|
35016
34949
|
}
|
|
35017
34950
|
if (typeof value === "object" && "hostname" in value) {
|
|
35018
|
-
const { hostname: hostname4, port, protocol: protocol2 = "", path
|
|
35019
|
-
const url2 = new URL(`${protocol2}//${hostname4}${port ? `:${port}` : ""}${
|
|
34951
|
+
const { hostname: hostname4, port, protocol: protocol2 = "", path = "", query = {} } = value;
|
|
34952
|
+
const url2 = new URL(`${protocol2}//${hostname4}${port ? `:${port}` : ""}${path}`);
|
|
35020
34953
|
url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
|
|
35021
34954
|
return url2;
|
|
35022
34955
|
}
|
|
@@ -36224,14 +36157,14 @@ var require_readFile = __commonJS((exports) => {
|
|
|
36224
36157
|
var promises_1 = __require("node:fs/promises");
|
|
36225
36158
|
exports.filePromises = {};
|
|
36226
36159
|
exports.fileIntercept = {};
|
|
36227
|
-
var readFile = (
|
|
36228
|
-
if (exports.fileIntercept[
|
|
36229
|
-
return exports.fileIntercept[
|
|
36160
|
+
var readFile = (path, options) => {
|
|
36161
|
+
if (exports.fileIntercept[path] !== undefined) {
|
|
36162
|
+
return exports.fileIntercept[path];
|
|
36230
36163
|
}
|
|
36231
|
-
if (!exports.filePromises[
|
|
36232
|
-
exports.filePromises[
|
|
36164
|
+
if (!exports.filePromises[path] || options?.ignoreCache) {
|
|
36165
|
+
exports.filePromises[path] = (0, promises_1.readFile)(path, "utf8");
|
|
36233
36166
|
}
|
|
36234
|
-
return exports.filePromises[
|
|
36167
|
+
return exports.filePromises[path];
|
|
36235
36168
|
};
|
|
36236
36169
|
exports.readFile = readFile;
|
|
36237
36170
|
});
|
|
@@ -36241,7 +36174,7 @@ var require_dist_cjs44 = __commonJS((exports) => {
|
|
|
36241
36174
|
var getHomeDir = require_getHomeDir();
|
|
36242
36175
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
36243
36176
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
36244
|
-
var
|
|
36177
|
+
var path = __require("path");
|
|
36245
36178
|
var types = require_dist_cjs();
|
|
36246
36179
|
var readFile = require_readFile();
|
|
36247
36180
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -36263,9 +36196,9 @@ var require_dist_cjs44 = __commonJS((exports) => {
|
|
|
36263
36196
|
...data.default && { default: data.default }
|
|
36264
36197
|
});
|
|
36265
36198
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
36266
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
36199
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
36267
36200
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
36268
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
36201
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
36269
36202
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
36270
36203
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
36271
36204
|
var parseIni = (iniData) => {
|
|
@@ -36320,11 +36253,11 @@ var require_dist_cjs44 = __commonJS((exports) => {
|
|
|
36320
36253
|
const relativeHomeDirPrefix = "~/";
|
|
36321
36254
|
let resolvedFilepath = filepath;
|
|
36322
36255
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
36323
|
-
resolvedFilepath =
|
|
36256
|
+
resolvedFilepath = path.join(homeDir, filepath.slice(2));
|
|
36324
36257
|
}
|
|
36325
36258
|
let resolvedConfigFilepath = configFilepath;
|
|
36326
36259
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
36327
|
-
resolvedConfigFilepath =
|
|
36260
|
+
resolvedConfigFilepath = path.join(homeDir, configFilepath.slice(2));
|
|
36328
36261
|
}
|
|
36329
36262
|
const parsedFiles = await Promise.all([
|
|
36330
36263
|
readFile.readFile(resolvedConfigFilepath, {
|
|
@@ -36363,8 +36296,8 @@ var require_dist_cjs44 = __commonJS((exports) => {
|
|
|
36363
36296
|
getFileRecord() {
|
|
36364
36297
|
return readFile.fileIntercept;
|
|
36365
36298
|
},
|
|
36366
|
-
interceptFile(
|
|
36367
|
-
readFile.fileIntercept[
|
|
36299
|
+
interceptFile(path2, contents) {
|
|
36300
|
+
readFile.fileIntercept[path2] = Promise.resolve(contents);
|
|
36368
36301
|
},
|
|
36369
36302
|
getTokenRecord() {
|
|
36370
36303
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -36592,8 +36525,8 @@ var require_dist_cjs46 = __commonJS((exports) => {
|
|
|
36592
36525
|
return endpoint.url.href;
|
|
36593
36526
|
}
|
|
36594
36527
|
if ("hostname" in endpoint) {
|
|
36595
|
-
const { protocol, hostname: hostname3, port, path
|
|
36596
|
-
return `${protocol}//${hostname3}${port ? ":" + port : ""}${
|
|
36528
|
+
const { protocol, hostname: hostname3, port, path } = endpoint;
|
|
36529
|
+
return `${protocol}//${hostname3}${port ? ":" + port : ""}${path}`;
|
|
36597
36530
|
}
|
|
36598
36531
|
}
|
|
36599
36532
|
return endpoint;
|
|
@@ -37659,7 +37592,7 @@ var require_dist_cjs52 = __commonJS((exports) => {
|
|
|
37659
37592
|
var protocolHttp = require_dist_cjs2();
|
|
37660
37593
|
var core2 = require_dist_cjs17();
|
|
37661
37594
|
var propertyProvider = require_dist_cjs18();
|
|
37662
|
-
var
|
|
37595
|
+
var client = require_client2();
|
|
37663
37596
|
var signatureV4 = require_dist_cjs19();
|
|
37664
37597
|
var cbor = require_cbor();
|
|
37665
37598
|
var schema = require_schema4();
|
|
@@ -37872,7 +37805,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
37872
37805
|
const creds = await boundProvider(options);
|
|
37873
37806
|
const attributedCreds = creds;
|
|
37874
37807
|
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
37875
|
-
return
|
|
37808
|
+
return client.setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
37876
37809
|
}
|
|
37877
37810
|
return attributedCreds;
|
|
37878
37811
|
};
|
|
@@ -40979,7 +40912,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
40979
40912
|
|
|
40980
40913
|
// node_modules/.pnpm/@aws-sdk+credential-provider-env@3.972.1/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js
|
|
40981
40914
|
var require_dist_cjs55 = __commonJS((exports) => {
|
|
40982
|
-
var
|
|
40915
|
+
var client = require_client3();
|
|
40983
40916
|
var propertyProvider = require_dist_cjs18();
|
|
40984
40917
|
var ENV_KEY = "AWS_ACCESS_KEY_ID";
|
|
40985
40918
|
var ENV_SECRET = "AWS_SECRET_ACCESS_KEY";
|
|
@@ -41004,7 +40937,7 @@ var require_dist_cjs55 = __commonJS((exports) => {
|
|
|
41004
40937
|
...credentialScope && { credentialScope },
|
|
41005
40938
|
...accountId && { accountId }
|
|
41006
40939
|
};
|
|
41007
|
-
|
|
40940
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
|
|
41008
40941
|
return credentials;
|
|
41009
40942
|
}
|
|
41010
40943
|
throw new propertyProvider.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
|
|
@@ -41552,7 +41485,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
|
|
|
41552
41485
|
var protocolHttp = require_dist_cjs2();
|
|
41553
41486
|
var core2 = require_dist_cjs17();
|
|
41554
41487
|
var propertyProvider = require_dist_cjs18();
|
|
41555
|
-
var
|
|
41488
|
+
var client = require_client3();
|
|
41556
41489
|
var signatureV4 = require_dist_cjs19();
|
|
41557
41490
|
var getDateHeader = (response) => protocolHttp.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
|
|
41558
41491
|
var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
@@ -41718,7 +41651,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
|
|
|
41718
41651
|
const creds = await boundProvider(options);
|
|
41719
41652
|
const attributedCreds = creds;
|
|
41720
41653
|
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
41721
|
-
return
|
|
41654
|
+
return client.setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
41722
41655
|
}
|
|
41723
41656
|
return attributedCreds;
|
|
41724
41657
|
};
|
|
@@ -41981,7 +41914,7 @@ var require_dist_cjs59 = __commonJS((exports) => {
|
|
|
41981
41914
|
var protocolHttp = require_dist_cjs2();
|
|
41982
41915
|
var core2 = require_dist_cjs17();
|
|
41983
41916
|
var propertyProvider = require_dist_cjs18();
|
|
41984
|
-
var
|
|
41917
|
+
var client = require_client3();
|
|
41985
41918
|
var signatureV4 = require_dist_cjs19();
|
|
41986
41919
|
var cbor = require_cbor();
|
|
41987
41920
|
var schema = require_schema4();
|
|
@@ -42194,7 +42127,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
42194
42127
|
const creds = await boundProvider(options);
|
|
42195
42128
|
const attributedCreds = creds;
|
|
42196
42129
|
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
42197
|
-
return
|
|
42130
|
+
return client.setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
42198
42131
|
}
|
|
42199
42132
|
return attributedCreds;
|
|
42200
42133
|
};
|
|
@@ -44445,7 +44378,7 @@ var require_package2 = __commonJS((exports, module) => {
|
|
|
44445
44378
|
|
|
44446
44379
|
// node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.972.1/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
|
|
44447
44380
|
var require_dist_cjs61 = __commonJS((exports) => {
|
|
44448
|
-
var
|
|
44381
|
+
var os = __require("os");
|
|
44449
44382
|
var process3 = __require("process");
|
|
44450
44383
|
var middlewareUserAgent = require_dist_cjs40();
|
|
44451
44384
|
var crtAvailability = {
|
|
@@ -44462,7 +44395,7 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
44462
44395
|
const sections = [
|
|
44463
44396
|
["aws-sdk-js", clientVersion],
|
|
44464
44397
|
["ua", "2.1"],
|
|
44465
|
-
[`os/${
|
|
44398
|
+
[`os/${os.platform()}`, os.release()],
|
|
44466
44399
|
["lang/js"],
|
|
44467
44400
|
["md/nodejs", `${process3.versions.node}`]
|
|
44468
44401
|
];
|
|
@@ -47152,11 +47085,11 @@ var require_sso_oidc = __commonJS((exports) => {
|
|
|
47152
47085
|
|
|
47153
47086
|
// node_modules/.pnpm/@aws-sdk+token-providers@3.974.0/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
47154
47087
|
var require_dist_cjs66 = __commonJS((exports) => {
|
|
47155
|
-
var
|
|
47088
|
+
var client = require_client3();
|
|
47156
47089
|
var httpAuthSchemes = require_httpAuthSchemes();
|
|
47157
47090
|
var propertyProvider = require_dist_cjs18();
|
|
47158
47091
|
var sharedIniFileLoader = require_dist_cjs44();
|
|
47159
|
-
var
|
|
47092
|
+
var fs = __require("fs");
|
|
47160
47093
|
var fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
|
|
47161
47094
|
logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
47162
47095
|
if (!signingName) {
|
|
@@ -47167,7 +47100,7 @@ var require_dist_cjs66 = __commonJS((exports) => {
|
|
|
47167
47100
|
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
47168
47101
|
}
|
|
47169
47102
|
const token = { token: process.env[bearerTokenKey] };
|
|
47170
|
-
|
|
47103
|
+
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
47171
47104
|
return token;
|
|
47172
47105
|
};
|
|
47173
47106
|
var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
|
|
@@ -47202,7 +47135,7 @@ var require_dist_cjs66 = __commonJS((exports) => {
|
|
|
47202
47135
|
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
47203
47136
|
}
|
|
47204
47137
|
};
|
|
47205
|
-
var { writeFile } =
|
|
47138
|
+
var { writeFile } = fs.promises;
|
|
47206
47139
|
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
47207
47140
|
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
47208
47141
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -48118,7 +48051,7 @@ var require_loadSso_CVy8iqsZ = __commonJS((exports) => {
|
|
|
48118
48051
|
var require_dist_cjs68 = __commonJS((exports) => {
|
|
48119
48052
|
var propertyProvider = require_dist_cjs18();
|
|
48120
48053
|
var sharedIniFileLoader = require_dist_cjs44();
|
|
48121
|
-
var
|
|
48054
|
+
var client = require_client3();
|
|
48122
48055
|
var tokenProviders = require_dist_cjs66();
|
|
48123
48056
|
var isSsoProfile = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
|
|
48124
48057
|
var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
|
|
@@ -48197,9 +48130,9 @@ var require_dist_cjs68 = __commonJS((exports) => {
|
|
|
48197
48130
|
...accountId && { accountId }
|
|
48198
48131
|
};
|
|
48199
48132
|
if (ssoSession) {
|
|
48200
|
-
|
|
48133
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
|
|
48201
48134
|
} else {
|
|
48202
|
-
|
|
48135
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
|
|
48203
48136
|
}
|
|
48204
48137
|
return credentials;
|
|
48205
48138
|
};
|
|
@@ -48851,7 +48784,7 @@ var require_signin = __commonJS((exports) => {
|
|
|
48851
48784
|
|
|
48852
48785
|
// node_modules/.pnpm/@aws-sdk+credential-provider-login@3.972.1/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js
|
|
48853
48786
|
var require_dist_cjs69 = __commonJS((exports) => {
|
|
48854
|
-
var
|
|
48787
|
+
var client = require_client3();
|
|
48855
48788
|
var propertyProvider = require_dist_cjs18();
|
|
48856
48789
|
var sharedIniFileLoader = require_dist_cjs44();
|
|
48857
48790
|
var protocolHttp = require_dist_cjs2();
|
|
@@ -48904,7 +48837,7 @@ var require_dist_cjs69 = __commonJS((exports) => {
|
|
|
48904
48837
|
};
|
|
48905
48838
|
const requestHandler = isH2(this.callerClientConfig?.requestHandler) ? undefined : this.callerClientConfig?.requestHandler;
|
|
48906
48839
|
const region = this.profileData.region ?? await this.callerClientConfig?.region?.() ?? process.env.AWS_REGION;
|
|
48907
|
-
const
|
|
48840
|
+
const client2 = new SigninClient({
|
|
48908
48841
|
credentials: {
|
|
48909
48842
|
accessKeyId: "",
|
|
48910
48843
|
secretAccessKey: ""
|
|
@@ -48915,7 +48848,7 @@ var require_dist_cjs69 = __commonJS((exports) => {
|
|
|
48915
48848
|
userAgentAppId,
|
|
48916
48849
|
...this.init?.clientConfig
|
|
48917
48850
|
});
|
|
48918
|
-
this.createDPoPInterceptor(
|
|
48851
|
+
this.createDPoPInterceptor(client2.middlewareStack);
|
|
48919
48852
|
const commandInput = {
|
|
48920
48853
|
tokenInput: {
|
|
48921
48854
|
clientId: token.clientId,
|
|
@@ -48924,7 +48857,7 @@ var require_dist_cjs69 = __commonJS((exports) => {
|
|
|
48924
48857
|
}
|
|
48925
48858
|
};
|
|
48926
48859
|
try {
|
|
48927
|
-
const response = await
|
|
48860
|
+
const response = await client2.send(new CreateOAuth2TokenCommand(commandInput));
|
|
48928
48861
|
const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
|
|
48929
48862
|
const { refreshToken, expiresIn } = response.tokenOutput ?? {};
|
|
48930
48863
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
@@ -49120,7 +49053,7 @@ var require_dist_cjs69 = __commonJS((exports) => {
|
|
|
49120
49053
|
}
|
|
49121
49054
|
const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
|
|
49122
49055
|
const credentials = await fetcher.loadCredentials();
|
|
49123
|
-
return
|
|
49056
|
+
return client.setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
|
|
49124
49057
|
};
|
|
49125
49058
|
exports.fromLoginCredentials = fromLoginCredentials;
|
|
49126
49059
|
});
|
|
@@ -49706,7 +49639,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
49706
49639
|
var middlewareEndpoint = require_dist_cjs46();
|
|
49707
49640
|
var EndpointParameters = require_EndpointParameters();
|
|
49708
49641
|
var schema = require_schema4();
|
|
49709
|
-
var
|
|
49642
|
+
var client = require_client3();
|
|
49710
49643
|
var regionConfigResolver = require_dist_cjs65();
|
|
49711
49644
|
|
|
49712
49645
|
class STSServiceException extends smithyClient.ServiceException {
|
|
@@ -50061,7 +49994,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
50061
49994
|
...Credentials.CredentialScope && { credentialScope: Credentials.CredentialScope },
|
|
50062
49995
|
...accountId && { accountId }
|
|
50063
49996
|
};
|
|
50064
|
-
|
|
49997
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
|
|
50065
49998
|
return credentials;
|
|
50066
49999
|
};
|
|
50067
50000
|
};
|
|
@@ -50098,9 +50031,9 @@ var require_sts = __commonJS((exports) => {
|
|
|
50098
50031
|
...accountId && { accountId }
|
|
50099
50032
|
};
|
|
50100
50033
|
if (accountId) {
|
|
50101
|
-
|
|
50034
|
+
client.setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
|
|
50102
50035
|
}
|
|
50103
|
-
|
|
50036
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
|
|
50104
50037
|
return credentials;
|
|
50105
50038
|
};
|
|
50106
50039
|
};
|
|
@@ -50183,7 +50116,7 @@ var require_dist_cjs71 = __commonJS((exports) => {
|
|
|
50183
50116
|
var propertyProvider = require_dist_cjs18();
|
|
50184
50117
|
var child_process = __require("child_process");
|
|
50185
50118
|
var util = __require("util");
|
|
50186
|
-
var
|
|
50119
|
+
var client = require_client3();
|
|
50187
50120
|
var getValidatedProcessCredentials = (profileName, data, profiles) => {
|
|
50188
50121
|
if (data.Version !== 1) {
|
|
50189
50122
|
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
|
@@ -50210,7 +50143,7 @@ var require_dist_cjs71 = __commonJS((exports) => {
|
|
|
50210
50143
|
...data.CredentialScope && { credentialScope: data.CredentialScope },
|
|
50211
50144
|
...accountId && { accountId }
|
|
50212
50145
|
};
|
|
50213
|
-
|
|
50146
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
|
50214
50147
|
return credentials;
|
|
50215
50148
|
};
|
|
50216
50149
|
var resolveProcessCredentials = async (profileName, profiles, logger) => {
|
|
@@ -50390,7 +50323,7 @@ var require_dist_cjs72 = __commonJS((exports) => {
|
|
|
50390
50323
|
var require_dist_cjs73 = __commonJS((exports) => {
|
|
50391
50324
|
var sharedIniFileLoader = require_dist_cjs44();
|
|
50392
50325
|
var propertyProvider = require_dist_cjs18();
|
|
50393
|
-
var
|
|
50326
|
+
var client = require_client3();
|
|
50394
50327
|
var credentialProviderLogin = require_dist_cjs69();
|
|
50395
50328
|
var resolveCredentialSource = (credentialSource, profileName, logger) => {
|
|
50396
50329
|
const sourceProvidersMap = {
|
|
@@ -50417,7 +50350,7 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50417
50350
|
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
|
50418
50351
|
}
|
|
50419
50352
|
};
|
|
50420
|
-
var setNamedProvider = (creds) =>
|
|
50353
|
+
var setNamedProvider = (creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
50421
50354
|
var isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
|
50422
50355
|
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
|
|
50423
50356
|
};
|
|
@@ -50460,7 +50393,7 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50460
50393
|
[source_profile]: true
|
|
50461
50394
|
}, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {})) : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
|
|
50462
50395
|
if (isCredentialSourceWithoutRoleArn(profileData)) {
|
|
50463
|
-
return sourceCredsProvider.then((creds) =>
|
|
50396
|
+
return sourceCredsProvider.then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
|
50464
50397
|
} else {
|
|
50465
50398
|
const params = {
|
|
50466
50399
|
RoleArn: profileData.role_arn,
|
|
@@ -50477,7 +50410,7 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50477
50410
|
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
|
50478
50411
|
}
|
|
50479
50412
|
const sourceCreds = await sourceCredsProvider;
|
|
50480
|
-
return options.roleAssumer(sourceCreds, params).then((creds) =>
|
|
50413
|
+
return options.roleAssumer(sourceCreds, params).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
|
|
50481
50414
|
}
|
|
50482
50415
|
};
|
|
50483
50416
|
var isCredentialSourceWithoutRoleArn = (section) => {
|
|
@@ -50491,13 +50424,13 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50491
50424
|
...options,
|
|
50492
50425
|
profile: profileName
|
|
50493
50426
|
})({ callerClientConfig });
|
|
50494
|
-
return
|
|
50427
|
+
return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
|
|
50495
50428
|
};
|
|
50496
50429
|
var isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
|
|
50497
50430
|
var resolveProcessCredentials = async (options, profile) => Promise.resolve().then(() => __toESM(require_dist_cjs71())).then(({ fromProcess }) => fromProcess({
|
|
50498
50431
|
...options,
|
|
50499
50432
|
profile
|
|
50500
|
-
})().then((creds) =>
|
|
50433
|
+
})().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
|
|
50501
50434
|
var resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
|
|
50502
50435
|
const { fromSSO } = await Promise.resolve().then(() => __toESM(require_dist_cjs68()));
|
|
50503
50436
|
return fromSSO({
|
|
@@ -50509,9 +50442,9 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50509
50442
|
callerClientConfig
|
|
50510
50443
|
}).then((creds) => {
|
|
50511
50444
|
if (profileData.sso_session) {
|
|
50512
|
-
return
|
|
50445
|
+
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
|
50513
50446
|
} else {
|
|
50514
|
-
return
|
|
50447
|
+
return client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
|
50515
50448
|
}
|
|
50516
50449
|
});
|
|
50517
50450
|
};
|
|
@@ -50526,7 +50459,7 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50526
50459
|
...profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope },
|
|
50527
50460
|
...profile.aws_account_id && { accountId: profile.aws_account_id }
|
|
50528
50461
|
};
|
|
50529
|
-
return
|
|
50462
|
+
return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
|
|
50530
50463
|
};
|
|
50531
50464
|
var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
|
|
50532
50465
|
var resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => Promise.resolve().then(() => __toESM(require_dist_cjs72())).then(({ fromTokenFile }) => fromTokenFile({
|
|
@@ -50538,7 +50471,7 @@ var require_dist_cjs73 = __commonJS((exports) => {
|
|
|
50538
50471
|
parentClientConfig: options.parentClientConfig
|
|
50539
50472
|
})({
|
|
50540
50473
|
callerClientConfig
|
|
50541
|
-
}).then((creds) =>
|
|
50474
|
+
}).then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q")));
|
|
50542
50475
|
var resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
|
50543
50476
|
const data = profiles[profileName];
|
|
50544
50477
|
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
@@ -51611,7 +51544,7 @@ var require_dist_cjs78 = __commonJS((exports) => {
|
|
|
51611
51544
|
|
|
51612
51545
|
// node_modules/.pnpm/@smithy+hash-stream-node@4.2.8/node_modules/@smithy/hash-stream-node/dist-cjs/index.js
|
|
51613
51546
|
var require_dist_cjs79 = __commonJS((exports) => {
|
|
51614
|
-
var
|
|
51547
|
+
var fs = __require("fs");
|
|
51615
51548
|
var utilUtf8 = require_dist_cjs8();
|
|
51616
51549
|
var stream = __require("stream");
|
|
51617
51550
|
|
|
@@ -51635,7 +51568,7 @@ var require_dist_cjs79 = __commonJS((exports) => {
|
|
|
51635
51568
|
reject(new Error("Unable to calculate hash for non-file streams."));
|
|
51636
51569
|
return;
|
|
51637
51570
|
}
|
|
51638
|
-
const fileStreamTee =
|
|
51571
|
+
const fileStreamTee = fs.createReadStream(fileStream.path, {
|
|
51639
51572
|
start: fileStream.start,
|
|
51640
51573
|
end: fileStream.end
|
|
51641
51574
|
});
|
|
@@ -53767,9 +53700,9 @@ var require_dist_cjs82 = __commonJS((exports) => {
|
|
|
53767
53700
|
return randomInRange(minDelay, delay);
|
|
53768
53701
|
};
|
|
53769
53702
|
var randomInRange = (min, max) => min + Math.random() * (max - min);
|
|
53770
|
-
var runPolling = async ({ minDelay, maxDelay, maxWaitTime, abortController, client
|
|
53703
|
+
var runPolling = async ({ minDelay, maxDelay, maxWaitTime, abortController, client, abortSignal }, input, acceptorChecks) => {
|
|
53771
53704
|
const observedResponses = {};
|
|
53772
|
-
const { state, reason } = await acceptorChecks(
|
|
53705
|
+
const { state, reason } = await acceptorChecks(client, input);
|
|
53773
53706
|
if (reason) {
|
|
53774
53707
|
const message = createMessageFromResponse(reason);
|
|
53775
53708
|
observedResponses[message] |= 0;
|
|
@@ -53793,7 +53726,7 @@ var require_dist_cjs82 = __commonJS((exports) => {
|
|
|
53793
53726
|
return { state: exports.WaiterState.TIMEOUT, observedResponses };
|
|
53794
53727
|
}
|
|
53795
53728
|
await sleep(delay);
|
|
53796
|
-
const { state: state2, reason: reason2 } = await acceptorChecks(
|
|
53729
|
+
const { state: state2, reason: reason2 } = await acceptorChecks(client, input);
|
|
53797
53730
|
if (reason2) {
|
|
53798
53731
|
const message = createMessageFromResponse(reason2);
|
|
53799
53732
|
observedResponses[message] |= 0;
|
|
@@ -60722,10 +60655,10 @@ var require_dist_cjs83 = __commonJS((exports) => {
|
|
|
60722
60655
|
var paginateListDirectoryBuckets = core2.createPaginator(S3Client, ListDirectoryBucketsCommand, "ContinuationToken", "ContinuationToken", "MaxDirectoryBuckets");
|
|
60723
60656
|
var paginateListObjectsV2 = core2.createPaginator(S3Client, ListObjectsV2Command, "ContinuationToken", "NextContinuationToken", "MaxKeys");
|
|
60724
60657
|
var paginateListParts = core2.createPaginator(S3Client, ListPartsCommand, "PartNumberMarker", "NextPartNumberMarker", "MaxParts");
|
|
60725
|
-
var checkState$3 = async (
|
|
60658
|
+
var checkState$3 = async (client, input) => {
|
|
60726
60659
|
let reason;
|
|
60727
60660
|
try {
|
|
60728
|
-
let result = await
|
|
60661
|
+
let result = await client.send(new HeadBucketCommand(input));
|
|
60729
60662
|
reason = result;
|
|
60730
60663
|
return { state: utilWaiter.WaiterState.SUCCESS, reason };
|
|
60731
60664
|
} catch (exception) {
|
|
@@ -60745,10 +60678,10 @@ var require_dist_cjs83 = __commonJS((exports) => {
|
|
|
60745
60678
|
const result = await utilWaiter.createWaiter({ ...serviceDefaults, ...params }, input, checkState$3);
|
|
60746
60679
|
return utilWaiter.checkExceptions(result);
|
|
60747
60680
|
};
|
|
60748
|
-
var checkState$2 = async (
|
|
60681
|
+
var checkState$2 = async (client, input) => {
|
|
60749
60682
|
let reason;
|
|
60750
60683
|
try {
|
|
60751
|
-
let result = await
|
|
60684
|
+
let result = await client.send(new HeadBucketCommand(input));
|
|
60752
60685
|
reason = result;
|
|
60753
60686
|
} catch (exception) {
|
|
60754
60687
|
reason = exception;
|
|
@@ -60767,10 +60700,10 @@ var require_dist_cjs83 = __commonJS((exports) => {
|
|
|
60767
60700
|
const result = await utilWaiter.createWaiter({ ...serviceDefaults, ...params }, input, checkState$2);
|
|
60768
60701
|
return utilWaiter.checkExceptions(result);
|
|
60769
60702
|
};
|
|
60770
|
-
var checkState$1 = async (
|
|
60703
|
+
var checkState$1 = async (client, input) => {
|
|
60771
60704
|
let reason;
|
|
60772
60705
|
try {
|
|
60773
|
-
let result = await
|
|
60706
|
+
let result = await client.send(new HeadObjectCommand(input));
|
|
60774
60707
|
reason = result;
|
|
60775
60708
|
return { state: utilWaiter.WaiterState.SUCCESS, reason };
|
|
60776
60709
|
} catch (exception) {
|
|
@@ -60790,10 +60723,10 @@ var require_dist_cjs83 = __commonJS((exports) => {
|
|
|
60790
60723
|
const result = await utilWaiter.createWaiter({ ...serviceDefaults, ...params }, input, checkState$1);
|
|
60791
60724
|
return utilWaiter.checkExceptions(result);
|
|
60792
60725
|
};
|
|
60793
|
-
var checkState = async (
|
|
60726
|
+
var checkState = async (client, input) => {
|
|
60794
60727
|
let reason;
|
|
60795
60728
|
try {
|
|
60796
|
-
let result = await
|
|
60729
|
+
let result = await client.send(new HeadObjectCommand(input));
|
|
60797
60730
|
reason = result;
|
|
60798
60731
|
} catch (exception) {
|
|
60799
60732
|
reason = exception;
|
|
@@ -61882,6 +61815,90 @@ var require_dist_cjs83 = __commonJS((exports) => {
|
|
|
61882
61815
|
exports.waitUntilObjectNotExists = waitUntilObjectNotExists;
|
|
61883
61816
|
});
|
|
61884
61817
|
|
|
61818
|
+
// src/serialization/data-source.ts
|
|
61819
|
+
async function getDataset(datasetName, source, options) {
|
|
61820
|
+
const state = getState();
|
|
61821
|
+
const accessToken = options.accessToken || state.accessToken;
|
|
61822
|
+
const apiKey = options.apiKey || state.apiKey;
|
|
61823
|
+
const headers = {
|
|
61824
|
+
"Content-Type": "application/json"
|
|
61825
|
+
};
|
|
61826
|
+
if (apiKey) {
|
|
61827
|
+
headers["x-api-key"] = apiKey;
|
|
61828
|
+
} else if (accessToken) {
|
|
61829
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
61830
|
+
} else {
|
|
61831
|
+
throw new Error("Authentication is required. Either provide accessToken, apiKey option, or set ORCHESTRATED_ACCESS_TOKEN/ORCHESTRATED_API_KEY environment variable. Run 'orcha login' to authenticate.");
|
|
61832
|
+
}
|
|
61833
|
+
const baseUrl = source.baseUrl.replace(/\/$/, "");
|
|
61834
|
+
let path2 = source.path.replace(/^\//, "");
|
|
61835
|
+
if (accessToken && !apiKey && !path2.startsWith("me/")) {
|
|
61836
|
+
path2 = `me/${path2}`;
|
|
61837
|
+
}
|
|
61838
|
+
const params = {
|
|
61839
|
+
...options,
|
|
61840
|
+
name: datasetName,
|
|
61841
|
+
tenantId: options.tenantId || state.tenantId,
|
|
61842
|
+
serviceName: options.serviceName || state.serviceName,
|
|
61843
|
+
environment: options.environment || state.environment
|
|
61844
|
+
};
|
|
61845
|
+
const timeout = options.timeout ?? 30000;
|
|
61846
|
+
const controller = new AbortController;
|
|
61847
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
61848
|
+
try {
|
|
61849
|
+
let url2;
|
|
61850
|
+
let fetchOptions;
|
|
61851
|
+
if (source.method === "GET") {
|
|
61852
|
+
const queryParams = new URLSearchParams(Object.entries(params).filter(([_, v]) => v !== undefined));
|
|
61853
|
+
url2 = `${baseUrl}/${path2}?${queryParams.toString()}`;
|
|
61854
|
+
fetchOptions = {
|
|
61855
|
+
method: "GET",
|
|
61856
|
+
headers,
|
|
61857
|
+
signal: controller.signal
|
|
61858
|
+
};
|
|
61859
|
+
} else {
|
|
61860
|
+
url2 = `${baseUrl}/${path2}`;
|
|
61861
|
+
fetchOptions = {
|
|
61862
|
+
method: "POST",
|
|
61863
|
+
headers,
|
|
61864
|
+
body: JSON.stringify(params),
|
|
61865
|
+
signal: controller.signal
|
|
61866
|
+
};
|
|
61867
|
+
}
|
|
61868
|
+
const response = await fetch(url2, fetchOptions);
|
|
61869
|
+
clearTimeout(timeoutId);
|
|
61870
|
+
if (!response.ok) {
|
|
61871
|
+
const errorText = await response.text();
|
|
61872
|
+
throw new Error(`API Gateway request failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
61873
|
+
}
|
|
61874
|
+
const rawData = await response.json();
|
|
61875
|
+
const data = DatasetResponseSchema.parse(rawData);
|
|
61876
|
+
return data.data;
|
|
61877
|
+
} catch (error48) {
|
|
61878
|
+
clearTimeout(timeoutId);
|
|
61879
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
61880
|
+
throw new Error(`API Gateway request timed out after ${timeout}ms`);
|
|
61881
|
+
}
|
|
61882
|
+
throw error48;
|
|
61883
|
+
}
|
|
61884
|
+
}
|
|
61885
|
+
var getApiUrl = () => {
|
|
61886
|
+
return getState().apiUrl;
|
|
61887
|
+
}, DatasetResponseSchema;
|
|
61888
|
+
var init_data_source = __esm(() => {
|
|
61889
|
+
init_zod();
|
|
61890
|
+
DatasetResponseSchema = exports_external.object({
|
|
61891
|
+
data: exports_external.array(exports_external.object({
|
|
61892
|
+
id: exports_external.string(),
|
|
61893
|
+
ctx: exports_external.object({
|
|
61894
|
+
systemPrompt: exports_external.string().optional()
|
|
61895
|
+
}).loose(),
|
|
61896
|
+
input: exports_external.string(),
|
|
61897
|
+
output: exports_external.string()
|
|
61898
|
+
}).loose())
|
|
61899
|
+
}).passthrough();
|
|
61900
|
+
});
|
|
61901
|
+
|
|
61885
61902
|
// src/api/definitions.ts
|
|
61886
61903
|
function normalizeName(name) {
|
|
61887
61904
|
return name.trim().toLowerCase();
|
|
@@ -117001,8 +117018,94 @@ function logError(e, verbose) {
|
|
|
117001
117018
|
}
|
|
117002
117019
|
|
|
117003
117020
|
// src/batch/manager.ts
|
|
117021
|
+
class S3FileManager {
|
|
117022
|
+
bucket;
|
|
117023
|
+
region;
|
|
117024
|
+
constructor(bucket, region) {
|
|
117025
|
+
this.bucket = bucket;
|
|
117026
|
+
this.region = region;
|
|
117027
|
+
}
|
|
117028
|
+
async upload(content, key) {
|
|
117029
|
+
const { getState: getState2 } = await Promise.resolve().then(() => exports_state);
|
|
117030
|
+
const state = getState2();
|
|
117031
|
+
if (!state.accessToken) {
|
|
117032
|
+
throw new Error("No access token found. Please run 'orcha login' to authenticate before using Bedrock batch mode.");
|
|
117033
|
+
}
|
|
117034
|
+
if (!state.tenantId || !state.serviceName) {
|
|
117035
|
+
throw new Error("tenantId and serviceName are required for Bedrock batch uploads.");
|
|
117036
|
+
}
|
|
117037
|
+
const response = await fetch(`${state.apiUrl}/me/upload-assets`, {
|
|
117038
|
+
method: "POST",
|
|
117039
|
+
headers: {
|
|
117040
|
+
Authorization: `Bearer ${state.accessToken}`,
|
|
117041
|
+
"Content-Type": "application/json"
|
|
117042
|
+
},
|
|
117043
|
+
body: JSON.stringify({
|
|
117044
|
+
tenantId: state.tenantId,
|
|
117045
|
+
serviceName: state.serviceName,
|
|
117046
|
+
assets: [
|
|
117047
|
+
{
|
|
117048
|
+
key,
|
|
117049
|
+
contentType: "application/jsonl"
|
|
117050
|
+
}
|
|
117051
|
+
]
|
|
117052
|
+
})
|
|
117053
|
+
});
|
|
117054
|
+
if (!response.ok) {
|
|
117055
|
+
const errorText = await response.text();
|
|
117056
|
+
throw new Error(`Failed to get presigned URL for batch upload: ${response.status} ${errorText}`);
|
|
117057
|
+
}
|
|
117058
|
+
const result = await response.json();
|
|
117059
|
+
if (!result.success || !result.assets?.[0]?.presignedUrl) {
|
|
117060
|
+
throw new Error(`Upload-assets request failed: ${result.error || "No presigned URL returned"}`);
|
|
117061
|
+
}
|
|
117062
|
+
const asset = result.assets[0];
|
|
117063
|
+
const uploadResponse = await fetch(asset.presignedUrl, {
|
|
117064
|
+
method: "PUT",
|
|
117065
|
+
headers: {
|
|
117066
|
+
"Content-Type": "application/jsonl"
|
|
117067
|
+
},
|
|
117068
|
+
body: content
|
|
117069
|
+
});
|
|
117070
|
+
if (!uploadResponse.ok) {
|
|
117071
|
+
throw new Error(`Failed to upload batch file to S3: ${uploadResponse.statusText}`);
|
|
117072
|
+
}
|
|
117073
|
+
return `s3://${result.bucket}/${asset.s3Key}`;
|
|
117074
|
+
}
|
|
117075
|
+
async read(s3Uri) {
|
|
117076
|
+
const { getState: getState2 } = await Promise.resolve().then(() => exports_state);
|
|
117077
|
+
const state = getState2();
|
|
117078
|
+
const { GetObjectCommand, S3Client } = require_dist_cjs83();
|
|
117079
|
+
const { bucket, key } = S3FileManager.parseS3Uri(s3Uri);
|
|
117080
|
+
const s3Config = { region: this.region };
|
|
117081
|
+
if (state.awsAccessKeyId && state.awsSecretAccessKey) {
|
|
117082
|
+
s3Config.credentials = {
|
|
117083
|
+
accessKeyId: state.awsAccessKeyId,
|
|
117084
|
+
secretAccessKey: state.awsSecretAccessKey,
|
|
117085
|
+
sessionToken: state.awsSessionToken || undefined
|
|
117086
|
+
};
|
|
117087
|
+
}
|
|
117088
|
+
const s3Client = new S3Client(s3Config);
|
|
117089
|
+
const response = await s3Client.send(new GetObjectCommand({
|
|
117090
|
+
Bucket: bucket,
|
|
117091
|
+
Key: key
|
|
117092
|
+
}));
|
|
117093
|
+
return await response.Body.transformToString();
|
|
117094
|
+
}
|
|
117095
|
+
static parseS3Uri(uri) {
|
|
117096
|
+
const match = uri.match(/^s3:\/\/([^/]+)\/(.+)$/);
|
|
117097
|
+
if (!match) {
|
|
117098
|
+
throw new Error(`Invalid S3 URI: ${uri}`);
|
|
117099
|
+
}
|
|
117100
|
+
return { bucket: match[1], key: match[2] };
|
|
117101
|
+
}
|
|
117102
|
+
}
|
|
117103
|
+
|
|
117004
117104
|
class BatchClient {
|
|
117005
117105
|
client;
|
|
117106
|
+
mode;
|
|
117107
|
+
s3FileManager = null;
|
|
117108
|
+
bedrockConfig = null;
|
|
117006
117109
|
tempDir;
|
|
117007
117110
|
requests = [];
|
|
117008
117111
|
responses = [];
|
|
@@ -117012,8 +117115,33 @@ class BatchClient {
|
|
|
117012
117115
|
pendingBatches = [];
|
|
117013
117116
|
completedBatches = [];
|
|
117014
117117
|
duplicateCount = 0;
|
|
117015
|
-
constructor(
|
|
117016
|
-
|
|
117118
|
+
constructor(options = {}) {
|
|
117119
|
+
const isBatchClientOptions = "mode" in options || "bedrock" in options || "clientOptions" in options;
|
|
117120
|
+
if (isBatchClientOptions) {
|
|
117121
|
+
const opts = options;
|
|
117122
|
+
this.mode = opts.mode ?? "OPENAI";
|
|
117123
|
+
if (this.mode === "BEDROCK_OPENAI") {
|
|
117124
|
+
if (!opts.bedrock) {
|
|
117125
|
+
throw new Error("Bedrock configuration is required when mode is BEDROCK_OPENAI");
|
|
117126
|
+
}
|
|
117127
|
+
this.bedrockConfig = opts.bedrock;
|
|
117128
|
+
this.s3FileManager = new S3FileManager(opts.bedrock.s3Bucket, opts.bedrock.region);
|
|
117129
|
+
this.client = new OpenAI({
|
|
117130
|
+
baseURL: `https://bedrock-runtime.${opts.bedrock.region}.amazonaws.com/openai/v1`,
|
|
117131
|
+
apiKey: opts.bedrock.apiKey,
|
|
117132
|
+
defaultHeaders: {
|
|
117133
|
+
"X-Amzn-Bedrock-RoleArn": opts.bedrock.serviceRoleArn,
|
|
117134
|
+
"X-Amzn-Bedrock-ModelId": opts.bedrock.modelId
|
|
117135
|
+
},
|
|
117136
|
+
...opts.clientOptions
|
|
117137
|
+
});
|
|
117138
|
+
} else {
|
|
117139
|
+
this.client = new OpenAI(opts.clientOptions ?? {});
|
|
117140
|
+
}
|
|
117141
|
+
} else {
|
|
117142
|
+
this.mode = "OPENAI";
|
|
117143
|
+
this.client = new OpenAI(options);
|
|
117144
|
+
}
|
|
117017
117145
|
this.tempDir = path.join(os.tmpdir(), "batches");
|
|
117018
117146
|
if (!fs.existsSync(this.tempDir)) {
|
|
117019
117147
|
fs.mkdirSync(this.tempDir, { recursive: true });
|
|
@@ -117099,6 +117227,22 @@ class BatchClient {
|
|
|
117099
117227
|
return filename;
|
|
117100
117228
|
}
|
|
117101
117229
|
async uploadFile(filePath) {
|
|
117230
|
+
if (this.mode === "BEDROCK_OPENAI" && this.s3FileManager && this.bedrockConfig) {
|
|
117231
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
117232
|
+
const prefix = this.bedrockConfig.s3Prefix ?? "bedrock-batch";
|
|
117233
|
+
const timestamp = Date.now();
|
|
117234
|
+
const s3Key = `${prefix}/${timestamp}/input.jsonl`;
|
|
117235
|
+
const s3Uri = await this.s3FileManager.upload(content, s3Key);
|
|
117236
|
+
return {
|
|
117237
|
+
id: s3Uri,
|
|
117238
|
+
object: "file",
|
|
117239
|
+
bytes: Buffer.byteLength(content, "utf-8"),
|
|
117240
|
+
created_at: Math.floor(Date.now() / 1000),
|
|
117241
|
+
filename: "input.jsonl",
|
|
117242
|
+
purpose: "batch",
|
|
117243
|
+
status: "processed"
|
|
117244
|
+
};
|
|
117245
|
+
}
|
|
117102
117246
|
const fileStream = fs.createReadStream(filePath);
|
|
117103
117247
|
const file2 = await this.client.files.create({
|
|
117104
117248
|
file: fileStream,
|
|
@@ -117137,8 +117281,13 @@ class BatchClient {
|
|
|
117137
117281
|
if (!batch.output_file_id) {
|
|
117138
117282
|
throw new Error(`Batch ${batchId} has no output file`);
|
|
117139
117283
|
}
|
|
117140
|
-
|
|
117141
|
-
|
|
117284
|
+
let responseText;
|
|
117285
|
+
if (this.mode === "BEDROCK_OPENAI" && this.s3FileManager) {
|
|
117286
|
+
responseText = await this.s3FileManager.read(batch.output_file_id);
|
|
117287
|
+
} else {
|
|
117288
|
+
const fileContent = await this.client.files.content(batch.output_file_id);
|
|
117289
|
+
responseText = await fileContent.text();
|
|
117290
|
+
}
|
|
117142
117291
|
const results = responseText.split(`
|
|
117143
117292
|
`).filter((line) => line.trim()).map((line) => {
|
|
117144
117293
|
const parsed = JSON.parse(line);
|
|
@@ -118024,7 +118173,29 @@ function getEvaluationOptions(name, options, state) {
|
|
|
118024
118173
|
let evalClient;
|
|
118025
118174
|
let openaiClient;
|
|
118026
118175
|
if (execute === "batch") {
|
|
118027
|
-
|
|
118176
|
+
if (merged.batchClient) {
|
|
118177
|
+
batchClient = merged.batchClient;
|
|
118178
|
+
} else {
|
|
118179
|
+
const batchProcessor = merged.batchProcessor ?? "OPENAI";
|
|
118180
|
+
if (batchProcessor === "BEDROCK_OPENAI") {
|
|
118181
|
+
if (!state.bedrockRegion || !state.bedrockApiKey || !state.bedrockServiceRoleArn || !state.bedrockModelId || !state.bedrockS3Bucket) {
|
|
118182
|
+
throw new Error(`Bedrock configuration is incomplete. Required: bedrockRegion, bedrockApiKey, bedrockServiceRoleArn, bedrockModelId, bedrockS3Bucket.
|
|
118183
|
+
` + "Provide via state, environment variables (ORCHESTRATED_BEDROCK_*), or Orchestrated.yaml.");
|
|
118184
|
+
}
|
|
118185
|
+
batchClient = new BatchClient({
|
|
118186
|
+
mode: "BEDROCK_OPENAI",
|
|
118187
|
+
bedrock: {
|
|
118188
|
+
region: state.bedrockRegion,
|
|
118189
|
+
apiKey: state.bedrockApiKey,
|
|
118190
|
+
serviceRoleArn: state.bedrockServiceRoleArn,
|
|
118191
|
+
modelId: state.bedrockModelId,
|
|
118192
|
+
s3Bucket: state.bedrockS3Bucket
|
|
118193
|
+
}
|
|
118194
|
+
});
|
|
118195
|
+
} else {
|
|
118196
|
+
batchClient = new BatchClient;
|
|
118197
|
+
}
|
|
118198
|
+
}
|
|
118028
118199
|
evalClient = merged.evalClient || new EvalClient({
|
|
118029
118200
|
batchClient
|
|
118030
118201
|
});
|
|
@@ -118824,4 +118995,4 @@ export {
|
|
|
118824
118995
|
Behavioral
|
|
118825
118996
|
};
|
|
118826
118997
|
|
|
118827
|
-
//# debugId=
|
|
118998
|
+
//# debugId=B986FC088997E94964756E2164756E21
|