@amqp-contract/contract 0.3.4 → 0.4.0

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
@@ -16,76 +16,58 @@
16
16
  pnpm add @amqp-contract/contract
17
17
  ```
18
18
 
19
- ## Usage
19
+ ## Quick Start
20
+
21
+ ### Recommended: Publisher-First / Consumer-First Patterns
22
+
23
+ For robust contract definitions with guaranteed consistency, use `definePublisherFirst` (for events) or `defineConsumerFirst` (for commands):
20
24
 
21
25
  ```typescript
22
- import { defineContract, defineExchange, defineQueue, defineQueueBinding, defineExchangeBinding, definePublisher, defineConsumer, defineMessage } from '@amqp-contract/contract';
26
+ import { definePublisherFirst, defineContract, defineExchange, defineQueue, defineMessage } from '@amqp-contract/contract';
23
27
  import { z } from 'zod';
24
28
 
25
- // Define exchanges and queues first so they can be referenced
29
+ // Event-oriented pattern: publisher doesn't need to know about queues
26
30
  const ordersExchange = defineExchange('orders', 'topic', { durable: true });
27
- const analyticsExchange = defineExchange('analytics', 'topic', { durable: true });
28
- const orderProcessingQueue = defineQueue('order-processing', { durable: true });
29
- const analyticsProcessingQueue = defineQueue('analytics-processing', { durable: true });
30
-
31
- // Define message schemas with metadata
32
- const orderMessage = defineMessage(
33
- z.object({
34
- orderId: z.string(),
35
- amount: z.number(),
36
- }),
37
- {
38
- summary: 'Order created event',
39
- description: 'Emitted when a new order is created',
40
- }
31
+ const orderMessage = defineMessage(z.object({
32
+ orderId: z.string(),
33
+ amount: z.number(),
34
+ }));
35
+
36
+ const orderCreatedEvent = definePublisherFirst(
37
+ ordersExchange,
38
+ orderMessage,
39
+ { routingKey: 'order.created' }
41
40
  );
42
41
 
43
- // Define your contract using object references
42
+ // Multiple queues can consume the same event
43
+ const orderQueue = defineQueue('order-processing', { durable: true });
44
+ const { consumer, binding } = orderCreatedEvent.createConsumer(orderQueue);
45
+
44
46
  const contract = defineContract({
45
- exchanges: {
46
- orders: ordersExchange,
47
- analytics: analyticsExchange,
48
- },
49
- queues: {
50
- orderProcessing: orderProcessingQueue,
51
- analyticsProcessing: analyticsProcessingQueue,
52
- },
53
- bindings: {
54
- // Queue-to-exchange binding
55
- orderBinding: defineQueueBinding(orderProcessingQueue, ordersExchange, {
56
- routingKey: 'order.created',
57
- }),
58
- // Exchange-to-exchange binding
59
- analyticsBinding: defineExchangeBinding(analyticsExchange, ordersExchange, {
60
- routingKey: 'order.#',
61
- }),
62
- // Queue receives from analytics exchange
63
- analyticsQueueBinding: defineQueueBinding(analyticsProcessingQueue, analyticsExchange, {
64
- routingKey: 'order.#',
65
- }),
66
- },
67
- publishers: {
68
- orderCreated: definePublisher(ordersExchange, orderMessage, {
69
- routingKey: 'order.created',
70
- }),
71
- },
72
- consumers: {
73
- processOrder: defineConsumer(orderProcessingQueue, orderMessage, {
74
- prefetch: 10,
75
- }),
76
- processAnalytics: defineConsumer(analyticsProcessingQueue, orderMessage),
77
- },
47
+ exchanges: { orders: ordersExchange },
48
+ queues: { orderQueue },
49
+ bindings: { orderBinding: binding },
50
+ publishers: { orderCreated: orderCreatedEvent.publisher },
51
+ consumers: { processOrder: consumer },
78
52
  });
79
53
  ```
80
54
 
81
- ## API
55
+ **Benefits:**
82
56
 
83
- For complete API documentation, see the [Contract API Reference](https://btravers.github.io/amqp-contract/api/contract).
57
+ - Guaranteed message schema consistency between publishers and consumers
58
+ - ✅ Automatic routing key synchronization
59
+ - ✅ Full type safety with TypeScript inference
60
+ - ✅ Event-oriented (publisher-first) and command-oriented (consumer-first) patterns
84
61
 
85
62
  ## Documentation
86
63
 
87
64
  📖 **[Read the full documentation →](https://btravers.github.io/amqp-contract)**
88
65
 
66
+ - [Getting Started Guide](https://btravers.github.io/amqp-contract/guide/defining-contracts)
67
+ - [Publisher-First Pattern](https://btravers.github.io/amqp-contract/guide/defining-contracts#publisher-first-pattern)
68
+ - [Consumer-First Pattern](https://btravers.github.io/amqp-contract/guide/defining-contracts#consumer-first-pattern)
69
+ - [Complete API Reference](https://btravers.github.io/amqp-contract/api/contract)
70
+
89
71
  ## License
90
72
 
91
73
  MIT
package/dist/index.cjs CHANGED
@@ -287,13 +287,67 @@ function defineConsumer(queue, message, options) {
287
287
  function defineContract(definition) {
288
288
  return definition;
289
289
  }
290
+ /**
291
+ * Helper to call definePublisher with proper type handling.
292
+ * Type safety is enforced by overloaded public function signatures.
293
+ * @internal
294
+ */
295
+ function callDefinePublisher(exchange, message, options) {
296
+ if (exchange.type === "fanout") return definePublisher(exchange, message, options);
297
+ return definePublisher(exchange, message, options);
298
+ }
299
+ /**
300
+ * Helper to call defineQueueBinding with proper type handling.
301
+ * Type safety is enforced by overloaded public function signatures.
302
+ * @internal
303
+ */
304
+ function callDefineQueueBinding(queue, exchange, options) {
305
+ if (exchange.type === "fanout") return defineQueueBinding(queue, exchange, options);
306
+ return defineQueueBinding(queue, exchange, options);
307
+ }
308
+ /**
309
+ * Implementation of definePublisherFirst.
310
+ * @internal
311
+ */
312
+ function definePublisherFirst(exchange, message, options) {
313
+ const publisher = callDefinePublisher(exchange, message, options);
314
+ const createConsumer = (queue) => {
315
+ const binding = callDefineQueueBinding(queue, exchange, options);
316
+ return {
317
+ consumer: defineConsumer(queue, message),
318
+ binding
319
+ };
320
+ };
321
+ return {
322
+ publisher,
323
+ createConsumer
324
+ };
325
+ }
326
+ /**
327
+ * Implementation of defineConsumerFirst.
328
+ * @internal
329
+ */
330
+ function defineConsumerFirst(queue, exchange, message, options) {
331
+ const consumer = defineConsumer(queue, message);
332
+ const binding = callDefineQueueBinding(queue, exchange, options);
333
+ const createPublisher = () => {
334
+ return callDefinePublisher(exchange, message, options);
335
+ };
336
+ return {
337
+ consumer,
338
+ binding,
339
+ createPublisher
340
+ };
341
+ }
290
342
 
291
343
  //#endregion
292
344
  exports.defineConsumer = defineConsumer;
345
+ exports.defineConsumerFirst = defineConsumerFirst;
293
346
  exports.defineContract = defineContract;
294
347
  exports.defineExchange = defineExchange;
295
348
  exports.defineExchangeBinding = defineExchangeBinding;
296
349
  exports.defineMessage = defineMessage;
297
350
  exports.definePublisher = definePublisher;
351
+ exports.definePublisherFirst = definePublisherFirst;
298
352
  exports.defineQueue = defineQueue;
299
353
  exports.defineQueueBinding = defineQueueBinding;
package/dist/index.d.cts CHANGED
@@ -855,6 +855,284 @@ declare function defineConsumer<TMessage extends MessageDefinition>(queue: Queue
855
855
  * ```
856
856
  */
857
857
  declare function defineContract<TContract extends ContractDefinition>(definition: TContract): TContract;
858
+ /**
859
+ * Publisher-first builder result.
860
+ *
861
+ * This type represents a publisher and provides a method to create
862
+ * a consumer that uses the same message schema with a binding to the exchange.
863
+ *
864
+ * This pattern is suitable for event-oriented messaging where publishers
865
+ * emit events without knowing which queues will consume them.
866
+ *
867
+ * @template TMessage - The message definition
868
+ * @template TPublisher - The publisher definition
869
+ */
870
+ type PublisherFirstResult<TMessage extends MessageDefinition, TPublisher extends PublisherDefinition<TMessage>> = {
871
+ /** The publisher definition */
872
+ publisher: TPublisher;
873
+ /**
874
+ * Create a consumer that receives messages from this publisher.
875
+ * The consumer will automatically use the same message schema and
876
+ * a binding will be created with the same routing key.
877
+ *
878
+ * @param queue - The queue that will consume the messages
879
+ * @returns An object with the consumer definition and binding
880
+ */
881
+ createConsumer: (queue: QueueDefinition) => {
882
+ consumer: ConsumerDefinition<TMessage>;
883
+ binding: QueueBindingDefinition;
884
+ };
885
+ };
886
+ /**
887
+ * Define a publisher-first relationship for event-oriented messaging.
888
+ *
889
+ * This builder enforces consistency by:
890
+ * 1. Ensuring the publisher and consumer use the same message schema
891
+ * 2. Linking the routing key from the publisher to the binding
892
+ *
893
+ * Use this pattern for events where publishers don't need to know about queues.
894
+ * Multiple consumers can be created for different queues, all using the same message schema.
895
+ *
896
+ * @param exchange - The exchange to publish to (fanout type)
897
+ * @param message - The message definition (schema and metadata)
898
+ * @param options - Optional binding configuration
899
+ * @returns A publisher-first result with publisher and consumer factory
900
+ *
901
+ * @example
902
+ * ```typescript
903
+ * import { z } from 'zod';
904
+ *
905
+ * const logsExchange = defineExchange('logs', 'fanout', { durable: true });
906
+ * const logMessage = defineMessage(
907
+ * z.object({
908
+ * level: z.enum(['info', 'warn', 'error']),
909
+ * message: z.string(),
910
+ * })
911
+ * );
912
+ *
913
+ * // Create publisher-first relationship (event pattern)
914
+ * const logEvent = definePublisherFirst(logsExchange, logMessage);
915
+ *
916
+ * // Multiple queues can consume the same event
917
+ * const logsQueue1 = defineQueue('logs-queue-1', { durable: true });
918
+ * const logsQueue2 = defineQueue('logs-queue-2', { durable: true });
919
+ *
920
+ * // Use in contract
921
+ * const { consumer: consumer1, binding: binding1 } = logEvent.createConsumer(logsQueue1);
922
+ * const { consumer: consumer2, binding: binding2 } = logEvent.createConsumer(logsQueue2);
923
+ *
924
+ * const contract = defineContract({
925
+ * exchanges: { logs: logsExchange },
926
+ * queues: { logsQueue1, logsQueue2 },
927
+ * bindings: {
928
+ * logBinding1: binding1,
929
+ * logBinding2: binding2,
930
+ * },
931
+ * publishers: { publishLog: logEvent.publisher },
932
+ * consumers: {
933
+ * consumeLog1: consumer1,
934
+ * consumeLog2: consumer2,
935
+ * },
936
+ * });
937
+ * ```
938
+ */
939
+ declare function definePublisherFirst<TMessage extends MessageDefinition>(exchange: FanoutExchangeDefinition, message: TMessage, options?: Omit<Extract<QueueBindingDefinition, {
940
+ exchange: FanoutExchangeDefinition;
941
+ }>, "type" | "queue" | "exchange" | "routingKey">): PublisherFirstResult<TMessage, Extract<PublisherDefinition<TMessage>, {
942
+ exchange: FanoutExchangeDefinition;
943
+ }>>;
944
+ /**
945
+ * Define a publisher-first relationship for event-oriented messaging.
946
+ *
947
+ * This builder enforces consistency by:
948
+ * 1. Ensuring the publisher and consumer use the same message schema
949
+ * 2. Linking the routing key from the publisher to the binding
950
+ *
951
+ * Use this pattern for events where publishers don't need to know about queues.
952
+ * Multiple consumers can be created for different queues, all using the same message schema.
953
+ *
954
+ * @param exchange - The exchange to publish to (direct or topic type)
955
+ * @param message - The message definition (schema and metadata)
956
+ * @param options - Binding configuration (routingKey is required)
957
+ * @param options.routingKey - The routing key for message routing
958
+ * @returns A publisher-first result with publisher and consumer factory
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * import { z } from 'zod';
963
+ *
964
+ * const ordersExchange = defineExchange('orders', 'topic', { durable: true });
965
+ * const orderMessage = defineMessage(
966
+ * z.object({
967
+ * orderId: z.string(),
968
+ * amount: z.number(),
969
+ * })
970
+ * );
971
+ *
972
+ * // Create publisher-first relationship with routing key (event pattern)
973
+ * const orderCreatedEvent = definePublisherFirst(
974
+ * ordersExchange,
975
+ * orderMessage,
976
+ * { routingKey: 'order.created' }
977
+ * );
978
+ *
979
+ * // Multiple queues can consume the same event
980
+ * const orderQueue = defineQueue('order-processing', { durable: true });
981
+ * const analyticsQueue = defineQueue('analytics', { durable: true });
982
+ *
983
+ * // Use in contract - routing key is consistent across publisher and bindings
984
+ * const { consumer: processConsumer, binding: processBinding } = orderCreatedEvent.createConsumer(orderQueue);
985
+ * const { consumer: analyticsConsumer, binding: analyticsBinding } = orderCreatedEvent.createConsumer(analyticsQueue);
986
+ *
987
+ * const contract = defineContract({
988
+ * exchanges: { orders: ordersExchange },
989
+ * queues: { orderQueue, analyticsQueue },
990
+ * bindings: {
991
+ * orderBinding: processBinding,
992
+ * analyticsBinding,
993
+ * },
994
+ * publishers: { orderCreated: orderCreatedEvent.publisher },
995
+ * consumers: {
996
+ * processOrder: processConsumer,
997
+ * trackOrder: analyticsConsumer,
998
+ * },
999
+ * });
1000
+ * ```
1001
+ */
1002
+ declare function definePublisherFirst<TMessage extends MessageDefinition>(exchange: DirectExchangeDefinition | TopicExchangeDefinition, message: TMessage, options: Omit<Extract<QueueBindingDefinition, {
1003
+ exchange: DirectExchangeDefinition | TopicExchangeDefinition;
1004
+ }>, "type" | "queue" | "exchange">): PublisherFirstResult<TMessage, Extract<PublisherDefinition<TMessage>, {
1005
+ exchange: DirectExchangeDefinition | TopicExchangeDefinition;
1006
+ }>>;
1007
+ /**
1008
+ * Consumer-first builder result.
1009
+ *
1010
+ * This type represents a consumer with its binding and provides a method to create
1011
+ * a publisher that uses the same message schema and routing key.
1012
+ *
1013
+ * @template TMessage - The message definition
1014
+ * @template TConsumer - The consumer definition
1015
+ * @template TBinding - The queue binding definition
1016
+ */
1017
+ type ConsumerFirstResult<TMessage extends MessageDefinition, TConsumer extends ConsumerDefinition<TMessage>, TBinding extends QueueBindingDefinition> = {
1018
+ /** The consumer definition */
1019
+ consumer: TConsumer;
1020
+ /** The binding definition connecting the exchange to the queue */
1021
+ binding: TBinding;
1022
+ /**
1023
+ * Create a publisher that sends messages to this consumer.
1024
+ * The publisher will automatically use the same message schema and routing key.
1025
+ *
1026
+ * @returns A publisher definition with the same message type and routing key
1027
+ */
1028
+ createPublisher: () => PublisherDefinition<TMessage>;
1029
+ };
1030
+ /**
1031
+ * Define a consumer-first relationship between a consumer and publisher.
1032
+ *
1033
+ * This builder enforces consistency by:
1034
+ * 1. Ensuring the consumer and publisher use the same message schema
1035
+ * 2. Linking the routing key from the binding to the publisher
1036
+ * 3. Creating a binding that connects the exchange to the queue
1037
+ *
1038
+ * Use this when you want to start with a consumer and ensure publishers
1039
+ * send messages of the correct type.
1040
+ *
1041
+ * @param queue - The queue to consume from
1042
+ * @param exchange - The exchange that routes to the queue (fanout type)
1043
+ * @param message - The message definition (schema and metadata)
1044
+ * @param options - Optional binding configuration
1045
+ * @returns A consumer-first result with consumer, binding, and publisher factory
1046
+ *
1047
+ * @example
1048
+ * ```typescript
1049
+ * import { z } from 'zod';
1050
+ *
1051
+ * const notificationsQueue = defineQueue('notifications', { durable: true });
1052
+ * const notificationsExchange = defineExchange('notifications', 'fanout', { durable: true });
1053
+ * const notificationMessage = defineMessage(
1054
+ * z.object({
1055
+ * userId: z.string(),
1056
+ * message: z.string(),
1057
+ * })
1058
+ * );
1059
+ *
1060
+ * // Create consumer-first relationship
1061
+ * const notificationConsumerFirst = defineConsumerFirst(
1062
+ * notificationsQueue,
1063
+ * notificationsExchange,
1064
+ * notificationMessage
1065
+ * );
1066
+ *
1067
+ * // Use in contract
1068
+ * const contract = defineContract({
1069
+ * exchanges: { notifications: notificationsExchange },
1070
+ * queues: { notificationsQueue },
1071
+ * bindings: { notificationBinding: notificationConsumerFirst.binding },
1072
+ * publishers: { sendNotification: notificationConsumerFirst.createPublisher() },
1073
+ * consumers: { processNotification: notificationConsumerFirst.consumer },
1074
+ * });
1075
+ * ```
1076
+ */
1077
+ declare function defineConsumerFirst<TMessage extends MessageDefinition>(queue: QueueDefinition, exchange: FanoutExchangeDefinition, message: TMessage, options?: Omit<Extract<QueueBindingDefinition, {
1078
+ exchange: FanoutExchangeDefinition;
1079
+ }>, "type" | "queue" | "exchange" | "routingKey">): ConsumerFirstResult<TMessage, ConsumerDefinition<TMessage>, Extract<QueueBindingDefinition, {
1080
+ exchange: FanoutExchangeDefinition;
1081
+ }>>;
1082
+ /**
1083
+ * Define a consumer-first relationship between a consumer and publisher.
1084
+ *
1085
+ * This builder enforces consistency by:
1086
+ * 1. Ensuring the consumer and publisher use the same message schema
1087
+ * 2. Linking the routing key from the binding to the publisher
1088
+ * 3. Creating a binding that connects the exchange to the queue
1089
+ *
1090
+ * Use this when you want to start with a consumer and ensure publishers
1091
+ * send messages with the correct type and routing key.
1092
+ *
1093
+ * @param queue - The queue to consume from
1094
+ * @param exchange - The exchange that routes to the queue (direct or topic type)
1095
+ * @param message - The message definition (schema and metadata)
1096
+ * @param options - Binding configuration (routingKey is required)
1097
+ * @param options.routingKey - The routing key for message routing
1098
+ * @returns A consumer-first result with consumer, binding, and publisher factory
1099
+ *
1100
+ * @example
1101
+ * ```typescript
1102
+ * import { z } from 'zod';
1103
+ *
1104
+ * const taskQueue = defineQueue('tasks', { durable: true });
1105
+ * const tasksExchange = defineExchange('tasks', 'direct', { durable: true });
1106
+ * const taskMessage = defineMessage(
1107
+ * z.object({
1108
+ * taskId: z.string(),
1109
+ * payload: z.record(z.unknown()),
1110
+ * })
1111
+ * );
1112
+ *
1113
+ * // Create consumer-first relationship with routing key
1114
+ * const taskConsumerFirst = defineConsumerFirst(
1115
+ * taskQueue,
1116
+ * tasksExchange,
1117
+ * taskMessage,
1118
+ * { routingKey: 'task.execute' }
1119
+ * );
1120
+ *
1121
+ * // Use in contract - routing key is consistent across consumer and publisher
1122
+ * const contract = defineContract({
1123
+ * exchanges: { tasks: tasksExchange },
1124
+ * queues: { taskQueue },
1125
+ * bindings: { taskBinding: taskConsumerFirst.binding },
1126
+ * publishers: { executeTask: taskConsumerFirst.createPublisher() },
1127
+ * consumers: { processTask: taskConsumerFirst.consumer },
1128
+ * });
1129
+ * ```
1130
+ */
1131
+ declare function defineConsumerFirst<TMessage extends MessageDefinition>(queue: QueueDefinition, exchange: DirectExchangeDefinition | TopicExchangeDefinition, message: TMessage, options: Omit<Extract<QueueBindingDefinition, {
1132
+ exchange: DirectExchangeDefinition | TopicExchangeDefinition;
1133
+ }>, "type" | "queue" | "exchange">): ConsumerFirstResult<TMessage, ConsumerDefinition<TMessage>, Extract<QueueBindingDefinition, {
1134
+ exchange: DirectExchangeDefinition | TopicExchangeDefinition;
1135
+ }>>;
858
1136
  //#endregion
859
- export { type AnySchema, type BaseExchangeDefinition, type BindingDefinition, type ConsumerDefinition, type ContractDefinition, type DirectExchangeDefinition, type ExchangeBindingDefinition, type ExchangeDefinition, type FanoutExchangeDefinition, type InferConsumerNames, type InferPublisherNames, type MessageDefinition, type PublisherDefinition, type QueueBindingDefinition, type QueueDefinition, type TopicExchangeDefinition, defineConsumer, defineContract, defineExchange, defineExchangeBinding, defineMessage, definePublisher, defineQueue, defineQueueBinding };
1137
+ export { type AnySchema, type BaseExchangeDefinition, type BindingDefinition, type ConsumerDefinition, type ConsumerFirstResult, type ContractDefinition, type DirectExchangeDefinition, type ExchangeBindingDefinition, type ExchangeDefinition, type FanoutExchangeDefinition, type InferConsumerNames, type InferPublisherNames, type MessageDefinition, type PublisherDefinition, type PublisherFirstResult, type QueueBindingDefinition, type QueueDefinition, type TopicExchangeDefinition, defineConsumer, defineConsumerFirst, defineContract, defineExchange, defineExchangeBinding, defineMessage, definePublisher, definePublisherFirst, defineQueue, defineQueueBinding };
860
1138
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/builder.ts"],"sourcesContent":[],"mappings":";;;;;;AAWA;AAQA;AA6CA;AAiBA;AAqBA;AASA;;AAEI,KAtGQ,SAAA,GAAY,gBAsGpB;;;AASJ;AAuDA;;;AAEoC,KAhKxB,sBAAA,GAgKwB;EAAjB;;;EAYC,IAAA,EAAA,MAAA;EAsBR;;;;EAe+B,OAAA,CAAA,EAAA,OAAA;EAU3B;;AAuBhB;;EAUc,UAAA,CAAA,EAAA,OAAA;EAIA;;;;AAsBd;EAmBY,QAAA,CAAA,EAAA,OAAA;EAAqC;;;;EAMN,SAAA,CAAA,EAlR7B,MAkR6B,CAAA,MAAA,EAAA,OAAA,CAAA;CAS3B;;AAsBhB;;;;;;AAyCA;;;;;;AAiBa,KA3VD,wBAAA,GAA2B,sBA2V1B,GAAA;EAOiB,IAAA,EAAA,QAAA;CAAf;;;;AAyBf;;;;;;AAkBA;;;;AACiE,KA7XrD,wBAAA,GAA2B,sBA6X0B,GAAA;EAAS,IAAA,EAAA,QAAA;;;;ACxa1E;;;;;AA4BA;;;;;AA6BA;;;;;AAwDgB,KDjDJ,uBAAA,GAA0B,sBCiDX,GAAA;EAEV,IAAA,EAAA,OAAA;CAAL;;;AA2CZ;;;AAEmB,KDvFP,kBAAA,GACR,wBCsFe,GDrFf,wBCqFe,GDpFf,uBCoFe;;;;;;;AAmCH,KD/GJ,eAAA,GC+GsB;EACzB;;;EAGuC,IAAA,EAAA,MAAA;EAA5C;;;;EAGD,OAAA,CAAA,EAAA,OAAA;EAAO;AAoCV;;;;EAKM,SAAA,CAAA,EAAA,OAAA;EACY;;;;EAKhB,UAAA,CAAA,EAAA,OAAA;EACY;;;;AA6Dd;;;;;;;;;;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