clarifai-web-grpc 1.0.4 → 1.1.2
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/.eslintrc.yml +12 -0
- package/CHANGELOG.md +2 -2
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +2 -6
- package/dist/cjs/resources.d.ts +11 -0
- package/dist/cjs/resources.js +34 -0
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.js +1 -3
- package/dist/esm/resources.d.ts +11 -0
- package/dist/esm/resources.js +10 -0
- package/package.json +24 -2
- package/tests/basic.test.ts +5 -5
- package/tests/helpers.test.ts +47 -0
- package/index.ts +0 -11
- package/resources.ts +0 -1
- package/service.ts +0 -1
- package/tests/package.test.ts +0 -0
package/.eslintrc.yml
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [1.
|
|
1
|
+
## [1.1.2](https://github.com/Clarifai/clarifai-web-grpc/compare/v1.1.1...v1.1.2) (2022-01-28)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* remove source files from packages, and properly map entrypoints ([f66bab3](https://github.com/Clarifai/clarifai-web-grpc/commit/f66bab30da9c998881d61c7fa6bfce23e1ffa454))
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.V2Client = exports.ClarifaiStub = void 0;
|
|
4
4
|
const serviceServiceClientPb_1 = require("./proto/clarifai/api/serviceServiceClientPb");
|
|
5
5
|
Object.defineProperty(exports, "V2Client", { enumerable: true, get: function () { return serviceServiceClientPb_1.V2Client; } });
|
|
6
6
|
class ClarifaiStub {
|
|
7
|
-
static grpc(hostname = 'api.clarifai.com') {
|
|
7
|
+
static grpc(hostname = 'api-grpc-web.clarifai.com') {
|
|
8
8
|
return new serviceServiceClientPb_1.V2Client(hostname);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.ClarifaiStub = ClarifaiStub;
|
|
12
|
-
var grpc_web_1 = require("grpc-web");
|
|
13
|
-
Object.defineProperty(exports, "ClientReadableStream", { enumerable: true, get: function () { return grpc_web_1.ClientReadableStream; } });
|
|
14
|
-
var status_pb_1 = require("./proto/clarifai/api/status/status_pb");
|
|
15
|
-
Object.defineProperty(exports, "BaseResponse", { enumerable: true, get: function () { return status_pb_1.BaseResponse; } });
|
package/dist/cjs/resources.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export * from './proto/clarifai/api/resources_pb';
|
|
2
|
+
export { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
3
|
+
export { Api } from 'google-protobuf/google/protobuf/api_pb';
|
|
4
|
+
export { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
|
5
|
+
export { Empty } from 'google-protobuf/google/protobuf/empty_pb';
|
|
6
|
+
export { Struct } from 'google-protobuf/google/protobuf/struct_pb';
|
|
7
|
+
export { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
8
|
+
export { Type, Field, Enum, EnumValue, Option } from 'google-protobuf/google/protobuf/type_pb';
|
|
9
|
+
export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
10
|
+
export type { Error, Metadata } from 'grpc-web';
|
|
11
|
+
export { Status, BaseResponse } from './proto/clarifai/api/status/status_pb';
|
|
12
|
+
export { StatusCode } from './proto/clarifai/api/status/status_code_pb';
|
package/dist/cjs/resources.js
CHANGED
|
@@ -10,4 +10,38 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.StatusCode = exports.BaseResponse = exports.Status = exports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = exports.Option = exports.EnumValue = exports.Enum = exports.Field = exports.Type = exports.Timestamp = exports.Struct = exports.Empty = exports.Duration = exports.Api = exports.Any = void 0;
|
|
13
14
|
__exportStar(require("./proto/clarifai/api/resources_pb"), exports);
|
|
15
|
+
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
16
|
+
Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return any_pb_1.Any; } });
|
|
17
|
+
var api_pb_1 = require("google-protobuf/google/protobuf/api_pb");
|
|
18
|
+
Object.defineProperty(exports, "Api", { enumerable: true, get: function () { return api_pb_1.Api; } });
|
|
19
|
+
var duration_pb_1 = require("google-protobuf/google/protobuf/duration_pb");
|
|
20
|
+
Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return duration_pb_1.Duration; } });
|
|
21
|
+
var empty_pb_1 = require("google-protobuf/google/protobuf/empty_pb");
|
|
22
|
+
Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return empty_pb_1.Empty; } });
|
|
23
|
+
var struct_pb_1 = require("google-protobuf/google/protobuf/struct_pb");
|
|
24
|
+
Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return struct_pb_1.Struct; } });
|
|
25
|
+
var timestamp_pb_1 = require("google-protobuf/google/protobuf/timestamp_pb");
|
|
26
|
+
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return timestamp_pb_1.Timestamp; } });
|
|
27
|
+
var type_pb_1 = require("google-protobuf/google/protobuf/type_pb");
|
|
28
|
+
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return type_pb_1.Type; } });
|
|
29
|
+
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return type_pb_1.Field; } });
|
|
30
|
+
Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return type_pb_1.Enum; } });
|
|
31
|
+
Object.defineProperty(exports, "EnumValue", { enumerable: true, get: function () { return type_pb_1.EnumValue; } });
|
|
32
|
+
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return type_pb_1.Option; } });
|
|
33
|
+
var wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
34
|
+
Object.defineProperty(exports, "DoubleValue", { enumerable: true, get: function () { return wrappers_pb_1.DoubleValue; } });
|
|
35
|
+
Object.defineProperty(exports, "FloatValue", { enumerable: true, get: function () { return wrappers_pb_1.FloatValue; } });
|
|
36
|
+
Object.defineProperty(exports, "Int64Value", { enumerable: true, get: function () { return wrappers_pb_1.Int64Value; } });
|
|
37
|
+
Object.defineProperty(exports, "UInt64Value", { enumerable: true, get: function () { return wrappers_pb_1.UInt64Value; } });
|
|
38
|
+
Object.defineProperty(exports, "Int32Value", { enumerable: true, get: function () { return wrappers_pb_1.Int32Value; } });
|
|
39
|
+
Object.defineProperty(exports, "UInt32Value", { enumerable: true, get: function () { return wrappers_pb_1.UInt32Value; } });
|
|
40
|
+
Object.defineProperty(exports, "BoolValue", { enumerable: true, get: function () { return wrappers_pb_1.BoolValue; } });
|
|
41
|
+
Object.defineProperty(exports, "StringValue", { enumerable: true, get: function () { return wrappers_pb_1.StringValue; } });
|
|
42
|
+
Object.defineProperty(exports, "BytesValue", { enumerable: true, get: function () { return wrappers_pb_1.BytesValue; } });
|
|
43
|
+
var status_pb_1 = require("./proto/clarifai/api/status/status_pb");
|
|
44
|
+
Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return status_pb_1.Status; } });
|
|
45
|
+
Object.defineProperty(exports, "BaseResponse", { enumerable: true, get: function () { return status_pb_1.BaseResponse; } });
|
|
46
|
+
var status_code_pb_1 = require("./proto/clarifai/api/status/status_code_pb");
|
|
47
|
+
Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return status_code_pb_1.StatusCode; } });
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { V2Client } from './proto/clarifai/api/serviceServiceClientPb';
|
|
2
2
|
export class ClarifaiStub {
|
|
3
|
-
static grpc(hostname = 'api.clarifai.com') {
|
|
3
|
+
static grpc(hostname = 'api-grpc-web.clarifai.com') {
|
|
4
4
|
return new V2Client(hostname);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export { V2Client };
|
|
8
|
-
export { ClientReadableStream } from 'grpc-web';
|
|
9
|
-
export { BaseResponse } from './proto/clarifai/api/status/status_pb';
|
package/dist/esm/resources.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export * from './proto/clarifai/api/resources_pb';
|
|
2
|
+
export { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
3
|
+
export { Api } from 'google-protobuf/google/protobuf/api_pb';
|
|
4
|
+
export { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
|
5
|
+
export { Empty } from 'google-protobuf/google/protobuf/empty_pb';
|
|
6
|
+
export { Struct } from 'google-protobuf/google/protobuf/struct_pb';
|
|
7
|
+
export { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
8
|
+
export { Type, Field, Enum, EnumValue, Option } from 'google-protobuf/google/protobuf/type_pb';
|
|
9
|
+
export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
10
|
+
export type { Error, Metadata } from 'grpc-web';
|
|
11
|
+
export { Status, BaseResponse } from './proto/clarifai/api/status/status_pb';
|
|
12
|
+
export { StatusCode } from './proto/clarifai/api/status/status_code_pb';
|
package/dist/esm/resources.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export * from './proto/clarifai/api/resources_pb';
|
|
2
|
+
export { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
3
|
+
export { Api } from 'google-protobuf/google/protobuf/api_pb';
|
|
4
|
+
export { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
|
5
|
+
export { Empty } from 'google-protobuf/google/protobuf/empty_pb';
|
|
6
|
+
export { Struct } from 'google-protobuf/google/protobuf/struct_pb';
|
|
7
|
+
export { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
8
|
+
export { Type, Field, Enum, EnumValue, Option } from 'google-protobuf/google/protobuf/type_pb';
|
|
9
|
+
export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
10
|
+
export { Status, BaseResponse } from './proto/clarifai/api/status/status_pb';
|
|
11
|
+
export { StatusCode } from './proto/clarifai/api/status/status_code_pb';
|
package/package.json
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clarifai-web-grpc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "The official Clarifai gRPC-web client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./resources": {
|
|
14
|
+
"import": "./dist/esm/resources.js",
|
|
15
|
+
"require": "./dist/cjs/resources.js"
|
|
16
|
+
},
|
|
17
|
+
"./service": {
|
|
18
|
+
"import": "./dist/esm/service.js",
|
|
19
|
+
"require": "./dist/cjs/service.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
8
22
|
"repository": "https://github.com/Clarifai/clarifai-web-grpc",
|
|
9
23
|
"author": "Clarifai Inc.",
|
|
10
24
|
"license": "Apache-2.0",
|
|
11
25
|
"keywords": [],
|
|
12
26
|
"scripts": {
|
|
13
27
|
"test": "mocha",
|
|
14
|
-
"lint": "
|
|
28
|
+
"lint": "eslint index.ts resources.ts service.ts",
|
|
15
29
|
"clean": "rm -rf dist clarifai-web-grpc-*.tgz",
|
|
30
|
+
"typecheck": "tsc --pretty --noEmit",
|
|
16
31
|
"build:cjs": "tsc -b tsconfig.cjs.json",
|
|
17
32
|
"build:esm": "tsc -b",
|
|
18
33
|
"build": "yarn build:esm && yarn build:cjs",
|
|
@@ -32,7 +47,14 @@
|
|
|
32
47
|
"@types/google-protobuf": "~3.7.0",
|
|
33
48
|
"@types/mocha": "^9.0.0",
|
|
34
49
|
"@types/node": "~10.17.0",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
|
51
|
+
"@typescript-eslint/parser": "^5.10.1",
|
|
35
52
|
"chai": "^4.3.4",
|
|
53
|
+
"eslint": "^7.32.0",
|
|
54
|
+
"eslint-config-standard": "^16.0.3",
|
|
55
|
+
"eslint-plugin-import": "^2.25.4",
|
|
56
|
+
"eslint-plugin-node": "^11.1.0",
|
|
57
|
+
"eslint-plugin-promise": "^5.2.0",
|
|
36
58
|
"husky": "^7.0.4",
|
|
37
59
|
"mocha": "^9.1.3",
|
|
38
60
|
"semantic-release": "^18.0.1",
|
package/tests/basic.test.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { describe, it } from 'mocha'
|
|
2
|
+
import { expect } from 'chai'
|
|
1
3
|
import { ClarifaiStub as StubSRC } from '../index'
|
|
2
4
|
import { ClarifaiStub as StubCJS } from '../dist/cjs/index'
|
|
3
5
|
import { ClarifaiStub as StubESM } from '../dist/esm/index'
|
|
4
|
-
import { describe, it } from 'mocha'
|
|
5
|
-
import { expect } from 'chai'
|
|
6
6
|
|
|
7
7
|
describe('Client Stub (src)', () => {
|
|
8
8
|
it('works', () => {
|
|
9
9
|
const client = StubSRC.grpc()
|
|
10
|
-
expect(client.hostname_).to.equal('api.clarifai.com')
|
|
10
|
+
expect(client.hostname_).to.equal('api-grpc-web.clarifai.com')
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
it('allows custom hostname', () => {
|
|
@@ -19,7 +19,7 @@ describe('Client Stub (src)', () => {
|
|
|
19
19
|
describe('Client Stub (cjs)', () => {
|
|
20
20
|
it('works', () => {
|
|
21
21
|
const client = StubCJS.grpc()
|
|
22
|
-
expect(client.hostname_).to.equal('api.clarifai.com')
|
|
22
|
+
expect(client.hostname_).to.equal('api-grpc-web.clarifai.com')
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
it('allows custom hostname', () => {
|
|
@@ -31,7 +31,7 @@ describe('Client Stub (cjs)', () => {
|
|
|
31
31
|
describe('Client Stub (esm)', () => {
|
|
32
32
|
it('works', () => {
|
|
33
33
|
const client = StubESM.grpc()
|
|
34
|
-
expect(client.hostname_).to.equal('api.clarifai.com')
|
|
34
|
+
expect(client.hostname_).to.equal('api-grpc-web.clarifai.com')
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
it('allows custom hostname', () => {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, it } from 'mocha'
|
|
2
|
+
import { expect } from 'chai'
|
|
3
|
+
import * as ResourcesSRC from '../resources'
|
|
4
|
+
import * as ResourcesCJS from '../dist/cjs/resources'
|
|
5
|
+
import * as ResourcesESM from '../dist/esm/resources'
|
|
6
|
+
|
|
7
|
+
function verifyInterface (modInterface: Record<string, unknown>) {
|
|
8
|
+
expect(modInterface.Any).to.be.instanceOf(Function)
|
|
9
|
+
expect(modInterface.Api).to.be.instanceOf(Function)
|
|
10
|
+
expect(modInterface.Duration).to.be.instanceOf(Function)
|
|
11
|
+
expect(modInterface.Empty).to.be.instanceOf(Function)
|
|
12
|
+
expect(modInterface.Struct).to.be.instanceOf(Function)
|
|
13
|
+
expect(modInterface.Timestamp).to.be.instanceOf(Function)
|
|
14
|
+
expect(modInterface.Type).to.be.instanceOf(Function)
|
|
15
|
+
expect(modInterface.Field).to.be.instanceOf(Function)
|
|
16
|
+
expect(modInterface.Enum).to.be.instanceOf(Function)
|
|
17
|
+
expect(modInterface.EnumValue).to.be.instanceOf(Function)
|
|
18
|
+
expect(modInterface.Option).to.be.instanceOf(Function)
|
|
19
|
+
expect(modInterface.DoubleValue).to.be.instanceOf(Function)
|
|
20
|
+
expect(modInterface.FloatValue).to.be.instanceOf(Function)
|
|
21
|
+
expect(modInterface.Int64Value).to.be.instanceOf(Function)
|
|
22
|
+
expect(modInterface.UInt64Value).to.be.instanceOf(Function)
|
|
23
|
+
expect(modInterface.Int32Value).to.be.instanceOf(Function)
|
|
24
|
+
expect(modInterface.UInt32Value).to.be.instanceOf(Function)
|
|
25
|
+
expect(modInterface.BoolValue).to.be.instanceOf(Function)
|
|
26
|
+
expect(modInterface.StringValue).to.be.instanceOf(Function)
|
|
27
|
+
expect(modInterface.BytesValue).to.be.instanceOf(Function)
|
|
28
|
+
expect(modInterface.BaseResponse).to.be.instanceOf(Function)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('Resources/Helpers (src)', () => {
|
|
32
|
+
it('exports various google-protobuf & grpc-web helper classes', () => {
|
|
33
|
+
verifyInterface(ResourcesSRC)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('Resources/Helpers (cjs)', () => {
|
|
38
|
+
it('exports various google-protobuf & grpc-web helper classes', () => {
|
|
39
|
+
verifyInterface(ResourcesCJS)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
describe('Resources/Helpers (esm)', () => {
|
|
44
|
+
it('exports various google-protobuf & grpc-web helper classes', () => {
|
|
45
|
+
verifyInterface(ResourcesESM)
|
|
46
|
+
})
|
|
47
|
+
})
|
package/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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/resources.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './proto/clarifai/api/resources_pb'
|
package/service.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './proto/clarifai/api/service_pb'
|
package/tests/package.test.ts
DELETED
|
File without changes
|