@rocketmq/serializer 0.1.0 → 0.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.
@@ -1,21 +1,23 @@
1
1
 
2
2
 
3
- > @rocketmq/serializer@0.1.0 build /home/edilson/learnspace/rocketmq-broker/client-ts/packages/serializer
3
+ > @rocketmq/serializer@0.1.2 build /home/edilson/learnspace/rocketmq-broker/rocketmq.js/packages/serializer
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/index.ts
7
7
  CLI Using tsconfig: tsconfig.json
8
8
  CLI tsup v8.5.1
9
- CLI Using tsup config: /home/edilson/learnspace/rocketmq-broker/client-ts/packages/serializer/tsup.config.ts
9
+ CLI Using tsup config: /home/edilson/learnspace/rocketmq-broker/rocketmq.js/packages/serializer/tsup.config.ts
10
10
  CLI Target: es2022
11
11
  CLI Cleaning output folder
12
12
  ESM Build start
13
13
  CJS Build start
14
- CJS dist/index.cjs 1.25 KB
15
- CJS ⚡️ Build success in 10ms
16
- ESM dist/index.js 248.00 B
17
- ESM ⚡️ Build success in 10ms
14
+ ESM dist/index.js 462.00 B
15
+ ESM dist/index.js.map 1.03 KB
16
+ ESM ⚡️ Build success in 29ms
17
+ CJS dist/index.cjs 1.42 KB
18
+ CJS dist/index.cjs.map 1.17 KB
19
+ CJS ⚡️ Build success in 29ms
18
20
  DTS Build start
19
- DTS ⚡️ Build success in 1037ms
21
+ DTS ⚡️ Build success in 910ms
20
22
  DTS dist/index.d.ts 1.17 KB
21
23
  DTS dist/index.d.cts 1.17 KB
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @rocketmq/serializer
2
+
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - docs: comprehensive README and API docs like Python SDK
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @rocketmq/serializer
2
+
3
+ Serialization adapters for RocketMQ payloads.
4
+
5
+ This package provides the `Serializer` interface and a default `JsonSerializer` implementation used by the SDK to convert TypeScript objects to and from `Buffer` payloads for AMQP transmission.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @rocketmq/serializer
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ The `JsonSerializer` is used by default in `@rocketmq/core`. You can implement the `Serializer` interface to create custom formats (e.g., Avro, MessagePack).
16
+
17
+ ```typescript
18
+ import { JsonSerializer } from '@rocketmq/serializer';
19
+
20
+ const serializer = new JsonSerializer();
21
+
22
+ const buf = serializer.serialize({ hello: 'world' });
23
+ const obj = serializer.deserialize(buf);
24
+ ```
25
+
26
+ ## License
27
+
28
+ Apache 2.0
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +27,9 @@ module.exports = __toCommonJS(index_exports);
26
27
 
27
28
  // src/json.ts
28
29
  var JsonSerializer = class {
30
+ static {
31
+ __name(this, "JsonSerializer");
32
+ }
29
33
  contentType = "application/json";
30
34
  serialize(value) {
31
35
  return Buffer.from(JSON.stringify(value));
@@ -38,3 +42,4 @@ var JsonSerializer = class {
38
42
  0 && (module.exports = {
39
43
  JsonSerializer
40
44
  });
45
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/json.ts"],"sourcesContent":["export type { Serializer } from './types.js';\nexport { JsonSerializer } from './json.js';\n","/**\n * JSON serializer — default encoding for RocketMQ SDK.\n *\n * Produces `application/json` payloads that the Rust broker validates\n * by checking all proto schema fields are present in the JSON object.\n *\n * Usage:\n * const s = new JsonSerializer();\n * const buf = s.serialize({ id: \"1\" });\n */\n\nimport type { Serializer } from './types.js';\n\nexport class JsonSerializer implements Serializer {\n readonly contentType = 'application/json';\n\n serialize(value: unknown): Buffer {\n return Buffer.from(JSON.stringify(value));\n }\n\n deserialize(buf: Buffer): unknown {\n return JSON.parse(buf.toString());\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;ACYO,IAAMA,iBAAN,MAAMA;EAbb,OAaaA;;;EACFC,cAAc;EAEvBC,UAAUC,OAAwB;AAChC,WAAOC,OAAOC,KAAKC,KAAKC,UAAUJ,KAAAA,CAAAA;EACpC;EAEAK,YAAYC,KAAsB;AAChC,WAAOH,KAAKI,MAAMD,IAAIE,SAAQ,CAAA;EAChC;AACF;","names":["JsonSerializer","contentType","serialize","value","Buffer","from","JSON","stringify","deserialize","buf","parse","toString"]}
package/dist/index.js CHANGED
@@ -1,5 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/json.ts
2
5
  var JsonSerializer = class {
6
+ static {
7
+ __name(this, "JsonSerializer");
8
+ }
3
9
  contentType = "application/json";
4
10
  serialize(value) {
5
11
  return Buffer.from(JSON.stringify(value));
@@ -11,3 +17,4 @@ var JsonSerializer = class {
11
17
  export {
12
18
  JsonSerializer
13
19
  };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/json.ts"],"sourcesContent":["/**\n * JSON serializer — default encoding for RocketMQ SDK.\n *\n * Produces `application/json` payloads that the Rust broker validates\n * by checking all proto schema fields are present in the JSON object.\n *\n * Usage:\n * const s = new JsonSerializer();\n * const buf = s.serialize({ id: \"1\" });\n */\n\nimport type { Serializer } from './types.js';\n\nexport class JsonSerializer implements Serializer {\n readonly contentType = 'application/json';\n\n serialize(value: unknown): Buffer {\n return Buffer.from(JSON.stringify(value));\n }\n\n deserialize(buf: Buffer): unknown {\n return JSON.parse(buf.toString());\n }\n}\n"],"mappings":";;;;AAaO,IAAMA,iBAAN,MAAMA;EAbb,OAaaA;;;EACFC,cAAc;EAEvBC,UAAUC,OAAwB;AAChC,WAAOC,OAAOC,KAAKC,KAAKC,UAAUJ,KAAAA,CAAAA;EACpC;EAEAK,YAAYC,KAAsB;AAChC,WAAOH,KAAKI,MAAMD,IAAIE,SAAQ,CAAA;EAChC;AACF;","names":["JsonSerializer","contentType","serialize","value","Buffer","from","JSON","stringify","deserialize","buf","parse","toString"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketmq/serializer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/tsup.config.ts CHANGED
@@ -5,4 +5,5 @@ export default defineConfig({
5
5
  format: ["esm", "cjs"],
6
6
  dts: true,
7
7
  clean: true,
8
+ sourcemap: true,
8
9
  });