@ondewo/nlu-client-typescript 6.14.0 → 7.0.1

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.
@@ -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>}
@@ -63,10 +63,16 @@ export interface OfflineTokenLoginOptions {
63
63
  /** Optional clock override returning epoch ms (tests); defaults to Date.now. */
64
64
  nowInMs?: () => number;
65
65
  }
66
- /** Error raised on any token-endpoint or token-shape failure. */
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
+ */
67
73
  export declare class TokenError extends Error {
68
74
  /**
69
- * Construct a token error.
75
+ * Construct a token error and pin its `name` to `"TokenError"`.
70
76
  *
71
77
  * @param message - Human-readable description of the token failure.
72
78
  */
@@ -97,7 +103,10 @@ export declare class OfflineTokenProvider {
97
103
  private readonly fetchImpl;
98
104
  /** Epoch-ms clock (injectable for deterministic tests; defaults to `Date.now`). */
99
105
  private readonly nowInMs;
100
- /** The current access token, or `null` before bootstrap / after the loop has lapsed. */
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
+ */
101
110
  private accessToken;
102
111
  /** The current offline refresh token, or `null` before bootstrap. */
103
112
  private refreshToken;
@@ -149,17 +158,28 @@ export declare class OfflineTokenProvider {
149
158
  /**
150
159
  * Read the current access token.
151
160
  *
152
- * @returns The current access token, or `null` before bootstrap / after the bounded loop has lapsed.
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.
153
167
  */
154
168
  getAccessToken(): string | null;
155
169
  /**
156
170
  * Build the value for an `Authorization` gRPC metadata header.
157
171
  *
158
172
  * @returns The `Bearer <access_token>` header value.
159
- * @throws {TokenError} When no access token is available (login not completed or already lapsed).
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}.
160
176
  */
161
177
  getAuthorizationHeader(): string;
162
- /** Stop the auto-refresh loop. Idempotent; safe to call from any state. */
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
+ */
163
183
  stop(): void;
164
184
  }
165
185
  /**