@ancha-labs/cli 0.4.26 → 0.4.28
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/lib/ancha.mjs +1768 -1608
- package/lib/assets/docs/run.md +2 -0
- package/lib/assets/docs/traces.md +10 -0
- package/lib/assets/harbor/companion.mjs +363 -355
- package/lib/assets/ui/app.js +20283 -449
- package/lib/worker.mjs +667 -577
- package/lib/world-server.mjs +363 -355
- package/package.json +1 -1
|
@@ -9238,13 +9238,13 @@ var require_inspect = __commonJS({
|
|
|
9238
9238
|
function isJSONable(value4) {
|
|
9239
9239
|
return typeof value4.toJSON === "function";
|
|
9240
9240
|
}
|
|
9241
|
-
function formatObject(
|
|
9242
|
-
const entries3 = Object.entries(
|
|
9241
|
+
function formatObject(object18, seenValues) {
|
|
9242
|
+
const entries3 = Object.entries(object18);
|
|
9243
9243
|
if (entries3.length === 0) {
|
|
9244
9244
|
return "{}";
|
|
9245
9245
|
}
|
|
9246
9246
|
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
9247
|
-
return "[" + getObjectTag(
|
|
9247
|
+
return "[" + getObjectTag(object18) + "]";
|
|
9248
9248
|
}
|
|
9249
9249
|
const properties3 = entries3.map(
|
|
9250
9250
|
([key4, value4]) => key4 + ": " + formatValue(value4, seenValues)
|
|
@@ -9271,10 +9271,10 @@ var require_inspect = __commonJS({
|
|
|
9271
9271
|
}
|
|
9272
9272
|
return "[" + items.join(", ") + "]";
|
|
9273
9273
|
}
|
|
9274
|
-
function getObjectTag(
|
|
9275
|
-
const tag3 = Object.prototype.toString.call(
|
|
9276
|
-
if (tag3 === "Object" && typeof
|
|
9277
|
-
const name5 =
|
|
9274
|
+
function getObjectTag(object18) {
|
|
9275
|
+
const tag3 = Object.prototype.toString.call(object18).replace(/^\[object /, "").replace(/]$/, "");
|
|
9276
|
+
if (tag3 === "Object" && typeof object18.constructor === "function") {
|
|
9277
|
+
const name5 = object18.constructor.name;
|
|
9278
9278
|
if (typeof name5 === "string" && name5 !== "") {
|
|
9279
9279
|
return name5;
|
|
9280
9280
|
}
|
|
@@ -21479,10 +21479,10 @@ var require_promiseForObject = __commonJS({
|
|
|
21479
21479
|
value: true
|
|
21480
21480
|
});
|
|
21481
21481
|
exports.promiseForObject = promiseForObject;
|
|
21482
|
-
function promiseForObject(
|
|
21483
|
-
return Promise.all(Object.values(
|
|
21482
|
+
function promiseForObject(object18) {
|
|
21483
|
+
return Promise.all(Object.values(object18)).then((resolvedValues) => {
|
|
21484
21484
|
const resolvedObject = /* @__PURE__ */ Object.create(null);
|
|
21485
|
-
for (const [i, key4] of Object.keys(
|
|
21485
|
+
for (const [i, key4] of Object.keys(object18).entries()) {
|
|
21486
21486
|
resolvedObject[key4] = resolvedValues[i];
|
|
21487
21487
|
}
|
|
21488
21488
|
return resolvedObject;
|
|
@@ -27866,9 +27866,9 @@ var require_lodash = __commonJS({
|
|
|
27866
27866
|
function asciiWords(string7) {
|
|
27867
27867
|
return string7.match(reAsciiWord) || [];
|
|
27868
27868
|
}
|
|
27869
|
-
function basePropertyOf(
|
|
27869
|
+
function basePropertyOf(object18) {
|
|
27870
27870
|
return function(key4) {
|
|
27871
|
-
return
|
|
27871
|
+
return object18 == null ? void 0 : object18[key4];
|
|
27872
27872
|
};
|
|
27873
27873
|
}
|
|
27874
27874
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
@@ -30685,32 +30685,32 @@ var require_namespace = __commonJS({
|
|
|
30685
30685
|
return this.nested[name5].values;
|
|
30686
30686
|
throw Error("no such enum: " + name5);
|
|
30687
30687
|
};
|
|
30688
|
-
Namespace.prototype.add = function add(
|
|
30689
|
-
if (!(
|
|
30688
|
+
Namespace.prototype.add = function add(object18) {
|
|
30689
|
+
if (!(object18 instanceof Field && object18.extend !== void 0 || object18 instanceof Type || object18 instanceof OneOf || object18 instanceof Enum || object18 instanceof Service || object18 instanceof Namespace))
|
|
30690
30690
|
throw TypeError("object must be a valid nested object");
|
|
30691
|
-
if (
|
|
30691
|
+
if (object18.name === "__proto__")
|
|
30692
30692
|
return this;
|
|
30693
30693
|
if (!this.nested)
|
|
30694
30694
|
this.nested = {};
|
|
30695
30695
|
else {
|
|
30696
|
-
var prev = this.get(
|
|
30696
|
+
var prev = this.get(object18.name);
|
|
30697
30697
|
if (prev) {
|
|
30698
|
-
if (prev instanceof Namespace &&
|
|
30698
|
+
if (prev instanceof Namespace && object18 instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {
|
|
30699
30699
|
var nested = prev.nestedArray;
|
|
30700
30700
|
for (var i = 0; i < nested.length; ++i)
|
|
30701
|
-
|
|
30701
|
+
object18.add(nested[i]);
|
|
30702
30702
|
this.remove(prev);
|
|
30703
30703
|
if (!this.nested)
|
|
30704
30704
|
this.nested = {};
|
|
30705
|
-
|
|
30705
|
+
object18.setOptions(prev.options, true);
|
|
30706
30706
|
} else
|
|
30707
|
-
throw Error("duplicate name '" +
|
|
30707
|
+
throw Error("duplicate name '" + object18.name + "' in " + this);
|
|
30708
30708
|
}
|
|
30709
30709
|
}
|
|
30710
|
-
this.nested[
|
|
30710
|
+
this.nested[object18.name] = object18;
|
|
30711
30711
|
if (!(this instanceof Type || this instanceof Service || this instanceof Enum || this instanceof Field)) {
|
|
30712
|
-
if (!
|
|
30713
|
-
|
|
30712
|
+
if (!object18._edition) {
|
|
30713
|
+
object18._edition = object18._defaultEdition;
|
|
30714
30714
|
}
|
|
30715
30715
|
}
|
|
30716
30716
|
this._needsRecursiveFeatureResolution = true;
|
|
@@ -30720,18 +30720,18 @@ var require_namespace = __commonJS({
|
|
|
30720
30720
|
parent2._needsRecursiveFeatureResolution = true;
|
|
30721
30721
|
parent2._needsRecursiveResolve = true;
|
|
30722
30722
|
}
|
|
30723
|
-
|
|
30723
|
+
object18.onAdd(this);
|
|
30724
30724
|
return clearCache(this);
|
|
30725
30725
|
};
|
|
30726
|
-
Namespace.prototype.remove = function remove5(
|
|
30727
|
-
if (!(
|
|
30726
|
+
Namespace.prototype.remove = function remove5(object18) {
|
|
30727
|
+
if (!(object18 instanceof ReflectionObject))
|
|
30728
30728
|
throw TypeError("object must be a ReflectionObject");
|
|
30729
|
-
if (
|
|
30730
|
-
throw Error(
|
|
30731
|
-
delete this.nested[
|
|
30729
|
+
if (object18.parent !== this)
|
|
30730
|
+
throw Error(object18 + " is not a member of " + this);
|
|
30731
|
+
delete this.nested[object18.name];
|
|
30732
30732
|
if (!Object.keys(this.nested).length)
|
|
30733
30733
|
this.nested = void 0;
|
|
30734
|
-
|
|
30734
|
+
object18.onRemove(this);
|
|
30735
30735
|
return clearCache(this);
|
|
30736
30736
|
};
|
|
30737
30737
|
Namespace.prototype.define = function define2(path4, json33) {
|
|
@@ -31069,27 +31069,27 @@ var require_service2 = __commonJS({
|
|
|
31069
31069
|
});
|
|
31070
31070
|
return this;
|
|
31071
31071
|
};
|
|
31072
|
-
Service.prototype.add = function add(
|
|
31073
|
-
if (this.get(
|
|
31074
|
-
throw Error("duplicate name '" +
|
|
31075
|
-
if (
|
|
31076
|
-
if (
|
|
31072
|
+
Service.prototype.add = function add(object18) {
|
|
31073
|
+
if (this.get(object18.name))
|
|
31074
|
+
throw Error("duplicate name '" + object18.name + "' in " + this);
|
|
31075
|
+
if (object18 instanceof Method) {
|
|
31076
|
+
if (object18.name === "__proto__")
|
|
31077
31077
|
return this;
|
|
31078
|
-
this.methods[
|
|
31079
|
-
|
|
31078
|
+
this.methods[object18.name] = object18;
|
|
31079
|
+
object18.parent = this;
|
|
31080
31080
|
return clearCache(this);
|
|
31081
31081
|
}
|
|
31082
|
-
return Namespace.prototype.add.call(this,
|
|
31082
|
+
return Namespace.prototype.add.call(this, object18);
|
|
31083
31083
|
};
|
|
31084
|
-
Service.prototype.remove = function remove5(
|
|
31085
|
-
if (
|
|
31086
|
-
if (this.methods[
|
|
31087
|
-
throw Error(
|
|
31088
|
-
delete this.methods[
|
|
31089
|
-
|
|
31084
|
+
Service.prototype.remove = function remove5(object18) {
|
|
31085
|
+
if (object18 instanceof Method) {
|
|
31086
|
+
if (this.methods[object18.name] !== object18)
|
|
31087
|
+
throw Error(object18 + " is not a member of " + this);
|
|
31088
|
+
delete this.methods[object18.name];
|
|
31089
|
+
object18.parent = null;
|
|
31090
31090
|
return clearCache(this);
|
|
31091
31091
|
}
|
|
31092
|
-
return Namespace.prototype.remove.call(this,
|
|
31092
|
+
return Namespace.prototype.remove.call(this, object18);
|
|
31093
31093
|
};
|
|
31094
31094
|
Service.prototype.create = function create3(rpcImpl, requestDelimited, responseDelimited) {
|
|
31095
31095
|
var rpcService = new rpc2.Service(rpcImpl, requestDelimited, responseDelimited);
|
|
@@ -31140,8 +31140,8 @@ var require_message = __commonJS({
|
|
|
31140
31140
|
Message.verify = function verify4(message8) {
|
|
31141
31141
|
return this.$type.verify(message8);
|
|
31142
31142
|
};
|
|
31143
|
-
Message.fromObject = function fromObject(
|
|
31144
|
-
return this.$type.fromObject(
|
|
31143
|
+
Message.fromObject = function fromObject(object18) {
|
|
31144
|
+
return this.$type.fromObject(object18);
|
|
31145
31145
|
};
|
|
31146
31146
|
Message.toObject = function toObject(message8, options3) {
|
|
31147
31147
|
return this.$type.toObject(message8, options3);
|
|
@@ -31527,26 +31527,26 @@ var require_wrappers = __commonJS({
|
|
|
31527
31527
|
var Message = require_message();
|
|
31528
31528
|
var util = require_minimal();
|
|
31529
31529
|
wrappers[".google.protobuf.Any"] = {
|
|
31530
|
-
fromObject: function(
|
|
31530
|
+
fromObject: function(object18, depth) {
|
|
31531
31531
|
if (depth === void 0)
|
|
31532
31532
|
depth = 0;
|
|
31533
31533
|
if (depth > util.recursionLimit)
|
|
31534
31534
|
throw Error("max depth exceeded");
|
|
31535
|
-
if (
|
|
31536
|
-
var name5 =
|
|
31535
|
+
if (object18 && object18["@type"]) {
|
|
31536
|
+
var name5 = object18["@type"].substring(object18["@type"].lastIndexOf("/") + 1);
|
|
31537
31537
|
var type = this.lookup(name5);
|
|
31538
31538
|
if (type) {
|
|
31539
|
-
var type_url =
|
|
31539
|
+
var type_url = object18["@type"].charAt(0) === "." ? object18["@type"].slice(1) : object18["@type"];
|
|
31540
31540
|
if (type_url.indexOf("/") === -1) {
|
|
31541
31541
|
type_url = "/" + type_url;
|
|
31542
31542
|
}
|
|
31543
31543
|
return this.create({
|
|
31544
31544
|
type_url,
|
|
31545
|
-
value: type.encode(type.fromObject(
|
|
31545
|
+
value: type.encode(type.fromObject(object18, depth + 1)).finish()
|
|
31546
31546
|
});
|
|
31547
31547
|
}
|
|
31548
31548
|
}
|
|
31549
|
-
return this.fromObject(
|
|
31549
|
+
return this.fromObject(object18, depth);
|
|
31550
31550
|
},
|
|
31551
31551
|
toObject: function(message8, options3, depth) {
|
|
31552
31552
|
if (depth === void 0)
|
|
@@ -31564,14 +31564,14 @@ var require_wrappers = __commonJS({
|
|
|
31564
31564
|
message8 = type.decode(message8.value, void 0, void 0, depth + 1);
|
|
31565
31565
|
}
|
|
31566
31566
|
if (!(message8 instanceof this.ctor) && message8 instanceof Message) {
|
|
31567
|
-
var
|
|
31567
|
+
var object18 = message8.$type.toObject(message8, options3, depth + 1);
|
|
31568
31568
|
var messageName = message8.$type.fullName[0] === "." ? message8.$type.fullName.slice(1) : message8.$type.fullName;
|
|
31569
31569
|
if (prefix2 === "") {
|
|
31570
31570
|
prefix2 = googleApi;
|
|
31571
31571
|
}
|
|
31572
31572
|
name5 = prefix2 + messageName;
|
|
31573
|
-
|
|
31574
|
-
return
|
|
31573
|
+
object18["@type"] = name5;
|
|
31574
|
+
return object18;
|
|
31575
31575
|
}
|
|
31576
31576
|
return this.toObject(message8, options3, depth);
|
|
31577
31577
|
}
|
|
@@ -31801,59 +31801,59 @@ var require_type2 = __commonJS({
|
|
|
31801
31801
|
return this.nested[name5];
|
|
31802
31802
|
return null;
|
|
31803
31803
|
};
|
|
31804
|
-
Type.prototype.add = function add(
|
|
31805
|
-
if (this.get(
|
|
31806
|
-
throw Error("duplicate name '" +
|
|
31807
|
-
if (
|
|
31804
|
+
Type.prototype.add = function add(object18) {
|
|
31805
|
+
if (this.get(object18.name))
|
|
31806
|
+
throw Error("duplicate name '" + object18.name + "' in " + this);
|
|
31807
|
+
if (object18 instanceof Field && object18.extend === void 0) {
|
|
31808
31808
|
if (this._fieldsById ? (
|
|
31809
31809
|
/* istanbul ignore next */
|
|
31810
|
-
this._fieldsById[
|
|
31811
|
-
) : this.fieldsById[
|
|
31812
|
-
throw Error("duplicate id " +
|
|
31813
|
-
if (this.isReservedId(
|
|
31814
|
-
throw Error("id " +
|
|
31815
|
-
if (this.isReservedName(
|
|
31816
|
-
throw Error("name '" +
|
|
31817
|
-
if (
|
|
31810
|
+
this._fieldsById[object18.id]
|
|
31811
|
+
) : this.fieldsById[object18.id])
|
|
31812
|
+
throw Error("duplicate id " + object18.id + " in " + this);
|
|
31813
|
+
if (this.isReservedId(object18.id))
|
|
31814
|
+
throw Error("id " + object18.id + " is reserved in " + this);
|
|
31815
|
+
if (this.isReservedName(object18.name) || object18.name.charAt(0) === "$")
|
|
31816
|
+
throw Error("name '" + object18.name + "' is reserved in " + this);
|
|
31817
|
+
if (object18.name === "__proto__")
|
|
31818
31818
|
return this;
|
|
31819
|
-
if (
|
|
31820
|
-
|
|
31821
|
-
this.fields[
|
|
31822
|
-
|
|
31823
|
-
|
|
31819
|
+
if (object18.parent)
|
|
31820
|
+
object18.parent.remove(object18);
|
|
31821
|
+
this.fields[object18.name] = object18;
|
|
31822
|
+
object18.message = this;
|
|
31823
|
+
object18.onAdd(this);
|
|
31824
31824
|
return clearCache(this);
|
|
31825
31825
|
}
|
|
31826
|
-
if (
|
|
31827
|
-
if (
|
|
31828
|
-
throw Error("name '" +
|
|
31829
|
-
if (
|
|
31826
|
+
if (object18 instanceof OneOf) {
|
|
31827
|
+
if (object18.name.charAt(0) === "$")
|
|
31828
|
+
throw Error("name '" + object18.name + "' is reserved in " + this);
|
|
31829
|
+
if (object18.name === "__proto__")
|
|
31830
31830
|
return this;
|
|
31831
31831
|
if (!this.oneofs)
|
|
31832
31832
|
this.oneofs = {};
|
|
31833
|
-
this.oneofs[
|
|
31834
|
-
|
|
31833
|
+
this.oneofs[object18.name] = object18;
|
|
31834
|
+
object18.onAdd(this);
|
|
31835
31835
|
return clearCache(this);
|
|
31836
31836
|
}
|
|
31837
|
-
return Namespace.prototype.add.call(this,
|
|
31837
|
+
return Namespace.prototype.add.call(this, object18);
|
|
31838
31838
|
};
|
|
31839
|
-
Type.prototype.remove = function remove5(
|
|
31840
|
-
if (
|
|
31841
|
-
if (!this.fields || this.fields[
|
|
31842
|
-
throw Error(
|
|
31843
|
-
delete this.fields[
|
|
31844
|
-
|
|
31845
|
-
|
|
31839
|
+
Type.prototype.remove = function remove5(object18) {
|
|
31840
|
+
if (object18 instanceof Field && object18.extend === void 0) {
|
|
31841
|
+
if (!this.fields || this.fields[object18.name] !== object18)
|
|
31842
|
+
throw Error(object18 + " is not a member of " + this);
|
|
31843
|
+
delete this.fields[object18.name];
|
|
31844
|
+
object18.parent = null;
|
|
31845
|
+
object18.onRemove(this);
|
|
31846
31846
|
return clearCache(this);
|
|
31847
31847
|
}
|
|
31848
|
-
if (
|
|
31849
|
-
if (!this.oneofs || this.oneofs[
|
|
31850
|
-
throw Error(
|
|
31851
|
-
delete this.oneofs[
|
|
31852
|
-
|
|
31853
|
-
|
|
31848
|
+
if (object18 instanceof OneOf) {
|
|
31849
|
+
if (!this.oneofs || this.oneofs[object18.name] !== object18)
|
|
31850
|
+
throw Error(object18 + " is not a member of " + this);
|
|
31851
|
+
delete this.oneofs[object18.name];
|
|
31852
|
+
object18.parent = null;
|
|
31853
|
+
object18.onRemove(this);
|
|
31854
31854
|
return clearCache(this);
|
|
31855
31855
|
}
|
|
31856
|
-
return Namespace.prototype.remove.call(this,
|
|
31856
|
+
return Namespace.prototype.remove.call(this, object18);
|
|
31857
31857
|
};
|
|
31858
31858
|
Type.prototype.isReservedId = function isReservedId(id14) {
|
|
31859
31859
|
return Namespace.isReservedId(this.reserved, id14);
|
|
@@ -31918,8 +31918,8 @@ var require_type2 = __commonJS({
|
|
|
31918
31918
|
Type.prototype.verify = function verify_setup(message8, depth) {
|
|
31919
31919
|
return this.setup().verify(message8, depth);
|
|
31920
31920
|
};
|
|
31921
|
-
Type.prototype.fromObject = function fromObject(
|
|
31922
|
-
return this.setup().fromObject(
|
|
31921
|
+
Type.prototype.fromObject = function fromObject(object18, depth) {
|
|
31922
|
+
return this.setup().fromObject(object18, depth);
|
|
31923
31923
|
};
|
|
31924
31924
|
Type.prototype.toObject = function toObject(message8, options3) {
|
|
31925
31925
|
return this.setup().toObject.apply(this, arguments);
|
|
@@ -32120,65 +32120,65 @@ var require_root = __commonJS({
|
|
|
32120
32120
|
}
|
|
32121
32121
|
return false;
|
|
32122
32122
|
}
|
|
32123
|
-
Root.prototype._handleAdd = function _handleAdd(
|
|
32124
|
-
if (
|
|
32123
|
+
Root.prototype._handleAdd = function _handleAdd(object18) {
|
|
32124
|
+
if (object18 instanceof Field) {
|
|
32125
32125
|
if (
|
|
32126
32126
|
/* an extension field (implies not part of a oneof) */
|
|
32127
|
-
|
|
32128
|
-
!
|
|
32127
|
+
object18.extend !== void 0 && /* not already handled */
|
|
32128
|
+
!object18.extensionField
|
|
32129
32129
|
) {
|
|
32130
|
-
if (!tryHandleExtension(this,
|
|
32131
|
-
this.deferred.push(
|
|
32132
|
-
}
|
|
32133
|
-
} else if (
|
|
32134
|
-
if (exposeRe.test(
|
|
32135
|
-
|
|
32136
|
-
} else if (!(
|
|
32137
|
-
if (
|
|
32130
|
+
if (!tryHandleExtension(this, object18))
|
|
32131
|
+
this.deferred.push(object18);
|
|
32132
|
+
}
|
|
32133
|
+
} else if (object18 instanceof Enum) {
|
|
32134
|
+
if (exposeRe.test(object18.name))
|
|
32135
|
+
object18.parent[object18.name] = object18.values;
|
|
32136
|
+
} else if (!(object18 instanceof OneOf)) {
|
|
32137
|
+
if (object18 instanceof Type)
|
|
32138
32138
|
for (var i = 0; i < this.deferred.length; )
|
|
32139
32139
|
if (tryHandleExtension(this, this.deferred[i]))
|
|
32140
32140
|
this.deferred.splice(i, 1);
|
|
32141
32141
|
else
|
|
32142
32142
|
++i;
|
|
32143
32143
|
for (var j = 0; j < /* initializes */
|
|
32144
|
-
|
|
32145
|
-
this._handleAdd(
|
|
32146
|
-
if (exposeRe.test(
|
|
32147
|
-
|
|
32144
|
+
object18.nestedArray.length; ++j)
|
|
32145
|
+
this._handleAdd(object18._nestedArray[j]);
|
|
32146
|
+
if (exposeRe.test(object18.name))
|
|
32147
|
+
object18.parent[object18.name] = object18;
|
|
32148
32148
|
}
|
|
32149
|
-
if (
|
|
32150
|
-
this._fullyQualifiedObjects[
|
|
32149
|
+
if (object18 instanceof Type || object18 instanceof Enum || object18 instanceof Field) {
|
|
32150
|
+
this._fullyQualifiedObjects[object18.fullName] = object18;
|
|
32151
32151
|
}
|
|
32152
32152
|
};
|
|
32153
|
-
Root.prototype._handleRemove = function _handleRemove(
|
|
32154
|
-
if (
|
|
32153
|
+
Root.prototype._handleRemove = function _handleRemove(object18) {
|
|
32154
|
+
if (object18 instanceof Field) {
|
|
32155
32155
|
if (
|
|
32156
32156
|
/* an extension field */
|
|
32157
|
-
|
|
32157
|
+
object18.extend !== void 0
|
|
32158
32158
|
) {
|
|
32159
32159
|
if (
|
|
32160
32160
|
/* already handled */
|
|
32161
|
-
|
|
32161
|
+
object18.extensionField
|
|
32162
32162
|
) {
|
|
32163
|
-
|
|
32164
|
-
|
|
32163
|
+
object18.extensionField.parent.remove(object18.extensionField);
|
|
32164
|
+
object18.extensionField = null;
|
|
32165
32165
|
} else {
|
|
32166
|
-
var index = this.deferred.indexOf(
|
|
32166
|
+
var index = this.deferred.indexOf(object18);
|
|
32167
32167
|
if (index > -1)
|
|
32168
32168
|
this.deferred.splice(index, 1);
|
|
32169
32169
|
}
|
|
32170
32170
|
}
|
|
32171
|
-
} else if (
|
|
32172
|
-
if (exposeRe.test(
|
|
32173
|
-
delete
|
|
32174
|
-
} else if (
|
|
32171
|
+
} else if (object18 instanceof Enum) {
|
|
32172
|
+
if (exposeRe.test(object18.name))
|
|
32173
|
+
delete object18.parent[object18.name];
|
|
32174
|
+
} else if (object18 instanceof Namespace) {
|
|
32175
32175
|
for (var i = 0; i < /* initializes */
|
|
32176
|
-
|
|
32177
|
-
this._handleRemove(
|
|
32178
|
-
if (exposeRe.test(
|
|
32179
|
-
delete
|
|
32176
|
+
object18.nestedArray.length; ++i)
|
|
32177
|
+
this._handleRemove(object18._nestedArray[i]);
|
|
32178
|
+
if (exposeRe.test(object18.name))
|
|
32179
|
+
delete object18.parent[object18.name];
|
|
32180
32180
|
}
|
|
32181
|
-
delete this._fullyQualifiedObjects[
|
|
32181
|
+
delete this._fullyQualifiedObjects[object18.fullName];
|
|
32182
32182
|
};
|
|
32183
32183
|
Root._configure = function(Type_, parse_, common_) {
|
|
32184
32184
|
Type = Type_;
|
|
@@ -32209,23 +32209,23 @@ var require_util = __commonJS({
|
|
|
32209
32209
|
throw Error("max depth exceeded");
|
|
32210
32210
|
return depth;
|
|
32211
32211
|
};
|
|
32212
|
-
util.toArray = function toArray(
|
|
32213
|
-
if (
|
|
32214
|
-
var keys6 = Object.keys(
|
|
32212
|
+
util.toArray = function toArray(object18) {
|
|
32213
|
+
if (object18) {
|
|
32214
|
+
var keys6 = Object.keys(object18), array3 = new Array(keys6.length), index = 0;
|
|
32215
32215
|
while (index < keys6.length)
|
|
32216
|
-
array3[index] =
|
|
32216
|
+
array3[index] = object18[keys6[index++]];
|
|
32217
32217
|
return array3;
|
|
32218
32218
|
}
|
|
32219
32219
|
return [];
|
|
32220
32220
|
};
|
|
32221
32221
|
util.toObject = function toObject(array3) {
|
|
32222
|
-
var
|
|
32222
|
+
var object18 = {}, index = 0;
|
|
32223
32223
|
while (index < array3.length) {
|
|
32224
32224
|
var key4 = array3[index++], val = array3[index++];
|
|
32225
32225
|
if (val !== void 0)
|
|
32226
|
-
|
|
32226
|
+
object18[key4] = val;
|
|
32227
32227
|
}
|
|
32228
|
-
return
|
|
32228
|
+
return object18;
|
|
32229
32229
|
};
|
|
32230
32230
|
util.isReserved = function isReserved(name5) {
|
|
32231
32231
|
return reservedRe.test(name5);
|
|
@@ -32266,14 +32266,14 @@ var require_util = __commonJS({
|
|
|
32266
32266
|
return type;
|
|
32267
32267
|
};
|
|
32268
32268
|
var decorateEnumIndex = 0;
|
|
32269
|
-
util.decorateEnum = function decorateEnum(
|
|
32270
|
-
if (
|
|
32271
|
-
return
|
|
32269
|
+
util.decorateEnum = function decorateEnum(object18) {
|
|
32270
|
+
if (object18.$type)
|
|
32271
|
+
return object18.$type;
|
|
32272
32272
|
if (!Enum)
|
|
32273
32273
|
Enum = require_enum();
|
|
32274
|
-
var enm = new Enum("Enum" + decorateEnumIndex++,
|
|
32274
|
+
var enm = new Enum("Enum" + decorateEnumIndex++, object18);
|
|
32275
32275
|
util.decorateRoot.add(enm);
|
|
32276
|
-
Object.defineProperty(
|
|
32276
|
+
Object.defineProperty(object18, "$type", { value: enm, enumerable: false });
|
|
32277
32277
|
return enm;
|
|
32278
32278
|
};
|
|
32279
32279
|
util.setProperty = function setProperty(dst, path4, value4, ifNotSet) {
|
|
@@ -57311,9 +57311,9 @@ function floatSafeRemainder(val, step2) {
|
|
|
57311
57311
|
return ratio - roundedRatio;
|
|
57312
57312
|
}
|
|
57313
57313
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
57314
|
-
function defineLazy(
|
|
57314
|
+
function defineLazy(object18, key4, getter2) {
|
|
57315
57315
|
let value4 = void 0;
|
|
57316
|
-
Object.defineProperty(
|
|
57316
|
+
Object.defineProperty(object18, key4, {
|
|
57317
57317
|
get() {
|
|
57318
57318
|
if (value4 === EVALUATING) {
|
|
57319
57319
|
return void 0;
|
|
@@ -57325,7 +57325,7 @@ function defineLazy(object17, key4, getter2) {
|
|
|
57325
57325
|
return value4;
|
|
57326
57326
|
},
|
|
57327
57327
|
set(v) {
|
|
57328
|
-
Object.defineProperty(
|
|
57328
|
+
Object.defineProperty(object18, key4, {
|
|
57329
57329
|
value: v
|
|
57330
57330
|
// configurable: true,
|
|
57331
57331
|
});
|
|
@@ -72440,8 +72440,8 @@ function foldObjects(members4) {
|
|
|
72440
72440
|
}
|
|
72441
72441
|
const properties3 = {};
|
|
72442
72442
|
const required4 = /* @__PURE__ */ new Set();
|
|
72443
|
-
for (const
|
|
72444
|
-
for (const key4 in
|
|
72443
|
+
for (const object18 of objects) {
|
|
72444
|
+
for (const key4 in object18.properties) {
|
|
72445
72445
|
if (Object.prototype.hasOwnProperty.call(properties3, key4))
|
|
72446
72446
|
continue;
|
|
72447
72447
|
const parts3 = [];
|
|
@@ -72455,18 +72455,18 @@ function foldObjects(members4) {
|
|
|
72455
72455
|
const merged = parts3.length === 1 ? parts3[0] : foldObjects(parts3) ?? { allOf: parts3 };
|
|
72456
72456
|
assignProp(properties3, key4, merged);
|
|
72457
72457
|
}
|
|
72458
|
-
for (const key4 of
|
|
72458
|
+
for (const key4 of object18.required ?? [])
|
|
72459
72459
|
required4.add(key4);
|
|
72460
72460
|
}
|
|
72461
72461
|
const folded = { type: "object", properties: properties3 };
|
|
72462
72462
|
if (required4.size)
|
|
72463
72463
|
folded.required = [...required4];
|
|
72464
|
-
if (objects.every((
|
|
72464
|
+
if (objects.every((object18) => object18.additionalProperties === false)) {
|
|
72465
72465
|
folded.additionalProperties = false;
|
|
72466
72466
|
} else {
|
|
72467
72467
|
const constraints = [];
|
|
72468
|
-
for (const
|
|
72469
|
-
const constraint = undeclaredConstraint(
|
|
72468
|
+
for (const object18 of objects) {
|
|
72469
|
+
const constraint = undeclaredConstraint(object18);
|
|
72470
72470
|
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
72471
72471
|
constraints.push(constraint);
|
|
72472
72472
|
}
|
|
@@ -77702,8 +77702,8 @@ var HubSpotSeedSchema = external_exports.strictObject({
|
|
|
77702
77702
|
const plural4 = { company: "companies", contact: "contacts", deal: "deals" };
|
|
77703
77703
|
seed43.webhooks?.subscriptions.forEach((subscription2, index) => {
|
|
77704
77704
|
const [type, property4] = subscription2.split(":");
|
|
77705
|
-
const
|
|
77706
|
-
if (property4 !== void 0 && !(property4 in hubspotPropertySchemas[
|
|
77705
|
+
const object18 = plural4[type.split(".")[0]];
|
|
77706
|
+
if (property4 !== void 0 && !(property4 in hubspotPropertySchemas[object18].shape)) issue8(["webhooks", "subscriptions", index], `${property4} is not a ${object18.slice(0, -1)} property`);
|
|
77707
77707
|
if (seed43.webhooks.subscriptions.indexOf(subscription2) !== index) issue8(["webhooks", "subscriptions", index], "duplicate subscription");
|
|
77708
77708
|
});
|
|
77709
77709
|
});
|
|
@@ -80170,9 +80170,9 @@ var AttioSeedSchema = external_exports.strictObject({
|
|
|
80170
80170
|
const members4 = new Set(seed43.members.map((m) => m.ref));
|
|
80171
80171
|
if (!members4.has(seed43.agent)) issue8(["agent"], "agent must be the ref of a member");
|
|
80172
80172
|
const recordObject = /* @__PURE__ */ new Map();
|
|
80173
|
-
for (const
|
|
80174
|
-
if (recordObject.has(r2.ref)) issue8(["records",
|
|
80175
|
-
recordObject.set(r2.ref,
|
|
80173
|
+
for (const object18 of ["people", "companies", "deals"]) seed43.records[object18].forEach((r2, i) => {
|
|
80174
|
+
if (recordObject.has(r2.ref)) issue8(["records", object18, i, "ref"], "duplicate record ref");
|
|
80175
|
+
recordObject.set(r2.ref, object18);
|
|
80176
80176
|
});
|
|
80177
80177
|
const lists = /* @__PURE__ */ new Set();
|
|
80178
80178
|
const emails = new Set(seed43.members.map((m) => m.email.toLowerCase()));
|
|
@@ -80193,9 +80193,9 @@ var AttioSeedSchema = external_exports.strictObject({
|
|
|
80193
80193
|
}
|
|
80194
80194
|
}
|
|
80195
80195
|
};
|
|
80196
|
-
for (const
|
|
80197
|
-
const standard2 = { ...Object.fromEntries(ATTIO_STANDARD_ATTRIBUTES[
|
|
80198
|
-
seed43.records[
|
|
80196
|
+
for (const object18 of ["people", "companies", "deals"]) {
|
|
80197
|
+
const standard2 = { ...Object.fromEntries(ATTIO_STANDARD_ATTRIBUTES[object18].map((slug10) => [slug10, {}])), ...STANDARD_LOOKUPS[object18], ...object18 === "deals" && { stage: { options: seed43.deal_stages } } };
|
|
80198
|
+
seed43.records[object18].forEach((r2, i) => named4(r2.values, seed43.attributes[object18] ?? [], standard2, ["records", object18, i, "values"]));
|
|
80199
80199
|
}
|
|
80200
80200
|
seed43.lists.forEach((l, i) => {
|
|
80201
80201
|
if (lists.has(l.api_slug)) issue8(["lists", i, "api_slug"], "duplicate list slug");
|
|
@@ -80220,7 +80220,7 @@ var AttioSeedSchema = external_exports.strictObject({
|
|
|
80220
80220
|
});
|
|
80221
80221
|
});
|
|
80222
80222
|
function attioSeedRecords(seed43) {
|
|
80223
|
-
return ["people", "companies", "deals"].flatMap((
|
|
80223
|
+
return ["people", "companies", "deals"].flatMap((object18) => seed43.records[object18].map((r2) => ({ collection: object18, id: r2.ref, label: String(r2.values.name ?? r2.ref) })));
|
|
80224
80224
|
}
|
|
80225
80225
|
var attioStarterSeed = {
|
|
80226
80226
|
workspace: { name: "Acme", slug: "acme" },
|
|
@@ -87251,7 +87251,7 @@ function validateRefs(scene2) {
|
|
|
87251
87251
|
for (const field5 of ["charge", "payment_intent"]) localUse(`stripe.refunds.${field5}`, c.state["stripe.refunds"][field5], field5, stripeRefs(field5));
|
|
87252
87252
|
}
|
|
87253
87253
|
if ("stripe.balance" in c.state) localUse("stripe.balance.customer", c.state["stripe.balance"].customer, "customer", stripeRefs("customer"));
|
|
87254
|
-
if ("stripe.unchanged" in c.state) c.state["stripe.unchanged"].objects.forEach((
|
|
87254
|
+
if ("stripe.unchanged" in c.state) c.state["stripe.unchanged"].objects.forEach((object18, n2) => localUse(`stripe.unchanged.objects[${n2}].id`, object18.id, object18.type, stripeRefs(object18.type)));
|
|
87255
87255
|
if ("okta.user" in c.state && c.state["okta.user"].startsWith("$")) use(`${p2}.okta.user`, c.state["okta.user"], "user", "okta");
|
|
87256
87256
|
});
|
|
87257
87257
|
const selector2 = (value4, p2) => {
|
|
@@ -89774,6 +89774,13 @@ function functionToolWiringIssues(observation) {
|
|
|
89774
89774
|
return observation.missing.length ? [{ kind: "tools", owner: "harness", service: "tools", message: functionWiringMessage(observation.missing) }] : [];
|
|
89775
89775
|
}
|
|
89776
89776
|
|
|
89777
|
+
// packages/core/src/function-tool-view.ts
|
|
89778
|
+
var object3 = (value4) => value4 !== null && typeof value4 === "object" && !Array.isArray(value4) ? value4 : {};
|
|
89779
|
+
function functionCallFields(entry2) {
|
|
89780
|
+
const response5 = object3(entry2.response);
|
|
89781
|
+
return { args: object3(entry2.request).args, result: response5.result, error_type: response5.error_type ?? object3(response5.error).type };
|
|
89782
|
+
}
|
|
89783
|
+
|
|
89777
89784
|
// packages/server/src/store.ts
|
|
89778
89785
|
import Database from "better-sqlite3";
|
|
89779
89786
|
var SCHEMA = `
|
|
@@ -90976,8 +90983,8 @@ var Context = class {
|
|
|
90976
90983
|
* })
|
|
90977
90984
|
* ```
|
|
90978
90985
|
*/
|
|
90979
|
-
json = (
|
|
90980
|
-
return this.#newResponse(JSON.stringify(
|
|
90986
|
+
json = (object18, arg, headers) => {
|
|
90987
|
+
return this.#newResponse(JSON.stringify(object18), arg, setDefaultContentType("application/json", headers));
|
|
90981
90988
|
};
|
|
90982
90989
|
html = (html2, arg, headers) => {
|
|
90983
90990
|
const res = (html3) => this.#newResponse(html3, arg, setDefaultContentType("text/html; charset=UTF-8", headers));
|
|
@@ -92321,11 +92328,11 @@ function argumentError(schema, args) {
|
|
|
92321
92328
|
if (errors2.every((error64) => error64 !== void 0)) return errors2[0];
|
|
92322
92329
|
}
|
|
92323
92330
|
if (value4 !== null && typeof value4 === "object" && !Array.isArray(value4)) {
|
|
92324
|
-
const
|
|
92325
|
-
for (const name5 of rule.required ?? []) if (!Object.hasOwn(
|
|
92331
|
+
const object18 = value4;
|
|
92332
|
+
for (const name5 of rule.required ?? []) if (!Object.hasOwn(object18, name5)) return `Missing required argument: ${[...path4, name5].join(".")}`;
|
|
92326
92333
|
const properties3 = rule.properties ?? {};
|
|
92327
92334
|
const patterns = Object.entries(rule.patternProperties ?? {}).map(([pattern, child2]) => ({ pattern: new RegExp(pattern), child: child2 }));
|
|
92328
|
-
for (const [name5, child2] of Object.entries(
|
|
92335
|
+
for (const [name5, child2] of Object.entries(object18)) {
|
|
92329
92336
|
const children3 = patterns.filter((p2) => p2.pattern.test(name5)).map((p2) => p2.child);
|
|
92330
92337
|
if (Object.hasOwn(properties3, name5)) children3.unshift(properties3[name5]);
|
|
92331
92338
|
if (!children3.length) {
|
|
@@ -94326,7 +94333,7 @@ function evaluateTrace(trace, calls2, tools) {
|
|
|
94326
94333
|
evidence: seqs(parts3.flatMap((p2) => p2.evidence))
|
|
94327
94334
|
};
|
|
94328
94335
|
}
|
|
94329
|
-
var
|
|
94336
|
+
var object4 = (value4) => value4 !== null && typeof value4 === "object" && !Array.isArray(value4) ? value4 : void 0;
|
|
94330
94337
|
var jsonValue = (value4) => value4 === void 0 ? "(missing)" : JSON.stringify(value4);
|
|
94331
94338
|
function toolValueDifferences(have, want, path4, subset) {
|
|
94332
94339
|
if (Array.isArray(want)) {
|
|
@@ -94336,7 +94343,7 @@ function toolValueDifferences(have, want, path4, subset) {
|
|
|
94336
94343
|
...want.flatMap((value4, index) => toolValueDifferences(have[index], value4, `${path4}[${index}]`, false))
|
|
94337
94344
|
];
|
|
94338
94345
|
}
|
|
94339
|
-
const desired =
|
|
94346
|
+
const desired = object4(want), actual = object4(have);
|
|
94340
94347
|
if (desired && actual) return [
|
|
94341
94348
|
...Object.entries(desired).flatMap(([key4, value4]) => Object.hasOwn(actual, key4) ? toolValueDifferences(actual[key4], value4, `${path4}.${key4}`, subset) : [`${path4}.${key4}: expected ${jsonValue(value4)}, got (missing)`]),
|
|
94342
94349
|
...!subset ? Object.keys(actual).filter((key4) => !Object.hasOwn(desired, key4)).map((key4) => `${path4}.${key4}: unexpected ${jsonValue(actual[key4])}`) : []
|
|
@@ -94348,11 +94355,12 @@ function evaluateToolCall(check3, trace) {
|
|
|
94348
94355
|
const status4 = check3.status ?? "succeeded", count4 = check3.count ?? { gte: 1 };
|
|
94349
94356
|
const expected = `${check3.name}: status ${status4}; count ${JSON.stringify(count4)}` + (check3.args ? `; args ${JSON.stringify(check3.args)}` : "") + (check3.result ? `; result ${JSON.stringify(check3.result)}` : "") + (check3.error ? `; error.type ${JSON.stringify(check3.error.type)}` : "");
|
|
94350
94357
|
const candidates = calls2.map((entry2) => {
|
|
94351
|
-
const response5 =
|
|
94358
|
+
const response5 = object4(entry2.response), request4 = object4(entry2.request);
|
|
94352
94359
|
const functionCall = entry2.service === "tools" && entry2.path === `/tools/${check3.name}`;
|
|
94353
|
-
const params10 =
|
|
94354
|
-
const
|
|
94355
|
-
const
|
|
94360
|
+
const params10 = object4(request4?.params);
|
|
94361
|
+
const fields11 = functionCallFields(entry2);
|
|
94362
|
+
const args = functionCall ? fields11.args : entry2.method === "MCP" ? request4?.args ?? request4?.arguments : params10?.arguments;
|
|
94363
|
+
const result = functionCall ? fields11.result : entry2.method === "POST" ? response5?.result : entry2.response;
|
|
94356
94364
|
const unconfirmed = response5?.execution_status === "unknown" || response5?.execution_status === "pending";
|
|
94357
94365
|
if (unconfirmed) throw new AnchaError("USAGE", `${check3.name} (seq ${entry2.seq}): completion missing. ${functionWiringMessage([check3.name])} Await the wrapped call and its completion report before finishing the task.`);
|
|
94358
94366
|
const actualStatus = response5?.execution_status === "failed" || failure2(entry2) !== void 0 || response5?.isError === true || response5?.error != null ? "failed" : "succeeded";
|
|
@@ -94369,14 +94377,14 @@ function evaluateToolCall(check3, trace) {
|
|
|
94369
94377
|
}
|
|
94370
94378
|
differences2.push(...toolValueDifferences(value4, predicate.equals !== void 0 ? predicate.equals : predicate.contains, field5, predicate.contains !== void 0));
|
|
94371
94379
|
}
|
|
94372
|
-
const errorType = response5?.error_type ??
|
|
94380
|
+
const errorType = functionCall ? fields11.error_type : response5?.error_type ?? object4(response5?.error)?.type;
|
|
94373
94381
|
if (check3.error && errorType !== check3.error.type) differences2.push(`error.type: expected ${jsonValue(check3.error.type)}, got ${jsonValue(errorType)}`);
|
|
94374
94382
|
return { entry: entry2, differences: differences2, actualStatus };
|
|
94375
94383
|
});
|
|
94376
94384
|
const matched = candidates.filter((call2) => call2.differences.length === 0);
|
|
94377
94385
|
const passed = (count4.eq === void 0 || matched.length === count4.eq) && (count4.gte === void 0 || matched.length >= count4.gte) && (count4.lte === void 0 || matched.length <= count4.lte);
|
|
94378
94386
|
const closest = [...candidates].sort((a, b) => a.differences.length - b.differences.length || a.entry.seq - b.entry.seq)[0];
|
|
94379
|
-
const detail3 = closest ? `closest call ${check3.name} (seq ${closest.entry.seq}${closest.entry.completion ? `, completion seq ${closest.entry.completion.seq}` : ""}${
|
|
94387
|
+
const detail3 = closest ? `closest call ${check3.name} (seq ${closest.entry.seq}${closest.entry.completion ? `, completion seq ${closest.entry.completion.seq}` : ""}${object4(closest.entry.response)?.source ? `, ${object4(closest.entry.response).source}` : ""}): ${list2(closest.differences) || `status ${closest.actualStatus}; all call predicates match`}` : `no call named ${check3.name}`;
|
|
94380
94388
|
const actual = `${check3.name}: count ${matched.length} matching of ${calls2.length} named call(s); ${detail3}`;
|
|
94381
94389
|
return {
|
|
94382
94390
|
passed,
|
|
@@ -95802,13 +95810,13 @@ function githubEvent(ctx, type, payload2, additionalLinks = []) {
|
|
|
95802
95810
|
const body6 = structuredClone({ ...payload2, sender: payload2.sender ?? userShape(githubEventContext(ctx), botUser(ctx)) });
|
|
95803
95811
|
const apiLinks = [];
|
|
95804
95812
|
const fields11 = (pointer2, keys6) => {
|
|
95805
|
-
let
|
|
95813
|
+
let object18 = body6;
|
|
95806
95814
|
for (const key4 of pointer2.slice(1).split("/")) {
|
|
95807
|
-
if (!
|
|
95808
|
-
|
|
95815
|
+
if (!object18 || typeof object18 !== "object") return;
|
|
95816
|
+
object18 = object18[key4];
|
|
95809
95817
|
}
|
|
95810
|
-
if (!
|
|
95811
|
-
const resource2 =
|
|
95818
|
+
if (!object18 || typeof object18 !== "object") return;
|
|
95819
|
+
const resource2 = object18;
|
|
95812
95820
|
for (const key4 of keys6) {
|
|
95813
95821
|
const value4 = resource2[key4];
|
|
95814
95822
|
if (typeof value4 !== "string" || !(value4.startsWith(`${semanticOrigin}/`) || value4.startsWith("/"))) continue;
|
|
@@ -97107,12 +97115,12 @@ function transitionIncident(ctx, id14, change3, actor3) {
|
|
|
97107
97115
|
}
|
|
97108
97116
|
|
|
97109
97117
|
// packages/server/src/twins/pagerduty/ingest.ts
|
|
97110
|
-
function
|
|
97118
|
+
function object5(value4) {
|
|
97111
97119
|
return value4 !== null && typeof value4 === "object" && !Array.isArray(value4);
|
|
97112
97120
|
}
|
|
97113
97121
|
function ingestEvent(ctx, input5) {
|
|
97114
97122
|
return withMutation(ctx, () => {
|
|
97115
|
-
if (!
|
|
97123
|
+
if (!object5(input5)) invalid2("Event must be an object");
|
|
97116
97124
|
for (const key5 of Object.keys(input5)) if (!["routing_key", "event_action", "dedup_key", "payload"].includes(key5)) unsupported2(`Events ${key5}`);
|
|
97117
97125
|
if (typeof input5.routing_key !== "string") invalid2("routing_key is required");
|
|
97118
97126
|
const service = ctx.store.db.prepare("SELECT * FROM pagerduty_services WHERE routing_key = ?").get(input5.routing_key);
|
|
@@ -97121,11 +97129,11 @@ function ingestEvent(ctx, input5) {
|
|
|
97121
97129
|
if (input5.dedup_key !== void 0 && (typeof input5.dedup_key !== "string" || !input5.dedup_key.length || input5.dedup_key.length > 255)) invalid2("dedup_key must be 1 to 255 characters");
|
|
97122
97130
|
if (input5.event_action !== "trigger" && input5.dedup_key === void 0) invalid2("dedup_key is required");
|
|
97123
97131
|
if (input5.payload !== void 0) {
|
|
97124
|
-
if (!
|
|
97132
|
+
if (!object5(input5.payload)) invalid2("payload must be an object");
|
|
97125
97133
|
for (const key5 of Object.keys(input5.payload)) if (!["summary", "source", "severity", "timestamp", "component", "group", "class", "custom_details"].includes(key5)) unsupported2(`Events payload.${key5}`);
|
|
97126
97134
|
for (const key5 of ["component", "group", "class"]) if (input5.payload[key5] !== void 0 && typeof input5.payload[key5] !== "string") invalid2(`Invalid payload.${key5}`);
|
|
97127
97135
|
if (input5.payload.timestamp !== void 0 && (!/^\d{4}-\d\d-\d\dT/.test(input5.payload.timestamp) || !Number.isFinite(Date.parse(input5.payload.timestamp)))) invalid2("Invalid payload.timestamp");
|
|
97128
|
-
if (input5.payload.custom_details !== void 0 && !
|
|
97136
|
+
if (input5.payload.custom_details !== void 0 && !object5(input5.payload.custom_details)) invalid2("Invalid payload.custom_details");
|
|
97129
97137
|
}
|
|
97130
97138
|
if (input5.event_action === "trigger") {
|
|
97131
97139
|
const p2 = input5.payload;
|
|
@@ -97601,11 +97609,11 @@ function replaceLink(message8, link6, url4) {
|
|
|
97601
97609
|
for (const [index, key4] of keys6.entries()) {
|
|
97602
97610
|
if (typeof target5 !== "object" || target5 === null || !Object.hasOwn(target5, key4) || Array.isArray(target5) && !/^(0|[1-9]\d*)$/.test(key4))
|
|
97603
97611
|
throw new AnchaError("INTERNAL", "Missing Slack message API link field");
|
|
97604
|
-
const
|
|
97612
|
+
const object18 = target5;
|
|
97605
97613
|
if (index === keys6.length - 1) {
|
|
97606
|
-
if (
|
|
97607
|
-
Object.defineProperty(
|
|
97608
|
-
} else target5 =
|
|
97614
|
+
if (object18[key4] !== link6.path) throw new AnchaError("INTERNAL", "Slack message API link does not match its semantic path");
|
|
97615
|
+
Object.defineProperty(object18, key4, { value: url4, enumerable: true, configurable: true, writable: true });
|
|
97616
|
+
} else target5 = object18[key4];
|
|
97609
97617
|
}
|
|
97610
97618
|
}
|
|
97611
97619
|
function persistMessageLinks(ctx, row2, links3 = []) {
|
|
@@ -98247,7 +98255,7 @@ var SINGULAR = { companies: "company", contacts: "contact", deals: "deal" };
|
|
|
98247
98255
|
function emitWebhooks(ctx, type, prior, next2) {
|
|
98248
98256
|
const seed43 = ctx.scene.seed.hubspot, webhooks = seed43?.webhooks;
|
|
98249
98257
|
if (!seed43 || !webhooks?.subscriptions.length) return;
|
|
98250
|
-
const
|
|
98258
|
+
const object18 = SINGULAR[type];
|
|
98251
98259
|
webhooks.subscriptions.forEach((subscription2, index) => {
|
|
98252
98260
|
const [subscriptionType, propertyName] = subscription2.split(":");
|
|
98253
98261
|
const event3 = () => ({
|
|
@@ -98261,8 +98269,8 @@ function emitWebhooks(ctx, type, prior, next2) {
|
|
|
98261
98269
|
objectId: Number(next2.id),
|
|
98262
98270
|
changeSource: "API"
|
|
98263
98271
|
});
|
|
98264
|
-
if (subscriptionType === `${
|
|
98265
|
-
if (subscriptionType === `${
|
|
98272
|
+
if (subscriptionType === `${object18}.creation` && prior === void 0) ctx.events.append({ service: "hubspot", type: subscriptionType, payload: [event3()] });
|
|
98273
|
+
if (subscriptionType === `${object18}.propertyChange` && propertyName !== void 0) {
|
|
98266
98274
|
const value4 = next2.properties[propertyName];
|
|
98267
98275
|
if (value4 !== void 0 && value4 !== "" && value4 !== prior?.properties[propertyName]) ctx.events.append({ service: "hubspot", type: subscriptionType, payload: [{ ...event3(), propertyName, propertyValue: value4 }] });
|
|
98268
98276
|
}
|
|
@@ -99555,7 +99563,7 @@ function handleMutation(handler, status4 = 200, applicationKey = true) {
|
|
|
99555
99563
|
}
|
|
99556
99564
|
};
|
|
99557
99565
|
}
|
|
99558
|
-
function
|
|
99566
|
+
function object6(value4, field5) {
|
|
99559
99567
|
if (value4 === null || typeof value4 !== "object" || Array.isArray(value4)) throw new DatadogError(400, `Invalid ${field5}: expected object`);
|
|
99560
99568
|
return value4;
|
|
99561
99569
|
}
|
|
@@ -103089,7 +103097,7 @@ function fields4(value4, allowed2) {
|
|
|
103089
103097
|
if (!allowed2.includes(key4))
|
|
103090
103098
|
gap(`field ${key4}`);
|
|
103091
103099
|
}
|
|
103092
|
-
function
|
|
103100
|
+
function object7(value4) {
|
|
103093
103101
|
if (!value4 || typeof value4 !== "object" || Array.isArray(value4))
|
|
103094
103102
|
invalid5("Expected an object");
|
|
103095
103103
|
return value4;
|
|
@@ -103332,7 +103340,7 @@ function search2(ctx, body6, customer3, stream = false) {
|
|
|
103332
103340
|
if (body6.summaryRowSetting && !["UNSPECIFIED", "NO_SUMMARY_ROW"].includes(body6.summaryRowSetting))
|
|
103333
103341
|
gap("summaryRowSetting");
|
|
103334
103342
|
if (body6.searchSettings) {
|
|
103335
|
-
fields4(
|
|
103343
|
+
fields4(object7(body6.searchSettings), ["returnTotalResultsCount"]);
|
|
103336
103344
|
if (body6.searchSettings.returnTotalResultsCount !== void 0 && typeof body6.searchSettings.returnTotalResultsCount !== "boolean")
|
|
103337
103345
|
invalid5("returnTotalResultsCount must be boolean");
|
|
103338
103346
|
}
|
|
@@ -103481,7 +103489,7 @@ function updatePaths(mask2) {
|
|
|
103481
103489
|
invalid5("update_mask is required");
|
|
103482
103490
|
return mask2.split(",").map((p2) => p2.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`));
|
|
103483
103491
|
}
|
|
103484
|
-
const obj =
|
|
103492
|
+
const obj = object7(mask2);
|
|
103485
103493
|
fields4(obj, ["paths"]);
|
|
103486
103494
|
if (!Array.isArray(obj.paths) || !obj.paths.length || obj.paths.some((p2) => typeof p2 !== "string"))
|
|
103487
103495
|
invalid5("update_mask.paths must contain field paths");
|
|
@@ -103511,7 +103519,7 @@ function validateRelationships(ctx, kind, record9, cid) {
|
|
|
103511
103519
|
throw new AdsError(3, "fieldError", "INVALID_VALUE", "end_date_time must not precede start_date_time");
|
|
103512
103520
|
}
|
|
103513
103521
|
function oneOperation(ctx, kind, cid, raw3, returnResource) {
|
|
103514
|
-
const op =
|
|
103522
|
+
const op = object7(raw3);
|
|
103515
103523
|
fields4(op, ["create", "update", "remove", "updateMask"]);
|
|
103516
103524
|
const types = ["create", "update", "remove"].filter((k) => op[k] !== void 0);
|
|
103517
103525
|
if (types.length !== 1)
|
|
@@ -103520,7 +103528,7 @@ function oneOperation(ctx, kind, cid, raw3, returnResource) {
|
|
|
103520
103528
|
invalid5("update_mask is only valid with update");
|
|
103521
103529
|
let record9;
|
|
103522
103530
|
if (op.create !== void 0) {
|
|
103523
|
-
const input5 =
|
|
103531
|
+
const input5 = object7(op.create);
|
|
103524
103532
|
for (const k of ["resourceName", "id", "criterionId", "policySummary", "type"]) {
|
|
103525
103533
|
if (input5[k] !== void 0 && !(k === "type" && kind === "adGroups"))
|
|
103526
103534
|
throw new AdsError(3, "fieldError", "VALUE_MUST_BE_UNSET", `${k} must not be set on create`);
|
|
@@ -103537,7 +103545,7 @@ function oneOperation(ctx, kind, cid, raw3, returnResource) {
|
|
|
103537
103545
|
if (kind === "ads") {
|
|
103538
103546
|
if (input5.ad?.id !== void 0 || input5.ad?.resourceName !== void 0 || input5.ad?.type !== void 0)
|
|
103539
103547
|
throw new AdsError(3, "fieldError", "VALUE_MUST_BE_UNSET", "Ad id, resource_name and type are assigned on create");
|
|
103540
|
-
record9.ad = { ...
|
|
103548
|
+
record9.ad = { ...object7(input5.ad), id: id14, resourceName: `customers/${cid}/ads/${id14}`, type: "RESPONSIVE_SEARCH_AD" };
|
|
103541
103549
|
record9.policySummary = { reviewStatus: "REVIEW_IN_PROGRESS", approvalStatus: "UNKNOWN" };
|
|
103542
103550
|
}
|
|
103543
103551
|
if (kind === "criteria")
|
|
@@ -103545,7 +103553,7 @@ function oneOperation(ctx, kind, cid, raw3, returnResource) {
|
|
|
103545
103553
|
if (kind === "budgets")
|
|
103546
103554
|
record9.status = "ENABLED";
|
|
103547
103555
|
} else {
|
|
103548
|
-
const input5 = op.update === void 0 ? void 0 :
|
|
103556
|
+
const input5 = op.update === void 0 ? void 0 : object7(op.update), name5 = parseName(op.remove ?? input5?.resourceName, cid, kind);
|
|
103549
103557
|
const old = get(ctx, kind, name5);
|
|
103550
103558
|
if (!old)
|
|
103551
103559
|
throw new AdsError(3, "mutateError", "RESOURCE_NOT_FOUND", "Resource does not exist");
|
|
@@ -103643,7 +103651,7 @@ function execute2(ctx, method2, raw3, headers) {
|
|
|
103643
103651
|
const write4 = method2.startsWith("Mutate");
|
|
103644
103652
|
return (write4 ? withMutation : withRead)(ctx, () => {
|
|
103645
103653
|
authenticate4(ctx, headers);
|
|
103646
|
-
const body6 =
|
|
103654
|
+
const body6 = object7(raw3);
|
|
103647
103655
|
if (method2 === "ListAccessibleCustomers") {
|
|
103648
103656
|
fields4(body6, []);
|
|
103649
103657
|
return { resourceNames: config3(ctx).access.directCustomerIds.map((id14) => `customers/${id14}`) };
|
|
@@ -104088,7 +104096,7 @@ function invalid6(message8, param4 = null) {
|
|
|
104088
104096
|
function unsupported6(message8) {
|
|
104089
104097
|
throw new AdsError2(501, `ancha: not implemented: ${message8}`, "unsupported_operation");
|
|
104090
104098
|
}
|
|
104091
|
-
function
|
|
104099
|
+
function object8(value4, field5 = "body") {
|
|
104092
104100
|
if (!value4 || typeof value4 !== "object" || Array.isArray(value4)) invalid6(`${field5} must be an object`, field5);
|
|
104093
104101
|
return value4;
|
|
104094
104102
|
}
|
|
@@ -104218,15 +104226,15 @@ var createFields = { campaigns: ["name", "description", "status", "start_time",
|
|
|
104218
104226
|
var updateFields = { campaigns: ["name", "description", "status", "start_time", "end_time", "budget", "targeting"], adGroups: ["name", "description", "status", "context_hints", "bidding_config"], ads: ["name", "status", "creative"] };
|
|
104219
104227
|
function targeting2(value4, previous) {
|
|
104220
104228
|
if (value4 === null) return {};
|
|
104221
|
-
const body6 =
|
|
104229
|
+
const body6 = object8(value4, "targeting");
|
|
104222
104230
|
keys2(body6, ["locations", "platforms"], "targeting");
|
|
104223
|
-
if (body6.locations !== void 0) keys2(
|
|
104224
|
-
if (body6.platforms !== void 0 && body6.platforms !== null) keys2(
|
|
104231
|
+
if (body6.locations !== void 0) keys2(object8(body6.locations, "locations"), ["countries"], "targeting.locations");
|
|
104232
|
+
if (body6.platforms !== void 0 && body6.platforms !== null) keys2(object8(body6.platforms, "platforms"), ["included"], "targeting.platforms");
|
|
104225
104233
|
const parsed3 = parse5(ChatGPTAdsTargetingSchema, body6);
|
|
104226
104234
|
return { ...parsed3, ...!Object.hasOwn(body6, "platforms") && previous?.platforms !== void 0 ? { platforms: previous.platforms } : {} };
|
|
104227
104235
|
}
|
|
104228
104236
|
function bidding(value4, campaign2, access3) {
|
|
104229
|
-
const body6 =
|
|
104237
|
+
const body6 = object8(value4, "bidding_config");
|
|
104230
104238
|
keys2(body6, ["billing_event_type", "strategy", "max_bid_micros"], "bidding_config");
|
|
104231
104239
|
if (body6.strategy === "maximize_conversions") unsupported6("conversion bidding");
|
|
104232
104240
|
const bid = parse5(ChatGPTAdsBiddingSchema, body6), billing = campaign2.bidding_type === "clicks" ? "click" : "impression";
|
|
@@ -104238,7 +104246,7 @@ function bidding(value4, campaign2, access3) {
|
|
|
104238
104246
|
return { ...bid, strategy };
|
|
104239
104247
|
}
|
|
104240
104248
|
function creative(value4, access3, creating) {
|
|
104241
|
-
const body6 =
|
|
104249
|
+
const body6 = object8(value4, "creative");
|
|
104242
104250
|
keys2(body6, ["type", "title", "body", "target_url", "file_id", "price"], "creative");
|
|
104243
104251
|
if (body6.type !== void 0 && body6.type !== "chat_card") unsupported6(`creative type ${String(body6.type)}`);
|
|
104244
104252
|
const parsed3 = parse5(ChatGPTAdsCreativeSchema, body6);
|
|
@@ -104259,7 +104267,7 @@ function validateSeed(seed43) {
|
|
|
104259
104267
|
return parse5(ChatGPTAdsSeedSchema, seed43);
|
|
104260
104268
|
}
|
|
104261
104269
|
function mutate2(c, access3, kind, input5, existing2) {
|
|
104262
|
-
const body6 =
|
|
104270
|
+
const body6 = object8(input5), creating = !existing2;
|
|
104263
104271
|
keys2(body6, creating ? createFields[kind] : updateFields[kind], kind);
|
|
104264
104272
|
if (creating && !["active", "paused"].includes(body6.status)) invalid6("Create status must be active or paused", "status");
|
|
104265
104273
|
if (creating) {
|
|
@@ -104276,7 +104284,7 @@ function mutate2(c, access3, kind, input5, existing2) {
|
|
|
104276
104284
|
if (kind === "campaigns") {
|
|
104277
104285
|
if (creating && body6.bidding_type === void 0) candidate.bidding_type = "impressions";
|
|
104278
104286
|
if (Object.hasOwn(body6, "targeting")) candidate.targeting = targeting2(body6.targeting, existing2?.targeting);
|
|
104279
|
-
if (body6.budget !== void 0) keys2(
|
|
104287
|
+
if (body6.budget !== void 0) keys2(object8(body6.budget, "budget"), ["daily_spend_limit_micros", "lifetime_spend_limit_micros"], "budget");
|
|
104280
104288
|
if (candidate.end_time !== void 0 && candidate.end_time !== null && Number(candidate.end_time) <= Number(candidate.start_time ?? timestamp4)) invalid6("end_time must follow start_time");
|
|
104281
104289
|
} else if (kind === "adGroups") {
|
|
104282
104290
|
if (body6.bidding_config !== void 0) candidate.bidding_config = bidding(body6.bidding_config, ancestor ?? find(access3, "campaigns", existing2.campaign_id), access3);
|
|
@@ -104355,7 +104363,7 @@ var levels = ["ad_account", "campaign", "ad_group", "ad"];
|
|
|
104355
104363
|
var metrics = ["impressions", "clicks", "spend", "ctr", "cpc", "cpm"];
|
|
104356
104364
|
function json7(value4, field5) {
|
|
104357
104365
|
try {
|
|
104358
|
-
return
|
|
104366
|
+
return object8(JSON.parse(value4), field5);
|
|
104359
104367
|
} catch (error64) {
|
|
104360
104368
|
if (error64 instanceof SyntaxError) invalid6(`Invalid JSON in ${field5}`);
|
|
104361
104369
|
throw error64;
|
|
@@ -104531,7 +104539,7 @@ function invalid7(message8) {
|
|
|
104531
104539
|
function unsupported7(message8) {
|
|
104532
104540
|
throw new GA4Error(501, "UNIMPLEMENTED", `ancha: not implemented: ${message8}`);
|
|
104533
104541
|
}
|
|
104534
|
-
function
|
|
104542
|
+
function object9(value4, field5) {
|
|
104535
104543
|
if (!value4 || typeof value4 !== "object" || Array.isArray(value4)) invalid7(`${field5} must be an object`);
|
|
104536
104544
|
return value4;
|
|
104537
104545
|
}
|
|
@@ -104655,7 +104663,7 @@ function selectedFields(raw3, kind, required4 = false) {
|
|
|
104655
104663
|
if (raw3 === void 0 && !required4) return [];
|
|
104656
104664
|
if (!Array.isArray(raw3) || raw3.length > (kind === "dimensions" ? 9 : 10) || required4 && !raw3.length) invalid7(`Invalid ${kind} count`);
|
|
104657
104665
|
const fields11 = raw3.map((entry2, index) => {
|
|
104658
|
-
const item2 =
|
|
104666
|
+
const item2 = object9(entry2, `${kind}[${index}]`);
|
|
104659
104667
|
keys3(item2, kind === "dimensions" ? ["name", "dimensionExpression"] : ["name", "expression", "invisible"], kind);
|
|
104660
104668
|
if (item2.dimensionExpression !== void 0 || item2.expression !== void 0 || item2.invisible === true) unsupported7(`${kind} expressions or invisible metrics`);
|
|
104661
104669
|
if (item2.invisible !== void 0 && typeof item2.invisible !== "boolean") invalid7("Invalid invisible");
|
|
@@ -104718,7 +104726,7 @@ function metric2(atoms, name5) {
|
|
|
104718
104726
|
|
|
104719
104727
|
// packages/server/src/twins/ga4/filter.ts
|
|
104720
104728
|
function numeric(value4) {
|
|
104721
|
-
const item2 =
|
|
104729
|
+
const item2 = object9(value4, "NumericValue");
|
|
104722
104730
|
keys3(item2, ["int64Value", "doubleValue"], "NumericValue");
|
|
104723
104731
|
if (Object.keys(item2).length !== 1) invalid7("NumericValue must contain exactly one value");
|
|
104724
104732
|
if (item2.int64Value !== void 0) {
|
|
@@ -104735,7 +104743,7 @@ function compileFilter(raw3, kind) {
|
|
|
104735
104743
|
let count4 = 0;
|
|
104736
104744
|
const compile2 = (raw4, depth) => {
|
|
104737
104745
|
if (depth > 8 || ++count4 > 100) invalid7("Filter exceeds supported depth/node limit");
|
|
104738
|
-
const expr =
|
|
104746
|
+
const expr = object9(raw4, "FilterExpression");
|
|
104739
104747
|
keys3(expr, ["andGroup", "orGroup", "notExpression", "filter"], "FilterExpression");
|
|
104740
104748
|
if (Object.keys(expr).length !== 1) invalid7("FilterExpression requires exactly one expression");
|
|
104741
104749
|
if (expr.notExpression !== void 0) {
|
|
@@ -104743,18 +104751,18 @@ function compileFilter(raw3, kind) {
|
|
|
104743
104751
|
return (read6) => !child2(read6);
|
|
104744
104752
|
}
|
|
104745
104753
|
for (const op2 of ["andGroup", "orGroup"]) if (expr[op2] !== void 0) {
|
|
104746
|
-
const group5 =
|
|
104754
|
+
const group5 = object9(expr[op2], op2);
|
|
104747
104755
|
keys3(group5, ["expressions"], op2);
|
|
104748
104756
|
if (!Array.isArray(group5.expressions) || !group5.expressions.length || group5.expressions.length > 20) invalid7("Invalid filter group");
|
|
104749
104757
|
const children3 = group5.expressions.map((child2) => compile2(child2, depth + 1));
|
|
104750
104758
|
return op2 === "andGroup" ? (read6) => children3.every((fn) => fn(read6)) : (read6) => children3.some((fn) => fn(read6));
|
|
104751
104759
|
}
|
|
104752
|
-
const filter4 =
|
|
104760
|
+
const filter4 = object9(expr.filter, "filter");
|
|
104753
104761
|
keys3(filter4, ["fieldName", "stringFilter", "inListFilter", "numericFilter", "betweenFilter", "emptyFilter"], "filter");
|
|
104754
104762
|
const field5 = kind === "dimension" ? dimensionName(filter4.fieldName) : metricName(filter4.fieldName);
|
|
104755
104763
|
const operators = Object.keys(filter4).filter((key4) => key4 !== "fieldName");
|
|
104756
104764
|
if (operators.length !== 1) invalid7("Filter requires one operator");
|
|
104757
|
-
const op = operators[0], value4 =
|
|
104765
|
+
const op = operators[0], value4 = object9(filter4[op], op);
|
|
104758
104766
|
if (op === "stringFilter") {
|
|
104759
104767
|
if (kind === "metric") invalid7("stringFilter requires a dimension");
|
|
104760
104768
|
keys3(value4, ["matchType", "value", "caseSensitive"], "stringFilter");
|
|
@@ -104820,7 +104828,7 @@ function date9(value4, property4, ctx) {
|
|
|
104820
104828
|
function ranges(raw3, property4, ctx) {
|
|
104821
104829
|
if (!Array.isArray(raw3) || raw3.length < 1 || raw3.length > 4) invalid7("One to four dateRanges are required");
|
|
104822
104830
|
const result = raw3.map((entry2, i) => {
|
|
104823
|
-
const value4 =
|
|
104831
|
+
const value4 = object9(entry2, "dateRanges");
|
|
104824
104832
|
keys3(value4, ["startDate", "endDate", "name"], "dateRanges");
|
|
104825
104833
|
const start2 = date9(value4.startDate, property4, ctx), end = date9(value4.endDate, property4, ctx);
|
|
104826
104834
|
if (end < start2) invalid7("startDate must not be after endDate");
|
|
@@ -104843,13 +104851,13 @@ function ordering(raw3, dims, mets) {
|
|
|
104843
104851
|
if (raw3 === void 0) raw3 = [];
|
|
104844
104852
|
if (!Array.isArray(raw3) || raw3.length > 20) invalid7("Invalid orderBys");
|
|
104845
104853
|
const comparisons = raw3.map((entry2) => {
|
|
104846
|
-
const value4 =
|
|
104854
|
+
const value4 = object9(entry2, "orderBys");
|
|
104847
104855
|
keys3(value4, ["dimension", "metric", "pivot", "desc"], "orderBys");
|
|
104848
104856
|
if (value4.pivot !== void 0) unsupported7("pivot order");
|
|
104849
104857
|
if (value4.dimension === void 0 === (value4.metric === void 0)) invalid7("Specify one dimension or metric order");
|
|
104850
104858
|
const sign3 = bool2(value4.desc, "orderBys.desc") ? -1 : 1;
|
|
104851
104859
|
if (value4.dimension !== void 0) {
|
|
104852
|
-
const order7 =
|
|
104860
|
+
const order7 = object9(value4.dimension, "dimension order");
|
|
104853
104861
|
keys3(order7, ["dimensionName", "orderType"], "dimension order");
|
|
104854
104862
|
const name5 = order7.dimensionName === "dateRange" ? "dateRange" : dimensionName(order7.dimensionName), index2 = dims.indexOf(name5);
|
|
104855
104863
|
if (index2 < 0) invalid7("Ordered dimension must be selected");
|
|
@@ -104864,7 +104872,7 @@ function ordering(raw3, dims, mets) {
|
|
|
104864
104872
|
return sign3 * lexical(type === "CASE_INSENSITIVE_ALPHANUMERIC" ? left.toLowerCase() : left, type === "CASE_INSENSITIVE_ALPHANUMERIC" ? right.toLowerCase() : right);
|
|
104865
104873
|
};
|
|
104866
104874
|
}
|
|
104867
|
-
const order6 =
|
|
104875
|
+
const order6 = object9(value4.metric, "metric order");
|
|
104868
104876
|
keys3(order6, ["metricName"], "metric order");
|
|
104869
104877
|
const index = mets.indexOf(metricName(order6.metricName));
|
|
104870
104878
|
if (index < 0) invalid7("Ordered metric must be selected");
|
|
@@ -104880,7 +104888,7 @@ function ordering(raw3, dims, mets) {
|
|
|
104880
104888
|
}
|
|
104881
104889
|
var wire = (row2) => ({ dimensionValues: row2.dimensions.map((value4) => ({ value: value4 })), metricValues: row2.metrics.map((value4) => ({ value: String(value4) })) });
|
|
104882
104890
|
function report2(ctx, property4, raw3, batch3 = false) {
|
|
104883
|
-
const value4 =
|
|
104891
|
+
const value4 = object9(raw3, "RunReportRequest");
|
|
104884
104892
|
keys3(value4, ["property", "dimensions", "metrics", "dateRanges", "dimensionFilter", "metricFilter", "offset", "limit", "metricAggregations", "orderBys", "currencyCode", "keepEmptyRows", "returnPropertyQuota", "cohortSpec", "comparisons"], "RunReportRequest");
|
|
104885
104893
|
if (value4.property !== void 0 && (!batch3 || value4.property !== `properties/${property4.id}`)) invalid7("Property must be specified in the path and match the batch");
|
|
104886
104894
|
if (value4.cohortSpec !== void 0 || value4.comparisons !== void 0) unsupported7("cohorts or comparisons");
|
|
@@ -104939,14 +104947,14 @@ var ga4Routes = [
|
|
|
104939
104947
|
return { ...result.response, ...result.returnQuota ? { propertyQuota: used } : {} };
|
|
104940
104948
|
} },
|
|
104941
104949
|
{ method: "POST", path: "/v1beta/properties/:property{[0-9]+:batchRunReports}", notes: "One to five reports for one property; prevalidate all reports before local quota debit.", run: (c, body6) => {
|
|
104942
|
-
const p2 = property2(c, c.req.param("property").split(":")[0]), value4 =
|
|
104950
|
+
const p2 = property2(c, c.req.param("property").split(":")[0]), value4 = object9(body6, "BatchRunReportsRequest");
|
|
104943
104951
|
keys3(value4, ["requests"], "BatchRunReportsRequest");
|
|
104944
104952
|
if (!Array.isArray(value4.requests) || !value4.requests.length || value4.requests.length > 5) invalid7("Batch requires one to five report requests");
|
|
104945
104953
|
const results = value4.requests.map((request4) => report2(c.env.ctx, p2, request4, true)), used = quota(c.env.ctx, p2.id, results.length);
|
|
104946
104954
|
return { kind: "analyticsData#batchRunReports", reports: results.map((result) => ({ ...result.response, ...result.returnQuota ? { propertyQuota: used } : {} })) };
|
|
104947
104955
|
} },
|
|
104948
104956
|
{ method: "POST", path: "/v1beta/properties/:property{[0-9]+:checkCompatibility}", notes: "Compatibility only within the supported metadata subset; all supported combinations are compatible. Unknown fields expose gaps.", run: (c, body6) => {
|
|
104949
|
-
const p2 = property2(c, c.req.param("property").split(":")[0]), value4 =
|
|
104957
|
+
const p2 = property2(c, c.req.param("property").split(":")[0]), value4 = object9(body6, "CheckCompatibilityRequest");
|
|
104950
104958
|
keys3(value4, ["dimensions", "metrics", "dimensionFilter", "metricFilter", "compatibilityFilter"], "CheckCompatibilityRequest");
|
|
104951
104959
|
selectedFields(value4.dimensions, "dimensions");
|
|
104952
104960
|
selectedFields(value4.metrics, "metrics");
|
|
@@ -106507,13 +106515,13 @@ function target(ctx, value4) {
|
|
|
106507
106515
|
function parse7(c, body6, version5, old) {
|
|
106508
106516
|
query3(c, []);
|
|
106509
106517
|
const ctx = c.env.ctx, now11 = ctx.clock.now().getTime();
|
|
106510
|
-
let attrs =
|
|
106518
|
+
let attrs = object6(body6, "body");
|
|
106511
106519
|
if (version5 === 2) {
|
|
106512
106520
|
keys(attrs, ["data"], "body");
|
|
106513
|
-
const data5 =
|
|
106521
|
+
const data5 = object6(attrs.data, "data");
|
|
106514
106522
|
keys(data5, ["type", "id", "attributes"], "data");
|
|
106515
106523
|
if (data5.type !== "downtime" || (old ? data5.id !== old.uuid : data5.id !== void 0)) throw new DatadogError(400, "Invalid downtime type or id");
|
|
106516
|
-
attrs =
|
|
106524
|
+
attrs = object6(data5.attributes, "attributes");
|
|
106517
106525
|
}
|
|
106518
106526
|
keys(attrs, version5 === 1 ? ["scope", "monitor_id", "monitor_tags", "start", "end", "message", "timezone", "mute_first_recovery_notification", "notify_end_types", "notify_end_states"] : ["scope", "monitor_identifier", "schedule", "message", "display_timezone", "mute_first_recovery_notification", "notify_end_types", "notify_end_states"], "downtime");
|
|
106519
106527
|
if (!old && attrs.scope === void 0) throw new DatadogError(400, "scope is required");
|
|
@@ -106528,7 +106536,7 @@ function parse7(c, body6, version5, old) {
|
|
|
106528
106536
|
monitorId = null;
|
|
106529
106537
|
}
|
|
106530
106538
|
} else if (attrs.monitor_identifier !== void 0) {
|
|
106531
|
-
const identifier4 =
|
|
106539
|
+
const identifier4 = object6(attrs.monitor_identifier, "monitor_identifier");
|
|
106532
106540
|
keys(identifier4, ["monitor_id", "monitor_tags"], "monitor_identifier");
|
|
106533
106541
|
if (Object.keys(identifier4).length !== 1) throw new DatadogError(400, "Specify exactly one monitor identifier");
|
|
106534
106542
|
if (identifier4.monitor_id !== void 0) monitorId = target(ctx, identifier4.monitor_id);
|
|
@@ -106538,7 +106546,7 @@ function parse7(c, body6, version5, old) {
|
|
|
106538
106546
|
monitorId = null;
|
|
106539
106547
|
}
|
|
106540
106548
|
} else if (!old && version5 === 2) throw new DatadogError(400, "monitor_identifier is required");
|
|
106541
|
-
const schedule3 = version5 === 1 ? attrs : attrs.schedule === void 0 ? {} :
|
|
106549
|
+
const schedule3 = version5 === 1 ? attrs : attrs.schedule === void 0 ? {} : object6(attrs.schedule, "schedule");
|
|
106542
106550
|
if (version5 === 2) keys(schedule3, ["start", "end"], "schedule");
|
|
106543
106551
|
const start2 = schedule3.start === void 0 ? old?.start ?? now11 : timestamp2(schedule3.start, version5, "start");
|
|
106544
106552
|
if (schedule3.end === void 0 && !old) unsupported4("indefinite downtime; provide a finite end");
|
|
@@ -106899,7 +106907,7 @@ function listEvents(c) {
|
|
|
106899
106907
|
}
|
|
106900
106908
|
function createEvent(c, input5) {
|
|
106901
106909
|
query3(c, []);
|
|
106902
|
-
const body6 =
|
|
106910
|
+
const body6 = object6(input5, "event");
|
|
106903
106911
|
const title2 = string5(body6.title, "title"), text24 = string5(body6.text, "text");
|
|
106904
106912
|
if (text24.length > 4e3) throw new DatadogError(400, "Event text exceeds 4000 characters");
|
|
106905
106913
|
const now11 = c.env.ctx.clock.nowMs();
|
|
@@ -106926,10 +106934,10 @@ function find2(c, id14) {
|
|
|
106926
106934
|
return row2;
|
|
106927
106935
|
}
|
|
106928
106936
|
function attributes(input5, create3, id14) {
|
|
106929
|
-
const body6 =
|
|
106937
|
+
const body6 = object6(input5, "body"), data5 = object6(body6.data, "data");
|
|
106930
106938
|
if (data5.type !== "incidents") throw new DatadogError(400, "Invalid data.type: expected incidents");
|
|
106931
106939
|
if (!create3 && incidentId(data5.id) !== id14) throw new DatadogError(400, "Incident id does not match URL");
|
|
106932
|
-
const attrs =
|
|
106940
|
+
const attrs = object6(data5.attributes === void 0 && !create3 ? {} : data5.attributes, "data.attributes");
|
|
106933
106941
|
const title2 = attrs.title === void 0 && !create3 ? void 0 : string5(attrs.title, "title");
|
|
106934
106942
|
if ((create3 || attrs.customer_impacted !== void 0) && typeof attrs.customer_impacted !== "boolean") throw new DatadogError(400, "Invalid customer_impacted: expected boolean");
|
|
106935
106943
|
if (attrs.customer_impact_scope !== void 0 && typeof attrs.customer_impact_scope !== "string") throw new DatadogError(400, "Invalid customer_impact_scope");
|
|
@@ -106937,9 +106945,9 @@ function attributes(input5, create3, id14) {
|
|
|
106937
106945
|
if ("state" in attrs || "severity" in attrs || "status" in attrs) throw new DatadogError(400, "Incident state and severity belong in attributes.fields");
|
|
106938
106946
|
let state2, severity;
|
|
106939
106947
|
if (attrs.fields !== void 0) {
|
|
106940
|
-
const fields11 =
|
|
106948
|
+
const fields11 = object6(attrs.fields, "fields");
|
|
106941
106949
|
for (const [name5, value4] of Object.entries(fields11)) {
|
|
106942
|
-
const field5 =
|
|
106950
|
+
const field5 = object6(value4, `fields.${name5}`);
|
|
106943
106951
|
if (name5 !== "state" && name5 !== "severity") unsupported4(`incident field ${name5}`);
|
|
106944
106952
|
if (typeof field5.value !== "string") throw new DatadogError(400, `Invalid fields.${name5}.value`);
|
|
106945
106953
|
if (field5.type !== void 0 && field5.type !== "dropdown") {
|
|
@@ -107076,10 +107084,10 @@ async function searchLogs(c) {
|
|
|
107076
107084
|
}
|
|
107077
107085
|
function listLogs(c, input5) {
|
|
107078
107086
|
query3(c, []);
|
|
107079
|
-
const body6 =
|
|
107080
|
-
const filter4 = body6.filter === void 0 ? {} :
|
|
107081
|
-
const page18 = body6.page === void 0 ? {} :
|
|
107082
|
-
const options3 = body6.options === void 0 ? {} :
|
|
107087
|
+
const body6 = object6(input5, "logs search");
|
|
107088
|
+
const filter4 = body6.filter === void 0 ? {} : object6(body6.filter, "filter");
|
|
107089
|
+
const page18 = body6.page === void 0 ? {} : object6(body6.page, "page");
|
|
107090
|
+
const options3 = body6.options === void 0 ? {} : object6(body6.options, "options");
|
|
107083
107091
|
const from = filter4.from === void 0 ? "now-15m" : string5(filter4.from, "filter.from");
|
|
107084
107092
|
const to = filter4.to === void 0 ? "now" : string5(filter4.to, "filter.to");
|
|
107085
107093
|
const source = filter4.query === void 0 ? "*" : string5(filter4.query, "filter.query");
|
|
@@ -109236,7 +109244,7 @@ function errorBody2(e) {
|
|
|
109236
109244
|
function errorResponse3(e) {
|
|
109237
109245
|
return json8(errorBody2(e), e.status, e.gap ? { [GAP_HEADER]: "1" } : {});
|
|
109238
109246
|
}
|
|
109239
|
-
function
|
|
109247
|
+
function object10(input5) {
|
|
109240
109248
|
if (!input5 || typeof input5 !== "object" || Array.isArray(input5)) invalid10("Expected an object");
|
|
109241
109249
|
return input5;
|
|
109242
109250
|
}
|
|
@@ -109426,11 +109434,11 @@ function create(ctx, kind, account9, body6) {
|
|
|
109426
109434
|
}
|
|
109427
109435
|
function update3(ctx, kind, account9, id14, body6) {
|
|
109428
109436
|
access(ctx, account9, true);
|
|
109429
|
-
const row2 = find3(ctx, kind, id14, account9), original = value2(row2), root3 =
|
|
109437
|
+
const row2 = find3(ctx, kind, id14, account9), original = value2(row2), root3 = object10(body6);
|
|
109430
109438
|
fields6(root3, ["patch"]);
|
|
109431
|
-
const patch =
|
|
109439
|
+
const patch = object10(root3.patch);
|
|
109432
109440
|
fields6(patch, ["$set"]);
|
|
109433
|
-
const changes =
|
|
109441
|
+
const changes = object10(patch.$set);
|
|
109434
109442
|
fields6(changes, mutable[kind]);
|
|
109435
109443
|
if (!Object.keys(changes).length) invalid10("patch.$set must not be empty");
|
|
109436
109444
|
if ((original.status === "CANCELED" || original.intendedStatus === "CANCELED") && (changes.status || changes.intendedStatus)) invalid10("Cannot reactivate a canceled entity");
|
|
@@ -109495,7 +109503,7 @@ function collectionWrite(kind, c, body6) {
|
|
|
109495
109503
|
const op = method(c, ["CREATE", "BATCH_CREATE"]);
|
|
109496
109504
|
if (op === "BATCH_CREATE") {
|
|
109497
109505
|
if (kind === "creatives") gap3("creative batch create");
|
|
109498
|
-
const b =
|
|
109506
|
+
const b = object10(body6);
|
|
109499
109507
|
fields6(b, ["elements"]);
|
|
109500
109508
|
if (!Array.isArray(b.elements) || !b.elements.length || b.elements.length > 100) invalid10("elements must contain 1..100 objects");
|
|
109501
109509
|
let hasGap = false;
|
|
@@ -109703,7 +109711,7 @@ var GongError = class extends Error {
|
|
|
109703
109711
|
function unsupported9(message8) {
|
|
109704
109712
|
throw new GongError(501, `ancha: not implemented: ${message8}`);
|
|
109705
109713
|
}
|
|
109706
|
-
function
|
|
109714
|
+
function object11(value4, field5) {
|
|
109707
109715
|
if (!value4 || typeof value4 !== "object" || Array.isArray(value4)) throw new GongError(400, `Invalid ${field5}: expected object`);
|
|
109708
109716
|
return value4;
|
|
109709
109717
|
}
|
|
@@ -109819,7 +109827,7 @@ function pageRequest(ctx, principal, op, criteria, raw3) {
|
|
|
109819
109827
|
|
|
109820
109828
|
// packages/server/src/twins/gong/routes.ts
|
|
109821
109829
|
function filter2(raw3, mode) {
|
|
109822
|
-
const value4 =
|
|
109830
|
+
const value4 = object11(raw3, "filter");
|
|
109823
109831
|
keys4(value4, ["fromDateTime", "toDateTime", "workspaceId", ...mode === "basic" ? [] : ["callIds"], ...mode === "extensive" ? ["primaryUserIds"] : []], "filter");
|
|
109824
109832
|
if (mode === "basic" && (value4.fromDateTime === void 0 || value4.toDateTime === void 0)) throw new GongError(400, "fromDateTime and toDateTime are required");
|
|
109825
109833
|
const parsed3 = {
|
|
@@ -109843,20 +109851,20 @@ function nonempty(values2) {
|
|
|
109843
109851
|
return values2;
|
|
109844
109852
|
}
|
|
109845
109853
|
function selector(raw3) {
|
|
109846
|
-
const value4 = raw3 === void 0 ? {} :
|
|
109854
|
+
const value4 = raw3 === void 0 ? {} : object11(raw3, "contentSelector");
|
|
109847
109855
|
keys4(value4, ["context", "contextTiming", "exposedFields"], "contentSelector");
|
|
109848
109856
|
const context3 = value4.context === void 0 ? "None" : value4.context;
|
|
109849
109857
|
if (!["None", "Basic", "Extended"].includes(context3)) throw new GongError(400, "Invalid contentSelector.context");
|
|
109850
109858
|
const timing = value4.contextTiming === void 0 ? ["Now"] : value4.contextTiming;
|
|
109851
109859
|
if (!Array.isArray(timing) || timing.length < 1 || timing.length > 2 || timing.some((v) => !["Now", "TimeOfCall"].includes(v)) || new Set(timing).size !== timing.length) throw new GongError(400, "Invalid contentSelector.contextTiming");
|
|
109852
109860
|
if (value4.contextTiming !== void 0 && context3 !== "Extended") throw new GongError(400, "contextTiming requires Extended context");
|
|
109853
|
-
const exposed = value4.exposedFields === void 0 ? {} :
|
|
109861
|
+
const exposed = value4.exposedFields === void 0 ? {} : object11(value4.exposedFields, "contentSelector.exposedFields");
|
|
109854
109862
|
keys4(exposed, ["parties", "content", "interaction", "collaboration", "media"], "contentSelector.exposedFields");
|
|
109855
109863
|
for (const name5 of ["parties", "media"]) if (exposed[name5] !== void 0 && typeof exposed[name5] !== "boolean") throw new GongError(400, `Invalid exposedFields.${name5}`);
|
|
109856
109864
|
if (exposed.media === true) unsupported9("contentSelector.exposedFields.media");
|
|
109857
109865
|
const unsupportedFields = { content: ["structure", "topics", "trackers", "trackerOccurrences", "pointsOfInterest", "brief", "outline", "highlights", "callOutcome", "keyPoints"], interaction: ["speakers", "video", "personInteractionStats", "questions"], collaboration: ["publicComments"] };
|
|
109858
109866
|
for (const [name5, allowed2] of Object.entries(unsupportedFields)) if (exposed[name5] !== void 0) {
|
|
109859
|
-
const fields11 =
|
|
109867
|
+
const fields11 = object11(exposed[name5], `exposedFields.${name5}`);
|
|
109860
109868
|
keys4(fields11, allowed2, `exposedFields.${name5}`);
|
|
109861
109869
|
for (const [field5, requested2] of Object.entries(fields11)) {
|
|
109862
109870
|
if (typeof requested2 !== "boolean") throw new GongError(400, `Invalid exposedFields.${name5}.${field5}`);
|
|
@@ -109886,7 +109894,7 @@ function extensive(call2, selected2) {
|
|
|
109886
109894
|
}
|
|
109887
109895
|
function post2(c, raw3, allowed2) {
|
|
109888
109896
|
query6(c, []);
|
|
109889
|
-
const value4 =
|
|
109897
|
+
const value4 = object11(raw3, "body");
|
|
109890
109898
|
keys4(value4, allowed2, "body");
|
|
109891
109899
|
return value4;
|
|
109892
109900
|
}
|
|
@@ -117994,8 +118002,8 @@ var docs = (code2) => `https://stripe.com/docs/error-codes/${code2.replace(/_/g,
|
|
|
117994
118002
|
function invalid13(message8, param4, code2) {
|
|
117995
118003
|
throw new StripeError(400, "invalid_request_error", message8, { ...code2 && { code: code2, doc_url: docs(code2) }, ...param4 && { param: param4 } });
|
|
117996
118004
|
}
|
|
117997
|
-
function missing2(
|
|
117998
|
-
throw new StripeError(404, "invalid_request_error", `No such ${
|
|
118005
|
+
function missing2(object18, id14, param4 = "id", detail3 = "") {
|
|
118006
|
+
throw new StripeError(404, "invalid_request_error", `No such ${object18}: '${id14}'${detail3}`, { code: "resource_missing", doc_url: docs("resource_missing"), param: param4 });
|
|
117999
118007
|
}
|
|
118000
118008
|
function unsupported14(what) {
|
|
118001
118009
|
throw new StripeError(501, "api_error", `ancha: not implemented: ${what}`, {}, true);
|
|
@@ -118021,7 +118029,7 @@ function oneOf(value4, param4, values2) {
|
|
|
118021
118029
|
if (typeof value4 !== "string" || !values2.includes(value4)) invalid13(`Invalid ${param4}: must be one of ${values2.slice(0, -1).join(", ")}, or ${values2[values2.length - 1]}`, param4);
|
|
118022
118030
|
return value4;
|
|
118023
118031
|
}
|
|
118024
|
-
function
|
|
118032
|
+
function object12(value4, param4, allowed2) {
|
|
118025
118033
|
if (value4 === void 0 || value4 === "") return void 0;
|
|
118026
118034
|
if (typeof value4 !== "object" || Array.isArray(value4)) invalid13(`Invalid object: ${param4}`, param4);
|
|
118027
118035
|
for (const key4 of Object.keys(value4)) if (!allowed2.includes(key4)) unsupported14(`parameter ${param4}[${key4}]`);
|
|
@@ -118054,7 +118062,7 @@ function range(value4, param4) {
|
|
|
118054
118062
|
const n2 = int2(value4, param4);
|
|
118055
118063
|
return (x) => x === n2;
|
|
118056
118064
|
}
|
|
118057
|
-
const bounds =
|
|
118065
|
+
const bounds = object12(value4, param4, ["gt", "gte", "lt", "lte"]);
|
|
118058
118066
|
const b = Object.fromEntries(Object.entries(bounds).map(([k, v]) => [k, int2(v, `${param4}[${k}]`)]));
|
|
118059
118067
|
return (x) => (b.gt === void 0 || x > b.gt) && (b.gte === void 0 || x >= b.gte) && (b.lt === void 0 || x < b.lt) && (b.lte === void 0 || x <= b.lte);
|
|
118060
118068
|
}
|
|
@@ -119038,7 +119046,7 @@ function customFields(value4) {
|
|
|
119038
119046
|
if (value4 === void 0) return void 0;
|
|
119039
119047
|
if (value4 === "") return null;
|
|
119040
119048
|
const fields11 = list9(value4, "custom_fields").map((f2, i) => {
|
|
119041
|
-
const field5 =
|
|
119049
|
+
const field5 = object12(f2, `custom_fields[${i}]`, ["name", "value"]);
|
|
119042
119050
|
const name5 = str(field5.name, `custom_fields[${i}][name]`, 40), v = str(field5.value, `custom_fields[${i}][value]`, 140);
|
|
119043
119051
|
if (!name5 || !v) invalid13("Each custom field needs a name and a value.", `custom_fields[${i}]`);
|
|
119044
119052
|
return { name: name5, value: v };
|
|
@@ -119062,7 +119070,7 @@ function customerFields(r2, c) {
|
|
|
119062
119070
|
}
|
|
119063
119071
|
if ("preferred_locales" in p2) c.preferred_locales = (list9(p2.preferred_locales, "preferred_locales") ?? []).map((l, i) => str(l, `preferred_locales[${i}]`));
|
|
119064
119072
|
c.metadata = mergeMetadata(c.metadata, p2.metadata);
|
|
119065
|
-
const settings =
|
|
119073
|
+
const settings = object12(p2.invoice_settings, "invoice_settings", ["default_payment_method"]);
|
|
119066
119074
|
if (p2.payment_method !== void 0) {
|
|
119067
119075
|
const pm = resolvePaymentMethod(r2.ctx, str(p2.payment_method, "payment_method"), c);
|
|
119068
119076
|
save6(r2.ctx, { ...pm, customer: c.id });
|
|
@@ -119143,7 +119151,7 @@ var stripeRoutes = [
|
|
|
119143
119151
|
if (proration === "always_invoice") unsupported14("proration_behavior=always_invoice");
|
|
119144
119152
|
sub2.metadata = mergeMetadata(sub2.metadata, r2.params.metadata);
|
|
119145
119153
|
if ("description" in r2.params) sub2.description = str(r2.params.description, "description", 500) || null;
|
|
119146
|
-
const details =
|
|
119154
|
+
const details = object12(r2.params.cancellation_details, "cancellation_details", ["comment", "feedback"]);
|
|
119147
119155
|
if (details) sub2.cancellation_details = {
|
|
119148
119156
|
...sub2.cancellation_details,
|
|
119149
119157
|
...details.comment !== void 0 && { comment: str(details.comment, "cancellation_details[comment]") || null },
|
|
@@ -119155,7 +119163,7 @@ var stripeRoutes = [
|
|
|
119155
119163
|
if (changes) {
|
|
119156
119164
|
const now11 = nowSeconds(r2.ctx);
|
|
119157
119165
|
changes.forEach((value4, i) => {
|
|
119158
|
-
const change3 =
|
|
119166
|
+
const change3 = object12(value4, `items[${i}]`, ["id", "price", "quantity", "deleted", "metadata"]);
|
|
119159
119167
|
const id14 = str(change3.id, `items[${i}][id]`), priceId = str(change3.price, `items[${i}][price]`), quantity = int2(change3.quantity, `items[${i}][quantity]`), remove5 = bool3(change3.deleted, `items[${i}][deleted]`);
|
|
119160
119168
|
if (quantity !== void 0 && quantity < 0) invalid13("Invalid quantity: must be greater than or equal to 0", `items[${i}][quantity]`);
|
|
119161
119169
|
const newPrice = priceId ? find4(r2.ctx, "price", priceId) : void 0;
|
|
@@ -119197,7 +119205,7 @@ var stripeRoutes = [
|
|
|
119197
119205
|
if (sub2.status === "canceled") invalid13("A canceled subscription can only update its cancellation_details and metadata.");
|
|
119198
119206
|
if (bool3(r2.params.invoice_now, "invoice_now")) unsupported14("cancel with invoice_now=true");
|
|
119199
119207
|
if (bool3(r2.params.prorate, "prorate")) unsupported14("cancel with prorate=true");
|
|
119200
|
-
const details =
|
|
119208
|
+
const details = object12(r2.params.cancellation_details, "cancellation_details", ["comment", "feedback"]);
|
|
119201
119209
|
const at3 = nowSeconds(r2.ctx);
|
|
119202
119210
|
Object.assign(sub2, {
|
|
119203
119211
|
status: "canceled",
|
|
@@ -119285,7 +119293,7 @@ var stripeRoutes = [
|
|
|
119285
119293
|
const p2 = r2.params;
|
|
119286
119294
|
if (p2.customer === void 0) invalid13("Missing required param: customer.", "customer", "parameter_missing");
|
|
119287
119295
|
const c = liveCustomer(r2.ctx, str(p2.customer, "customer"));
|
|
119288
|
-
const pricing =
|
|
119296
|
+
const pricing = object12(p2.pricing, "pricing", ["price"]);
|
|
119289
119297
|
const price3 = pricing?.price !== void 0 ? find4(r2.ctx, "price", str(pricing.price, "pricing[price]")) : null;
|
|
119290
119298
|
const amount3 = int2(p2.amount, "amount"), quantity = int2(p2.quantity, "quantity") ?? 1;
|
|
119291
119299
|
if (price3 && amount3 !== void 0) invalid13("You may only specify one of these parameters: amount, pricing[price].", "amount");
|
|
@@ -119296,7 +119304,7 @@ var stripeRoutes = [
|
|
|
119296
119304
|
const inv = p2.invoice !== void 0 ? find4(r2.ctx, "invoice", str(p2.invoice, "invoice")) : null;
|
|
119297
119305
|
if (inv && inv.customer !== c.id) invalid13(`The invoice ${inv.id} belongs to a different customer.`, "invoice");
|
|
119298
119306
|
if (inv && inv.status !== "draft") invalid13(`You can only add invoice items to draft invoices; ${inv.id} is ${inv.status}.`, "invoice", "invoice_not_editable");
|
|
119299
|
-
const periodValue =
|
|
119307
|
+
const periodValue = object12(p2.period, "period", ["start", "end"]);
|
|
119300
119308
|
const now11 = nowSeconds(r2.ctx), period2 = periodValue ? { start: int2(periodValue.start, "period[start]"), end: int2(periodValue.end, "period[end]") } : { start: now11, end: now11 };
|
|
119301
119309
|
const item2 = save6(r2.ctx, invoiceItem(r2.ctx, {
|
|
119302
119310
|
customer: c.id,
|
|
@@ -119337,7 +119345,7 @@ var stripeRoutes = [
|
|
|
119337
119345
|
const c = p2.customer !== void 0 ? liveCustomer(r2.ctx, str(p2.customer, "customer")) : null;
|
|
119338
119346
|
const types = list9(p2.payment_method_types, "payment_method_types")?.map((t, i) => str(t, `payment_method_types[${i}]`));
|
|
119339
119347
|
if (types && types.some((t) => t !== "card")) unsupported14(`payment_method_types other than card (${types.join(", ")})`);
|
|
119340
|
-
const auto =
|
|
119348
|
+
const auto = object12(p2.automatic_payment_methods, "automatic_payment_methods", ["enabled", "allow_redirects"]);
|
|
119341
119349
|
bool3(p2.off_session, "off_session");
|
|
119342
119350
|
const pm = p2.payment_method !== void 0 ? resolvePaymentMethod(r2.ctx, str(p2.payment_method, "payment_method"), c) : void 0;
|
|
119343
119351
|
const pi = save6(r2.ctx, paymentIntent(r2.ctx, {
|
|
@@ -119827,11 +119835,11 @@ function balance(ctx, args) {
|
|
|
119827
119835
|
function unchanged(ctx, args) {
|
|
119828
119836
|
const baseline = account5(ctx).__baseline;
|
|
119829
119837
|
if (baseline === void 0) throw new AnchaError("USAGE", "Stripe seed baseline is absent from this checkpoint", { hint: "create a fresh world to evaluate stripe.unchanged" });
|
|
119830
|
-
const changes = args.objects.flatMap((
|
|
119831
|
-
const row2 = resolve4(ctx,
|
|
119838
|
+
const changes = args.objects.flatMap((object18) => {
|
|
119839
|
+
const row2 = resolve4(ctx, object18.type, object18.id);
|
|
119832
119840
|
const before = row2 && baseline?.[row2.id];
|
|
119833
119841
|
const reason2 = !row2 ? "object absent" : !before ? "seed baseline absent" : !isDeepStrictEqual(present(row2), before) ? "object changed" : void 0;
|
|
119834
|
-
return reason2 ? [{ ...
|
|
119842
|
+
return reason2 ? [{ ...object18, reason: reason2 }] : [];
|
|
119835
119843
|
});
|
|
119836
119844
|
return checkOutcome(changes.length === 0, `objects unchanged from seed: ${JSON.stringify(args.objects)}`, changes.length ? JSON.stringify(changes) : "all named objects equal their seed state");
|
|
119837
119845
|
}
|
|
@@ -123270,14 +123278,14 @@ function writeAll(r2, parentId, attributes2, values2, mode, objectSlug) {
|
|
|
123270
123278
|
if (attr.is_required && !currentValues(r2.ctx, parentId, attr.id).length) invalid17(`Required value for attribute with slug "${attr.api_slug}" was not provided.`, "missing_value");
|
|
123271
123279
|
}
|
|
123272
123280
|
}
|
|
123273
|
-
function findRecord(r2,
|
|
123281
|
+
function findRecord(r2, object18) {
|
|
123274
123282
|
const id14 = r2.param("record_id");
|
|
123275
|
-
return one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", id14,
|
|
123283
|
+
return one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", id14, object18.id) ?? notFound9(`Record with ID "${id14}" not found.`);
|
|
123276
123284
|
}
|
|
123277
|
-
function createRecord3(r2,
|
|
123285
|
+
function createRecord3(r2, object18, values2) {
|
|
123278
123286
|
const id14 = uuid9(r2.ctx);
|
|
123279
|
-
run2(r2.ctx, "INSERT INTO attio_records (id, object_id, created_at, created_by) VALUES (?, ?, ?, ?)", id14,
|
|
123280
|
-
writeAll(r2, id14, attributesOf(r2.ctx,
|
|
123287
|
+
run2(r2.ctx, "INSERT INTO attio_records (id, object_id, created_at, created_by) VALUES (?, ?, ?, ?)", id14, object18.id, now5(r2.ctx), JSON.stringify(tokenActor(r2)));
|
|
123288
|
+
writeAll(r2, id14, attributesOf(r2.ctx, object18.id), values2, "create", object18.api_slug);
|
|
123281
123289
|
return one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ?", id14);
|
|
123282
123290
|
}
|
|
123283
123291
|
function query7(r2, rows7, attributes2) {
|
|
@@ -123313,7 +123321,7 @@ function query7(r2, rows7, attributes2) {
|
|
|
123313
123321
|
const { limit, offset: offset17 } = limitOffset(r2.body);
|
|
123314
123322
|
return kept.slice(offset17, offset17 + limit);
|
|
123315
123323
|
}
|
|
123316
|
-
var records = (r2,
|
|
123324
|
+
var records = (r2, object18) => all5(r2.ctx, "SELECT * FROM attio_records WHERE object_id = ? ORDER BY created_at, rowid", object18.id);
|
|
123317
123325
|
function memberRef(r2, value4) {
|
|
123318
123326
|
const key4 = value4?.referenced_actor_id ?? value4?.workspace_member_email_address;
|
|
123319
123327
|
const m = typeof key4 === "string" ? one2(r2.ctx, "SELECT * FROM attio_members WHERE id = ? OR lower(email) = lower(?)", key4, key4) : void 0;
|
|
@@ -123323,10 +123331,10 @@ function memberRef(r2, value4) {
|
|
|
123323
123331
|
function linkedRecords(r2, value4) {
|
|
123324
123332
|
if (!Array.isArray(value4)) invalid17("linked_records must be an array.");
|
|
123325
123333
|
return value4.map((l) => {
|
|
123326
|
-
const
|
|
123334
|
+
const object18 = findObject(r2.ctx, String(l?.target_object));
|
|
123327
123335
|
if (!l.target_record_id) unsupported18("linking tasks to records by a matching attribute");
|
|
123328
|
-
const record9 = one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", l.target_record_id,
|
|
123329
|
-
return { target_object_id:
|
|
123336
|
+
const record9 = one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", l.target_record_id, object18.id) ?? notFound9(`Record with ID "${l.target_record_id}" not found.`);
|
|
123337
|
+
return { target_object_id: object18.id, target_record_id: record9.id };
|
|
123330
123338
|
});
|
|
123331
123339
|
}
|
|
123332
123340
|
var deadline = (value4) => {
|
|
@@ -123369,8 +123377,8 @@ var attioRoutes = [
|
|
|
123369
123377
|
path: "/v2/objects/:object/records/query",
|
|
123370
123378
|
coverage: { status: "partial", notes: "filter shorthand, operators, value properties, $and/$or/$not; sorts by attribute; path filters through references are gaps" },
|
|
123371
123379
|
run: (r2) => {
|
|
123372
|
-
const
|
|
123373
|
-
return { data: query7(r2, records(r2,
|
|
123380
|
+
const object18 = findObject(r2.ctx, r2.param("object"));
|
|
123381
|
+
return { data: query7(r2, records(r2, object18), attributesOf(r2.ctx, object18.id)).map((rec) => recordShape(r2.ctx, rec)) };
|
|
123374
123382
|
}
|
|
123375
123383
|
},
|
|
123376
123384
|
{
|
|
@@ -123387,10 +123395,10 @@ var attioRoutes = [
|
|
|
123387
123395
|
data: { known: ["values"], supported: ["values"] },
|
|
123388
123396
|
coverage: { status: "partial", notes: "assert by a unique attribute: updates the match (appending to multiselect values) or creates a record" },
|
|
123389
123397
|
run: (r2) => {
|
|
123390
|
-
const
|
|
123398
|
+
const object18 = findObject(r2.ctx, r2.param("object"));
|
|
123391
123399
|
const slug10 = r2.query.get("matching_attribute");
|
|
123392
123400
|
if (!slug10) invalid17("The matching_attribute query parameter is required.", "missing_value");
|
|
123393
|
-
const attr = attributesOf(r2.ctx,
|
|
123401
|
+
const attr = attributesOf(r2.ctx, object18.id).find((a) => a.api_slug === slug10 || a.id === slug10);
|
|
123394
123402
|
if (!attr) invalid17(`Cannot find attribute with slug/ID "${slug10}".`, "value_not_found");
|
|
123395
123403
|
if (!attr.is_unique) invalid17(`Attribute with slug "${attr.api_slug}" is not unique and cannot be used to match records.`);
|
|
123396
123404
|
const given2 = (r2.data.values ?? {})[attr.api_slug] ?? (r2.data.values ?? {})[attr.id];
|
|
@@ -123398,9 +123406,9 @@ var attioRoutes = [
|
|
|
123398
123406
|
const wanted = (Array.isArray(given2) ? given2 : [given2]).map((v) => primary(r2.ctx, attr, parseValue(r2.ctx, attr, v)));
|
|
123399
123407
|
const owners = new Set(all5(r2.ctx, "SELECT * FROM attio_values WHERE attribute_id = ? AND active_until IS NULL", attr.id).filter((v) => wanted.includes(primary(r2.ctx, attr, JSON.parse(v.data)))).map((v) => v.parent_id));
|
|
123400
123408
|
if (owners.size > 1) invalid17("More than one record matches the given value.", "multiple_match_results");
|
|
123401
|
-
if (!owners.size) return { data: recordShape(r2.ctx, createRecord3(r2,
|
|
123409
|
+
if (!owners.size) return { data: recordShape(r2.ctx, createRecord3(r2, object18, r2.data.values)) };
|
|
123402
123410
|
const id14 = [...owners][0];
|
|
123403
|
-
writeAll(r2, id14, attributesOf(r2.ctx,
|
|
123411
|
+
writeAll(r2, id14, attributesOf(r2.ctx, object18.id), r2.data.values, "append", object18.api_slug);
|
|
123404
123412
|
return { data: recordShape(r2.ctx, one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ?", id14)) };
|
|
123405
123413
|
}
|
|
123406
123414
|
},
|
|
@@ -123411,8 +123419,8 @@ var attioRoutes = [
|
|
|
123411
123419
|
data: { known: ["values"], supported: ["values"] },
|
|
123412
123420
|
coverage: { status: "supported", notes: "multiselect values are added to" },
|
|
123413
123421
|
run: (r2) => {
|
|
123414
|
-
const
|
|
123415
|
-
writeAll(r2, rec.id, attributesOf(r2.ctx,
|
|
123422
|
+
const object18 = findObject(r2.ctx, r2.param("object")), rec = findRecord(r2, object18);
|
|
123423
|
+
writeAll(r2, rec.id, attributesOf(r2.ctx, object18.id), r2.data.values, "append", object18.api_slug);
|
|
123416
123424
|
return { data: recordShape(r2.ctx, rec) };
|
|
123417
123425
|
}
|
|
123418
123426
|
},
|
|
@@ -123422,8 +123430,8 @@ var attioRoutes = [
|
|
|
123422
123430
|
data: { known: ["values"], supported: ["values"] },
|
|
123423
123431
|
coverage: { status: "supported", notes: "multiselect values are replaced" },
|
|
123424
123432
|
run: (r2) => {
|
|
123425
|
-
const
|
|
123426
|
-
writeAll(r2, rec.id, attributesOf(r2.ctx,
|
|
123433
|
+
const object18 = findObject(r2.ctx, r2.param("object")), rec = findRecord(r2, object18);
|
|
123434
|
+
writeAll(r2, rec.id, attributesOf(r2.ctx, object18.id), r2.data.values, "replace", object18.api_slug);
|
|
123427
123435
|
return { data: recordShape(r2.ctx, rec) };
|
|
123428
123436
|
}
|
|
123429
123437
|
},
|
|
@@ -123443,8 +123451,8 @@ var attioRoutes = [
|
|
|
123443
123451
|
query: { known: ["show_historic", "limit", "offset"], supported: ["show_historic", "limit", "offset"] },
|
|
123444
123452
|
coverage: { status: "supported" },
|
|
123445
123453
|
run: (r2) => {
|
|
123446
|
-
const
|
|
123447
|
-
const attr = attributesOf(r2.ctx,
|
|
123454
|
+
const object18 = findObject(r2.ctx, r2.param("object")), rec = findRecord(r2, object18);
|
|
123455
|
+
const attr = attributesOf(r2.ctx, object18.id).find((a) => a.api_slug === r2.param("attribute") || a.id === r2.param("attribute")) ?? notFound9(`Attribute with slug/ID "${r2.param("attribute")}" not found.`);
|
|
123448
123456
|
const historic = r2.query.get("show_historic") === "true";
|
|
123449
123457
|
const rows7 = all5(r2.ctx, `SELECT * FROM attio_values WHERE parent_id = ? AND attribute_id = ? ${historic ? "" : "AND active_until IS NULL"} ORDER BY id`, rec.id, attr.id);
|
|
123450
123458
|
const { limit, offset: offset17 } = limitOffset({ limit: r2.query.get("limit") ?? void 0, offset: r2.query.get("offset") ?? void 0 });
|
|
@@ -123480,9 +123488,9 @@ var attioRoutes = [
|
|
|
123480
123488
|
coverage: { status: "supported" },
|
|
123481
123489
|
run: (r2) => {
|
|
123482
123490
|
const list16 = findList(r2.ctx, r2.param("list"));
|
|
123483
|
-
const
|
|
123484
|
-
if (
|
|
123485
|
-
const rec = one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", r2.data.parent_record_id,
|
|
123491
|
+
const object18 = findObject(r2.ctx, String(r2.data.parent_object ?? list16.parent_object));
|
|
123492
|
+
if (object18.api_slug !== list16.parent_object) invalid17(`The list "${list16.api_slug}" holds ${list16.parent_object} records, not ${object18.api_slug}.`);
|
|
123493
|
+
const rec = one2(r2.ctx, "SELECT * FROM attio_records WHERE id = ? AND object_id = ?", r2.data.parent_record_id, object18.id) ?? notFound9(`Record with ID "${r2.data.parent_record_id}" not found.`);
|
|
123486
123494
|
const id14 = uuid9(r2.ctx);
|
|
123487
123495
|
run2(r2.ctx, "INSERT INTO attio_entries (id, list_id, record_id, created_at) VALUES (?, ?, ?, ?)", id14, list16.id, rec.id, now5(r2.ctx));
|
|
123488
123496
|
writeAll(r2, id14, attributesOf(r2.ctx, listParent(list16)), r2.data.entry_values ?? {}, "create");
|
|
@@ -123522,8 +123530,8 @@ var attioRoutes = [
|
|
|
123522
123530
|
query: { known: ["limit", "offset", "parent_object", "parent_record_id"], supported: ["limit", "offset", "parent_object", "parent_record_id"] },
|
|
123523
123531
|
coverage: { status: "supported" },
|
|
123524
123532
|
run: (r2) => {
|
|
123525
|
-
const
|
|
123526
|
-
const objectSlug =
|
|
123533
|
+
const object18 = r2.query.get("parent_object"), record9 = r2.query.get("parent_record_id");
|
|
123534
|
+
const objectSlug = object18 ? findObject(r2.ctx, object18).api_slug : void 0;
|
|
123527
123535
|
const notes6 = all5(r2.ctx, "SELECT * FROM attio_notes ORDER BY created_at, rowid").filter((n2) => (!objectSlug || n2.parent_object === objectSlug) && (!record9 || n2.parent_record_id === record9));
|
|
123528
123536
|
const { limit, offset: offset17 } = limitOffset({ limit: r2.query.get("limit") ?? void 0, offset: r2.query.get("offset") ?? void 0 }, 10);
|
|
123529
123537
|
return { data: notes6.slice(offset17, offset17 + limit).map((n2) => noteShape2(r2.ctx, n2)) };
|
|
@@ -123538,14 +123546,14 @@ var attioRoutes = [
|
|
|
123538
123546
|
const d = r2.data;
|
|
123539
123547
|
for (const key4 of ["parent_object", "parent_record_id", "title", "format", "content"]) if (typeof d[key4] !== "string") invalid17(`Body payload validation error: "data.${key4}" is required.`, "missing_value");
|
|
123540
123548
|
if (d.format !== "plaintext" && d.format !== "markdown") invalid17('format must be "plaintext" or "markdown".');
|
|
123541
|
-
const
|
|
123542
|
-
if (!one2(r2.ctx, "SELECT 1 FROM attio_records WHERE id = ? AND object_id = ?", d.parent_record_id,
|
|
123549
|
+
const object18 = findObject(r2.ctx, d.parent_object);
|
|
123550
|
+
if (!one2(r2.ctx, "SELECT 1 FROM attio_records WHERE id = ? AND object_id = ?", d.parent_record_id, object18.id)) notFound9(`Record with ID "${d.parent_record_id}" not found.`);
|
|
123543
123551
|
const id14 = uuid9(r2.ctx);
|
|
123544
123552
|
run2(
|
|
123545
123553
|
r2.ctx,
|
|
123546
123554
|
"INSERT INTO attio_notes (id, parent_object, parent_record_id, title, content, created_by, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
123547
123555
|
id14,
|
|
123548
|
-
|
|
123556
|
+
object18.api_slug,
|
|
123549
123557
|
d.parent_record_id,
|
|
123550
123558
|
d.title,
|
|
123551
123559
|
d.content,
|
|
@@ -126653,7 +126661,7 @@ var requireFolder = (ctx, mail, key4) => {
|
|
|
126653
126661
|
if (!f2) throw missing4();
|
|
126654
126662
|
return f2;
|
|
126655
126663
|
};
|
|
126656
|
-
var
|
|
126664
|
+
var object13 = (value4) => !!value4 && typeof value4 === "object" && !Array.isArray(value4);
|
|
126657
126665
|
function input3(value4, mail) {
|
|
126658
126666
|
const result = OutlookMessageInputSchema.safeParse(value4);
|
|
126659
126667
|
if (!result.success) throw invalid20("The request body contains an invalid message property or value.");
|
|
@@ -126687,7 +126695,7 @@ function send(ctx, mail, draft2, keep = true) {
|
|
|
126687
126695
|
}
|
|
126688
126696
|
function responseDraft(ctx, mail, original, action, body6) {
|
|
126689
126697
|
if (body6.comment !== void 0 && (typeof body6.comment !== "string" || body6.message?.body !== void 0)) throw invalid20("Specify either comment or message.body, but not both.");
|
|
126690
|
-
if (body6.message !== void 0 && !
|
|
126698
|
+
if (body6.message !== void 0 && !object13(body6.message)) throw invalid20("message must be an object.");
|
|
126691
126699
|
if (body6.toRecipients !== void 0 && !OutlookMessageInputSchema.shape.toRecipients.safeParse(body6.toRecipients).success) throw invalid20("Invalid toRecipients.");
|
|
126692
126700
|
if (Object.keys(body6).some((k) => !["comment", "message", "toRecipients"].includes(k))) throw invalid20("Invalid message action parameter.");
|
|
126693
126701
|
const content2 = input3(body6.message ?? {}, mail), forwarding = action.toLowerCase().includes("forward"), all9 = action.toLowerCase().includes("replyall");
|
|
@@ -126737,7 +126745,7 @@ function attachmentRoute(ctx, mail, m, tail, method2, url4, headers, body6) {
|
|
|
126737
126745
|
}
|
|
126738
126746
|
if (tail[0] === "createUploadSession" && method2 === "POST") {
|
|
126739
126747
|
const item2 = body6.AttachmentItem;
|
|
126740
|
-
if (!
|
|
126748
|
+
if (!object13(item2) || item2.attachmentType !== "file" || typeof item2.name !== "string" || !Number.isInteger(item2.size) || item2.size < 3 * 1024 * 1024 || item2.size > 150 * 1024 * 1024) throw invalid20("AttachmentItem must describe a file between 3 MB and 150 MB.");
|
|
126741
126749
|
const id14 = ctx.secrets.hex(64), expiry = ctx.clock.nowMs() + 60 * 60 * 1e3;
|
|
126742
126750
|
ctx.store.db.prepare("INSERT INTO outlook_uploads VALUES (?, ?, ?, ?, ?)").run(id14, mail, m.id, JSON.stringify({ ...item2, expiry }), Buffer.alloc(0));
|
|
126743
126751
|
return json18({ "@odata.context": context2("microsoft.graph.uploadSession"), uploadUrl: `${ctx.serviceUrl}/upload/${id14}`, expirationDateTime: new Date(expiry).toISOString(), nextExpectedRanges: ["0-"] }, 201);
|
|
@@ -126840,7 +126848,7 @@ function route4(ctx, method2, url4, headers, body6, auth = "delegated") {
|
|
|
126840
126848
|
const mail = user8.email, resource2 = `users('${user8.id}')`;
|
|
126841
126849
|
if (!parts3.length && method2 === "GET") return json18({ "@odata.context": context2("users/$entity"), ...project8({ id: user8.id, displayName: user8.name, mail, userPrincipalName: mail, jobTitle: null }, url4, headers) });
|
|
126842
126850
|
if (parts3[0] === "sendMail" && method2 === "POST") {
|
|
126843
|
-
if (!
|
|
126851
|
+
if (!object13(body6.message) || body6.saveToSentItems !== void 0 && typeof body6.saveToSentItems !== "boolean") throw invalid20("A message and a boolean saveToSentItems value are required.");
|
|
126844
126852
|
const m2 = create2(ctx, mail, input3(body6.message, mail));
|
|
126845
126853
|
save8(ctx, mail, m2);
|
|
126846
126854
|
send(ctx, mail, m2, body6.saveToSentItems !== false);
|
|
@@ -130105,22 +130113,22 @@ function jsonParameter(value4, field5) {
|
|
|
130105
130113
|
}
|
|
130106
130114
|
function metadataOf(value4, prefix2 = "") {
|
|
130107
130115
|
if (value4 === void 0 || value4 === null || value4 === "") return {};
|
|
130108
|
-
const
|
|
130109
|
-
if (!isObject3(
|
|
130110
|
-
const entries3 = Object.entries(
|
|
130116
|
+
const object18 = jsonParameter(value4, `${prefix2}metadata`);
|
|
130117
|
+
if (!isObject3(object18)) throw invalid21(`${prefix2}metadata must be an object`);
|
|
130118
|
+
const entries3 = Object.entries(object18);
|
|
130111
130119
|
if (entries3.length > 20) throw invalid21(`${prefix2}metadata must have less than or equal to 20 keys`);
|
|
130112
130120
|
for (const [key4, item2] of entries3) {
|
|
130113
130121
|
if (key4.length > 40 || /["\\]/.test(key4)) throw invalid21(`${prefix2}metadata keys must be at most 40 characters and cannot contain " or \\`);
|
|
130114
130122
|
if (typeof item2 !== "string" || item2.length > 500 || /["\\]/.test(item2)) throw invalid21(`${prefix2}metadata.${key4} must be a string of at most 500 characters without " or \\`);
|
|
130115
130123
|
}
|
|
130116
|
-
return
|
|
130124
|
+
return object18;
|
|
130117
130125
|
}
|
|
130118
130126
|
function mergeVariablesOf(value4) {
|
|
130119
130127
|
if (value4 === void 0 || value4 === null || value4 === "") return null;
|
|
130120
|
-
const
|
|
130121
|
-
if (!isObject3(
|
|
130122
|
-
if (JSON.stringify(
|
|
130123
|
-
return
|
|
130128
|
+
const object18 = jsonParameter(value4, "merge_variables");
|
|
130129
|
+
if (!isObject3(object18)) throw invalid21("merge_variables must be an object");
|
|
130130
|
+
if (JSON.stringify(object18).length > 25e3) throw invalid21("merge_variables must be at most 25,000 characters");
|
|
130131
|
+
return object18;
|
|
130124
130132
|
}
|
|
130125
130133
|
var ADDRESS_FIELDS = ["description", "name", "company", "phone", "email", "address_line1", "address_line2", "address_city", "address_state", "address_zip", "address_country", "metadata"];
|
|
130126
130134
|
function addressInput(body6, prefix2 = "") {
|
|
@@ -130187,9 +130195,9 @@ function addressFor(call2, field5, required4) {
|
|
|
130187
130195
|
}
|
|
130188
130196
|
function rangeOf2(value4, field5) {
|
|
130189
130197
|
if (value4 === void 0) return () => true;
|
|
130190
|
-
const
|
|
130191
|
-
if (!isObject3(
|
|
130192
|
-
const tests = Object.entries(
|
|
130198
|
+
const object18 = jsonParameter(value4, field5);
|
|
130199
|
+
if (!isObject3(object18)) throw invalid21(`${field5} must be an object with gt, gte, lt or lte`);
|
|
130200
|
+
const tests = Object.entries(object18).map(([operator2, raw3]) => {
|
|
130193
130201
|
if (!["gt", "gte", "lt", "lte"].includes(operator2)) throw invalid21(`${field5}.${operator2} is not allowed`);
|
|
130194
130202
|
const ms = typeof raw3 === "string" ? Date.parse(raw3) : Number.NaN;
|
|
130195
130203
|
if (Number.isNaN(ms)) throw invalid21(`${field5}.${operator2} must be a valid ISO 8601 date`);
|
|
@@ -130982,7 +130990,7 @@ function unknownRoute13(c) {
|
|
|
130982
130990
|
}
|
|
130983
130991
|
|
|
130984
130992
|
// packages/server/src/twins/paypal/invoices.ts
|
|
130985
|
-
var
|
|
130993
|
+
var object14 = (v, field5) => {
|
|
130986
130994
|
if (!v || typeof v !== "object" || Array.isArray(v)) invalid22({ field: field5, issue: "INVALID_PARAMETER_SYNTAX", description: "Expected an object.", location: "body" });
|
|
130987
130995
|
return v;
|
|
130988
130996
|
};
|
|
@@ -130999,7 +131007,7 @@ function decimal3(v, field5) {
|
|
|
130999
131007
|
return n2;
|
|
131000
131008
|
}
|
|
131001
131009
|
function money10(v, currency, field5) {
|
|
131002
|
-
const m =
|
|
131010
|
+
const m = object14(v, field5);
|
|
131003
131011
|
keys5(m, ["currency_code", "value"], field5);
|
|
131004
131012
|
if (m.currency_code !== currency) refused("CURRENCY_MISMATCH", "Currency must match the invoice currency.", `${field5}/currency_code`);
|
|
131005
131013
|
return decimal3(m.value, `${field5}/value`);
|
|
@@ -131011,31 +131019,31 @@ var rounded = (a, b, denominator) => {
|
|
|
131011
131019
|
return result;
|
|
131012
131020
|
};
|
|
131013
131021
|
function invoiceFrom(ctx, body6) {
|
|
131014
|
-
const b =
|
|
131022
|
+
const b = object14(body6, "/");
|
|
131015
131023
|
keys5(b, ["detail", "invoicer", "primary_recipients", "items", "configuration"], "invoice");
|
|
131016
|
-
const detail3 =
|
|
131024
|
+
const detail3 = object14(b.detail, "/detail");
|
|
131017
131025
|
keys5(detail3, ["currency_code", "invoice_number", "reference", "note", "terms_and_conditions", "memo"], "/detail");
|
|
131018
131026
|
const currency = detail3.currency_code;
|
|
131019
131027
|
if (!["USD", "EUR", "GBP", "CAD", "AUD"].includes(currency)) unsupported23(`invoice currency ${String(currency)}`);
|
|
131020
131028
|
for (const key4 of ["invoice_number", "reference", "note", "terms_and_conditions", "memo"]) if (detail3[key4] !== void 0) text18(detail3[key4], `/detail/${key4}`, key4 === "invoice_number" ? 25 : 4e3);
|
|
131021
131029
|
if (detail3.invoice_number && allOf2(ctx, "invoice").some((i) => i.detail.invoice_number === detail3.invoice_number)) refused("DUPLICATE_INVOICE_NUMBER", "Invoice number must be unique.", "/detail/invoice_number");
|
|
131022
131030
|
if (b.configuration !== void 0) {
|
|
131023
|
-
const c =
|
|
131031
|
+
const c = object14(b.configuration, "/configuration");
|
|
131024
131032
|
keys5(c, ["tax_calculated_after_discount", "tax_inclusive"], "/configuration");
|
|
131025
131033
|
if (c.tax_calculated_after_discount !== void 0 && c.tax_calculated_after_discount !== true) unsupported23("configuration.tax_calculated_after_discount=false");
|
|
131026
131034
|
if (c.tax_inclusive !== void 0 && c.tax_inclusive !== false) unsupported23("configuration.tax_inclusive=true");
|
|
131027
131035
|
}
|
|
131028
131036
|
const contact = (v, field5) => {
|
|
131029
|
-
const c =
|
|
131037
|
+
const c = object14(v, field5);
|
|
131030
131038
|
keys5(c, ["name", "email_address", "address", "business_name"], field5);
|
|
131031
131039
|
if (c.email_address !== void 0 && (typeof c.email_address !== "string" || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c.email_address))) invalid22({ field: `${field5}/email_address`, issue: "INVALID_PARAMETER_VALUE", description: "Invalid email address." });
|
|
131032
131040
|
if (c.name !== void 0) {
|
|
131033
|
-
const n2 =
|
|
131041
|
+
const n2 = object14(c.name, `${field5}/name`);
|
|
131034
131042
|
keys5(n2, ["given_name", "surname", "full_name"], `${field5}/name`);
|
|
131035
131043
|
for (const [k, v3] of Object.entries(n2)) text18(v3, `${field5}/name/${k}`, 300);
|
|
131036
131044
|
}
|
|
131037
131045
|
if (c.address !== void 0) {
|
|
131038
|
-
const a =
|
|
131046
|
+
const a = object14(c.address, `${field5}/address`);
|
|
131039
131047
|
keys5(a, ["address_line_1", "address_line_2", "admin_area_1", "admin_area_2", "postal_code", "country_code"], `${field5}/address`);
|
|
131040
131048
|
for (const [k, v3] of Object.entries(a)) text18(v3, `${field5}/address/${k}`, 300);
|
|
131041
131049
|
}
|
|
@@ -131045,21 +131053,21 @@ function invoiceFrom(ctx, body6) {
|
|
|
131045
131053
|
const invoicer = b.invoicer === void 0 ? void 0 : contact(b.invoicer, "/invoicer");
|
|
131046
131054
|
if (!Array.isArray(b.primary_recipients) || b.primary_recipients.length !== 1) invalid22({ field: "/primary_recipients", issue: "INVALID_ARRAY_SIZE", description: "Supply one primary recipient." });
|
|
131047
131055
|
const recipients2 = b.primary_recipients.map((raw3) => {
|
|
131048
|
-
const r2 =
|
|
131056
|
+
const r2 = object14(raw3, "/primary_recipients");
|
|
131049
131057
|
keys5(r2, ["billing_info"], "/primary_recipients");
|
|
131050
131058
|
const billing = contact(r2.billing_info, "/primary_recipients/billing_info");
|
|
131051
131059
|
return { billing_info: billing };
|
|
131052
131060
|
});
|
|
131053
131061
|
if (!Array.isArray(b.items) || b.items.length === 0 || b.items.length > 100) invalid22({ field: "/items", issue: "INVALID_ARRAY_SIZE", description: "Supply 1 to 100 items." });
|
|
131054
131062
|
const items = b.items.map((raw3, index) => {
|
|
131055
|
-
const path4 = `/items/${index}`, i =
|
|
131063
|
+
const path4 = `/items/${index}`, i = object14(raw3, path4);
|
|
131056
131064
|
keys5(i, ["name", "description", "quantity", "unit_amount", "tax", "discount", "unit_of_measure"], path4);
|
|
131057
131065
|
const name5 = text18(i.name, `${path4}/name`, 200), quantity = decimal3(i.quantity, `${path4}/quantity`);
|
|
131058
131066
|
if (quantity <= 0 || quantity > 1e6) invalid22({ field: `${path4}/quantity`, issue: "INVALID_PARAMETER_VALUE", description: "Quantity must be positive and at most 10000." });
|
|
131059
131067
|
const unit = money10(i.unit_amount, currency, `${path4}/unit_amount`), line2 = rounded(unit, quantity, 100);
|
|
131060
131068
|
let discount = 0, tax = 0;
|
|
131061
131069
|
if (i.discount !== void 0) {
|
|
131062
|
-
const d =
|
|
131070
|
+
const d = object14(i.discount, `${path4}/discount`);
|
|
131063
131071
|
keys5(d, ["percent", "amount"], `${path4}/discount`);
|
|
131064
131072
|
if (d.percent === void 0 === (d.amount === void 0)) invalid22({ field: `${path4}/discount`, issue: "INVALID_PARAMETER_VALUE", description: "Supply a discount percent or amount." });
|
|
131065
131073
|
if (d.percent !== void 0) {
|
|
@@ -131070,7 +131078,7 @@ function invoiceFrom(ctx, body6) {
|
|
|
131070
131078
|
if (discount > line2) refused("INVALID_DISCOUNT", "Discount cannot exceed the item amount.");
|
|
131071
131079
|
}
|
|
131072
131080
|
if (i.tax !== void 0) {
|
|
131073
|
-
const t =
|
|
131081
|
+
const t = object14(i.tax, `${path4}/tax`);
|
|
131074
131082
|
keys5(t, ["name", "percent"], `${path4}/tax`);
|
|
131075
131083
|
text18(t.name, `${path4}/tax/name`, 100);
|
|
131076
131084
|
const percent = decimal3(t.percent, `${path4}/tax/percent`);
|
|
@@ -131141,7 +131149,7 @@ var invoiceRoutes = [
|
|
|
131141
131149
|
return { items: all9.slice((page18 - 1) * size2, page18 * size2).map((i) => invoiceShape(i, r2.base)), ...r2.query.get("total_required") === "true" && { total_items: all9.length, total_pages: Math.ceil(all9.length / size2) } };
|
|
131142
131150
|
} },
|
|
131143
131151
|
{ method: "POST", path: "/v2/invoicing/invoices/:id/send", coverage: { status: "partial", notes: "Send a draft invoice to its billing recipient" }, run: (r2) => {
|
|
131144
|
-
const b =
|
|
131152
|
+
const b = object14(r2.body, "/");
|
|
131145
131153
|
keys5(b, ["send_to_recipient", "send_to_invoicer"], "/send");
|
|
131146
131154
|
for (const [k, v] of Object.entries(b)) if (typeof v !== "boolean") invalid22({ field: `/${k}`, issue: "INVALID_PARAMETER_VALUE", description: "Expected a boolean." });
|
|
131147
131155
|
if (b.send_to_recipient === false) unsupported23("send_to_recipient=false");
|
|
@@ -144991,10 +144999,10 @@ ${stream}endstream`);
|
|
|
144991
144999
|
objects[0] = "<< /Type /Catalog /Pages 2 0 R >>";
|
|
144992
145000
|
objects[1] = `<< /Type /Pages /Kids [${kids.join(" ")}] /Count ${pages.length} >>`;
|
|
144993
145001
|
let pdf = "%PDF-1.4\n", offsets = [0];
|
|
144994
|
-
objects.forEach((
|
|
145002
|
+
objects.forEach((object18, i) => {
|
|
144995
145003
|
offsets.push(Buffer.byteLength(pdf));
|
|
144996
145004
|
pdf += `${i + 1} 0 obj
|
|
144997
|
-
${
|
|
145005
|
+
${object18}
|
|
144998
145006
|
endobj
|
|
144999
145007
|
`;
|
|
145000
145008
|
});
|
|
@@ -146971,19 +146979,19 @@ var dependents = () => userError("This record cannot be deleted because it has d
|
|
|
146971
146979
|
var missing6 = (label7, path4) => userError(`Please enter value(s) for: ${label7}`, path4);
|
|
146972
146980
|
var permission6 = (field5, element) => new NetsuiteError(403, "INSUFFICIENT_PERMISSION", `Error while accessing a resource. You do not have permissions to set a value for element ${element} due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.`, field5);
|
|
146973
146981
|
var malformed = (path4, value4) => Object.assign(invalidValue2(path4, value4), { malformed: true });
|
|
146974
|
-
function
|
|
146982
|
+
function object15(value4, path4) {
|
|
146975
146983
|
if (value4 && typeof value4 === "object" && !Array.isArray(value4)) return value4;
|
|
146976
146984
|
if (path4 !== void 0) throw malformed(path4, value4);
|
|
146977
146985
|
throw new NetsuiteError(400, "INVALID_CONTENT", "The request body must be a JSON object.");
|
|
146978
146986
|
}
|
|
146979
146987
|
function entries2(raw3, path4) {
|
|
146980
146988
|
if (raw3 === null) return [];
|
|
146981
|
-
const list16 =
|
|
146989
|
+
const list16 = object15(raw3, path4).items;
|
|
146982
146990
|
if (!Array.isArray(list16)) throw malformed(`${path4}.items`, list16);
|
|
146983
|
-
return list16.map((entry2, index) =>
|
|
146991
|
+
return list16.map((entry2, index) => object15(entry2, `${path4}.items[${index}]`));
|
|
146984
146992
|
}
|
|
146985
146993
|
function refId(ctx, target5, raw3, path4) {
|
|
146986
|
-
const ref22 =
|
|
146994
|
+
const ref22 = object15(raw3, path4);
|
|
146987
146995
|
if (ref22.id !== void 0) {
|
|
146988
146996
|
const id14 = typeof ref22.id === "number" ? ref22.id : typeof ref22.id === "string" && /^\d{1,10}$/.test(ref22.id) ? Number(ref22.id) : Number.NaN;
|
|
146989
146997
|
if (!Number.isSafeInteger(id14) || id14 <= 0) throw malformed(path4, ref22.id);
|
|
@@ -146999,7 +147007,7 @@ function refId(ctx, target5, raw3, path4) {
|
|
|
146999
147007
|
}
|
|
147000
147008
|
var ADDRESS_KEYS = ["addressee", "attention", "addr1", "addr2", "addr3", "city", "state", "zip", "country", "addrPhone", "override"];
|
|
147001
147009
|
function address7(raw3, path4, strict, warnings2) {
|
|
147002
|
-
const given2 =
|
|
147010
|
+
const given2 = object15(raw3, path4), out = {};
|
|
147003
147011
|
for (const [key4, value4] of Object.entries(given2)) {
|
|
147004
147012
|
if (key4 === "links" || key4 === "addrText" || key4 === "refName") continue;
|
|
147005
147013
|
if (!ADDRESS_KEYS.includes(key4)) {
|
|
@@ -148077,7 +148085,7 @@ function orderStatusChange(ctx, prior, current, requested2) {
|
|
|
148077
148085
|
}
|
|
148078
148086
|
function save12(ctx, type, id14, body6, opts = {}) {
|
|
148079
148087
|
if (isBanking(type)) return saveBanking(ctx, type, id14, body6);
|
|
148080
|
-
const input5 =
|
|
148088
|
+
const input5 = object15(body6), kept = keptFields(ctx, type), given2 = /* @__PURE__ */ new Map();
|
|
148081
148089
|
const declared = new Set(customFieldsFor(ctx, type).map((f2) => f2.id));
|
|
148082
148090
|
for (const [name5, value4] of Object.entries(input5)) if (kept.has(name5) && !Object.hasOwn(FIELDS3[type], name5) && !declared.has(name5)) given2.set(name5, value4);
|
|
148083
148091
|
const saved = saveModeled(ctx, type, id14, given2.size ? without(input5, ...given2.keys()) : input5, opts);
|
|
@@ -148157,7 +148165,7 @@ var headerFrom = (t) => ({
|
|
|
148157
148165
|
...t.class !== null && { class: { id: t.class } }
|
|
148158
148166
|
});
|
|
148159
148167
|
function transform2(ctx, source, id14, targetName, raw3, base4 = {}) {
|
|
148160
|
-
const body6 =
|
|
148168
|
+
const body6 = object15(raw3), target5 = netsuiteRecordTypes.find((known2) => known2.toLowerCase() === targetName.toLowerCase());
|
|
148161
148169
|
if (!target5 || !(TRANSFORMS[source] ?? []).includes(target5)) throw gap6(`transforming a ${source} into a ${targetName}`);
|
|
148162
148170
|
const opts = { ...base4, replace: void 0, replaceSelected: void 0 };
|
|
148163
148171
|
const make = (type, fields11, origin) => ({ type, id: saveTransaction(ctx, type, void 0, fields11, { ...opts, ...origin && { origin } }) });
|
|
@@ -148511,15 +148519,15 @@ function match2(ctx, bankIds, gl, source) {
|
|
|
148511
148519
|
function saveBanking(ctx, type, id14, body6) {
|
|
148512
148520
|
if (type !== "transactionMatch" || id14 !== void 0) throw new NetsuiteError(405, "METHOD_NOT_ALLOWED", "Transaction matches are created once; imported bank data and suggestions are read-only.");
|
|
148513
148521
|
bankPermission(ctx, 2);
|
|
148514
|
-
const input5 =
|
|
148522
|
+
const input5 = object15(body6);
|
|
148515
148523
|
for (const key4 of Object.keys(input5)) if (!["importedTransactionMatch", "generalLedgerTransactionMatch"].includes(key4)) throw new NetsuiteError(403, "INSUFFICIENT_PERMISSION", `The field ${key4} is read-only.`);
|
|
148516
148524
|
const list16 = (name5) => {
|
|
148517
|
-
const items =
|
|
148525
|
+
const items = object15(input5[name5]).items;
|
|
148518
148526
|
if (!Array.isArray(items) || !items.length || items.length > 500) throw userError(`Provide ${name5}.items.`);
|
|
148519
|
-
return items.map((item2) =>
|
|
148527
|
+
return items.map((item2) => object15(item2));
|
|
148520
148528
|
};
|
|
148521
148529
|
const ref22 = (v) => {
|
|
148522
|
-
const n2 = Number(
|
|
148530
|
+
const n2 = Number(object15(v).id);
|
|
148523
148531
|
if (!Number.isSafeInteger(n2) || n2 <= 0) throw userError("Provide a valid internal ID.");
|
|
148524
148532
|
return n2;
|
|
148525
148533
|
};
|
|
@@ -148541,7 +148549,7 @@ function bankingActions(ctx, id14) {
|
|
|
148541
148549
|
function bankAction(ctx, id14, action, body6) {
|
|
148542
148550
|
if (!["accept", "reject"].includes(action)) throw userError("Choose accept or reject.");
|
|
148543
148551
|
bankPermission(ctx, action === "accept" ? 2 : 3);
|
|
148544
|
-
if (Object.keys(
|
|
148552
|
+
if (Object.keys(object15(body6 ?? {})).length) throw userError("This action takes the record ID only.");
|
|
148545
148553
|
const s2 = suggestion(ctx, id14), db3 = sql(ctx);
|
|
148546
148554
|
if (s2.status !== "pending") throw userError("This suggestion has already been accepted or rejected.");
|
|
148547
148555
|
if (action === "reject") {
|
|
@@ -154086,20 +154094,20 @@ async function mcpEndpoint(ctx, method2, text24, base4, serve3, caller2, headers
|
|
|
154086
154094
|
}
|
|
154087
154095
|
if (Array.isArray(message8)) return rpcError(null, -32600, "Invalid Request: send one JSON-RPC message per request.", 400);
|
|
154088
154096
|
if (!message8 || typeof message8 !== "object" || message8.jsonrpc !== "2.0") return rpcError(null, -32600, "Invalid Request", 400);
|
|
154089
|
-
const
|
|
154097
|
+
const object18 = (value4) => !!value4 && typeof value4 === "object" && !Array.isArray(value4);
|
|
154090
154098
|
if (message8.id !== void 0 && typeof message8.id !== "string" && !(typeof message8.id === "number" && Number.isInteger(message8.id))) return rpcError(null, -32600, "Invalid Request", 400);
|
|
154091
154099
|
if (message8.method === void 0) {
|
|
154092
|
-
const hasResult =
|
|
154100
|
+
const hasResult = object18(message8.result), hasError = object18(message8.error) && Number.isInteger(message8.error.code) && typeof message8.error.message === "string";
|
|
154093
154101
|
if (message8.id !== void 0 && (hasResult && message8.error === void 0 || hasError && message8.result === void 0)) return { status: 202, headers: {}, body: null };
|
|
154094
154102
|
return rpcError(null, -32600, "Invalid Request", 400);
|
|
154095
154103
|
}
|
|
154096
154104
|
if (typeof message8.method !== "string" || message8.result !== void 0 || message8.error !== void 0) return rpcError(null, -32600, "Invalid Request", 400);
|
|
154097
|
-
if (message8.params !== void 0 && !
|
|
154105
|
+
if (message8.params !== void 0 && !object18(message8.params)) return rpcError(message8.id, -32602, "Invalid params", 400);
|
|
154098
154106
|
if (message8.id === void 0) return { status: 202, headers: {}, body: null };
|
|
154099
154107
|
const id14 = message8.id, params10 = message8.params ?? {};
|
|
154100
154108
|
switch (message8.method) {
|
|
154101
154109
|
case "initialize": {
|
|
154102
|
-
if (typeof params10.protocolVersion !== "string" || !
|
|
154110
|
+
if (typeof params10.protocolVersion !== "string" || !object18(params10.capabilities) || !object18(params10.clientInfo) || typeof params10.clientInfo.name !== "string" || typeof params10.clientInfo.version !== "string") return rpcError(id14, -32602, "initialize requires protocolVersion, capabilities and clientInfo.");
|
|
154103
154111
|
const asked = params10.protocolVersion;
|
|
154104
154112
|
return reply4(id14, {
|
|
154105
154113
|
protocolVersion: PROTOCOLS.includes(asked) ? asked : PROTOCOLS[0],
|
|
@@ -155233,7 +155241,7 @@ function records2(ctx, method2, url4, segments3, body6, opts) {
|
|
|
155233
155241
|
async function suiteql(ctx, url4, body6, prefer) {
|
|
155234
155242
|
if (!/(^|[\s,;])transient($|[\s,;])/i.test(prefer ?? "")) throw new NetsuiteError(400, "INVALID_PARAMETER", "Invalid search query. SuiteQL requests need the header Prefer: transient.", { header: "Prefer" });
|
|
155235
155243
|
params7(url4, ["limit", "offset"]);
|
|
155236
|
-
const window5 = paging(url4), { q, params: values2 } =
|
|
155244
|
+
const window5 = paging(url4), { q, params: values2 } = object15(body6);
|
|
155237
155245
|
if (typeof q !== "string" || q.trim() === "") throw new NetsuiteError(400, "INVALID_PARAMETER", 'Invalid search query. Send the query as {"q": "SELECT ..."}.', "q");
|
|
155238
155246
|
if (values2 !== void 0 && (!Array.isArray(values2) || values2.length > 1e3)) throw new NetsuiteError(400, "INVALID_PARAMETER", "Invalid search query. Send params as an array of values for the ? markers.", "params");
|
|
155239
155247
|
try {
|
|
@@ -155507,13 +155515,13 @@ function materializeEvent(event3, info, transportNowMs, targetUrl) {
|
|
|
155507
155515
|
for (const [index, key4] of keys6.entries()) {
|
|
155508
155516
|
if (typeof target5 !== "object" || target5 === null || !Object.hasOwn(target5, key4)) throw new AnchaError("INTERNAL", `event pointer does not exist: ${pointer2}`);
|
|
155509
155517
|
if (Array.isArray(target5) && !/^(0|[1-9]\d*)$/.test(key4)) throw new AnchaError("INTERNAL", `invalid event array pointer: ${pointer2}`);
|
|
155510
|
-
const
|
|
155518
|
+
const object18 = target5;
|
|
155511
155519
|
if (index === keys6.length - 1) {
|
|
155512
|
-
if (typeof
|
|
155520
|
+
if (typeof object18[key4] !== "string") throw new AnchaError("INTERNAL", `event URL is not a string: ${pointer2}`);
|
|
155513
155521
|
const targetService = linkService === void 0 ? service : info.services[linkService];
|
|
155514
155522
|
if (!targetService) throw new AnchaError("INTERNAL", `missing ${linkService} service for event API link`);
|
|
155515
|
-
Object.defineProperty(
|
|
155516
|
-
} else target5 =
|
|
155523
|
+
Object.defineProperty(object18, key4, { value: targetService.url.replace(/\/$/, "") + path4, enumerable: true, configurable: true, writable: true });
|
|
155524
|
+
} else target5 = object18[key4];
|
|
155517
155525
|
}
|
|
155518
155526
|
}
|
|
155519
155527
|
body6 = JSON.stringify(payload2);
|
|
@@ -156562,7 +156570,7 @@ var conflict = (message8) => {
|
|
|
156562
156570
|
var bad3 = (message8) => {
|
|
156563
156571
|
throw new AnchaError("USAGE", message8);
|
|
156564
156572
|
};
|
|
156565
|
-
function
|
|
156573
|
+
function object16(value4) {
|
|
156566
156574
|
if (!value4 || typeof value4 !== "object" || Array.isArray(value4)) return bad3("expected a JSON object");
|
|
156567
156575
|
return value4;
|
|
156568
156576
|
}
|
|
@@ -156641,7 +156649,7 @@ function inspectionRoutes(opts) {
|
|
|
156641
156649
|
return c.json(observe(env, revisions.get(env) ?? null));
|
|
156642
156650
|
});
|
|
156643
156651
|
routes2.post("/envs/:id/inspect", async (c) => {
|
|
156644
|
-
const body6 =
|
|
156652
|
+
const body6 = object16(await c.req.json().catch(() => bad3("invalid JSON")));
|
|
156645
156653
|
only3(body6, []);
|
|
156646
156654
|
const env = opts.manager.get(c.req.param("id"));
|
|
156647
156655
|
return c.json(await env.serialize(() => {
|
|
@@ -156654,7 +156662,7 @@ function inspectionRoutes(opts) {
|
|
|
156654
156662
|
}));
|
|
156655
156663
|
});
|
|
156656
156664
|
routes2.post("/envs/:id/inspect/advance", async (c) => {
|
|
156657
|
-
const body6 =
|
|
156665
|
+
const body6 = object16(await c.req.json().catch(() => bad3("invalid JSON")));
|
|
156658
156666
|
only3(body6, ["revision", "untilMs"]);
|
|
156659
156667
|
const env = opts.manager.get(c.req.param("id"));
|
|
156660
156668
|
return c.json(await env.serialize(() => {
|
|
@@ -156666,7 +156674,7 @@ function inspectionRoutes(opts) {
|
|
|
156666
156674
|
}));
|
|
156667
156675
|
});
|
|
156668
156676
|
routes2.post("/envs/:id/inspect/reset", async (c) => {
|
|
156669
|
-
const body6 =
|
|
156677
|
+
const body6 = object16(await c.req.json().catch(() => bad3("invalid JSON")));
|
|
156670
156678
|
only3(body6, ["revision"]);
|
|
156671
156679
|
const env = opts.manager.get(c.req.param("id"));
|
|
156672
156680
|
return c.json(await env.serialize(async () => {
|
|
@@ -156680,12 +156688,12 @@ function inspectionRoutes(opts) {
|
|
|
156680
156688
|
}));
|
|
156681
156689
|
});
|
|
156682
156690
|
routes2.post("/envs/:id/inspect/action", async (c) => {
|
|
156683
|
-
const body6 =
|
|
156691
|
+
const body6 = object16(await c.req.json().catch(() => bad3("invalid JSON")));
|
|
156684
156692
|
only3(body6, ["revision", "action"]);
|
|
156685
156693
|
const env = opts.manager.get(c.req.param("id"));
|
|
156686
156694
|
return c.json(await env.serialize(async () => {
|
|
156687
156695
|
const revision = owned2(env, body6.revision);
|
|
156688
|
-
const action =
|
|
156696
|
+
const action = object16(body6.action);
|
|
156689
156697
|
const info = envInfo(env, opts.publicUrl(), opts.port());
|
|
156690
156698
|
let service, path4, method2, payload2;
|
|
156691
156699
|
switch (action.kind) {
|
|
@@ -156798,7 +156806,7 @@ function simulationRoutes({ manager }) {
|
|
|
156798
156806
|
|
|
156799
156807
|
// packages/server/src/control/session-routes.ts
|
|
156800
156808
|
import { isAbsolute } from "node:path";
|
|
156801
|
-
function
|
|
156809
|
+
function object17(value4) {
|
|
156802
156810
|
if (typeof value4 !== "object" || value4 === null || Array.isArray(value4)) throw new AnchaError("USAGE", "request must be a JSON object");
|
|
156803
156811
|
return value4;
|
|
156804
156812
|
}
|
|
@@ -156806,7 +156814,7 @@ function fields10(value4, allowed2) {
|
|
|
156806
156814
|
if (Object.keys(value4).some((key4) => !allowed2.includes(key4))) throw new AnchaError("USAGE", "unknown request field");
|
|
156807
156815
|
}
|
|
156808
156816
|
function parseOptions(value4) {
|
|
156809
|
-
const input5 =
|
|
156817
|
+
const input5 = object17(value4);
|
|
156810
156818
|
fields10(input5, ["mode", "idleMs", "delivery", "slackTransport", "clientOrigin", "setupCalls", "clockFile"]);
|
|
156811
156819
|
if (input5.clockFile !== void 0 && (typeof input5.clockFile !== "string" || !isAbsolute(input5.clockFile) || !input5.clockFile.endsWith("/clock.json") || input5.clockFile.includes("\0"))) {
|
|
156812
156820
|
throw new AnchaError("USAGE", "clockFile must be an absolute path ending in /clock.json");
|
|
@@ -156825,7 +156833,7 @@ function parseOptions(value4) {
|
|
|
156825
156833
|
if (input5.idleMs !== void 0 && (typeof input5.idleMs !== "number" || !Number.isFinite(input5.idleMs) || input5.idleMs < 0)) throw new AnchaError("USAGE", "idleMs must be non-negative simulated milliseconds");
|
|
156826
156834
|
if (input5.slackTransport !== void 0 && (typeof input5.slackTransport !== "string" || !["feed", "http", "socket"].includes(input5.slackTransport))) throw new AnchaError("USAGE", "invalid Slack transport");
|
|
156827
156835
|
if (input5.delivery !== void 0) {
|
|
156828
|
-
const delivery =
|
|
156836
|
+
const delivery = object17(input5.delivery);
|
|
156829
156837
|
fields10(delivery, [...SUPPORTED_TWINS, "app"]);
|
|
156830
156838
|
for (const url4 of Object.values(delivery)) {
|
|
156831
156839
|
try {
|
|
@@ -156838,7 +156846,7 @@ function parseOptions(value4) {
|
|
|
156838
156846
|
return input5;
|
|
156839
156847
|
}
|
|
156840
156848
|
function parseStartOptions(value4) {
|
|
156841
|
-
const input5 =
|
|
156849
|
+
const input5 = object17(value4);
|
|
156842
156850
|
fields10(input5, ["delivery", "timeoutMs"]);
|
|
156843
156851
|
if (input5.timeoutMs !== void 0 && (typeof input5.timeoutMs !== "number" || !Number.isSafeInteger(input5.timeoutMs) || input5.timeoutMs <= 0 || input5.timeoutMs > 2147483647)) throw new AnchaError("USAGE", "timeoutMs must be positive real milliseconds (at most 2147483647)");
|
|
156844
156852
|
if (input5.delivery !== void 0) parseOptions({ mode: "endpoint", delivery: input5.delivery });
|
|
@@ -156851,7 +156859,7 @@ function sessionRoutes(opts, sessions) {
|
|
|
156851
156859
|
app2.post("/envs/:id/trials", async (c) => {
|
|
156852
156860
|
let input5;
|
|
156853
156861
|
try {
|
|
156854
|
-
input5 =
|
|
156862
|
+
input5 = object17(await c.req.json());
|
|
156855
156863
|
} catch {
|
|
156856
156864
|
throw new AnchaError("USAGE", "request must be a JSON object");
|
|
156857
156865
|
}
|
|
@@ -156874,7 +156882,7 @@ function sessionRoutes(opts, sessions) {
|
|
|
156874
156882
|
app2.post("/envs/:id/trials/:sid/answer", async (c) => {
|
|
156875
156883
|
let input5;
|
|
156876
156884
|
try {
|
|
156877
|
-
input5 =
|
|
156885
|
+
input5 = object17(await c.req.json());
|
|
156878
156886
|
} catch {
|
|
156879
156887
|
throw new AnchaError("USAGE", "request must be a JSON object");
|
|
156880
156888
|
}
|
|
@@ -156889,7 +156897,7 @@ function sessionRoutes(opts, sessions) {
|
|
|
156889
156897
|
app2.post("/envs/:id/trials/:sid/agent", async (c) => {
|
|
156890
156898
|
let input5;
|
|
156891
156899
|
try {
|
|
156892
|
-
input5 =
|
|
156900
|
+
input5 = object17(await c.req.json());
|
|
156893
156901
|
} catch {
|
|
156894
156902
|
throw new AnchaError("USAGE", "request must be a JSON object");
|
|
156895
156903
|
}
|