clarifai-web-grpc 10.2.1 → 10.3.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 +13 -11
- package/VERSION +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/proto/clarifai/api/resources_pb.js +2102 -4
- package/dist/cjs/proto/clarifai/api/service_grpc_web_pb.js +0 -42
- package/dist/cjs/proto/clarifai/api/service_pb.js +731 -416
- package/dist/cjs/proto/clarifai/api/status/status_code_pb.js +2 -0
- package/dist/cjs/proto/clarifai/auth/scope/scope_pb.js +2 -0
- package/dist/cjs/resources.d.ts +1 -0
- package/dist/cjs/resources.js +3 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +6 -2
- package/dist/esm/proto/clarifai/api/resources_pb.js +2102 -4
- package/dist/esm/proto/clarifai/api/service_grpc_web_pb.js +0 -42
- package/dist/esm/proto/clarifai/api/service_pb.js +731 -416
- package/dist/esm/proto/clarifai/api/status/status_code_pb.js +2 -0
- package/dist/esm/proto/clarifai/auth/scope/scope_pb.js +2 -0
- package/dist/esm/resources.d.ts +1 -0
- package/dist/esm/resources.js +1 -0
- package/examples/post-app.ts +27 -0
- package/examples/post-input.ts +42 -0
- package/index.ts +7 -2
- package/package.json +1 -1
- package/proto/clarifai/api/resources_pb.d.ts +347 -0
- package/proto/clarifai/api/resources_pb.js +2629 -4
- package/proto/clarifai/api/service_grpc_web_pb.d.ts +0 -12
- package/proto/clarifai/api/service_grpc_web_pb.js +0 -61
- package/proto/clarifai/api/service_pb.d.ts +106 -64
- package/proto/clarifai/api/service_pb.js +918 -510
- package/proto/clarifai/api/status/status_code_pb.d.ts +2 -0
- package/proto/clarifai/api/status/status_code_pb.js +2 -0
- package/proto/clarifai/auth/scope/scope_pb.d.ts +2 -0
- package/proto/clarifai/auth/scope/scope_pb.js +2 -0
- package/resources.ts +1 -0
package/README.md
CHANGED
|
@@ -17,32 +17,34 @@ import { ClarifaiStub } from "clarifai-web-grpc";
|
|
|
17
17
|
import { App } from "clarifai-web-grpc/proto/clarifai/api/resources_pb";
|
|
18
18
|
import { PostAppsRequest } from "clarifai-web-grpc/proto/clarifai/api/service_pb";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// get a client object
|
|
21
|
+
const client = ClarifaiStub.promise()
|
|
22
22
|
|
|
23
|
+
// create an app
|
|
23
24
|
const app = new App();
|
|
24
25
|
app.setId("cat-app");
|
|
25
26
|
app.setDefaultWorkflowId("General-Detection");
|
|
26
27
|
app.setDescription("An app for some cats");
|
|
27
28
|
|
|
29
|
+
// create a request
|
|
28
30
|
const req = new PostAppsRequest();
|
|
29
31
|
req.setAppsList([app]);
|
|
30
32
|
|
|
33
|
+
// send the request
|
|
31
34
|
const auth = {
|
|
32
|
-
"
|
|
35
|
+
"authorization": `Key ${process.env.CLARIFAI_TOKEN}`,
|
|
33
36
|
};
|
|
37
|
+
const resp = await client.postApps(req, auth);
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.error(err);
|
|
38
|
-
} else {
|
|
39
|
-
console.log(resp.getAppsList()[0].getId()); // logs "cat-app"
|
|
40
|
-
}
|
|
41
|
-
});
|
|
39
|
+
// log the app id
|
|
40
|
+
console.log(resp.getAppsList()[0].getId());
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
##
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
See the examples directory for more examples of how to use the clarifai API client
|
|
45
46
|
|
|
47
|
+
## Publishing to NPM
|
|
46
48
|
Publishing the client to NPM involves merging a PR with 2 things:
|
|
47
49
|
1. Updates the `version` field in `package.json` to the appropriate version.
|
|
48
50
|
2. Commit message should begin with `"GRPC clients version"` eg `"GRPC clients version 9.4.0"`.
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
10.
|
|
1
|
+
10.3.0
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { V2Client, V2PromiseClient } from './proto/clarifai/api/service_grpc_web_pb';
|
|
2
2
|
export declare class ClarifaiStub {
|
|
3
3
|
static grpc(hostname?: string): V2Client;
|
|
4
|
+
static promise(hostname?: string): V2PromiseClient;
|
|
4
5
|
}
|
|
5
6
|
export { V2Client, V2PromiseClient };
|
|
6
|
-
export { RpcError, Metadata, ClientReadableStream } from 'grpc-web';
|
|
7
|
+
export { RpcError, Metadata, ClientReadableStream, Request, UnaryResponse } from 'grpc-web';
|
|
7
8
|
export { BaseResponse } from './proto/clarifai/api/status/status_pb';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseResponse = exports.ClientReadableStream = exports.RpcError = exports.V2PromiseClient = exports.V2Client = exports.ClarifaiStub = void 0;
|
|
3
|
+
exports.BaseResponse = exports.UnaryResponse = exports.Request = exports.ClientReadableStream = exports.RpcError = exports.V2PromiseClient = exports.V2Client = exports.ClarifaiStub = void 0;
|
|
4
4
|
const service_grpc_web_pb_1 = require("./proto/clarifai/api/service_grpc_web_pb");
|
|
5
5
|
Object.defineProperty(exports, "V2Client", { enumerable: true, get: function () { return service_grpc_web_pb_1.V2Client; } });
|
|
6
6
|
Object.defineProperty(exports, "V2PromiseClient", { enumerable: true, get: function () { return service_grpc_web_pb_1.V2PromiseClient; } });
|
|
7
7
|
class ClarifaiStub {
|
|
8
|
-
static grpc(hostname = 'api.clarifai.com') {
|
|
8
|
+
static grpc(hostname = 'https://api-grpc-web.clarifai.com') {
|
|
9
9
|
const options = { 'grpc.max_receive_message_length': 128 * 1024 * 1024 }; // 128 MB
|
|
10
10
|
return new service_grpc_web_pb_1.V2Client(hostname, null, options);
|
|
11
11
|
}
|
|
12
|
+
static promise(hostname = 'https://api-grpc-web.clarifai.com') {
|
|
13
|
+
const options = { 'grpc.max_receive_message_length': 128 * 1024 * 1024 }; // 128 MB
|
|
14
|
+
return new service_grpc_web_pb_1.V2PromiseClient(hostname, null, options);
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
exports.ClarifaiStub = ClarifaiStub;
|
|
14
18
|
var grpc_web_1 = require("grpc-web");
|
|
15
19
|
Object.defineProperty(exports, "RpcError", { enumerable: true, get: function () { return grpc_web_1.RpcError; } });
|
|
16
20
|
Object.defineProperty(exports, "ClientReadableStream", { enumerable: true, get: function () { return grpc_web_1.ClientReadableStream; } });
|
|
21
|
+
Object.defineProperty(exports, "Request", { enumerable: true, get: function () { return grpc_web_1.Request; } });
|
|
22
|
+
Object.defineProperty(exports, "UnaryResponse", { enumerable: true, get: function () { return grpc_web_1.UnaryResponse; } });
|
|
17
23
|
var status_pb_1 = require("./proto/clarifai/api/status/status_pb");
|
|
18
24
|
Object.defineProperty(exports, "BaseResponse", { enumerable: true, get: function () { return status_pb_1.BaseResponse; } });
|