@amqp-contract/client 0.0.1
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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/index.cjs +72 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +40 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +71 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Benoit Travers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @amqp-contract/client
|
|
2
|
+
|
|
3
|
+
Type-safe AMQP client for publishing messages using amqp-contract.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @amqp-contract/client amqplib
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createClient } from '@amqp-contract/client';
|
|
15
|
+
import { connect } from 'amqplib';
|
|
16
|
+
import { contract } from './contract';
|
|
17
|
+
|
|
18
|
+
// Connect to RabbitMQ
|
|
19
|
+
const connection = await connect('amqp://localhost');
|
|
20
|
+
|
|
21
|
+
// Create client from contract
|
|
22
|
+
const client = createClient(contract);
|
|
23
|
+
await client.connect(connection);
|
|
24
|
+
|
|
25
|
+
// Publish message with type safety
|
|
26
|
+
await client.publish('orderCreated', {
|
|
27
|
+
orderId: 'ORD-123',
|
|
28
|
+
amount: 99.99,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Clean up
|
|
32
|
+
await client.close();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### `createClient(contract)`
|
|
38
|
+
|
|
39
|
+
Create a type-safe AMQP client from a contract.
|
|
40
|
+
|
|
41
|
+
### `AmqpClient.connect(connection)`
|
|
42
|
+
|
|
43
|
+
Connect to an AMQP broker and set up all exchanges, queues, and bindings defined in the contract.
|
|
44
|
+
|
|
45
|
+
### `AmqpClient.publish(publisherName, message, options?)`
|
|
46
|
+
|
|
47
|
+
Publish a message using a defined publisher. The message will be validated against the schema and type-checked at compile time.
|
|
48
|
+
|
|
49
|
+
### `AmqpClient.close()`
|
|
50
|
+
|
|
51
|
+
Close the channel and connection.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/client.ts
|
|
3
|
+
/**
|
|
4
|
+
* Type-safe AMQP client for publishing messages
|
|
5
|
+
*/
|
|
6
|
+
var AmqpClient = class {
|
|
7
|
+
channel = null;
|
|
8
|
+
connection = null;
|
|
9
|
+
constructor(contract) {
|
|
10
|
+
this.contract = contract;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Connect to AMQP broker
|
|
14
|
+
*/
|
|
15
|
+
async connect(connection) {
|
|
16
|
+
this.connection = connection;
|
|
17
|
+
this.channel = await connection.createChannel();
|
|
18
|
+
if (this.contract.exchanges && this.channel) for (const exchange of Object.values(this.contract.exchanges)) await this.channel.assertExchange(exchange.name, exchange.type, {
|
|
19
|
+
durable: exchange.durable,
|
|
20
|
+
autoDelete: exchange.autoDelete,
|
|
21
|
+
internal: exchange.internal,
|
|
22
|
+
arguments: exchange.arguments
|
|
23
|
+
});
|
|
24
|
+
if (this.contract.queues && this.channel) for (const queue of Object.values(this.contract.queues)) await this.channel.assertQueue(queue.name, {
|
|
25
|
+
durable: queue.durable,
|
|
26
|
+
exclusive: queue.exclusive,
|
|
27
|
+
autoDelete: queue.autoDelete,
|
|
28
|
+
arguments: queue.arguments
|
|
29
|
+
});
|
|
30
|
+
if (this.contract.bindings && this.channel) for (const binding of Object.values(this.contract.bindings)) await this.channel.bindQueue(binding.queue, binding.exchange, binding.routingKey ?? "", binding.arguments);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Publish a message using a defined publisher
|
|
34
|
+
*/
|
|
35
|
+
async publish(publisherName, message, options) {
|
|
36
|
+
if (!this.channel) throw new Error("Client not connected. Call connect() first.");
|
|
37
|
+
const publishers = this.contract.publishers;
|
|
38
|
+
if (!publishers) throw new Error("No publishers defined in contract");
|
|
39
|
+
const publisher = publishers[publisherName];
|
|
40
|
+
if (!publisher || typeof publisher !== "object") throw new Error(`Publisher "${String(publisherName)}" not found in contract`);
|
|
41
|
+
const publisherDef = publisher;
|
|
42
|
+
const validation = publisherDef.message["~standard"].validate(message);
|
|
43
|
+
if (typeof validation === "object" && validation !== null && "issues" in validation && validation.issues) throw new Error(`Message validation failed: ${JSON.stringify(validation.issues)}`);
|
|
44
|
+
const validatedMessage = typeof validation === "object" && validation !== null && "value" in validation ? validation.value : message;
|
|
45
|
+
const routingKey = options?.routingKey ?? publisherDef.routingKey ?? "";
|
|
46
|
+
const content = Buffer.from(JSON.stringify(validatedMessage));
|
|
47
|
+
return this.channel.publish(publisherDef.exchange, routingKey, content, options?.options);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Close the connection
|
|
51
|
+
*/
|
|
52
|
+
async close() {
|
|
53
|
+
if (this.channel) {
|
|
54
|
+
await this.channel.close();
|
|
55
|
+
this.channel = null;
|
|
56
|
+
}
|
|
57
|
+
if (this.connection) {
|
|
58
|
+
await this.connection.close();
|
|
59
|
+
this.connection = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Create a type-safe AMQP client from a contract
|
|
65
|
+
*/
|
|
66
|
+
function createClient(contract) {
|
|
67
|
+
return new AmqpClient(contract);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.AmqpClient = AmqpClient;
|
|
72
|
+
exports.createClient = createClient;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Connection, Options } from "amqplib";
|
|
2
|
+
import { ClientInferPublisherInput, ContractDefinition, InferPublisherNames } from "@amqp-contract/contract";
|
|
3
|
+
|
|
4
|
+
//#region src/client.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for publishing a message
|
|
8
|
+
*/
|
|
9
|
+
interface PublishOptions {
|
|
10
|
+
routingKey?: string;
|
|
11
|
+
options?: Options.Publish;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Type-safe AMQP client for publishing messages
|
|
15
|
+
*/
|
|
16
|
+
declare class AmqpClient<TContract extends ContractDefinition> {
|
|
17
|
+
private readonly contract;
|
|
18
|
+
private channel;
|
|
19
|
+
private connection;
|
|
20
|
+
constructor(contract: TContract);
|
|
21
|
+
/**
|
|
22
|
+
* Connect to AMQP broker
|
|
23
|
+
*/
|
|
24
|
+
connect(connection: Connection): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Publish a message using a defined publisher
|
|
27
|
+
*/
|
|
28
|
+
publish<TName extends InferPublisherNames<TContract>>(publisherName: TName, message: ClientInferPublisherInput<TContract, TName>, options?: PublishOptions): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Close the connection
|
|
31
|
+
*/
|
|
32
|
+
close(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a type-safe AMQP client from a contract
|
|
36
|
+
*/
|
|
37
|
+
declare function createClient<TContract extends ContractDefinition>(contract: TContract): AmqpClient<TContract>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AmqpClient, type PublishOptions, createClient };
|
|
40
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +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;;;;;AAoDtB,cAxDN,UAwDM,CAAA,kBAxDuB,kBAwDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EAtD2B,SAsD3B;EACT;;;EA8DW,OAAA,CAAA,UAAY,EAhHA,UAgHA,CAAA,EAhHiB,OAgHjB,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"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Connection, Options } from "amqplib";
|
|
2
|
+
import { ClientInferPublisherInput, ContractDefinition, InferPublisherNames } from "@amqp-contract/contract";
|
|
3
|
+
|
|
4
|
+
//#region src/client.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for publishing a message
|
|
8
|
+
*/
|
|
9
|
+
interface PublishOptions {
|
|
10
|
+
routingKey?: string;
|
|
11
|
+
options?: Options.Publish;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Type-safe AMQP client for publishing messages
|
|
15
|
+
*/
|
|
16
|
+
declare class AmqpClient<TContract extends ContractDefinition> {
|
|
17
|
+
private readonly contract;
|
|
18
|
+
private channel;
|
|
19
|
+
private connection;
|
|
20
|
+
constructor(contract: TContract);
|
|
21
|
+
/**
|
|
22
|
+
* Connect to AMQP broker
|
|
23
|
+
*/
|
|
24
|
+
connect(connection: Connection): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Publish a message using a defined publisher
|
|
27
|
+
*/
|
|
28
|
+
publish<TName extends InferPublisherNames<TContract>>(publisherName: TName, message: ClientInferPublisherInput<TContract, TName>, options?: PublishOptions): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Close the connection
|
|
31
|
+
*/
|
|
32
|
+
close(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a type-safe AMQP client from a contract
|
|
36
|
+
*/
|
|
37
|
+
declare function createClient<TContract extends ContractDefinition>(contract: TContract): AmqpClient<TContract>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AmqpClient, type PublishOptions, createClient };
|
|
40
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +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;;;;;AAoDtB,cAxDN,UAwDM,CAAA,kBAxDuB,kBAwDvB,CAAA,CAAA;EACoB,iBAAA,QAAA;EAAW,QAAA,OAAA;EAArC,QAAA,UAAA;EACC,WAAA,CAAA,QAAA,EAtD2B,SAsD3B;EACT;;;EA8DW,OAAA,CAAA,UAAY,EAhHA,UAgHA,CAAA,EAhHiB,OAgHjB,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"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//#region src/client.ts
|
|
2
|
+
/**
|
|
3
|
+
* Type-safe AMQP client for publishing messages
|
|
4
|
+
*/
|
|
5
|
+
var AmqpClient = class {
|
|
6
|
+
channel = null;
|
|
7
|
+
connection = null;
|
|
8
|
+
constructor(contract) {
|
|
9
|
+
this.contract = contract;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Connect to AMQP broker
|
|
13
|
+
*/
|
|
14
|
+
async connect(connection) {
|
|
15
|
+
this.connection = connection;
|
|
16
|
+
this.channel = await connection.createChannel();
|
|
17
|
+
if (this.contract.exchanges && this.channel) for (const exchange of Object.values(this.contract.exchanges)) await this.channel.assertExchange(exchange.name, exchange.type, {
|
|
18
|
+
durable: exchange.durable,
|
|
19
|
+
autoDelete: exchange.autoDelete,
|
|
20
|
+
internal: exchange.internal,
|
|
21
|
+
arguments: exchange.arguments
|
|
22
|
+
});
|
|
23
|
+
if (this.contract.queues && this.channel) for (const queue of Object.values(this.contract.queues)) await this.channel.assertQueue(queue.name, {
|
|
24
|
+
durable: queue.durable,
|
|
25
|
+
exclusive: queue.exclusive,
|
|
26
|
+
autoDelete: queue.autoDelete,
|
|
27
|
+
arguments: queue.arguments
|
|
28
|
+
});
|
|
29
|
+
if (this.contract.bindings && this.channel) for (const binding of Object.values(this.contract.bindings)) await this.channel.bindQueue(binding.queue, binding.exchange, binding.routingKey ?? "", binding.arguments);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Publish a message using a defined publisher
|
|
33
|
+
*/
|
|
34
|
+
async publish(publisherName, message, options) {
|
|
35
|
+
if (!this.channel) throw new Error("Client not connected. Call connect() first.");
|
|
36
|
+
const publishers = this.contract.publishers;
|
|
37
|
+
if (!publishers) throw new Error("No publishers defined in contract");
|
|
38
|
+
const publisher = publishers[publisherName];
|
|
39
|
+
if (!publisher || typeof publisher !== "object") throw new Error(`Publisher "${String(publisherName)}" not found in contract`);
|
|
40
|
+
const publisherDef = publisher;
|
|
41
|
+
const validation = publisherDef.message["~standard"].validate(message);
|
|
42
|
+
if (typeof validation === "object" && validation !== null && "issues" in validation && validation.issues) throw new Error(`Message validation failed: ${JSON.stringify(validation.issues)}`);
|
|
43
|
+
const validatedMessage = typeof validation === "object" && validation !== null && "value" in validation ? validation.value : message;
|
|
44
|
+
const routingKey = options?.routingKey ?? publisherDef.routingKey ?? "";
|
|
45
|
+
const content = Buffer.from(JSON.stringify(validatedMessage));
|
|
46
|
+
return this.channel.publish(publisherDef.exchange, routingKey, content, options?.options);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Close the connection
|
|
50
|
+
*/
|
|
51
|
+
async close() {
|
|
52
|
+
if (this.channel) {
|
|
53
|
+
await this.channel.close();
|
|
54
|
+
this.channel = null;
|
|
55
|
+
}
|
|
56
|
+
if (this.connection) {
|
|
57
|
+
await this.connection.close();
|
|
58
|
+
this.connection = null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Create a type-safe AMQP client from a contract
|
|
64
|
+
*/
|
|
65
|
+
function createClient(contract) {
|
|
66
|
+
return new AmqpClient(contract);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { AmqpClient, createClient };
|
|
71
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["contract: TContract"],"sources":["../src/client.ts"],"sourcesContent":["import type { Channel, Connection as AmqpConnection, 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: AmqpConnection | null = null;\n\n constructor(private readonly contract: TContract) {}\n\n /**\n * Connect to AMQP broker\n */\n async connect(connection: AmqpConnection): Promise<void> {\n this.connection = connection;\n this.channel = await (\n connection as unknown as { createChannel(): Promise<Channel> }\n ).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,aAAoC;CAE5C,YAAY,AAAiBA,UAAqB;EAArB;;;;;CAK7B,MAAM,QAAQ,YAA2C;AACvD,OAAK,aAAa;AAClB,OAAK,UAAU,MACb,WACA,eAAe;AAGjB,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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amqp-contract/client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Client utilities for publishing messages using amqp-contract",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"amqp",
|
|
7
|
+
"typescript",
|
|
8
|
+
"contract",
|
|
9
|
+
"client",
|
|
10
|
+
"rabbitmq"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/btravers/amqp-contract#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/btravers/amqp-contract/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/btravers/amqp-contract.git",
|
|
19
|
+
"directory": "packages/client"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Benoit TRAVERS <benoit.travers.fr@gmail.com>",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/index.d.mts",
|
|
28
|
+
"default": "./dist/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/index.d.cts",
|
|
32
|
+
"default": "./dist/index.cjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/index.cjs",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@amqp-contract/contract": "0.0.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/amqplib": "0.10.8",
|
|
48
|
+
"@types/node": "24.10.2",
|
|
49
|
+
"@vitest/coverage-v8": "4.0.15",
|
|
50
|
+
"amqplib": "0.10.9",
|
|
51
|
+
"tsdown": "0.17.2",
|
|
52
|
+
"typescript": "5.9.3",
|
|
53
|
+
"vitest": "4.0.15",
|
|
54
|
+
"@amqp-contract/tsconfig": "0.0.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"amqplib": ">=0.10.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsdown src/index.ts --format cjs,esm --dts --clean",
|
|
61
|
+
"dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"test:watch": "vitest",
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
|
+
}
|
|
66
|
+
}
|