clarifai-web-grpc 2.0.0 → 3.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.
Files changed (73) hide show
  1. package/.github/workflows/ci.yml +6 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.mocharc.yml +5 -0
  4. package/CHANGELOG.md +5 -7
  5. package/dist/cjs/google/api/annotations_pb.d.ts +1 -0
  6. package/dist/cjs/google/api/annotations_pb.js +32 -0
  7. package/dist/cjs/google/api/http_pb.d.ts +1 -0
  8. package/dist/cjs/google/api/http_pb.js +813 -0
  9. package/dist/cjs/index.d.ts +7 -0
  10. package/dist/cjs/index.js +15 -0
  11. package/dist/cjs/proto/clarifai/api/resources_pb.d.ts +1 -0
  12. package/dist/cjs/proto/clarifai/api/resources_pb.js +32957 -0
  13. package/dist/cjs/proto/clarifai/api/serviceServiceClientPb.d.ts +275 -0
  14. package/dist/cjs/proto/clarifai/api/serviceServiceClientPb.js +908 -0
  15. package/dist/cjs/proto/clarifai/api/service_pb.d.ts +1 -0
  16. package/dist/cjs/proto/clarifai/api/service_pb.js +38791 -0
  17. package/dist/cjs/proto/clarifai/api/status/status_code_pb.d.ts +1 -0
  18. package/dist/cjs/proto/clarifai/api/status/status_code_pb.js +312 -0
  19. package/dist/cjs/proto/clarifai/api/status/status_pb.d.ts +1 -0
  20. package/dist/cjs/proto/clarifai/api/status/status_pb.js +473 -0
  21. package/dist/cjs/proto/clarifai/api/utils/extensions_pb.d.ts +1 -0
  22. package/dist/cjs/proto/clarifai/api/utils/extensions_pb.js +52 -0
  23. package/dist/cjs/proto/clarifai/api/utils/test_proto_pb.d.ts +1 -0
  24. package/dist/cjs/proto/clarifai/api/utils/test_proto_pb.js +521 -0
  25. package/dist/cjs/proto/clarifai/auth/scope/scope_pb.d.ts +1 -0
  26. package/dist/cjs/proto/clarifai/auth/scope/scope_pb.js +294 -0
  27. package/dist/cjs/proto/clarifai/auth/types/types_pb.d.ts +1 -0
  28. package/dist/cjs/proto/clarifai/auth/types/types_pb.js +26 -0
  29. package/dist/cjs/proto/clarifai/auth/util/extension_pb.d.ts +1 -0
  30. package/dist/cjs/proto/clarifai/auth/util/extension_pb.js +80 -0
  31. package/dist/cjs/resources.d.ts +1 -0
  32. package/dist/cjs/resources.js +13 -0
  33. package/dist/cjs/service.d.ts +1 -0
  34. package/dist/cjs/service.js +13 -0
  35. package/dist/esm/google/api/annotations_pb.d.ts +1 -0
  36. package/dist/esm/google/api/annotations_pb.js +32 -0
  37. package/dist/esm/google/api/http_pb.d.ts +1 -0
  38. package/dist/esm/google/api/http_pb.js +813 -0
  39. package/dist/esm/index.d.ts +7 -0
  40. package/dist/esm/index.js +9 -0
  41. package/dist/esm/proto/clarifai/api/resources_pb.d.ts +1 -0
  42. package/dist/esm/proto/clarifai/api/resources_pb.js +32957 -0
  43. package/dist/esm/proto/clarifai/api/serviceServiceClientPb.d.ts +275 -0
  44. package/dist/esm/proto/clarifai/api/serviceServiceClientPb.js +904 -0
  45. package/dist/esm/proto/clarifai/api/service_pb.d.ts +1 -0
  46. package/dist/esm/proto/clarifai/api/service_pb.js +38791 -0
  47. package/dist/esm/proto/clarifai/api/status/status_code_pb.d.ts +1 -0
  48. package/dist/esm/proto/clarifai/api/status/status_code_pb.js +312 -0
  49. package/dist/esm/proto/clarifai/api/status/status_pb.d.ts +1 -0
  50. package/dist/esm/proto/clarifai/api/status/status_pb.js +473 -0
  51. package/dist/esm/proto/clarifai/api/utils/extensions_pb.d.ts +1 -0
  52. package/dist/esm/proto/clarifai/api/utils/extensions_pb.js +52 -0
  53. package/dist/esm/proto/clarifai/api/utils/test_proto_pb.d.ts +1 -0
  54. package/dist/esm/proto/clarifai/api/utils/test_proto_pb.js +521 -0
  55. package/dist/esm/proto/clarifai/auth/scope/scope_pb.d.ts +1 -0
  56. package/dist/esm/proto/clarifai/auth/scope/scope_pb.js +294 -0
  57. package/dist/esm/proto/clarifai/auth/types/types_pb.d.ts +1 -0
  58. package/dist/esm/proto/clarifai/auth/types/types_pb.js +26 -0
  59. package/dist/esm/proto/clarifai/auth/util/extension_pb.d.ts +1 -0
  60. package/dist/esm/proto/clarifai/auth/util/extension_pb.js +80 -0
  61. package/dist/esm/resources.d.ts +1 -0
  62. package/dist/esm/resources.js +1 -0
  63. package/dist/esm/service.d.ts +1 -0
  64. package/dist/esm/service.js +1 -0
  65. package/index.ts +11 -0
  66. package/package.json +13 -11
  67. package/resources.ts +1 -0
  68. package/service.ts +1 -0
  69. package/tests/basic.test.ts +41 -0
  70. package/tests/package.test.ts +0 -0
  71. package/tsconfig.cjs.json +7 -0
  72. package/tsconfig.json +25 -0
  73. package/.eslintrc.yml +0 -12
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ // source: proto/clarifai/auth/scope/scope.proto
3
+ /**
4
+ * @fileoverview
5
+ * @enhanceable
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ var jspb = require('google-protobuf');
12
+ var goog = jspb;
13
+ var global = Function('return this')();
14
+ var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js');
15
+ goog.object.extend(proto, google_protobuf_descriptor_pb);
16
+ goog.exportSymbol('proto.clarifai.auth.scope.S', null, global);
17
+ goog.exportSymbol('proto.clarifai.auth.scope.ScopeList', null, global);
18
+ goog.exportSymbol('proto.clarifai.auth.scope.clarfaiExposed', null, global);
19
+ goog.exportSymbol('proto.clarifai.auth.scope.clarifaiDependingScopesList', null, global);
20
+ /**
21
+ * Generated by JsPbCodeGenerator.
22
+ * @param {Array=} opt_data Optional initial data array, typically from a
23
+ * server response, or constructed directly in Javascript. The array is used
24
+ * in place and becomes part of the constructed object. It is not cloned.
25
+ * If no data is provided, the constructed object will be empty, but still
26
+ * valid.
27
+ * @extends {jspb.Message}
28
+ * @constructor
29
+ */
30
+ proto.clarifai.auth.scope.ScopeList = function (opt_data) {
31
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.clarifai.auth.scope.ScopeList.repeatedFields_, null);
32
+ };
33
+ goog.inherits(proto.clarifai.auth.scope.ScopeList, jspb.Message);
34
+ if (goog.DEBUG && !COMPILED) {
35
+ /**
36
+ * @public
37
+ * @override
38
+ */
39
+ proto.clarifai.auth.scope.ScopeList.displayName = 'proto.clarifai.auth.scope.ScopeList';
40
+ }
41
+ /**
42
+ * List of repeated fields within this message type.
43
+ * @private {!Array<number>}
44
+ * @const
45
+ */
46
+ proto.clarifai.auth.scope.ScopeList.repeatedFields_ = [1, 2];
47
+ if (jspb.Message.GENERATE_TO_OBJECT) {
48
+ /**
49
+ * Creates an object representation of this proto.
50
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
51
+ * Optional fields that are not set will be set to undefined.
52
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
53
+ * For the list of reserved names please see:
54
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
55
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
56
+ * JSPB instance for transitional soy proto support:
57
+ * http://goto/soy-param-migration
58
+ * @return {!Object}
59
+ */
60
+ proto.clarifai.auth.scope.ScopeList.prototype.toObject = function (opt_includeInstance) {
61
+ return proto.clarifai.auth.scope.ScopeList.toObject(opt_includeInstance, this);
62
+ };
63
+ /**
64
+ * Static version of the {@see toObject} method.
65
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
66
+ * the JSPB instance for transitional soy proto support:
67
+ * http://goto/soy-param-migration
68
+ * @param {!proto.clarifai.auth.scope.ScopeList} msg The msg instance to transform.
69
+ * @return {!Object}
70
+ * @suppress {unusedLocalVariables} f is only used for nested messages
71
+ */
72
+ proto.clarifai.auth.scope.ScopeList.toObject = function (includeInstance, msg) {
73
+ var f, obj = {
74
+ scopesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
75
+ endpointsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f
76
+ };
77
+ if (includeInstance) {
78
+ obj.$jspbMessageInstance = msg;
79
+ }
80
+ return obj;
81
+ };
82
+ }
83
+ /**
84
+ * Deserializes binary data (in protobuf wire format).
85
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
86
+ * @return {!proto.clarifai.auth.scope.ScopeList}
87
+ */
88
+ proto.clarifai.auth.scope.ScopeList.deserializeBinary = function (bytes) {
89
+ var reader = new jspb.BinaryReader(bytes);
90
+ var msg = new proto.clarifai.auth.scope.ScopeList;
91
+ return proto.clarifai.auth.scope.ScopeList.deserializeBinaryFromReader(msg, reader);
92
+ };
93
+ /**
94
+ * Deserializes binary data (in protobuf wire format) from the
95
+ * given reader into the given message object.
96
+ * @param {!proto.clarifai.auth.scope.ScopeList} msg The message object to deserialize into.
97
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
98
+ * @return {!proto.clarifai.auth.scope.ScopeList}
99
+ */
100
+ proto.clarifai.auth.scope.ScopeList.deserializeBinaryFromReader = function (msg, reader) {
101
+ while (reader.nextField()) {
102
+ if (reader.isEndGroup()) {
103
+ break;
104
+ }
105
+ var field = reader.getFieldNumber();
106
+ switch (field) {
107
+ case 1:
108
+ var value = /** @type {!Array<!proto.clarifai.auth.scope.S>} */ (reader.readPackedEnum());
109
+ msg.setScopesList(value);
110
+ break;
111
+ case 2:
112
+ var value = /** @type {string} */ (reader.readString());
113
+ msg.addEndpoints(value);
114
+ break;
115
+ default:
116
+ reader.skipField();
117
+ break;
118
+ }
119
+ }
120
+ return msg;
121
+ };
122
+ /**
123
+ * Serializes the message to binary data (in protobuf wire format).
124
+ * @return {!Uint8Array}
125
+ */
126
+ proto.clarifai.auth.scope.ScopeList.prototype.serializeBinary = function () {
127
+ var writer = new jspb.BinaryWriter();
128
+ proto.clarifai.auth.scope.ScopeList.serializeBinaryToWriter(this, writer);
129
+ return writer.getResultBuffer();
130
+ };
131
+ /**
132
+ * Serializes the given message to binary data (in protobuf wire
133
+ * format), writing to the given BinaryWriter.
134
+ * @param {!proto.clarifai.auth.scope.ScopeList} message
135
+ * @param {!jspb.BinaryWriter} writer
136
+ * @suppress {unusedLocalVariables} f is only used for nested messages
137
+ */
138
+ proto.clarifai.auth.scope.ScopeList.serializeBinaryToWriter = function (message, writer) {
139
+ var f = undefined;
140
+ f = message.getScopesList();
141
+ if (f.length > 0) {
142
+ writer.writePackedEnum(1, f);
143
+ }
144
+ f = message.getEndpointsList();
145
+ if (f.length > 0) {
146
+ writer.writeRepeatedString(2, f);
147
+ }
148
+ };
149
+ /**
150
+ * repeated S scopes = 1;
151
+ * @return {!Array<!proto.clarifai.auth.scope.S>}
152
+ */
153
+ proto.clarifai.auth.scope.ScopeList.prototype.getScopesList = function () {
154
+ return /** @type {!Array<!proto.clarifai.auth.scope.S>} */ (jspb.Message.getRepeatedField(this, 1));
155
+ };
156
+ /**
157
+ * @param {!Array<!proto.clarifai.auth.scope.S>} value
158
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
159
+ */
160
+ proto.clarifai.auth.scope.ScopeList.prototype.setScopesList = function (value) {
161
+ return jspb.Message.setField(this, 1, value || []);
162
+ };
163
+ /**
164
+ * @param {!proto.clarifai.auth.scope.S} value
165
+ * @param {number=} opt_index
166
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
167
+ */
168
+ proto.clarifai.auth.scope.ScopeList.prototype.addScopes = function (value, opt_index) {
169
+ return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
170
+ };
171
+ /**
172
+ * Clears the list making it empty but non-null.
173
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
174
+ */
175
+ proto.clarifai.auth.scope.ScopeList.prototype.clearScopesList = function () {
176
+ return this.setScopesList([]);
177
+ };
178
+ /**
179
+ * repeated string endpoints = 2;
180
+ * @return {!Array<string>}
181
+ */
182
+ proto.clarifai.auth.scope.ScopeList.prototype.getEndpointsList = function () {
183
+ return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2));
184
+ };
185
+ /**
186
+ * @param {!Array<string>} value
187
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
188
+ */
189
+ proto.clarifai.auth.scope.ScopeList.prototype.setEndpointsList = function (value) {
190
+ return jspb.Message.setField(this, 2, value || []);
191
+ };
192
+ /**
193
+ * @param {string} value
194
+ * @param {number=} opt_index
195
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
196
+ */
197
+ proto.clarifai.auth.scope.ScopeList.prototype.addEndpoints = function (value, opt_index) {
198
+ return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
199
+ };
200
+ /**
201
+ * Clears the list making it empty but non-null.
202
+ * @return {!proto.clarifai.auth.scope.ScopeList} returns this
203
+ */
204
+ proto.clarifai.auth.scope.ScopeList.prototype.clearEndpointsList = function () {
205
+ return this.setEndpointsList([]);
206
+ };
207
+ /**
208
+ * @enum {number}
209
+ */
210
+ proto.clarifai.auth.scope.S = {
211
+ UNDEF: 0,
212
+ ALL: 1,
213
+ PREDICT: 2,
214
+ SEARCH: 3,
215
+ INPUTS_ADD: 4,
216
+ INPUTS_GET: 5,
217
+ INPUTS_PATCH: 7,
218
+ INPUTS_DELETE: 8,
219
+ OUTPUTS_PATCH: 9,
220
+ CONCEPTS_ADD: 10,
221
+ CONCEPTS_GET: 11,
222
+ CONCEPTS_PATCH: 12,
223
+ CONCEPTS_DELETE: 13,
224
+ MODELS_ADD: 14,
225
+ MODELS_GET: 15,
226
+ MODELS_PATCH: 16,
227
+ MODELS_DELETE: 17,
228
+ MODELS_TRAIN: 26,
229
+ MODELS_SYNC: 27,
230
+ WORKFLOWS_ADD: 18,
231
+ WORKFLOWS_GET: 19,
232
+ WORKFLOWS_PATCH: 20,
233
+ WORKFLOWS_DELETE: 21,
234
+ WORKFLOWMETRICS_GET: 96,
235
+ WORKFLOWMETRICS_ADD: 97,
236
+ WORKFLOWMETRICS_DELETE: 98,
237
+ TSNEVISUALIZATIONS_ADD: 24,
238
+ TSNEVISUALIZATIONS_GET: 25,
239
+ ANNOTATIONS_ADD: 37,
240
+ ANNOTATIONS_GET: 38,
241
+ ANNOTATIONS_PATCH: 39,
242
+ ANNOTATIONS_DELETE: 40,
243
+ COLLECTORS_ADD: 41,
244
+ COLLECTORS_GET: 42,
245
+ COLLECTORS_DELETE: 43,
246
+ APPS_ADD: 44,
247
+ APPS_GET: 45,
248
+ APPS_DELETE: 46,
249
+ KEYS_ADD: 47,
250
+ KEYS_GET: 48,
251
+ KEYS_DELETE: 49,
252
+ COLLABORATORS_ADD: 51,
253
+ COLLABORATORS_GET: 50,
254
+ COLLABORATORS_DELETE: 52,
255
+ METRICS_ADD: 54,
256
+ METRICS_GET: 53,
257
+ METRICS_DELETE: 63,
258
+ TASKS_ADD: 55,
259
+ TASKS_GET: 56,
260
+ TASKS_DELETE: 70,
261
+ PASSWORDPOLICIES_ADD: 57,
262
+ PASSWORDPOLICIES_GET: 58,
263
+ PASSWORDPOLICIES_DELETE: 59,
264
+ LABELORDERS_GET: 67,
265
+ LABELORDERS_ADD: 68,
266
+ LABELORDERS_DELETE: 69,
267
+ USERFEATURECONFIGS_GET: 71,
268
+ FINDDUPLICATEANNOTATIONSJOBS_ADD: 102,
269
+ FINDDUPLICATEANNOTATIONSJOBS_GET: 103,
270
+ FINDDUPLICATEANNOTATIONSJOBS_DELETE: 104
271
+ };
272
+ /**
273
+ * A tuple of {field number, class constructor} for the extension
274
+ * field named `clarfaiExposed`.
275
+ * @type {!jspb.ExtensionFieldInfo<boolean>}
276
+ */
277
+ proto.clarifai.auth.scope.clarfaiExposed = new jspb.ExtensionFieldInfo(80318, { clarfaiExposed: 0 }, null,
278
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 0);
279
+ google_protobuf_descriptor_pb.EnumValueOptions.extensionsBinary[80318] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.scope.clarfaiExposed, jspb.BinaryReader.prototype.readBool, jspb.BinaryWriter.prototype.writeBool, undefined, undefined, false);
280
+ // This registers the extension field with the extended class, so that
281
+ // toObject() will function correctly.
282
+ google_protobuf_descriptor_pb.EnumValueOptions.extensions[80318] = proto.clarifai.auth.scope.clarfaiExposed;
283
+ /**
284
+ * A tuple of {field number, class constructor} for the extension
285
+ * field named `clarifaiDependingScopesList`.
286
+ * @type {!jspb.ExtensionFieldInfo<!Array<!proto.clarifai.auth.scope.S>>}
287
+ */
288
+ proto.clarifai.auth.scope.clarifaiDependingScopesList = new jspb.ExtensionFieldInfo(80319, { clarifaiDependingScopesList: 0 }, null,
289
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 1);
290
+ google_protobuf_descriptor_pb.EnumValueOptions.extensionsBinary[80319] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.scope.clarifaiDependingScopesList, jspb.BinaryReader.prototype.readPackedEnum, jspb.BinaryWriter.prototype.writePackedEnum, undefined, undefined, true);
291
+ // This registers the extension field with the extended class, so that
292
+ // toObject() will function correctly.
293
+ google_protobuf_descriptor_pb.EnumValueOptions.extensions[80319] = proto.clarifai.auth.scope.clarifaiDependingScopesList;
294
+ goog.object.extend(exports, proto.clarifai.auth.scope);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // source: proto/clarifai/auth/types/types.proto
3
+ /**
4
+ * @fileoverview
5
+ * @enhanceable
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ var jspb = require('google-protobuf');
12
+ var goog = jspb;
13
+ var global = Function('return this')();
14
+ goog.exportSymbol('proto.clarifai.auth.types.AuthType', null, global);
15
+ /**
16
+ * @enum {number}
17
+ */
18
+ proto.clarifai.auth.types.AuthType = {
19
+ UNDEF: 0,
20
+ NOAUTH: 1,
21
+ KEYAUTH: 2,
22
+ SESSIONTOKENAUTH: 3,
23
+ ADMINAUTH: 4,
24
+ PATAUTH: 5
25
+ };
26
+ goog.object.extend(exports, proto.clarifai.auth.types);
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ // source: proto/clarifai/auth/util/extension.proto
3
+ /**
4
+ * @fileoverview
5
+ * @enhanceable
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ var jspb = require('google-protobuf');
12
+ var goog = jspb;
13
+ var global = Function('return this')();
14
+ var proto_clarifai_auth_scope_scope_pb = require('../../../../proto/clarifai/auth/scope/scope_pb.js');
15
+ goog.object.extend(proto, proto_clarifai_auth_scope_scope_pb);
16
+ var proto_clarifai_auth_types_types_pb = require('../../../../proto/clarifai/auth/types/types_pb.js');
17
+ goog.object.extend(proto, proto_clarifai_auth_types_types_pb);
18
+ var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js');
19
+ goog.object.extend(proto, google_protobuf_descriptor_pb);
20
+ goog.exportSymbol('proto.clarifai.auth.util.clAuthType', null, global);
21
+ goog.exportSymbol('proto.clarifai.auth.util.clDependingScopesList', null, global);
22
+ goog.exportSymbol('proto.clarifai.auth.util.clPrivateField', null, global);
23
+ goog.exportSymbol('proto.clarifai.auth.util.clPrivateMessage', null, global);
24
+ goog.exportSymbol('proto.clarifai.auth.util.clPrivateRpc', null, global);
25
+ /**
26
+ * A tuple of {field number, class constructor} for the extension
27
+ * field named `clPrivateField`.
28
+ * @type {!jspb.ExtensionFieldInfo<boolean>}
29
+ */
30
+ proto.clarifai.auth.util.clPrivateField = new jspb.ExtensionFieldInfo(80320, { clPrivateField: 0 }, null,
31
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 0);
32
+ google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[80320] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.util.clPrivateField, jspb.BinaryReader.prototype.readBool, jspb.BinaryWriter.prototype.writeBool, undefined, undefined, false);
33
+ // This registers the extension field with the extended class, so that
34
+ // toObject() will function correctly.
35
+ google_protobuf_descriptor_pb.FieldOptions.extensions[80320] = proto.clarifai.auth.util.clPrivateField;
36
+ /**
37
+ * A tuple of {field number, class constructor} for the extension
38
+ * field named `clPrivateRpc`.
39
+ * @type {!jspb.ExtensionFieldInfo<boolean>}
40
+ */
41
+ proto.clarifai.auth.util.clPrivateRpc = new jspb.ExtensionFieldInfo(80321, { clPrivateRpc: 0 }, null,
42
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 0);
43
+ google_protobuf_descriptor_pb.MethodOptions.extensionsBinary[80321] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.util.clPrivateRpc, jspb.BinaryReader.prototype.readBool, jspb.BinaryWriter.prototype.writeBool, undefined, undefined, false);
44
+ // This registers the extension field with the extended class, so that
45
+ // toObject() will function correctly.
46
+ google_protobuf_descriptor_pb.MethodOptions.extensions[80321] = proto.clarifai.auth.util.clPrivateRpc;
47
+ /**
48
+ * A tuple of {field number, class constructor} for the extension
49
+ * field named `clDependingScopesList`.
50
+ * @type {!jspb.ExtensionFieldInfo<!Array<!proto.clarifai.auth.scope.S>>}
51
+ */
52
+ proto.clarifai.auth.util.clDependingScopesList = new jspb.ExtensionFieldInfo(80322, { clDependingScopesList: 0 }, null,
53
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 1);
54
+ google_protobuf_descriptor_pb.MethodOptions.extensionsBinary[80322] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.util.clDependingScopesList, jspb.BinaryReader.prototype.readPackedEnum, jspb.BinaryWriter.prototype.writePackedEnum, undefined, undefined, true);
55
+ // This registers the extension field with the extended class, so that
56
+ // toObject() will function correctly.
57
+ google_protobuf_descriptor_pb.MethodOptions.extensions[80322] = proto.clarifai.auth.util.clDependingScopesList;
58
+ /**
59
+ * A tuple of {field number, class constructor} for the extension
60
+ * field named `clAuthType`.
61
+ * @type {!jspb.ExtensionFieldInfo<!proto.clarifai.auth.types.AuthType>}
62
+ */
63
+ proto.clarifai.auth.util.clAuthType = new jspb.ExtensionFieldInfo(80323, { clAuthType: 0 }, null,
64
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 0);
65
+ google_protobuf_descriptor_pb.MethodOptions.extensionsBinary[80323] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.util.clAuthType, jspb.BinaryReader.prototype.readEnum, jspb.BinaryWriter.prototype.writeEnum, undefined, undefined, false);
66
+ // This registers the extension field with the extended class, so that
67
+ // toObject() will function correctly.
68
+ google_protobuf_descriptor_pb.MethodOptions.extensions[80323] = proto.clarifai.auth.util.clAuthType;
69
+ /**
70
+ * A tuple of {field number, class constructor} for the extension
71
+ * field named `clPrivateMessage`.
72
+ * @type {!jspb.ExtensionFieldInfo<boolean>}
73
+ */
74
+ proto.clarifai.auth.util.clPrivateMessage = new jspb.ExtensionFieldInfo(80324, { clPrivateMessage: 0 }, null,
75
+ /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (null), 0);
76
+ google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[80324] = new jspb.ExtensionFieldBinaryInfo(proto.clarifai.auth.util.clPrivateMessage, jspb.BinaryReader.prototype.readBool, jspb.BinaryWriter.prototype.writeBool, undefined, undefined, false);
77
+ // This registers the extension field with the extended class, so that
78
+ // toObject() will function correctly.
79
+ google_protobuf_descriptor_pb.MessageOptions.extensions[80324] = proto.clarifai.auth.util.clPrivateMessage;
80
+ goog.object.extend(exports, proto.clarifai.auth.util);
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/resources_pb';
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/resources_pb';
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/service_pb';
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/service_pb';
package/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { V2Client } from './proto/clarifai/api/serviceServiceClientPb'
2
+
3
+ export class ClarifaiStub {
4
+ static grpc (hostname = 'api.clarifai.com') {
5
+ return new V2Client(hostname)
6
+ }
7
+ }
8
+
9
+ export { V2Client }
10
+ export { Error, Metadata, ClientReadableStream } from 'grpc-web'
11
+ export { BaseResponse } from './proto/clarifai/api/status/status_pb'
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "clarifai-web-grpc",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "The official Clarifai gRPC-web client",
5
- "type": "module",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
6
8
  "repository": "https://github.com/Clarifai/clarifai-web-grpc",
7
9
  "author": "Clarifai Inc.",
8
10
  "license": "Apache-2.0",
9
11
  "keywords": [],
10
12
  "scripts": {
13
+ "test": "mocha",
14
+ "lint": "standard index.ts resources.ts service.ts",
15
+ "clean": "rm -rf dist clarifai-web-grpc-*.tgz",
16
+ "build:cjs": "tsc -b tsconfig.cjs.json",
17
+ "build:esm": "tsc -b",
18
+ "build": "yarn build:esm && yarn build:cjs",
19
+ "prepack": "yarn clean && yarn build",
11
20
  "release": "semantic-release",
12
21
  "prepare": "husky install"
13
22
  },
14
23
  "dependencies": {
15
- "google-protobuf": "^3.19.4",
24
+ "google-protobuf": "~3.14.0",
16
25
  "grpc-web": "~1.0.5"
17
26
  },
18
27
  "devDependencies": {
@@ -20,17 +29,10 @@
20
29
  "@commitlint/config-conventional": "^16.0.0",
21
30
  "@semantic-release/changelog": "^6.0.1",
22
31
  "@types/chai": "^4.3.0",
23
- "@types/google-protobuf": "^3.15.5",
32
+ "@types/google-protobuf": "~3.7.0",
24
33
  "@types/mocha": "^9.0.0",
25
34
  "@types/node": "~10.17.0",
26
- "@typescript-eslint/eslint-plugin": "^5.10.1",
27
- "@typescript-eslint/parser": "^5.10.1",
28
35
  "chai": "^4.3.4",
29
- "eslint": "^7.32.0",
30
- "eslint-config-standard": "^16.0.3",
31
- "eslint-plugin-import": "^2.25.4",
32
- "eslint-plugin-node": "^11.1.0",
33
- "eslint-plugin-promise": "^5.2.0",
34
36
  "husky": "^7.0.4",
35
37
  "mocha": "^9.1.3",
36
38
  "semantic-release": "^18.0.1",
package/resources.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/resources_pb'
package/service.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './proto/clarifai/api/service_pb'
@@ -0,0 +1,41 @@
1
+ import { ClarifaiStub as StubSRC } from '../index'
2
+ import { ClarifaiStub as StubCJS } from '../dist/cjs/index'
3
+ import { ClarifaiStub as StubESM } from '../dist/esm/index'
4
+ import { describe, it } from 'mocha'
5
+ import { expect } from 'chai'
6
+
7
+ describe('Client Stub (src)', () => {
8
+ it('works', () => {
9
+ const client = StubSRC.grpc()
10
+ expect(client.hostname_).to.equal('api.clarifai.com')
11
+ })
12
+
13
+ it('allows custom hostname', () => {
14
+ const client = StubSRC.grpc('api-dev.clarifai.com')
15
+ expect(client.hostname_).to.equal('api-dev.clarifai.com')
16
+ })
17
+ })
18
+
19
+ describe('Client Stub (cjs)', () => {
20
+ it('works', () => {
21
+ const client = StubCJS.grpc()
22
+ expect(client.hostname_).to.equal('api.clarifai.com')
23
+ })
24
+
25
+ it('allows custom hostname', () => {
26
+ const client = StubCJS.grpc('api-dev.clarifai.com')
27
+ expect(client.hostname_).to.equal('api-dev.clarifai.com')
28
+ })
29
+ })
30
+
31
+ describe('Client Stub (esm)', () => {
32
+ it('works', () => {
33
+ const client = StubESM.grpc()
34
+ expect(client.hostname_).to.equal('api.clarifai.com')
35
+ })
36
+
37
+ it('allows custom hostname', () => {
38
+ const client = StubESM.grpc('api-dev.clarifai.com')
39
+ expect(client.hostname_).to.equal('api-dev.clarifai.com')
40
+ })
41
+ })
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "outDir": "./dist/cjs"
6
+ }
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "ESNext",
5
+ "strict": true,
6
+ "declaration": true,
7
+ "allowJs": true,
8
+ "outDir": "./dist/esm",
9
+ "moduleResolution": "node"
10
+ },
11
+ "include": [
12
+ "./index.ts",
13
+ "./resources.ts",
14
+ "./service.ts",
15
+ "proto/",
16
+ ],
17
+ "exclude": [
18
+ "node_modules"
19
+ ],
20
+ "ts-node": {
21
+ "compilerOptions": {
22
+ "module": "CommonJS"
23
+ }
24
+ }
25
+ }
package/.eslintrc.yml DELETED
@@ -1,12 +0,0 @@
1
- env:
2
- browser: true
3
- es2021: true
4
- extends:
5
- - standard
6
- parser: '@typescript-eslint/parser'
7
- parserOptions:
8
- ecmaVersion: 12
9
- sourceType: module
10
- plugins:
11
- - '@typescript-eslint'
12
- rules: {}