@amqp-contract/valibot 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 +58 -0
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +64 -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,58 @@
|
|
|
1
|
+
# @amqp-contract/valibot
|
|
2
|
+
|
|
3
|
+
Valibot integration for amqp-contract. This package declares peer dependencies for [Valibot](https://valibot.dev/) compatibility with amqp-contract.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @amqp-contract/contract @amqp-contract/valibot valibot
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @amqp-contract/contract @amqp-contract/valibot valibot
|
|
11
|
+
# or
|
|
12
|
+
yarn add @amqp-contract/contract @amqp-contract/valibot valibot
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import * as v from 'valibot';
|
|
19
|
+
import {
|
|
20
|
+
defineContract,
|
|
21
|
+
defineExchange,
|
|
22
|
+
defineQueue,
|
|
23
|
+
definePublisher,
|
|
24
|
+
defineConsumer,
|
|
25
|
+
} from '@amqp-contract/contract';
|
|
26
|
+
|
|
27
|
+
// Define your schemas using Valibot
|
|
28
|
+
const orderSchema = v.object({
|
|
29
|
+
orderId: v.string(),
|
|
30
|
+
amount: v.number(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Define your contract
|
|
34
|
+
const contract = defineContract({
|
|
35
|
+
exchanges: {
|
|
36
|
+
orders: defineExchange('orders', 'topic', { durable: true }),
|
|
37
|
+
},
|
|
38
|
+
queues: {
|
|
39
|
+
orderProcessing: defineQueue('order-processing', { durable: true }),
|
|
40
|
+
},
|
|
41
|
+
publishers: {
|
|
42
|
+
orderCreated: definePublisher('orders', orderSchema),
|
|
43
|
+
},
|
|
44
|
+
consumers: {
|
|
45
|
+
processOrder: defineConsumer('order-processing', orderSchema),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- **Type Safety**: Full TypeScript support with type inference from Valibot schemas
|
|
53
|
+
- **Standard Schema**: Uses the Standard Schema specification for interoperability
|
|
54
|
+
- **Peer Dependency Management**: Declares compatible Valibot versions as peer dependencies
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/dist/index.cjs
ADDED
|
File without changes
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amqp-contract/valibot",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Valibot integration for amqp-contract",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"amqp",
|
|
7
|
+
"typescript",
|
|
8
|
+
"contract",
|
|
9
|
+
"rabbitmq",
|
|
10
|
+
"valibot"
|
|
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/valibot"
|
|
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
|
+
"@vitest/coverage-v8": "4.0.15",
|
|
48
|
+
"tsdown": "0.17.2",
|
|
49
|
+
"typescript": "5.9.3",
|
|
50
|
+
"valibot": "0.42.1",
|
|
51
|
+
"vitest": "4.0.15",
|
|
52
|
+
"@amqp-contract/tsconfig": "0.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"valibot": ">=0.42.0 <1.0.0"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsdown src/index.ts --format cjs,esm --dts --clean",
|
|
59
|
+
"dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:watch": "vitest",
|
|
62
|
+
"typecheck": "tsc --noEmit"
|
|
63
|
+
}
|
|
64
|
+
}
|