@amqp-contract/client 0.0.2 → 0.0.4

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Type-safe AMQP client for publishing messages using amqp-contract.
4
4
 
5
+ 📖 **[Full documentation →](https://btravers.github.io/amqp-contract/api/client)**
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -18,9 +20,8 @@ import { contract } from './contract';
18
20
  // Connect to RabbitMQ
19
21
  const connection = await connect('amqp://localhost');
20
22
 
21
- // Create client from contract
22
- const client = createClient(contract);
23
- await client.connect(connection);
23
+ // Create client from contract (automatically connects)
24
+ const client = await createClient({ contract, connection });
24
25
 
25
26
  // Publish message with type safety
26
27
  await client.publish('orderCreated', {
@@ -34,14 +35,21 @@ await client.close();
34
35
 
35
36
  ## API
36
37
 
37
- ### `createClient(contract)`
38
+ ### `createClient(options)`
39
+
40
+ Create a type-safe AMQP client from a contract. Automatically connects to RabbitMQ.
38
41
 
39
- Create a type-safe AMQP client from a contract.
42
+ **Parameters:**
43
+
44
+ - `options.contract` - Contract definition
45
+ - `options.connection` - amqplib Connection object
40
46
 
41
47
  ### `AmqpClient.connect(connection)`
42
48
 
43
49
  Connect to an AMQP broker and set up all exchanges, queues, and bindings defined in the contract.
44
50
 
51
+ **Note:** When using `createClient()`, this is called automatically.
52
+
45
53
  ### `AmqpClient.publish(publisherName, message, options?)`
46
54
 
47
55
  Publish a message using a defined publisher. The message will be validated against the schema and type-checked at compile time.
package/dist/index.cjs CHANGED
@@ -62,9 +62,12 @@ var AmqpClient = class {
62
62
  };
63
63
  /**
64
64
  * Create a type-safe AMQP client from a contract
65
+ * The client will automatically connect to the AMQP broker
65
66
  */
66
- function createClient(contract) {
67
- return new AmqpClient(contract);
67
+ async function createClient(options) {
68
+ const client = new AmqpClient(options.contract);
69
+ await client.connect(options.connection);
70
+ return client;
68
71
  }
69
72
 
70
73
  //#endregion
package/dist/index.d.cts CHANGED
@@ -31,10 +31,18 @@ declare class AmqpClient<TContract extends ContractDefinition> {
31
31
  */
32
32
  close(): Promise<void>;
33
33
  }
34
+ /**
35
+ * Options for creating a client
36
+ */
37
+ interface CreateClientOptions<TContract extends ContractDefinition> {
38
+ contract: TContract;
39
+ connection: ChannelModel;
40
+ }
34
41
  /**
35
42
  * Create a type-safe AMQP client from a contract
43
+ * The client will automatically connect to the AMQP broker
36
44
  */
37
- declare function createClient<TContract extends ContractDefinition>(contract: TContract): AmqpClient<TContract>;
45
+ declare function createClient<TContract extends ContractDefinition>(options: CreateClientOptions<TContract>): Promise<AmqpClient<TContract>>;
38
46
  //#endregion
39
- export { AmqpClient, type PublishOptions, createClient };
47
+ export { AmqpClient, type CreateClientOptions, type PublishOptions, createClient };
40
48
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAQa,UARI,cAAA,CAQM;EAAmB,UAAA,CAAA,EAAA,MAAA;EAID,OAAA,CAAA,EAV7B,OAAA,CAAQ,OAUqB;;;;;AAkDtB,cAtDN,UAsDM,CAAA,kBAtDuB,kBAsDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EApD2B,SAoD3B;EACT;;;EA8DW,OAAA,CAAA,UAAY,EA9GA,YA8GA,CAAA,EA9Ge,OA8Gf,CAAA,IAAA,CAAA;EAAmB;;;EAE5C,OAAA,CAAA,cApE2B,mBAoE3B,CApE+C,SAoE/C,CAAA,CAAA,CAAA,aAAA,EAnEgB,KAmEhB,EAAA,OAAA,EAlEU,yBAkEV,CAlEoC,SAkEpC,EAlE+C,KAkE/C,CAAA,EAAA,OAAA,CAAA,EAjEW,cAiEX,CAAA,EAhEE,OAgEF,CAAA,OAAA,CAAA;EAAU;;;WAjBI;;;;;iBAeD,+BAA+B,8BACnC,YACT,WAAW"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAQa,UARI,cAAA,CAQM;EAAmB,UAAA,CAAA,EAAA,MAAA;EAID,OAAA,CAAA,EAV7B,OAAA,CAAQ,OAUqB;;;;;AAkDtB,cAtDN,UAsDM,CAAA,kBAtDuB,kBAsDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EApD2B,SAoD3B;EACT;;;EA8DY,OAAA,CAAA,UAAA,EA9GW,YA8GQ,CAAA,EA9GO,OA8GP,CAAA,IAAA,CAAA;EAAmB;;;EAE7B,OAAA,CAAA,cApEI,mBAoEJ,CApEwB,SAoExB,CAAA,CAAA,CAAA,aAAA,EAnEP,KAmEO,EAAA,OAAA,EAlEb,yBAkEa,CAlEa,SAkEb,EAlEwB,KAkExB,CAAA,EAAA,OAAA,CAAA,EAjEZ,cAiEY,CAAA,EAhErB,OAgEqB,CAAA,OAAA,CAAA;EAOJ;;;EACX,KAAA,CAAA,CAAA,EAzBM,OAyBN,CAAA,IAAA,CAAA;;;;;UAVM,sCAAsC;YAC3C;cACE;;;;;;iBAOQ,+BAA+B,6BAC1C,oBAAoB,aAC5B,QAAQ,WAAW"}
package/dist/index.d.mts CHANGED
@@ -31,10 +31,18 @@ declare class AmqpClient<TContract extends ContractDefinition> {
31
31
  */
32
32
  close(): Promise<void>;
33
33
  }
34
+ /**
35
+ * Options for creating a client
36
+ */
37
+ interface CreateClientOptions<TContract extends ContractDefinition> {
38
+ contract: TContract;
39
+ connection: ChannelModel;
40
+ }
34
41
  /**
35
42
  * Create a type-safe AMQP client from a contract
43
+ * The client will automatically connect to the AMQP broker
36
44
  */
37
- declare function createClient<TContract extends ContractDefinition>(contract: TContract): AmqpClient<TContract>;
45
+ declare function createClient<TContract extends ContractDefinition>(options: CreateClientOptions<TContract>): Promise<AmqpClient<TContract>>;
38
46
  //#endregion
39
- export { AmqpClient, type PublishOptions, createClient };
47
+ export { AmqpClient, type CreateClientOptions, type PublishOptions, createClient };
40
48
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAQa,UARI,cAAA,CAQM;EAAmB,UAAA,CAAA,EAAA,MAAA;EAID,OAAA,CAAA,EAV7B,OAAA,CAAQ,OAUqB;;;;;AAkDtB,cAtDN,UAsDM,CAAA,kBAtDuB,kBAsDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EApD2B,SAoD3B;EACT;;;EA8DW,OAAA,CAAA,UAAY,EA9GA,YA8GA,CAAA,EA9Ge,OA8Gf,CAAA,IAAA,CAAA;EAAmB;;;EAE5C,OAAA,CAAA,cApE2B,mBAoE3B,CApE+C,SAoE/C,CAAA,CAAA,CAAA,aAAA,EAnEgB,KAmEhB,EAAA,OAAA,EAlEU,yBAkEV,CAlEoC,SAkEpC,EAlE+C,KAkE/C,CAAA,EAAA,OAAA,CAAA,EAjEW,cAiEX,CAAA,EAhEE,OAgEF,CAAA,OAAA,CAAA;EAAU;;;WAjBI;;;;;iBAeD,+BAA+B,8BACnC,YACT,WAAW"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAQa,UARI,cAAA,CAQM;EAAmB,UAAA,CAAA,EAAA,MAAA;EAID,OAAA,CAAA,EAV7B,OAAA,CAAQ,OAUqB;;;;;AAkDtB,cAtDN,UAsDM,CAAA,kBAtDuB,kBAsDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EApD2B,SAoD3B;EACT;;;EA8DY,OAAA,CAAA,UAAA,EA9GW,YA8GQ,CAAA,EA9GO,OA8GP,CAAA,IAAA,CAAA;EAAmB;;;EAE7B,OAAA,CAAA,cApEI,mBAoEJ,CApEwB,SAoExB,CAAA,CAAA,CAAA,aAAA,EAnEP,KAmEO,EAAA,OAAA,EAlEb,yBAkEa,CAlEa,SAkEb,EAlEwB,KAkExB,CAAA,EAAA,OAAA,CAAA,EAjEZ,cAiEY,CAAA,EAhErB,OAgEqB,CAAA,OAAA,CAAA;EAOJ;;;EACX,KAAA,CAAA,CAAA,EAzBM,OAyBN,CAAA,IAAA,CAAA;;;;;UAVM,sCAAsC;YAC3C;cACE;;;;;;iBAOQ,+BAA+B,6BAC1C,oBAAoB,aAC5B,QAAQ,WAAW"}
package/dist/index.mjs CHANGED
@@ -61,9 +61,12 @@ var AmqpClient = class {
61
61
  };
62
62
  /**
63
63
  * Create a type-safe AMQP client from a contract
64
+ * The client will automatically connect to the AMQP broker
64
65
  */
65
- function createClient(contract) {
66
- return new AmqpClient(contract);
66
+ async function createClient(options) {
67
+ const client = new AmqpClient(options.contract);
68
+ await client.connect(options.connection);
69
+ return client;
67
70
  }
68
71
 
69
72
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["contract: TContract"],"sources":["../src/client.ts"],"sourcesContent":["import type { Channel, ChannelModel, Options } from \"amqplib\";\nimport type {\n ClientInferPublisherInput,\n ContractDefinition,\n InferPublisherNames,\n} from \"@amqp-contract/contract\";\n\n/**\n * Options for publishing a message\n */\nexport interface PublishOptions {\n routingKey?: string;\n options?: Options.Publish;\n}\n\n/**\n * Type-safe AMQP client for publishing messages\n */\nexport class AmqpClient<TContract extends ContractDefinition> {\n private channel: Channel | null = null;\n private connection: ChannelModel | null = null;\n\n constructor(private readonly contract: TContract) {}\n\n /**\n * Connect to AMQP broker\n */\n async connect(connection: ChannelModel): Promise<void> {\n this.connection = connection;\n this.channel = await connection.createChannel();\n\n // Setup exchanges\n if (this.contract.exchanges && this.channel) {\n for (const exchange of Object.values(this.contract.exchanges)) {\n await this.channel.assertExchange(exchange.name, exchange.type, {\n durable: exchange.durable,\n autoDelete: exchange.autoDelete,\n internal: exchange.internal,\n arguments: exchange.arguments,\n });\n }\n }\n\n // Setup queues\n if (this.contract.queues && this.channel) {\n for (const queue of Object.values(this.contract.queues)) {\n await this.channel.assertQueue(queue.name, {\n durable: queue.durable,\n exclusive: queue.exclusive,\n autoDelete: queue.autoDelete,\n arguments: queue.arguments,\n });\n }\n }\n\n // Setup bindings\n if (this.contract.bindings && this.channel) {\n for (const binding of Object.values(this.contract.bindings)) {\n await this.channel.bindQueue(\n binding.queue,\n binding.exchange,\n binding.routingKey ?? \"\",\n binding.arguments,\n );\n }\n }\n }\n\n /**\n * Publish a message using a defined publisher\n */\n async publish<TName extends InferPublisherNames<TContract>>(\n publisherName: TName,\n message: ClientInferPublisherInput<TContract, TName>,\n options?: PublishOptions,\n ): Promise<boolean> {\n if (!this.channel) {\n throw new Error(\"Client not connected. Call connect() first.\");\n }\n\n const publishers = this.contract.publishers as Record<string, unknown>;\n if (!publishers) {\n throw new Error(\"No publishers defined in contract\");\n }\n\n const publisher = publishers[publisherName as string];\n if (!publisher || typeof publisher !== \"object\") {\n throw new Error(`Publisher \"${String(publisherName)}\" not found in contract`);\n }\n\n const publisherDef = publisher as {\n exchange: string;\n routingKey?: string;\n message: { \"~standard\": { validate: (value: unknown) => unknown } };\n };\n\n // Validate message using schema\n const validation = publisherDef.message[\"~standard\"].validate(message);\n if (\n typeof validation === \"object\" &&\n validation !== null &&\n \"issues\" in validation &&\n validation.issues\n ) {\n throw new Error(`Message validation failed: ${JSON.stringify(validation.issues)}`);\n }\n\n const validatedMessage =\n typeof validation === \"object\" && validation !== null && \"value\" in validation\n ? validation.value\n : message;\n\n // Publish message\n const routingKey = options?.routingKey ?? publisherDef.routingKey ?? \"\";\n const content = Buffer.from(JSON.stringify(validatedMessage));\n\n return this.channel.publish(publisherDef.exchange, routingKey, content, options?.options);\n }\n\n /**\n * Close the connection\n */\n async close(): Promise<void> {\n if (this.channel) {\n await this.channel.close();\n this.channel = null;\n }\n if (this.connection) {\n await (this.connection as unknown as { close(): Promise<void> }).close();\n this.connection = null;\n }\n }\n}\n\n/**\n * Create a type-safe AMQP client from a contract\n */\nexport function createClient<TContract extends ContractDefinition>(\n contract: TContract,\n): AmqpClient<TContract> {\n return new AmqpClient(contract);\n}\n"],"mappings":";;;;AAkBA,IAAa,aAAb,MAA8D;CAC5D,AAAQ,UAA0B;CAClC,AAAQ,aAAkC;CAE1C,YAAY,AAAiBA,UAAqB;EAArB;;;;;CAK7B,MAAM,QAAQ,YAAyC;AACrD,OAAK,aAAa;AAClB,OAAK,UAAU,MAAM,WAAW,eAAe;AAG/C,MAAI,KAAK,SAAS,aAAa,KAAK,QAClC,MAAK,MAAM,YAAY,OAAO,OAAO,KAAK,SAAS,UAAU,CAC3D,OAAM,KAAK,QAAQ,eAAe,SAAS,MAAM,SAAS,MAAM;GAC9D,SAAS,SAAS;GAClB,YAAY,SAAS;GACrB,UAAU,SAAS;GACnB,WAAW,SAAS;GACrB,CAAC;AAKN,MAAI,KAAK,SAAS,UAAU,KAAK,QAC/B,MAAK,MAAM,SAAS,OAAO,OAAO,KAAK,SAAS,OAAO,CACrD,OAAM,KAAK,QAAQ,YAAY,MAAM,MAAM;GACzC,SAAS,MAAM;GACf,WAAW,MAAM;GACjB,YAAY,MAAM;GAClB,WAAW,MAAM;GAClB,CAAC;AAKN,MAAI,KAAK,SAAS,YAAY,KAAK,QACjC,MAAK,MAAM,WAAW,OAAO,OAAO,KAAK,SAAS,SAAS,CACzD,OAAM,KAAK,QAAQ,UACjB,QAAQ,OACR,QAAQ,UACR,QAAQ,cAAc,IACtB,QAAQ,UACT;;;;;CAQP,MAAM,QACJ,eACA,SACA,SACkB;AAClB,MAAI,CAAC,KAAK,QACR,OAAM,IAAI,MAAM,8CAA8C;EAGhE,MAAM,aAAa,KAAK,SAAS;AACjC,MAAI,CAAC,WACH,OAAM,IAAI,MAAM,oCAAoC;EAGtD,MAAM,YAAY,WAAW;AAC7B,MAAI,CAAC,aAAa,OAAO,cAAc,SACrC,OAAM,IAAI,MAAM,cAAc,OAAO,cAAc,CAAC,yBAAyB;EAG/E,MAAM,eAAe;EAOrB,MAAM,aAAa,aAAa,QAAQ,aAAa,SAAS,QAAQ;AACtE,MACE,OAAO,eAAe,YACtB,eAAe,QACf,YAAY,cACZ,WAAW,OAEX,OAAM,IAAI,MAAM,8BAA8B,KAAK,UAAU,WAAW,OAAO,GAAG;EAGpF,MAAM,mBACJ,OAAO,eAAe,YAAY,eAAe,QAAQ,WAAW,aAChE,WAAW,QACX;EAGN,MAAM,aAAa,SAAS,cAAc,aAAa,cAAc;EACrE,MAAM,UAAU,OAAO,KAAK,KAAK,UAAU,iBAAiB,CAAC;AAE7D,SAAO,KAAK,QAAQ,QAAQ,aAAa,UAAU,YAAY,SAAS,SAAS,QAAQ;;;;;CAM3F,MAAM,QAAuB;AAC3B,MAAI,KAAK,SAAS;AAChB,SAAM,KAAK,QAAQ,OAAO;AAC1B,QAAK,UAAU;;AAEjB,MAAI,KAAK,YAAY;AACnB,SAAO,KAAK,WAAqD,OAAO;AACxE,QAAK,aAAa;;;;;;;AAQxB,SAAgB,aACd,UACuB;AACvB,QAAO,IAAI,WAAW,SAAS"}
1
+ {"version":3,"file":"index.mjs","names":["contract: TContract"],"sources":["../src/client.ts"],"sourcesContent":["import type { Channel, ChannelModel, Options } from \"amqplib\";\nimport type {\n ClientInferPublisherInput,\n ContractDefinition,\n InferPublisherNames,\n} from \"@amqp-contract/contract\";\n\n/**\n * Options for publishing a message\n */\nexport interface PublishOptions {\n routingKey?: string;\n options?: Options.Publish;\n}\n\n/**\n * Type-safe AMQP client for publishing messages\n */\nexport class AmqpClient<TContract extends ContractDefinition> {\n private channel: Channel | null = null;\n private connection: ChannelModel | null = null;\n\n constructor(private readonly contract: TContract) {}\n\n /**\n * Connect to AMQP broker\n */\n async connect(connection: ChannelModel): Promise<void> {\n this.connection = connection;\n this.channel = await connection.createChannel();\n\n // Setup exchanges\n if (this.contract.exchanges && this.channel) {\n for (const exchange of Object.values(this.contract.exchanges)) {\n await this.channel.assertExchange(exchange.name, exchange.type, {\n durable: exchange.durable,\n autoDelete: exchange.autoDelete,\n internal: exchange.internal,\n arguments: exchange.arguments,\n });\n }\n }\n\n // Setup queues\n if (this.contract.queues && this.channel) {\n for (const queue of Object.values(this.contract.queues)) {\n await this.channel.assertQueue(queue.name, {\n durable: queue.durable,\n exclusive: queue.exclusive,\n autoDelete: queue.autoDelete,\n arguments: queue.arguments,\n });\n }\n }\n\n // Setup bindings\n if (this.contract.bindings && this.channel) {\n for (const binding of Object.values(this.contract.bindings)) {\n await this.channel.bindQueue(\n binding.queue,\n binding.exchange,\n binding.routingKey ?? \"\",\n binding.arguments,\n );\n }\n }\n }\n\n /**\n * Publish a message using a defined publisher\n */\n async publish<TName extends InferPublisherNames<TContract>>(\n publisherName: TName,\n message: ClientInferPublisherInput<TContract, TName>,\n options?: PublishOptions,\n ): Promise<boolean> {\n if (!this.channel) {\n throw new Error(\"Client not connected. Call connect() first.\");\n }\n\n const publishers = this.contract.publishers as Record<string, unknown>;\n if (!publishers) {\n throw new Error(\"No publishers defined in contract\");\n }\n\n const publisher = publishers[publisherName as string];\n if (!publisher || typeof publisher !== \"object\") {\n throw new Error(`Publisher \"${String(publisherName)}\" not found in contract`);\n }\n\n const publisherDef = publisher as {\n exchange: string;\n routingKey?: string;\n message: { \"~standard\": { validate: (value: unknown) => unknown } };\n };\n\n // Validate message using schema\n const validation = publisherDef.message[\"~standard\"].validate(message);\n if (\n typeof validation === \"object\" &&\n validation !== null &&\n \"issues\" in validation &&\n validation.issues\n ) {\n throw new Error(`Message validation failed: ${JSON.stringify(validation.issues)}`);\n }\n\n const validatedMessage =\n typeof validation === \"object\" && validation !== null && \"value\" in validation\n ? validation.value\n : message;\n\n // Publish message\n const routingKey = options?.routingKey ?? publisherDef.routingKey ?? \"\";\n const content = Buffer.from(JSON.stringify(validatedMessage));\n\n return this.channel.publish(publisherDef.exchange, routingKey, content, options?.options);\n }\n\n /**\n * Close the connection\n */\n async close(): Promise<void> {\n if (this.channel) {\n await this.channel.close();\n this.channel = null;\n }\n if (this.connection) {\n await (this.connection as unknown as { close(): Promise<void> }).close();\n this.connection = null;\n }\n }\n}\n\n/**\n * Options for creating a client\n */\nexport interface CreateClientOptions<TContract extends ContractDefinition> {\n contract: TContract;\n connection: ChannelModel;\n}\n\n/**\n * Create a type-safe AMQP client from a contract\n * The client will automatically connect to the AMQP broker\n */\nexport async function createClient<TContract extends ContractDefinition>(\n options: CreateClientOptions<TContract>,\n): Promise<AmqpClient<TContract>> {\n const client = new AmqpClient(options.contract);\n await client.connect(options.connection);\n return client;\n}\n"],"mappings":";;;;AAkBA,IAAa,aAAb,MAA8D;CAC5D,AAAQ,UAA0B;CAClC,AAAQ,aAAkC;CAE1C,YAAY,AAAiBA,UAAqB;EAArB;;;;;CAK7B,MAAM,QAAQ,YAAyC;AACrD,OAAK,aAAa;AAClB,OAAK,UAAU,MAAM,WAAW,eAAe;AAG/C,MAAI,KAAK,SAAS,aAAa,KAAK,QAClC,MAAK,MAAM,YAAY,OAAO,OAAO,KAAK,SAAS,UAAU,CAC3D,OAAM,KAAK,QAAQ,eAAe,SAAS,MAAM,SAAS,MAAM;GAC9D,SAAS,SAAS;GAClB,YAAY,SAAS;GACrB,UAAU,SAAS;GACnB,WAAW,SAAS;GACrB,CAAC;AAKN,MAAI,KAAK,SAAS,UAAU,KAAK,QAC/B,MAAK,MAAM,SAAS,OAAO,OAAO,KAAK,SAAS,OAAO,CACrD,OAAM,KAAK,QAAQ,YAAY,MAAM,MAAM;GACzC,SAAS,MAAM;GACf,WAAW,MAAM;GACjB,YAAY,MAAM;GAClB,WAAW,MAAM;GAClB,CAAC;AAKN,MAAI,KAAK,SAAS,YAAY,KAAK,QACjC,MAAK,MAAM,WAAW,OAAO,OAAO,KAAK,SAAS,SAAS,CACzD,OAAM,KAAK,QAAQ,UACjB,QAAQ,OACR,QAAQ,UACR,QAAQ,cAAc,IACtB,QAAQ,UACT;;;;;CAQP,MAAM,QACJ,eACA,SACA,SACkB;AAClB,MAAI,CAAC,KAAK,QACR,OAAM,IAAI,MAAM,8CAA8C;EAGhE,MAAM,aAAa,KAAK,SAAS;AACjC,MAAI,CAAC,WACH,OAAM,IAAI,MAAM,oCAAoC;EAGtD,MAAM,YAAY,WAAW;AAC7B,MAAI,CAAC,aAAa,OAAO,cAAc,SACrC,OAAM,IAAI,MAAM,cAAc,OAAO,cAAc,CAAC,yBAAyB;EAG/E,MAAM,eAAe;EAOrB,MAAM,aAAa,aAAa,QAAQ,aAAa,SAAS,QAAQ;AACtE,MACE,OAAO,eAAe,YACtB,eAAe,QACf,YAAY,cACZ,WAAW,OAEX,OAAM,IAAI,MAAM,8BAA8B,KAAK,UAAU,WAAW,OAAO,GAAG;EAGpF,MAAM,mBACJ,OAAO,eAAe,YAAY,eAAe,QAAQ,WAAW,aAChE,WAAW,QACX;EAGN,MAAM,aAAa,SAAS,cAAc,aAAa,cAAc;EACrE,MAAM,UAAU,OAAO,KAAK,KAAK,UAAU,iBAAiB,CAAC;AAE7D,SAAO,KAAK,QAAQ,QAAQ,aAAa,UAAU,YAAY,SAAS,SAAS,QAAQ;;;;;CAM3F,MAAM,QAAuB;AAC3B,MAAI,KAAK,SAAS;AAChB,SAAM,KAAK,QAAQ,OAAO;AAC1B,QAAK,UAAU;;AAEjB,MAAI,KAAK,YAAY;AACnB,SAAO,KAAK,WAAqD,OAAO;AACxE,QAAK,aAAa;;;;;;;;AAiBxB,eAAsB,aACpB,SACgC;CAChC,MAAM,SAAS,IAAI,WAAW,QAAQ,SAAS;AAC/C,OAAM,OAAO,QAAQ,QAAQ,WAAW;AACxC,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amqp-contract/client",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Client utilities for publishing messages using amqp-contract",
5
5
  "keywords": [
6
6
  "amqp",
@@ -41,7 +41,7 @@
41
41
  "dist"
42
42
  ],
43
43
  "dependencies": {
44
- "@amqp-contract/contract": "0.0.2"
44
+ "@amqp-contract/contract": "0.0.4"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/amqplib": "0.10.8",
@@ -52,6 +52,7 @@
52
52
  "typescript": "5.9.3",
53
53
  "vitest": "4.0.16",
54
54
  "zod": "4.2.1",
55
+ "@amqp-contract/testing": "0.0.4",
55
56
  "@amqp-contract/tsconfig": "0.0.0"
56
57
  },
57
58
  "peerDependencies": {
@@ -60,8 +61,9 @@
60
61
  "scripts": {
61
62
  "build": "tsdown src/index.ts --format cjs,esm --dts --clean",
62
63
  "dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
63
- "test": "vitest run",
64
- "test:watch": "vitest",
64
+ "test": "vitest run --project unit",
65
+ "test:integration": "vitest run --project integration",
66
+ "test:watch": "vitest --project unit",
65
67
  "typecheck": "tsc --noEmit"
66
68
  }
67
69
  }