Skip to content

Commit

Permalink
Proxy 1.0.0-M2 and new type_url for primitives (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren authored Apr 1, 2022
1 parent 1184c02 commit 5d81886
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion codegen/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ lazy val `kalix-codegen-js-cli` =
lazy val library =
new {
object Version {
val kalix = "0.10.0-M4"
val kalix = "1.0.0-M2"
val commonsIo = "2.8.0"
val kiama = "2.4.0"
val logback = "1.2.3"
Expand Down
2 changes: 1 addition & 1 deletion codegen/js-gen-cli/src/it/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kalix-npm-js {
}

kalix-proxy {
image = "gcr.io/kalix-public/kalix-proxy:0.10.0-M4"
image = "gcr.io/kalix-public/kalix-proxy:1.0.0-M2"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/js-doc-snippets/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/js-valueentity-shopping-cart/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/valueentity-counter/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/ts/ts-valueentity-counter/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/ts/ts-valueentity-shopping-cart/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:0.10.0-M4
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion sdk/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"frameworkVersion": "0.10.0-M4"
"frameworkVersion": "1.0.0-M2"
}
2 changes: 1 addition & 1 deletion sdk/src/protobuf-any.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Any = protobufHelper.moduleRoot.google.protobuf.Any;
// To allow primitive types to be stored, Kalix defines a number of primitive type URLs, based on protobuf types.
// The serialized values are valid protobuf messages that contain a value of that type as their single field at index
// 15.
const KalixPrimitive = 'p.kalix.io/';
const KalixPrimitive = 'type.kalix.io/';
// Chosen because it reduces the likelihood of clashing with something else.
const KalixPrimitiveFieldNumber = 1;
const KalixPrimitiveFieldNumberEncoded = KalixPrimitiveFieldNumber << 3; // 8
Expand Down
4 changes: 2 additions & 2 deletions sdk/test/akkaserverless.test.ts → sdk/test/kalix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ At package.test.json:2:4:
// Assert
result.getProto().should.equal('');
result.getComponentsList().length.should.equal(0);
serviceInfo?.getProtocolMajorVersion().should.equal(0);
serviceInfo?.getProtocolMinorVersion().should.equal(10);
serviceInfo?.getProtocolMajorVersion().should.equal(1);
serviceInfo?.getProtocolMinorVersion().should.equal(0);
serviceInfo?.getServiceName().should.equal('my-service');
serviceInfo?.getServiceVersion().should.equal('1.2.3');
serviceInfo?.getServiceRuntime().should.contains('node v');
Expand Down
24 changes: 12 additions & 12 deletions sdk/test/protobuf-any-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,68 +29,68 @@ const PrimitiveLike = root.lookupType('com.example.PrimitiveLike');
describe('AnySupport', () => {
it('should support serializing strings', () => {
const serialized = AnySupport.serialize('foo', true, false);
serialized.type_url.should.equal('p.kalix.io/string');
serialized.type_url.should.equal('type.kalix.io/string');
anySupport.deserialize(serialized).should.equal('foo');
});

it('should support serializing empty string (default)', () => {
const serialized = AnySupport.serialize('', true, false);
serialized.type_url.should.equal('p.kalix.io/string');
serialized.type_url.should.equal('type.kalix.io/string');
serialized.value.should.have.lengthOf(0); // empty bytes
anySupport.deserialize(serialized).should.equal('');
});

it('should support serializing long', () => {
const value = Long.fromNumber(2789);
const serialized = AnySupport.serialize(value, true, false);
serialized.type_url.should.equal('p.kalix.io/int64');
serialized.type_url.should.equal('type.kalix.io/int64');
anySupport.deserialize(serialized).should.eql(value);
});

it('should support serializing zero long (default)', () => {
const serialized = AnySupport.serialize(Long.fromNumber(0), true, false);
serialized.type_url.should.equal('p.kalix.io/int64');
serialized.type_url.should.equal('type.kalix.io/int64');
serialized.value.should.have.lengthOf(0); // empty bytes
anySupport.deserialize(serialized).should.eql(Long.ZERO);
});

it('should support serializing bytes', () => {
const bytes = Buffer.from('foo');
const serialized = AnySupport.serialize(bytes, true, false);
serialized.type_url.should.equal('p.kalix.io/bytes');
serialized.type_url.should.equal('type.kalix.io/bytes');
anySupport.deserialize(serialized).should.eql(bytes);
});

it('should support serializing empty bytes (default)', () => {
const bytes = Buffer.alloc(0);
const serialized = AnySupport.serialize(bytes, true, false);
serialized.type_url.should.equal('p.kalix.io/bytes');
serialized.type_url.should.equal('type.kalix.io/bytes');
serialized.value.should.have.lengthOf(0); // empty bytes
anySupport.deserialize(serialized).should.eql(bytes);
});

it('should support serializing booleans', () => {
const serialized = AnySupport.serialize(true, true, false);
serialized.type_url.should.equal('p.kalix.io/bool');
serialized.type_url.should.equal('type.kalix.io/bool');
anySupport.deserialize(serialized).should.equal(true);
});

it('should support serializing false booleans (default)', () => {
const serialized = AnySupport.serialize(false, true, false);
serialized.type_url.should.equal('p.kalix.io/bool');
serialized.type_url.should.equal('type.kalix.io/bool');
serialized.value.should.have.lengthOf(0); // empty bytes
anySupport.deserialize(serialized).should.equal(false);
});

it('should support serializing numbers', () => {
const serialized = AnySupport.serialize(1.2345, true, false);
serialized.type_url.should.equal('p.kalix.io/double');
serialized.type_url.should.equal('type.kalix.io/double');
anySupport.deserialize(serialized).should.equal(1.2345);
});

it('should support serializing zero numbers (default)', () => {
const serialized = AnySupport.serialize(0, true, false);
serialized.type_url.should.equal('p.kalix.io/double');
serialized.type_url.should.equal('type.kalix.io/double');
serialized.value.should.have.lengthOf(0); // empty bytes
anySupport.deserialize(serialized).should.equal(0);
});
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('AnySupport', () => {
it('should support deserializing primitives when the field in not present', () => {
anySupport
.deserialize({
type_url: 'p.kalix.io/string',
type_url: 'type.kalix.io/string',
value: PrimitiveLike.encode({}).finish(),
})
.should.equal('');
Expand All @@ -135,7 +135,7 @@ describe('AnySupport', () => {
it('should support deserializing primitives when other fields are present', () => {
anySupport
.deserialize({
type_url: 'p.kalix.io/string',
type_url: 'type.kalix.io/string',
value: PrimitiveLike.encode({
field1: 'one',
field2: 'two',
Expand Down

0 comments on commit 5d81886

Please sign in to comment.