@photon-cli/flux 0.2.4 → 0.2.6
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/dist/{cli.js → index.js} +297 -294
- package/dist/index.js.map +1 -0
- package/package.json +10 -2
- package/dist/cli.d.ts +0 -42
- package/dist/cli.js.map +0 -1
package/dist/{cli.js → index.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var fs = require('fs');
|
|
5
4
|
var path = require('path');
|
|
6
5
|
var readline = require('readline');
|
|
6
|
+
var fs = require('fs');
|
|
7
7
|
var url = require('url');
|
|
8
8
|
|
|
9
9
|
function _interopNamespace(e) {
|
|
@@ -24,9 +24,9 @@ function _interopNamespace(e) {
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
28
27
|
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
29
28
|
var readline__namespace = /*#__PURE__*/_interopNamespace(readline);
|
|
29
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
30
30
|
|
|
31
31
|
var __create = Object.create;
|
|
32
32
|
var __defProp = Object.defineProperty;
|
|
@@ -279,9 +279,9 @@ var require_ClientError = __commonJS({
|
|
|
279
279
|
var ts_error_1 = (init_es(), __toCommonJS(es_exports));
|
|
280
280
|
var Status_1 = require_Status();
|
|
281
281
|
var ClientError = class _ClientError extends ts_error_1.ExtendableError {
|
|
282
|
-
constructor(
|
|
283
|
-
super(`${
|
|
284
|
-
this.path =
|
|
282
|
+
constructor(path4, code, details) {
|
|
283
|
+
super(`${path4} ${Status_1.Status[code]}: ${details}`);
|
|
284
|
+
this.path = path4;
|
|
285
285
|
this.code = code;
|
|
286
286
|
this.details = details;
|
|
287
287
|
this.name = "ClientError";
|
|
@@ -1041,14 +1041,14 @@ var require_tls_helpers = __commonJS({
|
|
|
1041
1041
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1042
1042
|
exports2.CIPHER_SUITES = void 0;
|
|
1043
1043
|
exports2.getDefaultRootsData = getDefaultRootsData;
|
|
1044
|
-
var
|
|
1044
|
+
var fs3 = __require("fs");
|
|
1045
1045
|
exports2.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
|
|
1046
1046
|
var DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
|
|
1047
1047
|
var defaultRootsData = null;
|
|
1048
1048
|
function getDefaultRootsData() {
|
|
1049
1049
|
if (DEFAULT_ROOTS_FILE_PATH) {
|
|
1050
1050
|
if (defaultRootsData === null) {
|
|
1051
|
-
defaultRootsData =
|
|
1051
|
+
defaultRootsData = fs3.readFileSync(DEFAULT_ROOTS_FILE_PATH);
|
|
1052
1052
|
}
|
|
1053
1053
|
return defaultRootsData;
|
|
1054
1054
|
}
|
|
@@ -1078,19 +1078,19 @@ var require_uri_parser = __commonJS({
|
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
1080
|
var NUMBER_REGEX = /^\d+$/;
|
|
1081
|
-
function splitHostPort(
|
|
1082
|
-
if (
|
|
1083
|
-
const hostEnd =
|
|
1081
|
+
function splitHostPort(path4) {
|
|
1082
|
+
if (path4.startsWith("[")) {
|
|
1083
|
+
const hostEnd = path4.indexOf("]");
|
|
1084
1084
|
if (hostEnd === -1) {
|
|
1085
1085
|
return null;
|
|
1086
1086
|
}
|
|
1087
|
-
const host =
|
|
1087
|
+
const host = path4.substring(1, hostEnd);
|
|
1088
1088
|
if (host.indexOf(":") === -1) {
|
|
1089
1089
|
return null;
|
|
1090
1090
|
}
|
|
1091
|
-
if (
|
|
1092
|
-
if (
|
|
1093
|
-
const portString =
|
|
1091
|
+
if (path4.length > hostEnd + 1) {
|
|
1092
|
+
if (path4[hostEnd + 1] === ":") {
|
|
1093
|
+
const portString = path4.substring(hostEnd + 2);
|
|
1094
1094
|
if (NUMBER_REGEX.test(portString)) {
|
|
1095
1095
|
return {
|
|
1096
1096
|
host,
|
|
@@ -1108,7 +1108,7 @@ var require_uri_parser = __commonJS({
|
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
1110
1110
|
} else {
|
|
1111
|
-
const splitPath =
|
|
1111
|
+
const splitPath = path4.split(":");
|
|
1112
1112
|
if (splitPath.length === 2) {
|
|
1113
1113
|
if (NUMBER_REGEX.test(splitPath[1])) {
|
|
1114
1114
|
return {
|
|
@@ -1120,7 +1120,7 @@ var require_uri_parser = __commonJS({
|
|
|
1120
1120
|
}
|
|
1121
1121
|
} else {
|
|
1122
1122
|
return {
|
|
1123
|
-
host:
|
|
1123
|
+
host: path4
|
|
1124
1124
|
};
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
@@ -4273,14 +4273,14 @@ var require_client_interceptors = __commonJS({
|
|
|
4273
4273
|
}
|
|
4274
4274
|
};
|
|
4275
4275
|
exports2.InterceptingCall = InterceptingCall;
|
|
4276
|
-
function getCall(channel,
|
|
4276
|
+
function getCall(channel, path4, options) {
|
|
4277
4277
|
var _a, _b;
|
|
4278
4278
|
const deadline = (_a = options.deadline) !== null && _a !== void 0 ? _a : Infinity;
|
|
4279
4279
|
const host = options.host;
|
|
4280
4280
|
const parent = (_b = options.parent) !== null && _b !== void 0 ? _b : null;
|
|
4281
4281
|
const propagateFlags = options.propagate_flags;
|
|
4282
4282
|
const credentials = options.credentials;
|
|
4283
|
-
const call = channel.createCall(
|
|
4283
|
+
const call = channel.createCall(path4, deadline, host, parent, propagateFlags);
|
|
4284
4284
|
if (credentials) {
|
|
4285
4285
|
call.setCredentials(credentials);
|
|
4286
4286
|
}
|
|
@@ -4845,9 +4845,9 @@ var require_make_client = __commonJS({
|
|
|
4845
4845
|
ServiceClientImpl.serviceName = serviceName;
|
|
4846
4846
|
return ServiceClientImpl;
|
|
4847
4847
|
}
|
|
4848
|
-
function partial(fn,
|
|
4848
|
+
function partial(fn, path4, serialize, deserialize) {
|
|
4849
4849
|
return function(...args) {
|
|
4850
|
-
return fn.call(this,
|
|
4850
|
+
return fn.call(this, path4, serialize, deserialize, ...args);
|
|
4851
4851
|
};
|
|
4852
4852
|
}
|
|
4853
4853
|
function isProtobufTypeDefinition(obj) {
|
|
@@ -6679,7 +6679,7 @@ var require_fetch = __commonJS({
|
|
|
6679
6679
|
module2.exports = fetch;
|
|
6680
6680
|
var asPromise = require_aspromise();
|
|
6681
6681
|
var inquire2 = require_inquire();
|
|
6682
|
-
var
|
|
6682
|
+
var fs3 = inquire2("fs");
|
|
6683
6683
|
function fetch(filename, options, callback) {
|
|
6684
6684
|
if (typeof options === "function") {
|
|
6685
6685
|
callback = options;
|
|
@@ -6688,8 +6688,8 @@ var require_fetch = __commonJS({
|
|
|
6688
6688
|
options = {};
|
|
6689
6689
|
if (!callback)
|
|
6690
6690
|
return asPromise(fetch, this, filename, options);
|
|
6691
|
-
if (!options.xhr &&
|
|
6692
|
-
return
|
|
6691
|
+
if (!options.xhr && fs3 && fs3.readFile)
|
|
6692
|
+
return fs3.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
6693
6693
|
return err && typeof XMLHttpRequest !== "undefined" ? fetch.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
6694
6694
|
});
|
|
6695
6695
|
return fetch.xhr(filename, options, callback);
|
|
@@ -6726,15 +6726,15 @@ var require_fetch = __commonJS({
|
|
|
6726
6726
|
// node_modules/@protobufjs/path/index.js
|
|
6727
6727
|
var require_path = __commonJS({
|
|
6728
6728
|
"node_modules/@protobufjs/path/index.js"(exports2) {
|
|
6729
|
-
var
|
|
6729
|
+
var path4 = exports2;
|
|
6730
6730
|
var isAbsolute = (
|
|
6731
6731
|
/**
|
|
6732
6732
|
* Tests if the specified path is absolute.
|
|
6733
6733
|
* @param {string} path Path to test
|
|
6734
6734
|
* @returns {boolean} `true` if path is absolute
|
|
6735
6735
|
*/
|
|
6736
|
-
|
|
6737
|
-
return /^(?:\/|\w+:)/.test(
|
|
6736
|
+
path4.isAbsolute = function isAbsolute2(path5) {
|
|
6737
|
+
return /^(?:\/|\w+:)/.test(path5);
|
|
6738
6738
|
}
|
|
6739
6739
|
);
|
|
6740
6740
|
var normalize = (
|
|
@@ -6743,9 +6743,9 @@ var require_path = __commonJS({
|
|
|
6743
6743
|
* @param {string} path Path to normalize
|
|
6744
6744
|
* @returns {string} Normalized path
|
|
6745
6745
|
*/
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
var parts =
|
|
6746
|
+
path4.normalize = function normalize2(path5) {
|
|
6747
|
+
path5 = path5.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
6748
|
+
var parts = path5.split("/"), absolute = isAbsolute(path5), prefix = "";
|
|
6749
6749
|
if (absolute)
|
|
6750
6750
|
prefix = parts.shift() + "/";
|
|
6751
6751
|
for (var i = 0; i < parts.length; ) {
|
|
@@ -6764,7 +6764,7 @@ var require_path = __commonJS({
|
|
|
6764
6764
|
return prefix + parts.join("/");
|
|
6765
6765
|
}
|
|
6766
6766
|
);
|
|
6767
|
-
|
|
6767
|
+
path4.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
6768
6768
|
if (!alreadyNormalized)
|
|
6769
6769
|
includePath = normalize(includePath);
|
|
6770
6770
|
if (isAbsolute(includePath))
|
|
@@ -6914,16 +6914,16 @@ var require_namespace = __commonJS({
|
|
|
6914
6914
|
object.onRemove(this);
|
|
6915
6915
|
return clearCache(this);
|
|
6916
6916
|
};
|
|
6917
|
-
Namespace.prototype.define = function define2(
|
|
6918
|
-
if (util.isString(
|
|
6919
|
-
|
|
6920
|
-
else if (!Array.isArray(
|
|
6917
|
+
Namespace.prototype.define = function define2(path4, json) {
|
|
6918
|
+
if (util.isString(path4))
|
|
6919
|
+
path4 = path4.split(".");
|
|
6920
|
+
else if (!Array.isArray(path4))
|
|
6921
6921
|
throw TypeError("illegal path");
|
|
6922
|
-
if (
|
|
6922
|
+
if (path4 && path4.length && path4[0] === "")
|
|
6923
6923
|
throw Error("path must be relative");
|
|
6924
6924
|
var ptr = this;
|
|
6925
|
-
while (
|
|
6926
|
-
var part =
|
|
6925
|
+
while (path4.length > 0) {
|
|
6926
|
+
var part = path4.shift();
|
|
6927
6927
|
if (ptr.nested && ptr.nested[part]) {
|
|
6928
6928
|
ptr = ptr.nested[part];
|
|
6929
6929
|
if (!(ptr instanceof Namespace))
|
|
@@ -6958,26 +6958,26 @@ var require_namespace = __commonJS({
|
|
|
6958
6958
|
});
|
|
6959
6959
|
return this;
|
|
6960
6960
|
};
|
|
6961
|
-
Namespace.prototype.lookup = function lookup(
|
|
6961
|
+
Namespace.prototype.lookup = function lookup(path4, filterTypes, parentAlreadyChecked) {
|
|
6962
6962
|
if (typeof filterTypes === "boolean") {
|
|
6963
6963
|
parentAlreadyChecked = filterTypes;
|
|
6964
6964
|
filterTypes = void 0;
|
|
6965
6965
|
} else if (filterTypes && !Array.isArray(filterTypes))
|
|
6966
6966
|
filterTypes = [filterTypes];
|
|
6967
|
-
if (util.isString(
|
|
6968
|
-
if (
|
|
6967
|
+
if (util.isString(path4) && path4.length) {
|
|
6968
|
+
if (path4 === ".")
|
|
6969
6969
|
return this.root;
|
|
6970
|
-
|
|
6971
|
-
} else if (!
|
|
6970
|
+
path4 = path4.split(".");
|
|
6971
|
+
} else if (!path4.length)
|
|
6972
6972
|
return this;
|
|
6973
|
-
var flatPath =
|
|
6974
|
-
if (
|
|
6975
|
-
return this.root.lookup(
|
|
6973
|
+
var flatPath = path4.join(".");
|
|
6974
|
+
if (path4[0] === "")
|
|
6975
|
+
return this.root.lookup(path4.slice(1), filterTypes);
|
|
6976
6976
|
var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
|
|
6977
6977
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
6978
6978
|
return found;
|
|
6979
6979
|
}
|
|
6980
|
-
found = this._lookupImpl(
|
|
6980
|
+
found = this._lookupImpl(path4, flatPath);
|
|
6981
6981
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
6982
6982
|
return found;
|
|
6983
6983
|
}
|
|
@@ -6985,7 +6985,7 @@ var require_namespace = __commonJS({
|
|
|
6985
6985
|
return null;
|
|
6986
6986
|
var current = this;
|
|
6987
6987
|
while (current.parent) {
|
|
6988
|
-
found = current.parent._lookupImpl(
|
|
6988
|
+
found = current.parent._lookupImpl(path4, flatPath);
|
|
6989
6989
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
6990
6990
|
return found;
|
|
6991
6991
|
}
|
|
@@ -6993,49 +6993,49 @@ var require_namespace = __commonJS({
|
|
|
6993
6993
|
}
|
|
6994
6994
|
return null;
|
|
6995
6995
|
};
|
|
6996
|
-
Namespace.prototype._lookupImpl = function lookup(
|
|
6996
|
+
Namespace.prototype._lookupImpl = function lookup(path4, flatPath) {
|
|
6997
6997
|
if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
|
|
6998
6998
|
return this._lookupCache[flatPath];
|
|
6999
6999
|
}
|
|
7000
|
-
var found = this.get(
|
|
7000
|
+
var found = this.get(path4[0]);
|
|
7001
7001
|
var exact = null;
|
|
7002
7002
|
if (found) {
|
|
7003
|
-
if (
|
|
7003
|
+
if (path4.length === 1) {
|
|
7004
7004
|
exact = found;
|
|
7005
7005
|
} else if (found instanceof Namespace) {
|
|
7006
|
-
|
|
7007
|
-
exact = found._lookupImpl(
|
|
7006
|
+
path4 = path4.slice(1);
|
|
7007
|
+
exact = found._lookupImpl(path4, path4.join("."));
|
|
7008
7008
|
}
|
|
7009
7009
|
} else {
|
|
7010
7010
|
for (var i = 0; i < this.nestedArray.length; ++i)
|
|
7011
|
-
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(
|
|
7011
|
+
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path4, flatPath)))
|
|
7012
7012
|
exact = found;
|
|
7013
7013
|
}
|
|
7014
7014
|
this._lookupCache[flatPath] = exact;
|
|
7015
7015
|
return exact;
|
|
7016
7016
|
};
|
|
7017
|
-
Namespace.prototype.lookupType = function lookupType(
|
|
7018
|
-
var found = this.lookup(
|
|
7017
|
+
Namespace.prototype.lookupType = function lookupType(path4) {
|
|
7018
|
+
var found = this.lookup(path4, [Type]);
|
|
7019
7019
|
if (!found)
|
|
7020
|
-
throw Error("no such type: " +
|
|
7020
|
+
throw Error("no such type: " + path4);
|
|
7021
7021
|
return found;
|
|
7022
7022
|
};
|
|
7023
|
-
Namespace.prototype.lookupEnum = function lookupEnum(
|
|
7024
|
-
var found = this.lookup(
|
|
7023
|
+
Namespace.prototype.lookupEnum = function lookupEnum(path4) {
|
|
7024
|
+
var found = this.lookup(path4, [Enum]);
|
|
7025
7025
|
if (!found)
|
|
7026
|
-
throw Error("no such Enum '" +
|
|
7026
|
+
throw Error("no such Enum '" + path4 + "' in " + this);
|
|
7027
7027
|
return found;
|
|
7028
7028
|
};
|
|
7029
|
-
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(
|
|
7030
|
-
var found = this.lookup(
|
|
7029
|
+
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path4) {
|
|
7030
|
+
var found = this.lookup(path4, [Type, Enum]);
|
|
7031
7031
|
if (!found)
|
|
7032
|
-
throw Error("no such Type or Enum '" +
|
|
7032
|
+
throw Error("no such Type or Enum '" + path4 + "' in " + this);
|
|
7033
7033
|
return found;
|
|
7034
7034
|
};
|
|
7035
|
-
Namespace.prototype.lookupService = function lookupService(
|
|
7036
|
-
var found = this.lookup(
|
|
7035
|
+
Namespace.prototype.lookupService = function lookupService(path4) {
|
|
7036
|
+
var found = this.lookup(path4, [Service2]);
|
|
7037
7037
|
if (!found)
|
|
7038
|
-
throw Error("no such Service '" +
|
|
7038
|
+
throw Error("no such Service '" + path4 + "' in " + this);
|
|
7039
7039
|
return found;
|
|
7040
7040
|
};
|
|
7041
7041
|
Namespace._configure = function(Type_, Service_, Enum_) {
|
|
@@ -8387,14 +8387,14 @@ var require_util = __commonJS({
|
|
|
8387
8387
|
Object.defineProperty(object, "$type", { value: enm, enumerable: false });
|
|
8388
8388
|
return enm;
|
|
8389
8389
|
};
|
|
8390
|
-
util.setProperty = function setProperty(dst,
|
|
8391
|
-
function setProp(dst2,
|
|
8392
|
-
var part =
|
|
8390
|
+
util.setProperty = function setProperty(dst, path4, value, ifNotSet) {
|
|
8391
|
+
function setProp(dst2, path5, value2) {
|
|
8392
|
+
var part = path5.shift();
|
|
8393
8393
|
if (part === "__proto__" || part === "prototype") {
|
|
8394
8394
|
return dst2;
|
|
8395
8395
|
}
|
|
8396
|
-
if (
|
|
8397
|
-
dst2[part] = setProp(dst2[part] || {},
|
|
8396
|
+
if (path5.length > 0) {
|
|
8397
|
+
dst2[part] = setProp(dst2[part] || {}, path5, value2);
|
|
8398
8398
|
} else {
|
|
8399
8399
|
var prevValue = dst2[part];
|
|
8400
8400
|
if (prevValue && ifNotSet)
|
|
@@ -8407,10 +8407,10 @@ var require_util = __commonJS({
|
|
|
8407
8407
|
}
|
|
8408
8408
|
if (typeof dst !== "object")
|
|
8409
8409
|
throw TypeError("dst must be an object");
|
|
8410
|
-
if (!
|
|
8410
|
+
if (!path4)
|
|
8411
8411
|
throw TypeError("path must be specified");
|
|
8412
|
-
|
|
8413
|
-
return setProp(dst,
|
|
8412
|
+
path4 = path4.split(".");
|
|
8413
|
+
return setProp(dst, path4, value);
|
|
8414
8414
|
};
|
|
8415
8415
|
Object.defineProperty(util, "decorateRoot", {
|
|
8416
8416
|
get: function() {
|
|
@@ -8952,12 +8952,12 @@ var require_object = __commonJS({
|
|
|
8952
8952
|
*/
|
|
8953
8953
|
fullName: {
|
|
8954
8954
|
get: function() {
|
|
8955
|
-
var
|
|
8955
|
+
var path4 = [this.name], ptr = this.parent;
|
|
8956
8956
|
while (ptr) {
|
|
8957
|
-
|
|
8957
|
+
path4.unshift(ptr.name);
|
|
8958
8958
|
ptr = ptr.parent;
|
|
8959
8959
|
}
|
|
8960
|
-
return
|
|
8960
|
+
return path4.join(".");
|
|
8961
8961
|
}
|
|
8962
8962
|
}
|
|
8963
8963
|
});
|
|
@@ -12935,19 +12935,19 @@ var require_util2 = __commonJS({
|
|
|
12935
12935
|
"node_modules/@grpc/proto-loader/build/src/util.js"(exports2) {
|
|
12936
12936
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12937
12937
|
exports2.addCommonProtos = exports2.loadProtosWithOptionsSync = exports2.loadProtosWithOptions = void 0;
|
|
12938
|
-
var
|
|
12939
|
-
var
|
|
12938
|
+
var fs3 = __require("fs");
|
|
12939
|
+
var path4 = __require("path");
|
|
12940
12940
|
var Protobuf = require_protobufjs();
|
|
12941
12941
|
function addIncludePathResolver(root, includePaths) {
|
|
12942
12942
|
const originalResolvePath = root.resolvePath;
|
|
12943
12943
|
root.resolvePath = (origin, target) => {
|
|
12944
|
-
if (
|
|
12944
|
+
if (path4.isAbsolute(target)) {
|
|
12945
12945
|
return target;
|
|
12946
12946
|
}
|
|
12947
12947
|
for (const directory of includePaths) {
|
|
12948
|
-
const fullPath =
|
|
12948
|
+
const fullPath = path4.join(directory, target);
|
|
12949
12949
|
try {
|
|
12950
|
-
|
|
12950
|
+
fs3.accessSync(fullPath, fs3.constants.R_OK);
|
|
12951
12951
|
return fullPath;
|
|
12952
12952
|
} catch (err) {
|
|
12953
12953
|
continue;
|
|
@@ -19240,9 +19240,9 @@ var require_server_call = __commonJS({
|
|
|
19240
19240
|
return status;
|
|
19241
19241
|
}
|
|
19242
19242
|
var ServerUnaryCallImpl = class extends events_1.EventEmitter {
|
|
19243
|
-
constructor(
|
|
19243
|
+
constructor(path4, call, metadata, request) {
|
|
19244
19244
|
super();
|
|
19245
|
-
this.path =
|
|
19245
|
+
this.path = path4;
|
|
19246
19246
|
this.call = call;
|
|
19247
19247
|
this.metadata = metadata;
|
|
19248
19248
|
this.request = request;
|
|
@@ -19272,9 +19272,9 @@ var require_server_call = __commonJS({
|
|
|
19272
19272
|
};
|
|
19273
19273
|
exports2.ServerUnaryCallImpl = ServerUnaryCallImpl;
|
|
19274
19274
|
var ServerReadableStreamImpl = class extends stream_1.Readable {
|
|
19275
|
-
constructor(
|
|
19275
|
+
constructor(path4, call, metadata) {
|
|
19276
19276
|
super({ objectMode: true });
|
|
19277
|
-
this.path =
|
|
19277
|
+
this.path = path4;
|
|
19278
19278
|
this.call = call;
|
|
19279
19279
|
this.metadata = metadata;
|
|
19280
19280
|
this.cancelled = false;
|
|
@@ -19306,9 +19306,9 @@ var require_server_call = __commonJS({
|
|
|
19306
19306
|
};
|
|
19307
19307
|
exports2.ServerReadableStreamImpl = ServerReadableStreamImpl;
|
|
19308
19308
|
var ServerWritableStreamImpl = class extends stream_1.Writable {
|
|
19309
|
-
constructor(
|
|
19309
|
+
constructor(path4, call, metadata, request) {
|
|
19310
19310
|
super({ objectMode: true });
|
|
19311
|
-
this.path =
|
|
19311
|
+
this.path = path4;
|
|
19312
19312
|
this.call = call;
|
|
19313
19313
|
this.metadata = metadata;
|
|
19314
19314
|
this.request = request;
|
|
@@ -19362,9 +19362,9 @@ var require_server_call = __commonJS({
|
|
|
19362
19362
|
};
|
|
19363
19363
|
exports2.ServerWritableStreamImpl = ServerWritableStreamImpl;
|
|
19364
19364
|
var ServerDuplexStreamImpl = class extends stream_1.Duplex {
|
|
19365
|
-
constructor(
|
|
19365
|
+
constructor(path4, call, metadata) {
|
|
19366
19366
|
super({ objectMode: true });
|
|
19367
|
-
this.path =
|
|
19367
|
+
this.path = path4;
|
|
19368
19368
|
this.call = call;
|
|
19369
19369
|
this.metadata = metadata;
|
|
19370
19370
|
this.pendingStatus = {
|
|
@@ -21631,11 +21631,11 @@ var require_server = __commonJS({
|
|
|
21631
21631
|
}
|
|
21632
21632
|
return true;
|
|
21633
21633
|
}
|
|
21634
|
-
_retrieveHandler(
|
|
21635
|
-
serverCallTrace("Received call to method " +
|
|
21636
|
-
const handler = this.handlers.get(
|
|
21634
|
+
_retrieveHandler(path4) {
|
|
21635
|
+
serverCallTrace("Received call to method " + path4 + " at address " + this.serverAddressString);
|
|
21636
|
+
const handler = this.handlers.get(path4);
|
|
21637
21637
|
if (handler === void 0) {
|
|
21638
|
-
serverCallTrace("No handler registered for method " +
|
|
21638
|
+
serverCallTrace("No handler registered for method " + path4 + ". Sending UNIMPLEMENTED status.");
|
|
21639
21639
|
return null;
|
|
21640
21640
|
}
|
|
21641
21641
|
return handler;
|
|
@@ -21657,10 +21657,10 @@ var require_server = __commonJS({
|
|
|
21657
21657
|
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed();
|
|
21658
21658
|
return;
|
|
21659
21659
|
}
|
|
21660
|
-
const
|
|
21661
|
-
const handler = this._retrieveHandler(
|
|
21660
|
+
const path4 = headers[HTTP2_HEADER_PATH];
|
|
21661
|
+
const handler = this._retrieveHandler(path4);
|
|
21662
21662
|
if (!handler) {
|
|
21663
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
21663
|
+
this._respondWithError(getUnimplementedStatusResponse(path4), stream, channelzSessionInfo);
|
|
21664
21664
|
return;
|
|
21665
21665
|
}
|
|
21666
21666
|
const callEventTracker = {
|
|
@@ -21708,10 +21708,10 @@ var require_server = __commonJS({
|
|
|
21708
21708
|
if (this._verifyContentType(stream, headers) !== true) {
|
|
21709
21709
|
return;
|
|
21710
21710
|
}
|
|
21711
|
-
const
|
|
21712
|
-
const handler = this._retrieveHandler(
|
|
21711
|
+
const path4 = headers[HTTP2_HEADER_PATH];
|
|
21712
|
+
const handler = this._retrieveHandler(path4);
|
|
21713
21713
|
if (!handler) {
|
|
21714
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
21714
|
+
this._respondWithError(getUnimplementedStatusResponse(path4), stream, null);
|
|
21715
21715
|
return;
|
|
21716
21716
|
}
|
|
21717
21717
|
const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, null, handler, this.options);
|
|
@@ -22729,7 +22729,7 @@ var require_certificate_provider = __commonJS({
|
|
|
22729
22729
|
"node_modules/@grpc/grpc-js/build/src/certificate-provider.js"(exports2) {
|
|
22730
22730
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22731
22731
|
exports2.FileWatcherCertificateProvider = void 0;
|
|
22732
|
-
var
|
|
22732
|
+
var fs3 = __require("fs");
|
|
22733
22733
|
var logging = require_logging();
|
|
22734
22734
|
var constants_1 = require_constants();
|
|
22735
22735
|
var util_1 = __require("util");
|
|
@@ -22737,7 +22737,7 @@ var require_certificate_provider = __commonJS({
|
|
|
22737
22737
|
function trace(text) {
|
|
22738
22738
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text);
|
|
22739
22739
|
}
|
|
22740
|
-
var readFilePromise = (0, util_1.promisify)(
|
|
22740
|
+
var readFilePromise = (0, util_1.promisify)(fs3.readFile);
|
|
22741
22741
|
var FileWatcherCertificateProvider = class {
|
|
22742
22742
|
constructor(config) {
|
|
22743
22743
|
this.config = config;
|
|
@@ -22990,13 +22990,13 @@ var require_resolver_uds = __commonJS({
|
|
|
22990
22990
|
this.listener = listener;
|
|
22991
22991
|
this.hasReturnedResult = false;
|
|
22992
22992
|
this.endpoints = [];
|
|
22993
|
-
let
|
|
22993
|
+
let path4;
|
|
22994
22994
|
if (target.authority === "") {
|
|
22995
|
-
|
|
22995
|
+
path4 = "/" + target.path;
|
|
22996
22996
|
} else {
|
|
22997
|
-
|
|
22997
|
+
path4 = target.path;
|
|
22998
22998
|
}
|
|
22999
|
-
this.endpoints = [{ addresses: [{ path:
|
|
22999
|
+
this.endpoints = [{ addresses: [{ path: path4 }] }];
|
|
23000
23000
|
}
|
|
23001
23001
|
updateResolution() {
|
|
23002
23002
|
if (!this.hasReturnedResult) {
|
|
@@ -23055,12 +23055,12 @@ var require_resolver_ip = __commonJS({
|
|
|
23055
23055
|
return;
|
|
23056
23056
|
}
|
|
23057
23057
|
const pathList = target.path.split(",");
|
|
23058
|
-
for (const
|
|
23059
|
-
const hostPort = (0, uri_parser_1.splitHostPort)(
|
|
23058
|
+
for (const path4 of pathList) {
|
|
23059
|
+
const hostPort = (0, uri_parser_1.splitHostPort)(path4);
|
|
23060
23060
|
if (hostPort === null) {
|
|
23061
23061
|
this.error = {
|
|
23062
23062
|
code: constants_1.Status.UNAVAILABLE,
|
|
23063
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
23063
|
+
details: `Failed to parse ${target.scheme} address ${path4}`,
|
|
23064
23064
|
metadata: new metadata_1.Metadata()
|
|
23065
23065
|
};
|
|
23066
23066
|
return;
|
|
@@ -23068,7 +23068,7 @@ var require_resolver_ip = __commonJS({
|
|
|
23068
23068
|
if (target.scheme === IPV4_SCHEME && !(0, net_1.isIPv4)(hostPort.host) || target.scheme === IPV6_SCHEME && !(0, net_1.isIPv6)(hostPort.host)) {
|
|
23069
23069
|
this.error = {
|
|
23070
23070
|
code: constants_1.Status.UNAVAILABLE,
|
|
23071
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
23071
|
+
details: `Failed to parse ${target.scheme} address ${path4}`,
|
|
23072
23072
|
metadata: new metadata_1.Metadata()
|
|
23073
23073
|
};
|
|
23074
23074
|
return;
|
|
@@ -25252,7 +25252,7 @@ var require_createErrorStatusObject = __commonJS({
|
|
|
25252
25252
|
var grpc_js_1 = require_src3();
|
|
25253
25253
|
var abort_controller_x_1 = (init_es2(), __toCommonJS(es_exports2));
|
|
25254
25254
|
var nice_grpc_common_1 = require_lib();
|
|
25255
|
-
function createErrorStatusObject(
|
|
25255
|
+
function createErrorStatusObject(path4, error, trailer) {
|
|
25256
25256
|
if (error instanceof nice_grpc_common_1.ServerError) {
|
|
25257
25257
|
return {
|
|
25258
25258
|
code: error.code,
|
|
@@ -25266,7 +25266,7 @@ var require_createErrorStatusObject = __commonJS({
|
|
|
25266
25266
|
metadata: trailer
|
|
25267
25267
|
};
|
|
25268
25268
|
} else {
|
|
25269
|
-
process.emitWarning(`${
|
|
25269
|
+
process.emitWarning(`${path4}: Uncaught error in server implementation method. Server methods should only throw ServerError or AbortError. ${error instanceof Error ? error.stack : error}`);
|
|
25270
25270
|
return {
|
|
25271
25271
|
code: grpc_js_1.status.UNKNOWN,
|
|
25272
25272
|
details: "Unknown server error occurred",
|
|
@@ -25709,9 +25709,9 @@ var require_wrapClientError = __commonJS({
|
|
|
25709
25709
|
exports2.wrapClientError = wrapClientError;
|
|
25710
25710
|
var nice_grpc_common_1 = require_lib();
|
|
25711
25711
|
var grpc_js_1 = require_src3();
|
|
25712
|
-
function wrapClientError(error,
|
|
25712
|
+
function wrapClientError(error, path4) {
|
|
25713
25713
|
if (isStatusObject(error)) {
|
|
25714
|
-
return new nice_grpc_common_1.ClientError(
|
|
25714
|
+
return new nice_grpc_common_1.ClientError(path4, error.code, error.details);
|
|
25715
25715
|
}
|
|
25716
25716
|
return error;
|
|
25717
25717
|
}
|
|
@@ -28551,14 +28551,14 @@ var require_tls_helpers2 = __commonJS2({
|
|
|
28551
28551
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
28552
28552
|
exports2.CIPHER_SUITES = void 0;
|
|
28553
28553
|
exports2.getDefaultRootsData = getDefaultRootsData;
|
|
28554
|
-
var
|
|
28554
|
+
var fs3 = __require2("fs");
|
|
28555
28555
|
exports2.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
|
|
28556
28556
|
var DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
|
|
28557
28557
|
var defaultRootsData = null;
|
|
28558
28558
|
function getDefaultRootsData() {
|
|
28559
28559
|
if (DEFAULT_ROOTS_FILE_PATH) {
|
|
28560
28560
|
if (defaultRootsData === null) {
|
|
28561
|
-
defaultRootsData =
|
|
28561
|
+
defaultRootsData = fs3.readFileSync(DEFAULT_ROOTS_FILE_PATH);
|
|
28562
28562
|
}
|
|
28563
28563
|
return defaultRootsData;
|
|
28564
28564
|
}
|
|
@@ -28586,19 +28586,19 @@ var require_uri_parser2 = __commonJS2({
|
|
|
28586
28586
|
};
|
|
28587
28587
|
}
|
|
28588
28588
|
var NUMBER_REGEX = /^\d+$/;
|
|
28589
|
-
function splitHostPort(
|
|
28590
|
-
if (
|
|
28591
|
-
const hostEnd =
|
|
28589
|
+
function splitHostPort(path4) {
|
|
28590
|
+
if (path4.startsWith("[")) {
|
|
28591
|
+
const hostEnd = path4.indexOf("]");
|
|
28592
28592
|
if (hostEnd === -1) {
|
|
28593
28593
|
return null;
|
|
28594
28594
|
}
|
|
28595
|
-
const host =
|
|
28595
|
+
const host = path4.substring(1, hostEnd);
|
|
28596
28596
|
if (host.indexOf(":") === -1) {
|
|
28597
28597
|
return null;
|
|
28598
28598
|
}
|
|
28599
|
-
if (
|
|
28600
|
-
if (
|
|
28601
|
-
const portString =
|
|
28599
|
+
if (path4.length > hostEnd + 1) {
|
|
28600
|
+
if (path4[hostEnd + 1] === ":") {
|
|
28601
|
+
const portString = path4.substring(hostEnd + 2);
|
|
28602
28602
|
if (NUMBER_REGEX.test(portString)) {
|
|
28603
28603
|
return {
|
|
28604
28604
|
host,
|
|
@@ -28616,7 +28616,7 @@ var require_uri_parser2 = __commonJS2({
|
|
|
28616
28616
|
};
|
|
28617
28617
|
}
|
|
28618
28618
|
} else {
|
|
28619
|
-
const splitPath =
|
|
28619
|
+
const splitPath = path4.split(":");
|
|
28620
28620
|
if (splitPath.length === 2) {
|
|
28621
28621
|
if (NUMBER_REGEX.test(splitPath[1])) {
|
|
28622
28622
|
return {
|
|
@@ -28628,7 +28628,7 @@ var require_uri_parser2 = __commonJS2({
|
|
|
28628
28628
|
}
|
|
28629
28629
|
} else {
|
|
28630
28630
|
return {
|
|
28631
|
-
host:
|
|
28631
|
+
host: path4
|
|
28632
28632
|
};
|
|
28633
28633
|
}
|
|
28634
28634
|
}
|
|
@@ -31758,14 +31758,14 @@ var require_client_interceptors2 = __commonJS2({
|
|
|
31758
31758
|
}
|
|
31759
31759
|
};
|
|
31760
31760
|
exports2.InterceptingCall = InterceptingCall;
|
|
31761
|
-
function getCall(channel,
|
|
31761
|
+
function getCall(channel, path4, options) {
|
|
31762
31762
|
var _a, _b;
|
|
31763
31763
|
const deadline = (_a = options.deadline) !== null && _a !== void 0 ? _a : Infinity;
|
|
31764
31764
|
const host = options.host;
|
|
31765
31765
|
const parent = (_b = options.parent) !== null && _b !== void 0 ? _b : null;
|
|
31766
31766
|
const propagateFlags = options.propagate_flags;
|
|
31767
31767
|
const credentials = options.credentials;
|
|
31768
|
-
const call = channel.createCall(
|
|
31768
|
+
const call = channel.createCall(path4, deadline, host, parent, propagateFlags);
|
|
31769
31769
|
if (credentials) {
|
|
31770
31770
|
call.setCredentials(credentials);
|
|
31771
31771
|
}
|
|
@@ -32326,9 +32326,9 @@ var require_make_client2 = __commonJS2({
|
|
|
32326
32326
|
ServiceClientImpl.serviceName = serviceName;
|
|
32327
32327
|
return ServiceClientImpl;
|
|
32328
32328
|
}
|
|
32329
|
-
function partial(fn,
|
|
32329
|
+
function partial(fn, path4, serialize, deserialize) {
|
|
32330
32330
|
return function(...args) {
|
|
32331
|
-
return fn.call(this,
|
|
32331
|
+
return fn.call(this, path4, serialize, deserialize, ...args);
|
|
32332
32332
|
};
|
|
32333
32333
|
}
|
|
32334
32334
|
function isProtobufTypeDefinition(obj) {
|
|
@@ -34120,7 +34120,7 @@ var require_fetch2 = __commonJS2({
|
|
|
34120
34120
|
module2.exports = fetch;
|
|
34121
34121
|
var asPromise = require_aspromise2();
|
|
34122
34122
|
var inquire2 = require_inquire2();
|
|
34123
|
-
var
|
|
34123
|
+
var fs3 = inquire2("fs");
|
|
34124
34124
|
function fetch(filename, options, callback) {
|
|
34125
34125
|
if (typeof options === "function") {
|
|
34126
34126
|
callback = options;
|
|
@@ -34129,8 +34129,8 @@ var require_fetch2 = __commonJS2({
|
|
|
34129
34129
|
options = {};
|
|
34130
34130
|
if (!callback)
|
|
34131
34131
|
return asPromise(fetch, this, filename, options);
|
|
34132
|
-
if (!options.xhr &&
|
|
34133
|
-
return
|
|
34132
|
+
if (!options.xhr && fs3 && fs3.readFile)
|
|
34133
|
+
return fs3.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
34134
34134
|
return err && typeof XMLHttpRequest !== "undefined" ? fetch.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8"));
|
|
34135
34135
|
});
|
|
34136
34136
|
return fetch.xhr(filename, options, callback);
|
|
@@ -34165,14 +34165,14 @@ var require_fetch2 = __commonJS2({
|
|
|
34165
34165
|
});
|
|
34166
34166
|
var require_path2 = __commonJS2({
|
|
34167
34167
|
"node_modules/@protobufjs/path/index.js"(exports2) {
|
|
34168
|
-
var
|
|
34168
|
+
var path4 = exports2;
|
|
34169
34169
|
var isAbsolute = (
|
|
34170
34170
|
/**
|
|
34171
34171
|
* Tests if the specified path is absolute.
|
|
34172
34172
|
* @param {string} path Path to test
|
|
34173
34173
|
* @returns {boolean} `true` if path is absolute
|
|
34174
34174
|
*/
|
|
34175
|
-
|
|
34175
|
+
path4.isAbsolute = function isAbsolute2(path22) {
|
|
34176
34176
|
return /^(?:\/|\w+:)/.test(path22);
|
|
34177
34177
|
}
|
|
34178
34178
|
);
|
|
@@ -34182,7 +34182,7 @@ var require_path2 = __commonJS2({
|
|
|
34182
34182
|
* @param {string} path Path to normalize
|
|
34183
34183
|
* @returns {string} Normalized path
|
|
34184
34184
|
*/
|
|
34185
|
-
|
|
34185
|
+
path4.normalize = function normalize2(path22) {
|
|
34186
34186
|
path22 = path22.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
34187
34187
|
var parts = path22.split("/"), absolute = isAbsolute(path22), prefix = "";
|
|
34188
34188
|
if (absolute)
|
|
@@ -34203,7 +34203,7 @@ var require_path2 = __commonJS2({
|
|
|
34203
34203
|
return prefix + parts.join("/");
|
|
34204
34204
|
}
|
|
34205
34205
|
);
|
|
34206
|
-
|
|
34206
|
+
path4.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
34207
34207
|
if (!alreadyNormalized)
|
|
34208
34208
|
includePath = normalize(includePath);
|
|
34209
34209
|
if (isAbsolute(includePath))
|
|
@@ -34351,16 +34351,16 @@ var require_namespace2 = __commonJS2({
|
|
|
34351
34351
|
object.onRemove(this);
|
|
34352
34352
|
return clearCache(this);
|
|
34353
34353
|
};
|
|
34354
|
-
Namespace.prototype.define = function define2(
|
|
34355
|
-
if (util.isString(
|
|
34356
|
-
|
|
34357
|
-
else if (!Array.isArray(
|
|
34354
|
+
Namespace.prototype.define = function define2(path4, json) {
|
|
34355
|
+
if (util.isString(path4))
|
|
34356
|
+
path4 = path4.split(".");
|
|
34357
|
+
else if (!Array.isArray(path4))
|
|
34358
34358
|
throw TypeError("illegal path");
|
|
34359
|
-
if (
|
|
34359
|
+
if (path4 && path4.length && path4[0] === "")
|
|
34360
34360
|
throw Error("path must be relative");
|
|
34361
34361
|
var ptr = this;
|
|
34362
|
-
while (
|
|
34363
|
-
var part =
|
|
34362
|
+
while (path4.length > 0) {
|
|
34363
|
+
var part = path4.shift();
|
|
34364
34364
|
if (ptr.nested && ptr.nested[part]) {
|
|
34365
34365
|
ptr = ptr.nested[part];
|
|
34366
34366
|
if (!(ptr instanceof Namespace))
|
|
@@ -34395,26 +34395,26 @@ var require_namespace2 = __commonJS2({
|
|
|
34395
34395
|
});
|
|
34396
34396
|
return this;
|
|
34397
34397
|
};
|
|
34398
|
-
Namespace.prototype.lookup = function lookup(
|
|
34398
|
+
Namespace.prototype.lookup = function lookup(path4, filterTypes, parentAlreadyChecked) {
|
|
34399
34399
|
if (typeof filterTypes === "boolean") {
|
|
34400
34400
|
parentAlreadyChecked = filterTypes;
|
|
34401
34401
|
filterTypes = void 0;
|
|
34402
34402
|
} else if (filterTypes && !Array.isArray(filterTypes))
|
|
34403
34403
|
filterTypes = [filterTypes];
|
|
34404
|
-
if (util.isString(
|
|
34405
|
-
if (
|
|
34404
|
+
if (util.isString(path4) && path4.length) {
|
|
34405
|
+
if (path4 === ".")
|
|
34406
34406
|
return this.root;
|
|
34407
|
-
|
|
34408
|
-
} else if (!
|
|
34407
|
+
path4 = path4.split(".");
|
|
34408
|
+
} else if (!path4.length)
|
|
34409
34409
|
return this;
|
|
34410
|
-
var flatPath =
|
|
34411
|
-
if (
|
|
34412
|
-
return this.root.lookup(
|
|
34410
|
+
var flatPath = path4.join(".");
|
|
34411
|
+
if (path4[0] === "")
|
|
34412
|
+
return this.root.lookup(path4.slice(1), filterTypes);
|
|
34413
34413
|
var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
|
|
34414
34414
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
34415
34415
|
return found;
|
|
34416
34416
|
}
|
|
34417
|
-
found = this._lookupImpl(
|
|
34417
|
+
found = this._lookupImpl(path4, flatPath);
|
|
34418
34418
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
34419
34419
|
return found;
|
|
34420
34420
|
}
|
|
@@ -34422,7 +34422,7 @@ var require_namespace2 = __commonJS2({
|
|
|
34422
34422
|
return null;
|
|
34423
34423
|
var current = this;
|
|
34424
34424
|
while (current.parent) {
|
|
34425
|
-
found = current.parent._lookupImpl(
|
|
34425
|
+
found = current.parent._lookupImpl(path4, flatPath);
|
|
34426
34426
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
34427
34427
|
return found;
|
|
34428
34428
|
}
|
|
@@ -34430,49 +34430,49 @@ var require_namespace2 = __commonJS2({
|
|
|
34430
34430
|
}
|
|
34431
34431
|
return null;
|
|
34432
34432
|
};
|
|
34433
|
-
Namespace.prototype._lookupImpl = function lookup(
|
|
34433
|
+
Namespace.prototype._lookupImpl = function lookup(path4, flatPath) {
|
|
34434
34434
|
if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
|
|
34435
34435
|
return this._lookupCache[flatPath];
|
|
34436
34436
|
}
|
|
34437
|
-
var found = this.get(
|
|
34437
|
+
var found = this.get(path4[0]);
|
|
34438
34438
|
var exact = null;
|
|
34439
34439
|
if (found) {
|
|
34440
|
-
if (
|
|
34440
|
+
if (path4.length === 1) {
|
|
34441
34441
|
exact = found;
|
|
34442
34442
|
} else if (found instanceof Namespace) {
|
|
34443
|
-
|
|
34444
|
-
exact = found._lookupImpl(
|
|
34443
|
+
path4 = path4.slice(1);
|
|
34444
|
+
exact = found._lookupImpl(path4, path4.join("."));
|
|
34445
34445
|
}
|
|
34446
34446
|
} else {
|
|
34447
34447
|
for (var i = 0; i < this.nestedArray.length; ++i)
|
|
34448
|
-
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(
|
|
34448
|
+
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path4, flatPath)))
|
|
34449
34449
|
exact = found;
|
|
34450
34450
|
}
|
|
34451
34451
|
this._lookupCache[flatPath] = exact;
|
|
34452
34452
|
return exact;
|
|
34453
34453
|
};
|
|
34454
|
-
Namespace.prototype.lookupType = function lookupType(
|
|
34455
|
-
var found = this.lookup(
|
|
34454
|
+
Namespace.prototype.lookupType = function lookupType(path4) {
|
|
34455
|
+
var found = this.lookup(path4, [Type]);
|
|
34456
34456
|
if (!found)
|
|
34457
|
-
throw Error("no such type: " +
|
|
34457
|
+
throw Error("no such type: " + path4);
|
|
34458
34458
|
return found;
|
|
34459
34459
|
};
|
|
34460
|
-
Namespace.prototype.lookupEnum = function lookupEnum(
|
|
34461
|
-
var found = this.lookup(
|
|
34460
|
+
Namespace.prototype.lookupEnum = function lookupEnum(path4) {
|
|
34461
|
+
var found = this.lookup(path4, [Enum]);
|
|
34462
34462
|
if (!found)
|
|
34463
|
-
throw Error("no such Enum '" +
|
|
34463
|
+
throw Error("no such Enum '" + path4 + "' in " + this);
|
|
34464
34464
|
return found;
|
|
34465
34465
|
};
|
|
34466
|
-
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(
|
|
34467
|
-
var found = this.lookup(
|
|
34466
|
+
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path4) {
|
|
34467
|
+
var found = this.lookup(path4, [Type, Enum]);
|
|
34468
34468
|
if (!found)
|
|
34469
|
-
throw Error("no such Type or Enum '" +
|
|
34469
|
+
throw Error("no such Type or Enum '" + path4 + "' in " + this);
|
|
34470
34470
|
return found;
|
|
34471
34471
|
};
|
|
34472
|
-
Namespace.prototype.lookupService = function lookupService(
|
|
34473
|
-
var found = this.lookup(
|
|
34472
|
+
Namespace.prototype.lookupService = function lookupService(path4) {
|
|
34473
|
+
var found = this.lookup(path4, [Service2]);
|
|
34474
34474
|
if (!found)
|
|
34475
|
-
throw Error("no such Service '" +
|
|
34475
|
+
throw Error("no such Service '" + path4 + "' in " + this);
|
|
34476
34476
|
return found;
|
|
34477
34477
|
};
|
|
34478
34478
|
Namespace._configure = function(Type_, Service_, Enum_) {
|
|
@@ -35802,7 +35802,7 @@ var require_util3 = __commonJS2({
|
|
|
35802
35802
|
Object.defineProperty(object, "$type", { value: enm, enumerable: false });
|
|
35803
35803
|
return enm;
|
|
35804
35804
|
};
|
|
35805
|
-
util.setProperty = function setProperty(dst,
|
|
35805
|
+
util.setProperty = function setProperty(dst, path4, value, ifNotSet) {
|
|
35806
35806
|
function setProp(dst2, path22, value2) {
|
|
35807
35807
|
var part = path22.shift();
|
|
35808
35808
|
if (part === "__proto__" || part === "prototype") {
|
|
@@ -35822,10 +35822,10 @@ var require_util3 = __commonJS2({
|
|
|
35822
35822
|
}
|
|
35823
35823
|
if (typeof dst !== "object")
|
|
35824
35824
|
throw TypeError("dst must be an object");
|
|
35825
|
-
if (!
|
|
35825
|
+
if (!path4)
|
|
35826
35826
|
throw TypeError("path must be specified");
|
|
35827
|
-
|
|
35828
|
-
return setProp(dst,
|
|
35827
|
+
path4 = path4.split(".");
|
|
35828
|
+
return setProp(dst, path4, value);
|
|
35829
35829
|
};
|
|
35830
35830
|
Object.defineProperty(util, "decorateRoot", {
|
|
35831
35831
|
get: function() {
|
|
@@ -36359,12 +36359,12 @@ var require_object2 = __commonJS2({
|
|
|
36359
36359
|
*/
|
|
36360
36360
|
fullName: {
|
|
36361
36361
|
get: function() {
|
|
36362
|
-
var
|
|
36362
|
+
var path4 = [this.name], ptr = this.parent;
|
|
36363
36363
|
while (ptr) {
|
|
36364
|
-
|
|
36364
|
+
path4.unshift(ptr.name);
|
|
36365
36365
|
ptr = ptr.parent;
|
|
36366
36366
|
}
|
|
36367
|
-
return
|
|
36367
|
+
return path4.join(".");
|
|
36368
36368
|
}
|
|
36369
36369
|
}
|
|
36370
36370
|
});
|
|
@@ -40315,19 +40315,19 @@ var require_util22 = __commonJS2({
|
|
|
40315
40315
|
"node_modules/@grpc/proto-loader/build/src/util.js"(exports2) {
|
|
40316
40316
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
40317
40317
|
exports2.addCommonProtos = exports2.loadProtosWithOptionsSync = exports2.loadProtosWithOptions = void 0;
|
|
40318
|
-
var
|
|
40319
|
-
var
|
|
40318
|
+
var fs3 = __require2("fs");
|
|
40319
|
+
var path4 = __require2("path");
|
|
40320
40320
|
var Protobuf = require_protobufjs2();
|
|
40321
40321
|
function addIncludePathResolver(root, includePaths) {
|
|
40322
40322
|
const originalResolvePath = root.resolvePath;
|
|
40323
40323
|
root.resolvePath = (origin, target) => {
|
|
40324
|
-
if (
|
|
40324
|
+
if (path4.isAbsolute(target)) {
|
|
40325
40325
|
return target;
|
|
40326
40326
|
}
|
|
40327
40327
|
for (const directory of includePaths) {
|
|
40328
|
-
const fullPath =
|
|
40328
|
+
const fullPath = path4.join(directory, target);
|
|
40329
40329
|
try {
|
|
40330
|
-
|
|
40330
|
+
fs3.accessSync(fullPath, fs3.constants.R_OK);
|
|
40331
40331
|
return fullPath;
|
|
40332
40332
|
} catch (err) {
|
|
40333
40333
|
continue;
|
|
@@ -46551,9 +46551,9 @@ var require_server_call2 = __commonJS2({
|
|
|
46551
46551
|
return status;
|
|
46552
46552
|
}
|
|
46553
46553
|
var ServerUnaryCallImpl = class extends events_1.EventEmitter {
|
|
46554
|
-
constructor(
|
|
46554
|
+
constructor(path4, call, metadata, request) {
|
|
46555
46555
|
super();
|
|
46556
|
-
this.path =
|
|
46556
|
+
this.path = path4;
|
|
46557
46557
|
this.call = call;
|
|
46558
46558
|
this.metadata = metadata;
|
|
46559
46559
|
this.request = request;
|
|
@@ -46583,9 +46583,9 @@ var require_server_call2 = __commonJS2({
|
|
|
46583
46583
|
};
|
|
46584
46584
|
exports2.ServerUnaryCallImpl = ServerUnaryCallImpl;
|
|
46585
46585
|
var ServerReadableStreamImpl = class extends stream_1.Readable {
|
|
46586
|
-
constructor(
|
|
46586
|
+
constructor(path4, call, metadata) {
|
|
46587
46587
|
super({ objectMode: true });
|
|
46588
|
-
this.path =
|
|
46588
|
+
this.path = path4;
|
|
46589
46589
|
this.call = call;
|
|
46590
46590
|
this.metadata = metadata;
|
|
46591
46591
|
this.cancelled = false;
|
|
@@ -46617,9 +46617,9 @@ var require_server_call2 = __commonJS2({
|
|
|
46617
46617
|
};
|
|
46618
46618
|
exports2.ServerReadableStreamImpl = ServerReadableStreamImpl;
|
|
46619
46619
|
var ServerWritableStreamImpl = class extends stream_1.Writable {
|
|
46620
|
-
constructor(
|
|
46620
|
+
constructor(path4, call, metadata, request) {
|
|
46621
46621
|
super({ objectMode: true });
|
|
46622
|
-
this.path =
|
|
46622
|
+
this.path = path4;
|
|
46623
46623
|
this.call = call;
|
|
46624
46624
|
this.metadata = metadata;
|
|
46625
46625
|
this.request = request;
|
|
@@ -46673,9 +46673,9 @@ var require_server_call2 = __commonJS2({
|
|
|
46673
46673
|
};
|
|
46674
46674
|
exports2.ServerWritableStreamImpl = ServerWritableStreamImpl;
|
|
46675
46675
|
var ServerDuplexStreamImpl = class extends stream_1.Duplex {
|
|
46676
|
-
constructor(
|
|
46676
|
+
constructor(path4, call, metadata) {
|
|
46677
46677
|
super({ objectMode: true });
|
|
46678
|
-
this.path =
|
|
46678
|
+
this.path = path4;
|
|
46679
46679
|
this.call = call;
|
|
46680
46680
|
this.metadata = metadata;
|
|
46681
46681
|
this.pendingStatus = {
|
|
@@ -48932,11 +48932,11 @@ var require_server2 = __commonJS2({
|
|
|
48932
48932
|
}
|
|
48933
48933
|
return true;
|
|
48934
48934
|
}
|
|
48935
|
-
_retrieveHandler(
|
|
48936
|
-
serverCallTrace("Received call to method " +
|
|
48937
|
-
const handler = this.handlers.get(
|
|
48935
|
+
_retrieveHandler(path4) {
|
|
48936
|
+
serverCallTrace("Received call to method " + path4 + " at address " + this.serverAddressString);
|
|
48937
|
+
const handler = this.handlers.get(path4);
|
|
48938
48938
|
if (handler === void 0) {
|
|
48939
|
-
serverCallTrace("No handler registered for method " +
|
|
48939
|
+
serverCallTrace("No handler registered for method " + path4 + ". Sending UNIMPLEMENTED status.");
|
|
48940
48940
|
return null;
|
|
48941
48941
|
}
|
|
48942
48942
|
return handler;
|
|
@@ -48958,10 +48958,10 @@ var require_server2 = __commonJS2({
|
|
|
48958
48958
|
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed();
|
|
48959
48959
|
return;
|
|
48960
48960
|
}
|
|
48961
|
-
const
|
|
48962
|
-
const handler = this._retrieveHandler(
|
|
48961
|
+
const path4 = headers[HTTP2_HEADER_PATH];
|
|
48962
|
+
const handler = this._retrieveHandler(path4);
|
|
48963
48963
|
if (!handler) {
|
|
48964
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
48964
|
+
this._respondWithError(getUnimplementedStatusResponse(path4), stream, channelzSessionInfo);
|
|
48965
48965
|
return;
|
|
48966
48966
|
}
|
|
48967
48967
|
const callEventTracker = {
|
|
@@ -49009,10 +49009,10 @@ var require_server2 = __commonJS2({
|
|
|
49009
49009
|
if (this._verifyContentType(stream, headers) !== true) {
|
|
49010
49010
|
return;
|
|
49011
49011
|
}
|
|
49012
|
-
const
|
|
49013
|
-
const handler = this._retrieveHandler(
|
|
49012
|
+
const path4 = headers[HTTP2_HEADER_PATH];
|
|
49013
|
+
const handler = this._retrieveHandler(path4);
|
|
49014
49014
|
if (!handler) {
|
|
49015
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
49015
|
+
this._respondWithError(getUnimplementedStatusResponse(path4), stream, null);
|
|
49016
49016
|
return;
|
|
49017
49017
|
}
|
|
49018
49018
|
const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, null, handler, this.options);
|
|
@@ -50024,7 +50024,7 @@ var require_certificate_provider2 = __commonJS2({
|
|
|
50024
50024
|
"node_modules/@grpc/grpc-js/build/src/certificate-provider.js"(exports2) {
|
|
50025
50025
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50026
50026
|
exports2.FileWatcherCertificateProvider = void 0;
|
|
50027
|
-
var
|
|
50027
|
+
var fs3 = __require2("fs");
|
|
50028
50028
|
var logging = require_logging2();
|
|
50029
50029
|
var constants_1 = require_constants2();
|
|
50030
50030
|
var util_1 = __require2("util");
|
|
@@ -50032,7 +50032,7 @@ var require_certificate_provider2 = __commonJS2({
|
|
|
50032
50032
|
function trace(text) {
|
|
50033
50033
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text);
|
|
50034
50034
|
}
|
|
50035
|
-
var readFilePromise = (0, util_1.promisify)(
|
|
50035
|
+
var readFilePromise = (0, util_1.promisify)(fs3.readFile);
|
|
50036
50036
|
var FileWatcherCertificateProvider = class {
|
|
50037
50037
|
constructor(config) {
|
|
50038
50038
|
this.config = config;
|
|
@@ -50281,13 +50281,13 @@ var require_resolver_uds2 = __commonJS2({
|
|
|
50281
50281
|
this.listener = listener;
|
|
50282
50282
|
this.hasReturnedResult = false;
|
|
50283
50283
|
this.endpoints = [];
|
|
50284
|
-
let
|
|
50284
|
+
let path4;
|
|
50285
50285
|
if (target.authority === "") {
|
|
50286
|
-
|
|
50286
|
+
path4 = "/" + target.path;
|
|
50287
50287
|
} else {
|
|
50288
|
-
|
|
50288
|
+
path4 = target.path;
|
|
50289
50289
|
}
|
|
50290
|
-
this.endpoints = [{ addresses: [{ path:
|
|
50290
|
+
this.endpoints = [{ addresses: [{ path: path4 }] }];
|
|
50291
50291
|
}
|
|
50292
50292
|
updateResolution() {
|
|
50293
50293
|
if (!this.hasReturnedResult) {
|
|
@@ -50344,12 +50344,12 @@ var require_resolver_ip2 = __commonJS2({
|
|
|
50344
50344
|
return;
|
|
50345
50345
|
}
|
|
50346
50346
|
const pathList = target.path.split(",");
|
|
50347
|
-
for (const
|
|
50348
|
-
const hostPort = (0, uri_parser_1.splitHostPort)(
|
|
50347
|
+
for (const path4 of pathList) {
|
|
50348
|
+
const hostPort = (0, uri_parser_1.splitHostPort)(path4);
|
|
50349
50349
|
if (hostPort === null) {
|
|
50350
50350
|
this.error = {
|
|
50351
50351
|
code: constants_1.Status.UNAVAILABLE,
|
|
50352
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
50352
|
+
details: `Failed to parse ${target.scheme} address ${path4}`,
|
|
50353
50353
|
metadata: new metadata_1.Metadata()
|
|
50354
50354
|
};
|
|
50355
50355
|
return;
|
|
@@ -50357,7 +50357,7 @@ var require_resolver_ip2 = __commonJS2({
|
|
|
50357
50357
|
if (target.scheme === IPV4_SCHEME && !(0, net_1.isIPv4)(hostPort.host) || target.scheme === IPV6_SCHEME && !(0, net_1.isIPv6)(hostPort.host)) {
|
|
50358
50358
|
this.error = {
|
|
50359
50359
|
code: constants_1.Status.UNAVAILABLE,
|
|
50360
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
50360
|
+
details: `Failed to parse ${target.scheme} address ${path4}`,
|
|
50361
50361
|
metadata: new metadata_1.Metadata()
|
|
50362
50362
|
};
|
|
50363
50363
|
return;
|
|
@@ -52080,10 +52080,86 @@ async function createGrpcClient(address, ...serviceImpls) {
|
|
|
52080
52080
|
grpcClientInstance.bindFns();
|
|
52081
52081
|
return grpcClientInstance;
|
|
52082
52082
|
}
|
|
52083
|
-
|
|
52083
|
+
|
|
52084
|
+
// src/service.ts
|
|
52085
|
+
var FluxService = class extends Service("FluxService") {
|
|
52086
|
+
sendMessage = server();
|
|
52087
|
+
messageStream = bidi();
|
|
52088
|
+
registerAgent = server();
|
|
52089
|
+
unregisterAgent = server();
|
|
52090
|
+
onIncomingMessage = client();
|
|
52091
|
+
validateUser = server();
|
|
52092
|
+
};
|
|
52093
|
+
|
|
52094
|
+
// src/flux-client.ts
|
|
52095
|
+
var GRPC_SERVER_ADDRESS = process.env.FLUX_SERVER_ADDRESS || "fluxy.photon.codes:443";
|
|
52096
|
+
var FluxClient = class {
|
|
52097
|
+
client = null;
|
|
52098
|
+
phoneNumber;
|
|
52099
|
+
onMessage;
|
|
52100
|
+
constructor(phoneNumber, onMessage) {
|
|
52101
|
+
this.phoneNumber = phoneNumber.replace(/[\s\-\(\)]/g, "");
|
|
52102
|
+
this.onMessage = onMessage;
|
|
52103
|
+
}
|
|
52104
|
+
async connect() {
|
|
52105
|
+
const clientImpl = FluxService.Client({
|
|
52106
|
+
async onIncomingMessage(message) {
|
|
52107
|
+
return { received: true };
|
|
52108
|
+
}
|
|
52109
|
+
});
|
|
52110
|
+
this.client = await createGrpcClient(GRPC_SERVER_ADDRESS, clientImpl);
|
|
52111
|
+
console.log(`[FLUX] Connected to server at ${GRPC_SERVER_ADDRESS}`);
|
|
52112
|
+
}
|
|
52113
|
+
async register() {
|
|
52114
|
+
if (!this.client) throw new Error("Not connected. Call connect() first.");
|
|
52115
|
+
const result = await this.client.FluxService.registerAgent(this.phoneNumber);
|
|
52116
|
+
if (result.success) {
|
|
52117
|
+
console.log(`[FLUX] Registered agent for ${this.phoneNumber}`);
|
|
52118
|
+
this.startMessageStream();
|
|
52119
|
+
} else {
|
|
52120
|
+
console.error(`[FLUX] Registration failed: ${result.error}`);
|
|
52121
|
+
}
|
|
52122
|
+
return result.success;
|
|
52123
|
+
}
|
|
52124
|
+
async startMessageStream() {
|
|
52125
|
+
if (!this.client) return;
|
|
52126
|
+
(async () => {
|
|
52127
|
+
for await (const [message] of this.client.FluxService.messageStream) {
|
|
52128
|
+
if ("ack" in message) {
|
|
52129
|
+
console.log(`[FLUX] Received ack: ${message.ack}`);
|
|
52130
|
+
} else {
|
|
52131
|
+
console.log(`[FLUX] Incoming message from ${message.userPhoneNumber}: ${message.text}`);
|
|
52132
|
+
await this.client.FluxService.messageStream({ ack: message.messageGuid });
|
|
52133
|
+
const response = await this.onMessage(message);
|
|
52134
|
+
if (response) {
|
|
52135
|
+
await this.sendMessage(message.userPhoneNumber, response, message.chatGuid);
|
|
52136
|
+
}
|
|
52137
|
+
}
|
|
52138
|
+
}
|
|
52139
|
+
})();
|
|
52140
|
+
}
|
|
52141
|
+
async sendMessage(to, text, chatGuid) {
|
|
52142
|
+
if (!this.client) throw new Error("Not connected. Call connect() first.");
|
|
52143
|
+
const result = await this.client.FluxService.sendMessage({
|
|
52144
|
+
userPhoneNumber: to,
|
|
52145
|
+
text,
|
|
52146
|
+
chatGuid
|
|
52147
|
+
});
|
|
52148
|
+
if (!result.success) {
|
|
52149
|
+
console.error(`[FLUX] Send failed: ${result.error}`);
|
|
52150
|
+
}
|
|
52151
|
+
return result.success;
|
|
52152
|
+
}
|
|
52153
|
+
async disconnect() {
|
|
52154
|
+
if (!this.client) return;
|
|
52155
|
+
await this.client.FluxService.unregisterAgent(this.phoneNumber);
|
|
52156
|
+
console.log(`[FLUX] Unregistered agent for ${this.phoneNumber}`);
|
|
52157
|
+
this.client = null;
|
|
52158
|
+
}
|
|
52159
|
+
};
|
|
52160
|
+
var GRPC_SERVER_ADDRESS2 = process.env.FLUX_SERVER_ADDRESS || "fluxy.photon.codes:443";
|
|
52084
52161
|
var CONFIG_DIR = path__namespace.join(process.env.HOME || "~", ".flux");
|
|
52085
52162
|
var CONFIG_FILE = path__namespace.join(CONFIG_DIR, "config.json");
|
|
52086
|
-
var AGENT_FILE_NAME = "agent.ts";
|
|
52087
52163
|
function loadConfig() {
|
|
52088
52164
|
try {
|
|
52089
52165
|
if (fs__namespace.existsSync(CONFIG_FILE)) {
|
|
@@ -52129,7 +52205,7 @@ async function login() {
|
|
|
52129
52205
|
return { received: true };
|
|
52130
52206
|
}
|
|
52131
52207
|
});
|
|
52132
|
-
const client2 = await createGrpcClient(
|
|
52208
|
+
const client2 = await createGrpcClient(GRPC_SERVER_ADDRESS2, clientImpl);
|
|
52133
52209
|
const result = await client2.FluxService.validateUser(phoneNumber);
|
|
52134
52210
|
if (result.error) {
|
|
52135
52211
|
console.error(`[FLUX] Login failed: ${result.error}`);
|
|
@@ -52145,7 +52221,7 @@ async function login() {
|
|
|
52145
52221
|
return phoneNumber;
|
|
52146
52222
|
} catch (error) {
|
|
52147
52223
|
console.error(`[FLUX] Failed to connect to server: ${error.message}`);
|
|
52148
|
-
console.error(`[FLUX] Make sure the Flux server is running at ${
|
|
52224
|
+
console.error(`[FLUX] Make sure the Flux server is running at ${GRPC_SERVER_ADDRESS2}`);
|
|
52149
52225
|
process.exit(1);
|
|
52150
52226
|
}
|
|
52151
52227
|
}
|
|
@@ -52161,6 +52237,7 @@ async function getPhoneNumber() {
|
|
|
52161
52237
|
console.log("[FLUX] Not logged in.");
|
|
52162
52238
|
return await login();
|
|
52163
52239
|
}
|
|
52240
|
+
var AGENT_FILE_NAME = "agent.ts";
|
|
52164
52241
|
function findAgentFile() {
|
|
52165
52242
|
const cwd = process.cwd();
|
|
52166
52243
|
const agentPath = path__namespace.join(cwd, AGENT_FILE_NAME);
|
|
@@ -52194,79 +52271,8 @@ async function loadAgent(agentPath) {
|
|
|
52194
52271
|
const agentModule = await import(moduleUrl);
|
|
52195
52272
|
return agentModule.default;
|
|
52196
52273
|
}
|
|
52197
|
-
|
|
52198
|
-
|
|
52199
|
-
messageStream = bidi();
|
|
52200
|
-
registerAgent = server();
|
|
52201
|
-
unregisterAgent = server();
|
|
52202
|
-
onIncomingMessage = client();
|
|
52203
|
-
// Login validation - checks if user exists in Firebase
|
|
52204
|
-
validateUser = server();
|
|
52205
|
-
};
|
|
52206
|
-
var FluxClient = class {
|
|
52207
|
-
client = null;
|
|
52208
|
-
phoneNumber;
|
|
52209
|
-
onMessage;
|
|
52210
|
-
constructor(phoneNumber, onMessage) {
|
|
52211
|
-
this.phoneNumber = phoneNumber.replace(/[\s\-\(\)]/g, "");
|
|
52212
|
-
this.onMessage = onMessage;
|
|
52213
|
-
}
|
|
52214
|
-
async connect() {
|
|
52215
|
-
const clientImpl = FluxService.Client({
|
|
52216
|
-
async onIncomingMessage(message) {
|
|
52217
|
-
return { received: true };
|
|
52218
|
-
}
|
|
52219
|
-
});
|
|
52220
|
-
this.client = await createGrpcClient(GRPC_SERVER_ADDRESS, clientImpl);
|
|
52221
|
-
console.log(`[FLUX] Connected to server at ${GRPC_SERVER_ADDRESS}`);
|
|
52222
|
-
}
|
|
52223
|
-
async register() {
|
|
52224
|
-
if (!this.client) throw new Error("Not connected. Call connect() first.");
|
|
52225
|
-
const result = await this.client.FluxService.registerAgent(this.phoneNumber);
|
|
52226
|
-
if (result.success) {
|
|
52227
|
-
console.log(`[FLUX] Registered agent for ${this.phoneNumber}`);
|
|
52228
|
-
this.startMessageStream();
|
|
52229
|
-
} else {
|
|
52230
|
-
console.error(`[FLUX] Registration failed: ${result.error}`);
|
|
52231
|
-
}
|
|
52232
|
-
return result.success;
|
|
52233
|
-
}
|
|
52234
|
-
async startMessageStream() {
|
|
52235
|
-
if (!this.client) return;
|
|
52236
|
-
(async () => {
|
|
52237
|
-
for await (const [message] of this.client.FluxService.messageStream) {
|
|
52238
|
-
if ("ack" in message) {
|
|
52239
|
-
console.log(`[FLUX] Received ack: ${message.ack}`);
|
|
52240
|
-
} else {
|
|
52241
|
-
console.log(`[FLUX] Incoming message from ${message.userPhoneNumber}: ${message.text}`);
|
|
52242
|
-
await this.client.FluxService.messageStream({ ack: message.messageGuid });
|
|
52243
|
-
const response = await this.onMessage(message);
|
|
52244
|
-
if (response) {
|
|
52245
|
-
await this.sendMessage(message.userPhoneNumber, response, message.chatGuid);
|
|
52246
|
-
}
|
|
52247
|
-
}
|
|
52248
|
-
}
|
|
52249
|
-
})();
|
|
52250
|
-
}
|
|
52251
|
-
async sendMessage(to, text, chatGuid) {
|
|
52252
|
-
if (!this.client) throw new Error("Not connected. Call connect() first.");
|
|
52253
|
-
const result = await this.client.FluxService.sendMessage({
|
|
52254
|
-
userPhoneNumber: to,
|
|
52255
|
-
text,
|
|
52256
|
-
chatGuid
|
|
52257
|
-
});
|
|
52258
|
-
if (!result.success) {
|
|
52259
|
-
console.error(`[FLUX] Send failed: ${result.error}`);
|
|
52260
|
-
}
|
|
52261
|
-
return result.success;
|
|
52262
|
-
}
|
|
52263
|
-
async disconnect() {
|
|
52264
|
-
if (!this.client) return;
|
|
52265
|
-
await this.client.FluxService.unregisterAgent(this.phoneNumber);
|
|
52266
|
-
console.log(`[FLUX] Unregistered agent for ${this.phoneNumber}`);
|
|
52267
|
-
this.client = null;
|
|
52268
|
-
}
|
|
52269
|
-
};
|
|
52274
|
+
|
|
52275
|
+
// src/index.ts
|
|
52270
52276
|
async function validateCommand() {
|
|
52271
52277
|
const agentPath = findAgentFile();
|
|
52272
52278
|
if (!agentPath) {
|
|
@@ -52277,10 +52283,10 @@ async function validateCommand() {
|
|
|
52277
52283
|
console.log(`[FLUX] Validating ${path__namespace.basename(agentPath)}...`);
|
|
52278
52284
|
const result = await validateAgentFile(agentPath);
|
|
52279
52285
|
if (result.valid) {
|
|
52280
|
-
console.log("[FLUX]
|
|
52286
|
+
console.log("[FLUX] Agent is valid!");
|
|
52281
52287
|
return true;
|
|
52282
52288
|
} else {
|
|
52283
|
-
console.error(`[FLUX]
|
|
52289
|
+
console.error(`[FLUX] Validation failed: ${result.error}`);
|
|
52284
52290
|
return false;
|
|
52285
52291
|
}
|
|
52286
52292
|
}
|
|
@@ -52314,7 +52320,6 @@ async function runLocal() {
|
|
|
52314
52320
|
const response = await agent.invoke({
|
|
52315
52321
|
message: input,
|
|
52316
52322
|
userPhoneNumber: "+1234567890"
|
|
52317
|
-
// Mock phone number for local testing
|
|
52318
52323
|
});
|
|
52319
52324
|
console.log(`Agent: ${response}
|
|
52320
52325
|
`);
|
|
@@ -52507,7 +52512,5 @@ better-grpc/dist/index.js:
|
|
|
52507
52512
|
*)
|
|
52508
52513
|
*)
|
|
52509
52514
|
*/
|
|
52510
|
-
|
|
52511
|
-
|
|
52512
|
-
//# sourceMappingURL=cli.js.map
|
|
52513
|
-
//# sourceMappingURL=cli.js.map
|
|
52515
|
+
//# sourceMappingURL=index.js.map
|
|
52516
|
+
//# sourceMappingURL=index.js.map
|