@ondewo/nlu-client-typescript 6.13.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/api/ondewo/nlu/agent_grpc_web_pb.d.ts +48 -0
- package/api/ondewo/nlu/agent_grpc_web_pb.js +244 -0
- package/api/ondewo/nlu/agent_pb.d.ts +196 -15
- package/api/ondewo/nlu/agent_pb.js +1627 -0
- package/api/ondewo/nlu/aiservices_pb.d.ts +0 -50
- package/api/ondewo/nlu/ccai_project_pb.d.ts +6 -93
- package/api/ondewo/nlu/ccai_project_pb.js +24 -132
- package/api/ondewo/nlu/common_pb.d.ts +140 -0
- package/api/ondewo/nlu/common_pb.js +1151 -9
- package/api/ondewo/nlu/context_pb.d.ts +8 -1
- package/api/ondewo/nlu/context_pb.js +22 -4
- package/api/ondewo/nlu/llm_evaluation_pb.d.ts +40 -5
- package/api/ondewo/nlu/llm_evaluation_pb.js +110 -20
- package/api/ondewo/nlu/operations_grpc_web_pb.d.ts +46 -0
- package/api/ondewo/nlu/operations_grpc_web_pb.js +241 -0
- package/api/ondewo/nlu/operations_pb.d.ts +429 -10
- package/api/ondewo/nlu/operations_pb.js +3413 -0
- package/api/ondewo/nlu/project_role_pb.d.ts +0 -10
- package/api/ondewo/nlu/rag_pb.d.ts +191 -520
- package/api/ondewo/nlu/rag_pb.js +1246 -1058
- package/api/ondewo/nlu/session_grpc_web_pb.d.ts +120 -0
- package/api/ondewo/nlu/session_grpc_web_pb.js +610 -0
- package/api/ondewo/nlu/session_pb.d.ts +818 -118
- package/api/ondewo/nlu/session_pb.js +6396 -3
- package/api/ondewo/nlu/user_grpc_web_pb.d.ts +59 -13
- package/api/ondewo/nlu/user_grpc_web_pb.js +300 -61
- package/api/ondewo/nlu/user_pb.d.ts +0 -87
- package/api/ondewo/nlu/user_pb.js +0 -436
- package/auth/offlineTokenProvider.d.ts +195 -0
- package/auth/offlineTokenProvider.js +372 -0
- package/package.json +11 -8
- package/public-api.d.ts +31 -31
- package/public-api.js +28 -28
- package/api/google/logging/v2/log_entry_pb.d.ts +0 -172
- package/api/google/logging/v2/log_entry_pb.js +0 -1333
|
@@ -56,8 +56,6 @@ goog.exportSymbol('proto.ondewo.nlu.ListUserPreferencesRequest', null, global);
|
|
|
56
56
|
goog.exportSymbol('proto.ondewo.nlu.ListUserPreferencesResponse', null, global);
|
|
57
57
|
goog.exportSymbol('proto.ondewo.nlu.ListUsersRequest', null, global);
|
|
58
58
|
goog.exportSymbol('proto.ondewo.nlu.ListUsersResponse', null, global);
|
|
59
|
-
goog.exportSymbol('proto.ondewo.nlu.LoginRequest', null, global);
|
|
60
|
-
goog.exportSymbol('proto.ondewo.nlu.LoginResponse', null, global);
|
|
61
59
|
goog.exportSymbol('proto.ondewo.nlu.ServerRole', null, global);
|
|
62
60
|
goog.exportSymbol('proto.ondewo.nlu.SetUserPreferencesRequest', null, global);
|
|
63
61
|
goog.exportSymbol('proto.ondewo.nlu.SetUserPreferencesResponse', null, global);
|
|
@@ -443,48 +441,6 @@ if (goog.DEBUG && !COMPILED) {
|
|
|
443
441
|
*/
|
|
444
442
|
proto.ondewo.nlu.ListServerPermissionsResponse.displayName = 'proto.ondewo.nlu.ListServerPermissionsResponse';
|
|
445
443
|
}
|
|
446
|
-
/**
|
|
447
|
-
* Generated by JsPbCodeGenerator.
|
|
448
|
-
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
449
|
-
* server response, or constructed directly in Javascript. The array is used
|
|
450
|
-
* in place and becomes part of the constructed object. It is not cloned.
|
|
451
|
-
* If no data is provided, the constructed object will be empty, but still
|
|
452
|
-
* valid.
|
|
453
|
-
* @extends {jspb.Message}
|
|
454
|
-
* @constructor
|
|
455
|
-
*/
|
|
456
|
-
proto.ondewo.nlu.LoginRequest = function(opt_data) {
|
|
457
|
-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
458
|
-
};
|
|
459
|
-
goog.inherits(proto.ondewo.nlu.LoginRequest, jspb.Message);
|
|
460
|
-
if (goog.DEBUG && !COMPILED) {
|
|
461
|
-
/**
|
|
462
|
-
* @public
|
|
463
|
-
* @override
|
|
464
|
-
*/
|
|
465
|
-
proto.ondewo.nlu.LoginRequest.displayName = 'proto.ondewo.nlu.LoginRequest';
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Generated by JsPbCodeGenerator.
|
|
469
|
-
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
470
|
-
* server response, or constructed directly in Javascript. The array is used
|
|
471
|
-
* in place and becomes part of the constructed object. It is not cloned.
|
|
472
|
-
* If no data is provided, the constructed object will be empty, but still
|
|
473
|
-
* valid.
|
|
474
|
-
* @extends {jspb.Message}
|
|
475
|
-
* @constructor
|
|
476
|
-
*/
|
|
477
|
-
proto.ondewo.nlu.LoginResponse = function(opt_data) {
|
|
478
|
-
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
479
|
-
};
|
|
480
|
-
goog.inherits(proto.ondewo.nlu.LoginResponse, jspb.Message);
|
|
481
|
-
if (goog.DEBUG && !COMPILED) {
|
|
482
|
-
/**
|
|
483
|
-
* @public
|
|
484
|
-
* @override
|
|
485
|
-
*/
|
|
486
|
-
proto.ondewo.nlu.LoginResponse.displayName = 'proto.ondewo.nlu.LoginResponse';
|
|
487
|
-
}
|
|
488
444
|
/**
|
|
489
445
|
* Generated by JsPbCodeGenerator.
|
|
490
446
|
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
@@ -4545,398 +4501,6 @@ proto.ondewo.nlu.ListServerPermissionsResponse.prototype.setNextPageToken = func
|
|
|
4545
4501
|
|
|
4546
4502
|
|
|
4547
4503
|
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
4551
|
-
/**
|
|
4552
|
-
* Creates an object representation of this proto.
|
|
4553
|
-
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
4554
|
-
* Optional fields that are not set will be set to undefined.
|
|
4555
|
-
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
4556
|
-
* For the list of reserved names please see:
|
|
4557
|
-
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
4558
|
-
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
4559
|
-
* JSPB instance for transitional soy proto support:
|
|
4560
|
-
* http://goto/soy-param-migration
|
|
4561
|
-
* @return {!Object}
|
|
4562
|
-
*/
|
|
4563
|
-
proto.ondewo.nlu.LoginRequest.prototype.toObject = function(opt_includeInstance) {
|
|
4564
|
-
return proto.ondewo.nlu.LoginRequest.toObject(opt_includeInstance, this);
|
|
4565
|
-
};
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
/**
|
|
4569
|
-
* Static version of the {@see toObject} method.
|
|
4570
|
-
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
4571
|
-
* the JSPB instance for transitional soy proto support:
|
|
4572
|
-
* http://goto/soy-param-migration
|
|
4573
|
-
* @param {!proto.ondewo.nlu.LoginRequest} msg The msg instance to transform.
|
|
4574
|
-
* @return {!Object}
|
|
4575
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
4576
|
-
*/
|
|
4577
|
-
proto.ondewo.nlu.LoginRequest.toObject = function(includeInstance, msg) {
|
|
4578
|
-
var f, obj = {
|
|
4579
|
-
userEmail: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
4580
|
-
password: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
4581
|
-
fieldMask: (f = msg.getFieldMask()) && google_protobuf_field_mask_pb.FieldMask.toObject(includeInstance, f)
|
|
4582
|
-
};
|
|
4583
|
-
|
|
4584
|
-
if (includeInstance) {
|
|
4585
|
-
obj.$jspbMessageInstance = msg;
|
|
4586
|
-
}
|
|
4587
|
-
return obj;
|
|
4588
|
-
};
|
|
4589
|
-
}
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
/**
|
|
4593
|
-
* Deserializes binary data (in protobuf wire format).
|
|
4594
|
-
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
4595
|
-
* @return {!proto.ondewo.nlu.LoginRequest}
|
|
4596
|
-
*/
|
|
4597
|
-
proto.ondewo.nlu.LoginRequest.deserializeBinary = function(bytes) {
|
|
4598
|
-
var reader = new jspb.BinaryReader(bytes);
|
|
4599
|
-
var msg = new proto.ondewo.nlu.LoginRequest;
|
|
4600
|
-
return proto.ondewo.nlu.LoginRequest.deserializeBinaryFromReader(msg, reader);
|
|
4601
|
-
};
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
/**
|
|
4605
|
-
* Deserializes binary data (in protobuf wire format) from the
|
|
4606
|
-
* given reader into the given message object.
|
|
4607
|
-
* @param {!proto.ondewo.nlu.LoginRequest} msg The message object to deserialize into.
|
|
4608
|
-
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
4609
|
-
* @return {!proto.ondewo.nlu.LoginRequest}
|
|
4610
|
-
*/
|
|
4611
|
-
proto.ondewo.nlu.LoginRequest.deserializeBinaryFromReader = function(msg, reader) {
|
|
4612
|
-
while (reader.nextField()) {
|
|
4613
|
-
if (reader.isEndGroup()) {
|
|
4614
|
-
break;
|
|
4615
|
-
}
|
|
4616
|
-
var field = reader.getFieldNumber();
|
|
4617
|
-
switch (field) {
|
|
4618
|
-
case 1:
|
|
4619
|
-
var value = /** @type {string} */ (reader.readString());
|
|
4620
|
-
msg.setUserEmail(value);
|
|
4621
|
-
break;
|
|
4622
|
-
case 2:
|
|
4623
|
-
var value = /** @type {string} */ (reader.readString());
|
|
4624
|
-
msg.setPassword(value);
|
|
4625
|
-
break;
|
|
4626
|
-
case 3:
|
|
4627
|
-
var value = new google_protobuf_field_mask_pb.FieldMask;
|
|
4628
|
-
reader.readMessage(value,google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader);
|
|
4629
|
-
msg.setFieldMask(value);
|
|
4630
|
-
break;
|
|
4631
|
-
default:
|
|
4632
|
-
reader.skipField();
|
|
4633
|
-
break;
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
return msg;
|
|
4637
|
-
};
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
/**
|
|
4641
|
-
* Serializes the message to binary data (in protobuf wire format).
|
|
4642
|
-
* @return {!Uint8Array}
|
|
4643
|
-
*/
|
|
4644
|
-
proto.ondewo.nlu.LoginRequest.prototype.serializeBinary = function() {
|
|
4645
|
-
var writer = new jspb.BinaryWriter();
|
|
4646
|
-
proto.ondewo.nlu.LoginRequest.serializeBinaryToWriter(this, writer);
|
|
4647
|
-
return writer.getResultBuffer();
|
|
4648
|
-
};
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
/**
|
|
4652
|
-
* Serializes the given message to binary data (in protobuf wire
|
|
4653
|
-
* format), writing to the given BinaryWriter.
|
|
4654
|
-
* @param {!proto.ondewo.nlu.LoginRequest} message
|
|
4655
|
-
* @param {!jspb.BinaryWriter} writer
|
|
4656
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
4657
|
-
*/
|
|
4658
|
-
proto.ondewo.nlu.LoginRequest.serializeBinaryToWriter = function(message, writer) {
|
|
4659
|
-
var f = undefined;
|
|
4660
|
-
f = message.getUserEmail();
|
|
4661
|
-
if (f.length > 0) {
|
|
4662
|
-
writer.writeString(
|
|
4663
|
-
1,
|
|
4664
|
-
f
|
|
4665
|
-
);
|
|
4666
|
-
}
|
|
4667
|
-
f = message.getPassword();
|
|
4668
|
-
if (f.length > 0) {
|
|
4669
|
-
writer.writeString(
|
|
4670
|
-
2,
|
|
4671
|
-
f
|
|
4672
|
-
);
|
|
4673
|
-
}
|
|
4674
|
-
f = message.getFieldMask();
|
|
4675
|
-
if (f != null) {
|
|
4676
|
-
writer.writeMessage(
|
|
4677
|
-
3,
|
|
4678
|
-
f,
|
|
4679
|
-
google_protobuf_field_mask_pb.FieldMask.serializeBinaryToWriter
|
|
4680
|
-
);
|
|
4681
|
-
}
|
|
4682
|
-
};
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
/**
|
|
4686
|
-
* optional string user_email = 1;
|
|
4687
|
-
* @return {string}
|
|
4688
|
-
*/
|
|
4689
|
-
proto.ondewo.nlu.LoginRequest.prototype.getUserEmail = function() {
|
|
4690
|
-
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
4691
|
-
};
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
/**
|
|
4695
|
-
* @param {string} value
|
|
4696
|
-
* @return {!proto.ondewo.nlu.LoginRequest} returns this
|
|
4697
|
-
*/
|
|
4698
|
-
proto.ondewo.nlu.LoginRequest.prototype.setUserEmail = function(value) {
|
|
4699
|
-
return jspb.Message.setProto3StringField(this, 1, value);
|
|
4700
|
-
};
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
/**
|
|
4704
|
-
* optional string password = 2;
|
|
4705
|
-
* @return {string}
|
|
4706
|
-
*/
|
|
4707
|
-
proto.ondewo.nlu.LoginRequest.prototype.getPassword = function() {
|
|
4708
|
-
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
|
4709
|
-
};
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
/**
|
|
4713
|
-
* @param {string} value
|
|
4714
|
-
* @return {!proto.ondewo.nlu.LoginRequest} returns this
|
|
4715
|
-
*/
|
|
4716
|
-
proto.ondewo.nlu.LoginRequest.prototype.setPassword = function(value) {
|
|
4717
|
-
return jspb.Message.setProto3StringField(this, 2, value);
|
|
4718
|
-
};
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
/**
|
|
4722
|
-
* optional google.protobuf.FieldMask field_mask = 3;
|
|
4723
|
-
* @return {?proto.google.protobuf.FieldMask}
|
|
4724
|
-
*/
|
|
4725
|
-
proto.ondewo.nlu.LoginRequest.prototype.getFieldMask = function() {
|
|
4726
|
-
return /** @type{?proto.google.protobuf.FieldMask} */ (
|
|
4727
|
-
jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 3));
|
|
4728
|
-
};
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
/**
|
|
4732
|
-
* @param {?proto.google.protobuf.FieldMask|undefined} value
|
|
4733
|
-
* @return {!proto.ondewo.nlu.LoginRequest} returns this
|
|
4734
|
-
*/
|
|
4735
|
-
proto.ondewo.nlu.LoginRequest.prototype.setFieldMask = function(value) {
|
|
4736
|
-
return jspb.Message.setWrapperField(this, 3, value);
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
/**
|
|
4741
|
-
* Clears the message field making it undefined.
|
|
4742
|
-
* @return {!proto.ondewo.nlu.LoginRequest} returns this
|
|
4743
|
-
*/
|
|
4744
|
-
proto.ondewo.nlu.LoginRequest.prototype.clearFieldMask = function() {
|
|
4745
|
-
return this.setFieldMask(undefined);
|
|
4746
|
-
};
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
/**
|
|
4750
|
-
* Returns whether this field is set.
|
|
4751
|
-
* @return {boolean}
|
|
4752
|
-
*/
|
|
4753
|
-
proto.ondewo.nlu.LoginRequest.prototype.hasFieldMask = function() {
|
|
4754
|
-
return jspb.Message.getField(this, 3) != null;
|
|
4755
|
-
};
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
4762
|
-
/**
|
|
4763
|
-
* Creates an object representation of this proto.
|
|
4764
|
-
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
4765
|
-
* Optional fields that are not set will be set to undefined.
|
|
4766
|
-
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
4767
|
-
* For the list of reserved names please see:
|
|
4768
|
-
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
4769
|
-
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
4770
|
-
* JSPB instance for transitional soy proto support:
|
|
4771
|
-
* http://goto/soy-param-migration
|
|
4772
|
-
* @return {!Object}
|
|
4773
|
-
*/
|
|
4774
|
-
proto.ondewo.nlu.LoginResponse.prototype.toObject = function(opt_includeInstance) {
|
|
4775
|
-
return proto.ondewo.nlu.LoginResponse.toObject(opt_includeInstance, this);
|
|
4776
|
-
};
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
/**
|
|
4780
|
-
* Static version of the {@see toObject} method.
|
|
4781
|
-
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
4782
|
-
* the JSPB instance for transitional soy proto support:
|
|
4783
|
-
* http://goto/soy-param-migration
|
|
4784
|
-
* @param {!proto.ondewo.nlu.LoginResponse} msg The msg instance to transform.
|
|
4785
|
-
* @return {!Object}
|
|
4786
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
4787
|
-
*/
|
|
4788
|
-
proto.ondewo.nlu.LoginResponse.toObject = function(includeInstance, msg) {
|
|
4789
|
-
var f, obj = {
|
|
4790
|
-
user: (f = msg.getUser()) && proto.ondewo.nlu.User.toObject(includeInstance, f),
|
|
4791
|
-
authToken: jspb.Message.getFieldWithDefault(msg, 2, "")
|
|
4792
|
-
};
|
|
4793
|
-
|
|
4794
|
-
if (includeInstance) {
|
|
4795
|
-
obj.$jspbMessageInstance = msg;
|
|
4796
|
-
}
|
|
4797
|
-
return obj;
|
|
4798
|
-
};
|
|
4799
|
-
}
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
/**
|
|
4803
|
-
* Deserializes binary data (in protobuf wire format).
|
|
4804
|
-
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
4805
|
-
* @return {!proto.ondewo.nlu.LoginResponse}
|
|
4806
|
-
*/
|
|
4807
|
-
proto.ondewo.nlu.LoginResponse.deserializeBinary = function(bytes) {
|
|
4808
|
-
var reader = new jspb.BinaryReader(bytes);
|
|
4809
|
-
var msg = new proto.ondewo.nlu.LoginResponse;
|
|
4810
|
-
return proto.ondewo.nlu.LoginResponse.deserializeBinaryFromReader(msg, reader);
|
|
4811
|
-
};
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
/**
|
|
4815
|
-
* Deserializes binary data (in protobuf wire format) from the
|
|
4816
|
-
* given reader into the given message object.
|
|
4817
|
-
* @param {!proto.ondewo.nlu.LoginResponse} msg The message object to deserialize into.
|
|
4818
|
-
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
4819
|
-
* @return {!proto.ondewo.nlu.LoginResponse}
|
|
4820
|
-
*/
|
|
4821
|
-
proto.ondewo.nlu.LoginResponse.deserializeBinaryFromReader = function(msg, reader) {
|
|
4822
|
-
while (reader.nextField()) {
|
|
4823
|
-
if (reader.isEndGroup()) {
|
|
4824
|
-
break;
|
|
4825
|
-
}
|
|
4826
|
-
var field = reader.getFieldNumber();
|
|
4827
|
-
switch (field) {
|
|
4828
|
-
case 1:
|
|
4829
|
-
var value = new proto.ondewo.nlu.User;
|
|
4830
|
-
reader.readMessage(value,proto.ondewo.nlu.User.deserializeBinaryFromReader);
|
|
4831
|
-
msg.setUser(value);
|
|
4832
|
-
break;
|
|
4833
|
-
case 2:
|
|
4834
|
-
var value = /** @type {string} */ (reader.readString());
|
|
4835
|
-
msg.setAuthToken(value);
|
|
4836
|
-
break;
|
|
4837
|
-
default:
|
|
4838
|
-
reader.skipField();
|
|
4839
|
-
break;
|
|
4840
|
-
}
|
|
4841
|
-
}
|
|
4842
|
-
return msg;
|
|
4843
|
-
};
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
/**
|
|
4847
|
-
* Serializes the message to binary data (in protobuf wire format).
|
|
4848
|
-
* @return {!Uint8Array}
|
|
4849
|
-
*/
|
|
4850
|
-
proto.ondewo.nlu.LoginResponse.prototype.serializeBinary = function() {
|
|
4851
|
-
var writer = new jspb.BinaryWriter();
|
|
4852
|
-
proto.ondewo.nlu.LoginResponse.serializeBinaryToWriter(this, writer);
|
|
4853
|
-
return writer.getResultBuffer();
|
|
4854
|
-
};
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
/**
|
|
4858
|
-
* Serializes the given message to binary data (in protobuf wire
|
|
4859
|
-
* format), writing to the given BinaryWriter.
|
|
4860
|
-
* @param {!proto.ondewo.nlu.LoginResponse} message
|
|
4861
|
-
* @param {!jspb.BinaryWriter} writer
|
|
4862
|
-
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
4863
|
-
*/
|
|
4864
|
-
proto.ondewo.nlu.LoginResponse.serializeBinaryToWriter = function(message, writer) {
|
|
4865
|
-
var f = undefined;
|
|
4866
|
-
f = message.getUser();
|
|
4867
|
-
if (f != null) {
|
|
4868
|
-
writer.writeMessage(
|
|
4869
|
-
1,
|
|
4870
|
-
f,
|
|
4871
|
-
proto.ondewo.nlu.User.serializeBinaryToWriter
|
|
4872
|
-
);
|
|
4873
|
-
}
|
|
4874
|
-
f = message.getAuthToken();
|
|
4875
|
-
if (f.length > 0) {
|
|
4876
|
-
writer.writeString(
|
|
4877
|
-
2,
|
|
4878
|
-
f
|
|
4879
|
-
);
|
|
4880
|
-
}
|
|
4881
|
-
};
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
/**
|
|
4885
|
-
* optional User user = 1;
|
|
4886
|
-
* @return {?proto.ondewo.nlu.User}
|
|
4887
|
-
*/
|
|
4888
|
-
proto.ondewo.nlu.LoginResponse.prototype.getUser = function() {
|
|
4889
|
-
return /** @type{?proto.ondewo.nlu.User} */ (
|
|
4890
|
-
jspb.Message.getWrapperField(this, proto.ondewo.nlu.User, 1));
|
|
4891
|
-
};
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
/**
|
|
4895
|
-
* @param {?proto.ondewo.nlu.User|undefined} value
|
|
4896
|
-
* @return {!proto.ondewo.nlu.LoginResponse} returns this
|
|
4897
|
-
*/
|
|
4898
|
-
proto.ondewo.nlu.LoginResponse.prototype.setUser = function(value) {
|
|
4899
|
-
return jspb.Message.setWrapperField(this, 1, value);
|
|
4900
|
-
};
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
/**
|
|
4904
|
-
* Clears the message field making it undefined.
|
|
4905
|
-
* @return {!proto.ondewo.nlu.LoginResponse} returns this
|
|
4906
|
-
*/
|
|
4907
|
-
proto.ondewo.nlu.LoginResponse.prototype.clearUser = function() {
|
|
4908
|
-
return this.setUser(undefined);
|
|
4909
|
-
};
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
/**
|
|
4913
|
-
* Returns whether this field is set.
|
|
4914
|
-
* @return {boolean}
|
|
4915
|
-
*/
|
|
4916
|
-
proto.ondewo.nlu.LoginResponse.prototype.hasUser = function() {
|
|
4917
|
-
return jspb.Message.getField(this, 1) != null;
|
|
4918
|
-
};
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
/**
|
|
4922
|
-
* optional string auth_token = 2;
|
|
4923
|
-
* @return {string}
|
|
4924
|
-
*/
|
|
4925
|
-
proto.ondewo.nlu.LoginResponse.prototype.getAuthToken = function() {
|
|
4926
|
-
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
|
4927
|
-
};
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
/**
|
|
4931
|
-
* @param {string} value
|
|
4932
|
-
* @return {!proto.ondewo.nlu.LoginResponse} returns this
|
|
4933
|
-
*/
|
|
4934
|
-
proto.ondewo.nlu.LoginResponse.prototype.setAuthToken = function(value) {
|
|
4935
|
-
return jspb.Message.setProto3StringField(this, 2, value);
|
|
4936
|
-
};
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
4504
|
/**
|
|
4941
4505
|
* List of repeated fields within this message type.
|
|
4942
4506
|
* @private {!Array<number>}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal structural type of the fetch Response fields this helper reads. Keeps the module
|
|
3
|
+
* self-contained (no DOM lib dependency) while still typing the injectable `fetchImpl`.
|
|
4
|
+
*/
|
|
5
|
+
export interface TokenFetchResponse {
|
|
6
|
+
/** Whether the HTTP status is in the 2xx success range. */
|
|
7
|
+
ok: boolean;
|
|
8
|
+
/** The numeric HTTP status code. */
|
|
9
|
+
status: number;
|
|
10
|
+
/**
|
|
11
|
+
* Read the full response body as text.
|
|
12
|
+
*
|
|
13
|
+
* @returns A promise resolving to the raw body string.
|
|
14
|
+
*/
|
|
15
|
+
text(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
/** Init object passed to the injectable fetch. */
|
|
18
|
+
export interface TokenFetchInit {
|
|
19
|
+
/** HTTP method (always `"POST"` for the token endpoint). */
|
|
20
|
+
method: string;
|
|
21
|
+
/** Request headers (content-type and accept). */
|
|
22
|
+
headers: Record<string, string>;
|
|
23
|
+
/** The form-encoded request body. */
|
|
24
|
+
body: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional undici dispatcher (Node only). The default transport attaches an insecure
|
|
27
|
+
* `Agent({ connect: { rejectUnauthorized: false } })` here when `verifySsl` is `false`; the global
|
|
28
|
+
* WHATWG fetch honours it. Never set on an injected `fetchImpl` and ignored in a browser bundle.
|
|
29
|
+
*/
|
|
30
|
+
dispatcher?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Injectable fetch signature (a subset of the global `fetch`) used by the token endpoint call.
|
|
34
|
+
*
|
|
35
|
+
* @param url - The token endpoint URL to POST to.
|
|
36
|
+
* @param init - The request init (method, headers, body).
|
|
37
|
+
* @returns A promise resolving to the (structurally minimal) response.
|
|
38
|
+
*/
|
|
39
|
+
export type TokenFetch = (url: string, init: TokenFetchInit) => Promise<TokenFetchResponse>;
|
|
40
|
+
/** Options for the D18 headless-SDK offline-token login. */
|
|
41
|
+
export interface OfflineTokenLoginOptions {
|
|
42
|
+
/** Base Keycloak URL, e.g. "https://auth.example.com/auth" (trailing slash tolerated). */
|
|
43
|
+
keycloakUrl: string;
|
|
44
|
+
/** Realm name, e.g. "ondewo-ccai-platform". */
|
|
45
|
+
realm: string;
|
|
46
|
+
/** Public SDK client id, e.g. "ondewo-nlu-cai-sdk-public". NO client_secret (Q1). */
|
|
47
|
+
clientId: string;
|
|
48
|
+
/** 2FA-exempt technical-user email. */
|
|
49
|
+
username: string;
|
|
50
|
+
/** Technical-user password. */
|
|
51
|
+
password: string;
|
|
52
|
+
/** Optional cap (seconds) on how long the auto-refresh loop runs after login. */
|
|
53
|
+
tokenExpirationInS?: number;
|
|
54
|
+
/** Optional fetch override (tests inject a mock); defaults to the global fetch. */
|
|
55
|
+
fetchImpl?: TokenFetch;
|
|
56
|
+
/**
|
|
57
|
+
* Verify the Keycloak TLS certificate on the token-endpoint call. Default `true` (secure). Set
|
|
58
|
+
* `false` ONLY for a self-signed local Envoy (e.g. `https://localhost:12001/auth`). Node-only: it is
|
|
59
|
+
* ignored in a browser bundle (the browser owns TLS) and ignored when a custom `fetchImpl` is
|
|
60
|
+
* injected. When `false` under Node the default transport attaches an insecure undici dispatcher.
|
|
61
|
+
*/
|
|
62
|
+
keycloakVerifySsl?: boolean;
|
|
63
|
+
/** Optional clock override returning epoch ms (tests); defaults to Date.now. */
|
|
64
|
+
nowInMs?: () => number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Error raised on any token-endpoint or token-shape failure.
|
|
68
|
+
*
|
|
69
|
+
* Name contract: every instance carries `name === "TokenError"` (set in the constructor, because
|
|
70
|
+
* subclassing `Error` does not propagate the subclass name). Callers may therefore discriminate on
|
|
71
|
+
* `error.name` as well as on `instanceof TokenError` -- the latter being unreliable across bundles.
|
|
72
|
+
*/
|
|
73
|
+
export declare class TokenError extends Error {
|
|
74
|
+
/**
|
|
75
|
+
* Construct a token error and pin its `name` to `"TokenError"`.
|
|
76
|
+
*
|
|
77
|
+
* @param message - Human-readable description of the token failure.
|
|
78
|
+
*/
|
|
79
|
+
constructor(message: string);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build the DEFAULT token transport (used only when no `fetchImpl` is injected). It delegates to the
|
|
83
|
+
* global WHATWG fetch, and -- when `verifySsl` is `false` under Node -- attaches an insecure undici
|
|
84
|
+
* dispatcher to the request init so the token POST skips certificate verification. With `verifySsl`
|
|
85
|
+
* `true` (the default) it is a plain pass-through to `globalThis.fetch`, i.e. unchanged behavior.
|
|
86
|
+
*
|
|
87
|
+
* @param verifySsl - Whether to verify the Keycloak TLS certificate; `false` opts into the insecure path.
|
|
88
|
+
* @returns A {@link TokenFetch} that resolves the global fetch at call time (honoring test overrides).
|
|
89
|
+
*/
|
|
90
|
+
export declare function createDefaultTokenFetch(verifySsl: boolean): TokenFetch;
|
|
91
|
+
/**
|
|
92
|
+
* A live access-token holder backed by a bounded auto-refresh loop. Obtain one from {@link login};
|
|
93
|
+
* read {@link getAuthorizationHeader} for the gRPC `Authorization` metadata and call {@link stop} when done.
|
|
94
|
+
*/
|
|
95
|
+
export declare class OfflineTokenProvider {
|
|
96
|
+
/** The realm token endpoint derived from `keycloakUrl` + `realm`. */
|
|
97
|
+
private readonly tokenEndpoint;
|
|
98
|
+
/** The public SDK client id sent on every grant. */
|
|
99
|
+
private readonly clientId;
|
|
100
|
+
/** Optional cap (seconds) on how long the refresh loop runs after login; `undefined` = unbounded. */
|
|
101
|
+
private readonly tokenExpirationInS;
|
|
102
|
+
/** The fetch transport (real global fetch or an injected mock). */
|
|
103
|
+
private readonly fetchImpl;
|
|
104
|
+
/** Epoch-ms clock (injectable for deterministic tests; defaults to `Date.now`). */
|
|
105
|
+
private readonly nowInMs;
|
|
106
|
+
/**
|
|
107
|
+
* The current access token, or `null` until {@link bootstrap} has completed. It is NEVER reset to
|
|
108
|
+
* `null` afterwards: neither {@link stop} nor the bounded deadline clears it.
|
|
109
|
+
*/
|
|
110
|
+
private accessToken;
|
|
111
|
+
/** The current offline refresh token, or `null` before bootstrap. */
|
|
112
|
+
private refreshToken;
|
|
113
|
+
/** The pending refresh timer handle, or `null` when no refresh is armed. */
|
|
114
|
+
private timer;
|
|
115
|
+
/** Whether {@link stop} has been called; suppresses further refresh scheduling. */
|
|
116
|
+
private stopped;
|
|
117
|
+
/** Epoch-ms instant past which the loop stops renewing, or `null` when unbounded. */
|
|
118
|
+
private deadlineInMs;
|
|
119
|
+
/** Optional callback invoked with the error of a failed background refresh. */
|
|
120
|
+
private onRefreshErrorHandler;
|
|
121
|
+
/**
|
|
122
|
+
* Construct an (un-bootstrapped) provider from login options. Call {@link bootstrap} (or use the
|
|
123
|
+
* module-level {@link login}) before reading a token.
|
|
124
|
+
*
|
|
125
|
+
* @param options - The D18 headless-SDK offline-token login options.
|
|
126
|
+
*/
|
|
127
|
+
constructor(options: OfflineTokenLoginOptions);
|
|
128
|
+
/**
|
|
129
|
+
* Perform the one-time ROPC login and arm the first refresh. Awaited by {@link login}.
|
|
130
|
+
*
|
|
131
|
+
* @param username - The 2FA-exempt technical-user email.
|
|
132
|
+
* @param password - The technical-user password.
|
|
133
|
+
* @returns A promise that resolves once the initial token is held and the first refresh is armed.
|
|
134
|
+
* @throws {TokenError} When the token endpoint fails or the response carries no refresh token.
|
|
135
|
+
*/
|
|
136
|
+
bootstrap(username: string, password: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Exchange the offline refresh token for a fresh access token and re-arm the next refresh.
|
|
139
|
+
*
|
|
140
|
+
* @returns A promise that resolves once the token is refreshed (or the loop has stopped).
|
|
141
|
+
* @throws {TokenError} When the refresh token-endpoint call fails or returns an invalid body.
|
|
142
|
+
*/
|
|
143
|
+
private refresh;
|
|
144
|
+
/**
|
|
145
|
+
* Arm a single timer for the next refresh, clamped to the bounded deadline. Stops silently once
|
|
146
|
+
* `tokenExpirationInS` has elapsed (no further renewal -> access lapses -> re-login required).
|
|
147
|
+
*
|
|
148
|
+
* @param expiresInRaw - The `expires_in` (seconds) reported by Keycloak; absent/non-positive
|
|
149
|
+
* values fall back to {@link MIN_REFRESH_DELAY_IN_S}.
|
|
150
|
+
*/
|
|
151
|
+
private scheduleRefresh;
|
|
152
|
+
/**
|
|
153
|
+
* Register a callback invoked with the error of a failed background refresh (optional diagnostics).
|
|
154
|
+
*
|
|
155
|
+
* @param handler - The callback to receive the refresh error; replaces any previously registered one.
|
|
156
|
+
*/
|
|
157
|
+
onRefreshError(handler: (error: unknown) => void): void;
|
|
158
|
+
/**
|
|
159
|
+
* Read the current access token.
|
|
160
|
+
*
|
|
161
|
+
* Once {@link bootstrap} has succeeded this never returns `null` again: when the bounded refresh
|
|
162
|
+
* loop lapses (or {@link stop} is called) the LAST fetched token keeps being returned even though
|
|
163
|
+
* it is by then expiring/expired. Callers must treat an `UNAUTHENTICATED` gRPC response -- not a
|
|
164
|
+
* `null` here -- as the signal to re-login.
|
|
165
|
+
*
|
|
166
|
+
* @returns The current access token, or `null` before {@link bootstrap} has completed.
|
|
167
|
+
*/
|
|
168
|
+
getAccessToken(): string | null;
|
|
169
|
+
/**
|
|
170
|
+
* Build the value for an `Authorization` gRPC metadata header.
|
|
171
|
+
*
|
|
172
|
+
* @returns The `Bearer <access_token>` header value.
|
|
173
|
+
* @throws {TokenError} When no access token has been fetched yet, i.e. {@link bootstrap} /
|
|
174
|
+
* {@link login} has not completed. It does NOT throw once the refresh loop has lapsed -- see
|
|
175
|
+
* {@link getAccessToken}.
|
|
176
|
+
*/
|
|
177
|
+
getAuthorizationHeader(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Stop the auto-refresh loop. Idempotent; safe to call from any state. It disarms the pending timer
|
|
180
|
+
* and suppresses further scheduling, but deliberately KEEPS the last access token readable through
|
|
181
|
+
* {@link getAccessToken} / {@link getAuthorizationHeader}.
|
|
182
|
+
*/
|
|
183
|
+
stop(): void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* One-time ROPC + offline_access login against the PUBLIC SDK client, returning a live token provider
|
|
187
|
+
* whose access token is auto-refreshed in the background until `tokenExpirationInS` elapses.
|
|
188
|
+
*
|
|
189
|
+
* @param options - The headless-SDK login options (`keycloakUrl`, `realm`, `clientId`, `username`,
|
|
190
|
+
* `password` are required; `tokenExpirationInS`, `fetchImpl`, `nowInMs` are optional).
|
|
191
|
+
* @returns A bootstrapped {@link OfflineTokenProvider} holding a live access token.
|
|
192
|
+
* @throws {TokenError} When required options are missing/empty, the token endpoint fails, or the
|
|
193
|
+
* response lacks an access or refresh token.
|
|
194
|
+
*/
|
|
195
|
+
export declare function login(options: OfflineTokenLoginOptions): Promise<OfflineTokenProvider>;
|