@venizia/ignis-helpers 0.4.2 → 0.4.3

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.
Files changed (183) hide show
  1. package/dist/cjs/common/types/field-mapping.d.ts +13 -1
  2. package/dist/cjs/common/types/field-mapping.d.ts.map +1 -1
  3. package/dist/cjs/common/types/field-mapping.js +20 -0
  4. package/dist/cjs/common/types/field-mapping.js.map +1 -1
  5. package/dist/cjs/core.d.ts +2 -1
  6. package/dist/cjs/core.d.ts.map +1 -1
  7. package/dist/cjs/core.js +6 -1
  8. package/dist/cjs/core.js.map +1 -1
  9. package/dist/cjs/modules/crypto/algorithms/aes.algorithm.d.ts +2 -2
  10. package/dist/cjs/modules/crypto/algorithms/aes.algorithm.d.ts.map +1 -1
  11. package/dist/cjs/modules/crypto/algorithms/aes.algorithm.js +3 -1
  12. package/dist/cjs/modules/crypto/algorithms/aes.algorithm.js.map +1 -1
  13. package/dist/cjs/modules/crypto/algorithms/aes.constants.d.ts +11 -0
  14. package/dist/cjs/modules/crypto/algorithms/aes.constants.d.ts.map +1 -0
  15. package/dist/cjs/modules/crypto/algorithms/aes.constants.js +14 -0
  16. package/dist/cjs/modules/crypto/algorithms/aes.constants.js.map +1 -0
  17. package/dist/cjs/modules/error/index.d.ts +1 -1
  18. package/dist/cjs/modules/error/index.d.ts.map +1 -1
  19. package/dist/cjs/modules/error/index.js +2 -1
  20. package/dist/cjs/modules/error/index.js.map +1 -1
  21. package/dist/cjs/modules/logger/hf/common/types.d.ts +3 -1
  22. package/dist/cjs/modules/logger/hf/common/types.d.ts.map +1 -1
  23. package/dist/cjs/modules/logger/hf/common/types.js.map +1 -1
  24. package/dist/cjs/modules/logger/pino/common/constants.d.ts +10 -1
  25. package/dist/cjs/modules/logger/pino/common/constants.d.ts.map +1 -1
  26. package/dist/cjs/modules/logger/pino/common/constants.js +11 -1
  27. package/dist/cjs/modules/logger/pino/common/constants.js.map +1 -1
  28. package/dist/cjs/modules/logger/pino/destination.d.ts.map +1 -1
  29. package/dist/cjs/modules/logger/pino/destination.js +4 -3
  30. package/dist/cjs/modules/logger/pino/destination.js.map +1 -1
  31. package/dist/cjs/modules/network/http-request/common/constants.d.ts +11 -0
  32. package/dist/cjs/modules/network/http-request/common/constants.d.ts.map +1 -0
  33. package/dist/cjs/modules/network/http-request/common/constants.js +14 -0
  34. package/dist/cjs/modules/network/http-request/common/constants.js.map +1 -0
  35. package/dist/cjs/modules/network/http-request/common/index.d.ts +1 -0
  36. package/dist/cjs/modules/network/http-request/common/index.d.ts.map +1 -1
  37. package/dist/cjs/modules/network/http-request/common/index.js +1 -0
  38. package/dist/cjs/modules/network/http-request/common/index.js.map +1 -1
  39. package/dist/cjs/modules/network/http-request/common/types.d.ts +1 -1
  40. package/dist/cjs/modules/network/http-request/common/types.d.ts.map +1 -1
  41. package/dist/cjs/modules/network/http-request/common/types.js.map +1 -1
  42. package/dist/cjs/modules/network/tcp-socket/base-tcp-server.helper.d.ts +13 -2
  43. package/dist/cjs/modules/network/tcp-socket/base-tcp-server.helper.d.ts.map +1 -1
  44. package/dist/cjs/modules/network/tcp-socket/base-tcp-server.helper.js +23 -6
  45. package/dist/cjs/modules/network/tcp-socket/base-tcp-server.helper.js.map +1 -1
  46. package/dist/cjs/modules/queue/common/constants.d.ts +11 -0
  47. package/dist/cjs/modules/queue/common/constants.d.ts.map +1 -0
  48. package/dist/cjs/modules/queue/common/constants.js +14 -0
  49. package/dist/cjs/modules/queue/common/constants.js.map +1 -0
  50. package/dist/cjs/modules/queue/common/index.d.ts +1 -0
  51. package/dist/cjs/modules/queue/common/index.d.ts.map +1 -1
  52. package/dist/cjs/modules/queue/common/index.js +1 -0
  53. package/dist/cjs/modules/queue/common/index.js.map +1 -1
  54. package/dist/cjs/modules/queue/common/types.d.ts +1 -1
  55. package/dist/cjs/modules/queue/common/types.d.ts.map +1 -1
  56. package/dist/cjs/modules/queue/common/types.js.map +1 -1
  57. package/dist/cjs/modules/queue/kafka/common/constants.d.ts +9 -0
  58. package/dist/cjs/modules/queue/kafka/common/constants.d.ts.map +1 -1
  59. package/dist/cjs/modules/queue/kafka/common/constants.js +11 -1
  60. package/dist/cjs/modules/queue/kafka/common/constants.js.map +1 -1
  61. package/dist/cjs/modules/queue/kafka/consumer.d.ts +2 -1
  62. package/dist/cjs/modules/queue/kafka/consumer.d.ts.map +1 -1
  63. package/dist/cjs/modules/queue/kafka/consumer.js +2 -2
  64. package/dist/cjs/modules/queue/kafka/consumer.js.map +1 -1
  65. package/dist/cjs/modules/temporal/common/constants.d.ts +21 -0
  66. package/dist/cjs/modules/temporal/common/constants.d.ts.map +1 -1
  67. package/dist/cjs/modules/temporal/common/constants.js +22 -1
  68. package/dist/cjs/modules/temporal/common/constants.js.map +1 -1
  69. package/dist/cjs/modules/temporal/locale/locale.d.ts +4 -3
  70. package/dist/cjs/modules/temporal/locale/locale.d.ts.map +1 -1
  71. package/dist/cjs/modules/temporal/locale/locale.js +2 -1
  72. package/dist/cjs/modules/temporal/locale/locale.js.map +1 -1
  73. package/dist/cjs/modules/temporal/pattern/common/constants.d.ts +43 -0
  74. package/dist/cjs/modules/temporal/pattern/common/constants.d.ts.map +1 -0
  75. package/dist/cjs/modules/temporal/pattern/common/constants.js +74 -0
  76. package/dist/cjs/modules/temporal/pattern/common/constants.js.map +1 -0
  77. package/dist/cjs/modules/temporal/pattern/common/index.d.ts +1 -0
  78. package/dist/cjs/modules/temporal/pattern/common/index.d.ts.map +1 -1
  79. package/dist/cjs/modules/temporal/pattern/common/index.js +1 -0
  80. package/dist/cjs/modules/temporal/pattern/common/index.js.map +1 -1
  81. package/dist/cjs/modules/temporal/pattern/common/types.d.ts +2 -11
  82. package/dist/cjs/modules/temporal/pattern/common/types.d.ts.map +1 -1
  83. package/dist/cjs/modules/temporal/pattern/common/types.js.map +1 -1
  84. package/dist/cjs/modules/temporal/pattern/tokens.d.ts +2 -1
  85. package/dist/cjs/modules/temporal/pattern/tokens.d.ts.map +1 -1
  86. package/dist/cjs/modules/temporal/pattern/tokens.js +2 -14
  87. package/dist/cjs/modules/temporal/pattern/tokens.js.map +1 -1
  88. package/dist/cjs/utilities/request.utility.d.ts +21 -2
  89. package/dist/cjs/utilities/request.utility.d.ts.map +1 -1
  90. package/dist/cjs/utilities/request.utility.js +25 -5
  91. package/dist/cjs/utilities/request.utility.js.map +1 -1
  92. package/dist/esm/common/types/field-mapping.d.ts +13 -1
  93. package/dist/esm/common/types/field-mapping.d.ts.map +1 -1
  94. package/dist/esm/common/types/field-mapping.js +18 -1
  95. package/dist/esm/common/types/field-mapping.js.map +1 -1
  96. package/dist/esm/core.d.ts +2 -1
  97. package/dist/esm/core.d.ts.map +1 -1
  98. package/dist/esm/core.js +4 -0
  99. package/dist/esm/core.js.map +1 -1
  100. package/dist/esm/modules/crypto/algorithms/aes.algorithm.d.ts +2 -2
  101. package/dist/esm/modules/crypto/algorithms/aes.algorithm.d.ts.map +1 -1
  102. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js +2 -0
  103. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js.map +1 -1
  104. package/dist/esm/modules/crypto/algorithms/aes.constants.d.ts +11 -0
  105. package/dist/esm/modules/crypto/algorithms/aes.constants.d.ts.map +1 -0
  106. package/dist/esm/modules/crypto/algorithms/aes.constants.js +10 -0
  107. package/dist/esm/modules/crypto/algorithms/aes.constants.js.map +1 -0
  108. package/dist/esm/modules/error/index.d.ts +1 -1
  109. package/dist/esm/modules/error/index.d.ts.map +1 -1
  110. package/dist/esm/modules/error/index.js +1 -1
  111. package/dist/esm/modules/error/index.js.map +1 -1
  112. package/dist/esm/modules/logger/hf/common/types.d.ts +3 -1
  113. package/dist/esm/modules/logger/hf/common/types.d.ts.map +1 -1
  114. package/dist/esm/modules/logger/hf/common/types.js.map +1 -1
  115. package/dist/esm/modules/logger/pino/common/constants.d.ts +10 -1
  116. package/dist/esm/modules/logger/pino/common/constants.d.ts.map +1 -1
  117. package/dist/esm/modules/logger/pino/common/constants.js +9 -0
  118. package/dist/esm/modules/logger/pino/common/constants.js.map +1 -1
  119. package/dist/esm/modules/logger/pino/destination.d.ts.map +1 -1
  120. package/dist/esm/modules/logger/pino/destination.js +4 -3
  121. package/dist/esm/modules/logger/pino/destination.js.map +1 -1
  122. package/dist/esm/modules/network/http-request/common/constants.d.ts +11 -0
  123. package/dist/esm/modules/network/http-request/common/constants.d.ts.map +1 -0
  124. package/dist/esm/modules/network/http-request/common/constants.js +10 -0
  125. package/dist/esm/modules/network/http-request/common/constants.js.map +1 -0
  126. package/dist/esm/modules/network/http-request/common/index.d.ts +1 -0
  127. package/dist/esm/modules/network/http-request/common/index.d.ts.map +1 -1
  128. package/dist/esm/modules/network/http-request/common/index.js +1 -0
  129. package/dist/esm/modules/network/http-request/common/index.js.map +1 -1
  130. package/dist/esm/modules/network/http-request/common/types.d.ts +1 -1
  131. package/dist/esm/modules/network/http-request/common/types.d.ts.map +1 -1
  132. package/dist/esm/modules/network/http-request/common/types.js.map +1 -1
  133. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.d.ts +13 -2
  134. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.d.ts.map +1 -1
  135. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js +21 -5
  136. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js.map +1 -1
  137. package/dist/esm/modules/queue/common/constants.d.ts +11 -0
  138. package/dist/esm/modules/queue/common/constants.d.ts.map +1 -0
  139. package/dist/esm/modules/queue/common/constants.js +10 -0
  140. package/dist/esm/modules/queue/common/constants.js.map +1 -0
  141. package/dist/esm/modules/queue/common/index.d.ts +1 -0
  142. package/dist/esm/modules/queue/common/index.d.ts.map +1 -1
  143. package/dist/esm/modules/queue/common/index.js +1 -0
  144. package/dist/esm/modules/queue/common/index.js.map +1 -1
  145. package/dist/esm/modules/queue/common/types.d.ts +1 -1
  146. package/dist/esm/modules/queue/common/types.d.ts.map +1 -1
  147. package/dist/esm/modules/queue/common/types.js.map +1 -1
  148. package/dist/esm/modules/queue/kafka/common/constants.d.ts +9 -0
  149. package/dist/esm/modules/queue/kafka/common/constants.d.ts.map +1 -1
  150. package/dist/esm/modules/queue/kafka/common/constants.js +9 -0
  151. package/dist/esm/modules/queue/kafka/common/constants.js.map +1 -1
  152. package/dist/esm/modules/queue/kafka/consumer.d.ts +2 -1
  153. package/dist/esm/modules/queue/kafka/consumer.d.ts.map +1 -1
  154. package/dist/esm/modules/queue/kafka/consumer.js +3 -3
  155. package/dist/esm/modules/queue/kafka/consumer.js.map +1 -1
  156. package/dist/esm/modules/temporal/common/constants.d.ts +21 -0
  157. package/dist/esm/modules/temporal/common/constants.d.ts.map +1 -1
  158. package/dist/esm/modules/temporal/common/constants.js +19 -0
  159. package/dist/esm/modules/temporal/common/constants.js.map +1 -1
  160. package/dist/esm/modules/temporal/locale/locale.d.ts +4 -3
  161. package/dist/esm/modules/temporal/locale/locale.d.ts.map +1 -1
  162. package/dist/esm/modules/temporal/locale/locale.js +2 -1
  163. package/dist/esm/modules/temporal/locale/locale.js.map +1 -1
  164. package/dist/esm/modules/temporal/pattern/common/constants.d.ts +43 -0
  165. package/dist/esm/modules/temporal/pattern/common/constants.d.ts.map +1 -0
  166. package/dist/esm/modules/temporal/pattern/common/constants.js +70 -0
  167. package/dist/esm/modules/temporal/pattern/common/constants.js.map +1 -0
  168. package/dist/esm/modules/temporal/pattern/common/index.d.ts +1 -0
  169. package/dist/esm/modules/temporal/pattern/common/index.d.ts.map +1 -1
  170. package/dist/esm/modules/temporal/pattern/common/index.js +1 -0
  171. package/dist/esm/modules/temporal/pattern/common/index.js.map +1 -1
  172. package/dist/esm/modules/temporal/pattern/common/types.d.ts +2 -11
  173. package/dist/esm/modules/temporal/pattern/common/types.d.ts.map +1 -1
  174. package/dist/esm/modules/temporal/pattern/common/types.js.map +1 -1
  175. package/dist/esm/modules/temporal/pattern/tokens.d.ts +2 -1
  176. package/dist/esm/modules/temporal/pattern/tokens.d.ts.map +1 -1
  177. package/dist/esm/modules/temporal/pattern/tokens.js +2 -14
  178. package/dist/esm/modules/temporal/pattern/tokens.js.map +1 -1
  179. package/dist/esm/utilities/request.utility.d.ts +21 -2
  180. package/dist/esm/utilities/request.utility.d.ts.map +1 -1
  181. package/dist/esm/utilities/request.utility.js +22 -4
  182. package/dist/esm/utilities/request.utility.js.map +1 -1
  183. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/consumer.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,6DAAkD;AAClD,iEAAsD;AAStD,+CAA+C;AAC/C,sCAAuC;AACvC,iCAAyC;AACzC,kDAA2F;AAiB3F;;;;GAIG;AACH,MAAa,mBAKX,SAAQ,sBAA6E;IA6CrF,YAAY,IAA+E;QACzF,KAAK,CAAC;YACJ,KAAK,EAAE,mBAAmB,CAAC,IAAI;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,gBAAgB;YAC/C,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC;YACrD,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAC;QApDK,WAAM,GACd,IAAI,CAAC;QACG,gBAAW,GAAyB,IAAI,CAAC;QACzC,wBAAmB,GAAqC,IAAI,CAAC;QAC7D,wBAAmB,GAAG,KAAK,CAAC;QAC5B,yBAAoB,GAAmD,IAAI,CAAC;QAC5E,uBAAkB,GAAG,KAAK,CAAC;QAgDnC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C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\nimport { toError } from '@/utilities/promise.utility';\nimport type {\n ConsumerGroupJoinPayload,\n ConsumerGroupLeavePayload,\n ConsumerGroupRebalancePayload,\n ConsumerHeartbeatErrorPayload,\n MessagesStream,\n Offsets,\n} from '@platformatic/kafka';\nimport { Consumer } from '@platformatic/kafka';\nimport { invokeHook } from '../common';\nimport { BaseKafkaHelper } from './base';\nimport { KafkaClientEvents, KafkaDefaults, KafkaHealthStatuses } from './common/constants';\nimport type {\n IKafkaConsumeStartOptions,\n IKafkaConsumerOptions,\n TKafkaGroupJoinCallback,\n TKafkaGroupLeaveCallback,\n TKafkaGroupRebalanceCallback,\n TKafkaHeartbeatErrorCallback,\n TKafkaLagCallback,\n TKafkaLagErrorCallback,\n TKafkaMessageCallback,\n TKafkaMessageDoneCallback,\n TKafkaMessageErrorCallback,\n TKafkaReconnectErrorCallback,\n TKafkaStreamErrorCallback,\n} from './common/types';\n\n/**\n * Wrapper around `@platformatic/kafka` Consumer with lifecycle management, health tracking, graceful shutdown, message callbacks, and lag monitoring.\n *\n * Every member below is `protected`, not `private`, so a consumer extends this class instead of forking it. That visibility is not a stable contract between minor versions.\n */\nexport class KafkaConsumerHelper<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n> extends BaseKafkaHelper<Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>> {\n protected stream: MessagesStream<KeyType, ValueType, HeaderKeyType, HeaderValueType> | null =\n null;\n protected consumeLoop: Promise<void> | null = null;\n protected consumeStartOptions: IKafkaConsumeStartOptions | null = null;\n protected lagMonitoringActive = false;\n protected lagMonitoringOptions: { topics: string[]; interval?: number } | null = null;\n protected sessionLikelyStale = false;\n\n protected readonly onMessage?: TKafkaMessageCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onMessageDone?: TKafkaMessageDoneCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onMessageError?: TKafkaMessageErrorCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onStreamError?: TKafkaStreamErrorCallback;\n protected readonly onReconnectError?: TKafkaReconnectErrorCallback;\n\n protected readonly onGroupJoin?: TKafkaGroupJoinCallback;\n protected readonly onGroupLeave?: TKafkaGroupLeaveCallback;\n protected readonly onGroupRebalance?: TKafkaGroupRebalanceCallback;\n protected readonly onHeartbeatError?: TKafkaHeartbeatErrorCallback;\n\n protected readonly onLag?: TKafkaLagCallback;\n protected readonly onLagError?: TKafkaLagErrorCallback;\n\n protected readonly initialOptions: IKafkaConsumerOptions<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n\n constructor(opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>) {\n super({\n scope: KafkaConsumerHelper.name,\n identifier: opts.identifier ?? 'kafka-consumer',\n shutdownTimeout: opts.shutdownTimeout,\n client: KafkaConsumerHelper.buildConsumerClient(opts),\n onBrokerConnect: opts.onBrokerConnect,\n onBrokerDisconnect: opts.onBrokerDisconnect,\n });\n\n this.initialOptions = opts;\n this.onMessage = opts.onMessage;\n this.onMessageDone = opts.onMessageDone;\n this.onMessageError = opts.onMessageError;\n this.onStreamError = opts.onStreamError;\n this.onReconnectError = opts.onReconnectError;\n this.onGroupJoin = opts.onGroupJoin;\n this.onGroupLeave = opts.onGroupLeave;\n this.onGroupRebalance = opts.onGroupRebalance;\n this.onHeartbeatError = opts.onHeartbeatError;\n this.onLag = opts.onLag;\n this.onLagError = opts.onLagError;\n\n this.configureBrokerEvents();\n\n this.logger.info(\n '[constructor] Kafka Consumer CREATED | ClientId: %s | GroupId: %s | Brokers: %j',\n opts.clientId,\n opts.groupId,\n opts.bootstrapBrokers,\n );\n }\n\n static newInstance<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n >(opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>) {\n return new KafkaConsumerHelper<KeyType, ValueType, HeaderKeyType, HeaderValueType>(opts);\n }\n\n /** The instance seam every rebuild goes through; the constructor alone uses the static factory because no instance exists yet. Override this to hand a rebuilt consumer different options or a test double. */\n protected buildClient(opts: {\n options: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return KafkaConsumerHelper.buildConsumerClient(opts.options);\n }\n\n protected static buildConsumerClient<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n >(\n opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>,\n ): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return new Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>({\n clientId: opts.clientId,\n bootstrapBrokers: opts.bootstrapBrokers,\n sasl: opts.sasl,\n tls: opts.tls,\n ssl: opts.ssl,\n connectTimeout: opts.connectTimeout,\n requestTimeout: opts.requestTimeout,\n groupId: opts.groupId,\n groupInstanceId: opts.groupInstanceId,\n groupProtocol: opts.groupProtocol ?? KafkaDefaults.GROUP_PROTOCOL,\n deserializers: opts.deserializers,\n autocommit: opts.autocommit ?? KafkaDefaults.AUTOCOMMIT,\n sessionTimeout: opts.sessionTimeout ?? KafkaDefaults.SESSION_TIMEOUT,\n heartbeatInterval: opts.heartbeatInterval ?? KafkaDefaults.HEARTBEAT_INTERVAL,\n rebalanceTimeout:\n opts.rebalanceTimeout ?? opts.sessionTimeout ?? KafkaDefaults.SESSION_TIMEOUT,\n highWaterMark: opts.highWaterMark ?? KafkaDefaults.HIGH_WATER_MARK,\n minBytes: opts.minBytes ?? KafkaDefaults.MIN_BYTES,\n maxBytes: opts.maxBytes ?? KafkaDefaults.MAX_BYTES,\n maxWaitTime: opts.maxWaitTime ?? KafkaDefaults.MAX_WAIT_TIME,\n metadataMaxAge: opts.metadataMaxAge ?? KafkaDefaults.METADATA_MAX_AGE,\n retries: opts.retries ?? KafkaDefaults.RETRIES,\n retryDelay: opts.retryDelay ?? KafkaDefaults.RETRY_DELAY,\n registry: opts.registry,\n });\n }\n\n getConsumer(): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return this.client;\n }\n\n getStream(): MessagesStream<KeyType, ValueType, HeaderKeyType, HeaderValueType> | null {\n return this.stream;\n }\n\n override isReady(): boolean {\n return this.healthStatus === KafkaHealthStatuses.CONNECTED && this.client.isActive();\n }\n\n async start(opts: IKafkaConsumeStartOptions): Promise<void> {\n if (this.stream) {\n this.logger.warn('[start] Consumer already started, ignoring duplicate start call');\n return;\n }\n\n this.logger.info('[start] Starting consumer | Topics: %j', opts.topics);\n\n this.consumeStartOptions = opts;\n this.stream = await this.client.consume({\n topics: opts.topics,\n mode: opts.mode ?? KafkaDefaults.CONSUME_MODE,\n fallbackMode: opts.fallbackMode ?? KafkaDefaults.CONSUME_FALLBACK_MODE,\n });\n\n // Successful consume() means we're freshly joined to the group; clear any stale-session flag set during initial broker negotiation (e.g. a transient BROKER_DISCONNECT during bootstrap).\n this.sessionLikelyStale = false;\n\n // Always attached, hook or not: a stream 'error' with ZERO listeners is rethrown by EventEmitter as an uncaught exception, so a pull-style consumer (start() + getStream(), no onMessage/onMessageError) would take the whole process down on the first broker drop.\n const startedStream = this.stream;\n startedStream.on(KafkaClientEvents.STREAM_ERROR, (streamError: Error) => {\n this.logger.for('start').error('Kafka stream ERROR | Error: %s', streamError);\n this.reportStreamError({ error: streamError, scope: 'start', stream: startedStream });\n });\n\n if (this.onMessage) {\n const loop = this.startConsumeLoop({\n messageHandler: this.onMessage,\n doneHandler: this.onMessageDone,\n errorHandler: this.onMessageError,\n reconnectDelayMs: opts.reconnectDelayMs ?? KafkaDefaults.RECONNECT_DELAY,\n maxReconnectAttempts: opts.maxReconnectAttempts ?? KafkaDefaults.MAX_RECONNECT_ATTEMPTS,\n }).finally(() => {\n // A finished loop (exhausted reconnects or shutdown) no longer reports stream errors; the listeners take over.\n if (this.consumeLoop === loop) {\n this.consumeLoop = null;\n }\n });\n this.consumeLoop = loop;\n }\n\n this.logger.info('[start] Consumer started | Topics: %j', opts.topics);\n }\n\n startLagMonitoring(opts: { topics: string[]; interval?: number }): void {\n if (this.lagMonitoringActive) {\n this.logger.warn(\n '[startLagMonitoring] Lag monitoring already active, ignoring duplicate call',\n );\n return;\n }\n\n const interval = opts.interval ?? KafkaDefaults.LAG_MONITOR_INTERVAL;\n this.client.startLagMonitoring({ topics: opts.topics }, interval);\n this.lagMonitoringActive = true;\n this.lagMonitoringOptions = { topics: opts.topics, interval };\n\n this.logger.info(\n '[startLagMonitoring] Lag monitoring STARTED | Topics: %j | Interval: %dms',\n opts.topics,\n interval,\n );\n }\n\n stopLagMonitoring(): void {\n if (!this.lagMonitoringActive) {\n return;\n }\n\n this.client.stopLagMonitoring();\n this.lagMonitoringActive = false;\n this.lagMonitoringOptions = null;\n\n this.logger.info('[stopLagMonitoring] Lag monitoring STOPPED');\n }\n\n protected override closeClient(): Promise<void> {\n return this.closeClientWithCallback();\n }\n\n async close(opts?: { isForce?: boolean }): Promise<void> {\n const force = opts?.isForce ?? false;\n\n this.stopLagMonitoring();\n await this.closeStream();\n\n if (force) {\n await this.closeClient();\n } else {\n try {\n await this.gracefulCloseClient();\n } catch (error) {\n this.logger.warn('[close] Graceful shutdown timed out, forcing close | Error: %s', error);\n await this.closeClient();\n }\n }\n\n this.resetHealthState();\n this.logger.info('[close] Consumer closed | Force: %s', force);\n }\n\n protected async startConsumeLoop(opts: {\n messageHandler: TKafkaMessageCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n doneHandler?: TKafkaMessageDoneCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n reconnectDelayMs: number;\n maxReconnectAttempts: number;\n }): Promise<void> {\n const { messageHandler, doneHandler, errorHandler, reconnectDelayMs, maxReconnectAttempts } =\n opts;\n\n const messages = this.consumeMessages({\n reconnectDelayMs,\n maxReconnectAttempts,\n errorHandler,\n });\n for await (const message of messages) {\n try {\n await messageHandler({ message });\n await doneHandler?.({ message });\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[startConsumeLoop] Message processing error: %s',\n normalizedError.message,\n );\n invokeHook({\n logger: this.logger,\n scope: 'startConsumeLoop',\n execution: () => errorHandler?.({ error: normalizedError, message }),\n });\n }\n }\n }\n\n protected async *consumeMessages(opts: {\n reconnectDelayMs: number;\n maxReconnectAttempts: number;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }) {\n const { reconnectDelayMs, maxReconnectAttempts, errorHandler } = opts;\n let consecutiveErrors = 0;\n\n while (true) {\n if (this.stream) {\n yield* this.drainStream({ errorHandler });\n }\n\n if (!this.consumeStartOptions) {\n this.logger.info('[consumeMessages] Shutdown requested, exiting consume loop');\n return;\n }\n\n consecutiveErrors++;\n if (consecutiveErrors > maxReconnectAttempts) {\n this.logger.error(\n '[consumeMessages] All %d reconnect attempts exhausted | Topics: %j',\n maxReconnectAttempts,\n this.consumeStartOptions?.topics,\n );\n return;\n }\n\n await this.attemptReconnect({\n attempt: consecutiveErrors,\n maxAttempts: maxReconnectAttempts,\n delayMs: reconnectDelayMs,\n errorHandler,\n });\n\n if (!this.consumeStartOptions) {\n this.logger.info(\n '[consumeMessages] Shutdown requested during reconnect, exiting consume loop',\n );\n return;\n }\n\n if (this.stream) {\n consecutiveErrors = 0;\n }\n }\n }\n\n /** Silent only while the consume loop is alive AND the erroring stream is the one it drains - the iterator then reports the same error once. A dead or replaced stream, or pull mode, reports here. */\n protected reportStreamError(opts: { error: Error; scope: string; stream: unknown }): void {\n if (this.consumeLoop && this.stream === opts.stream) {\n return;\n }\n\n invokeHook({\n logger: this.logger,\n scope: opts.scope,\n execution: () =>\n this.onStreamError\n ? this.onStreamError({ error: opts.error })\n : this.onMessageError?.({ error: opts.error }),\n });\n }\n\n protected async *drainStream(opts: {\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }) {\n this.logger.debug('[drainStream] Consuming | Topics: %j', this.consumeStartOptions?.topics);\n\n try {\n yield* this.stream!;\n this.logger.warn(\n '[drainStream] Stream ended normally | Topics: %j',\n this.consumeStartOptions?.topics,\n );\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[drainStream] Stream error: %s | Topics: %j',\n normalizedError.message,\n this.consumeStartOptions?.topics,\n );\n invokeHook({\n logger: this.logger,\n scope: 'drainStream',\n execution: () =>\n this.onStreamError\n ? this.onStreamError({ error: normalizedError })\n : opts.errorHandler?.({ error: normalizedError }),\n });\n }\n\n this.destroyDeadStream();\n }\n\n protected async attemptReconnect(opts: {\n attempt: number;\n maxAttempts: number;\n delayMs: number;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }): Promise<void> {\n const { attempt, maxAttempts, delayMs, errorHandler } = opts;\n\n this.logger.info(\n '[attemptReconnect] Reconnecting %d/%d in %dms | Topics: %j | ConnectedBrokers: %d',\n attempt,\n maxAttempts,\n delayMs,\n this.consumeStartOptions?.topics,\n this.getConnectedBrokerCount(),\n );\n await sleep(delayMs);\n\n if (!this.consumeStartOptions) {\n return;\n }\n\n const shouldRebuildClient = this.sessionLikelyStale;\n\n if (shouldRebuildClient) {\n this.logger.warn(\n '[attemptReconnect] Session stale flag is set, will rebuild client | Attempt: %d',\n attempt,\n );\n }\n\n if (shouldRebuildClient) {\n try {\n await this.rebuildClient();\n this.sessionLikelyStale = false;\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[attemptReconnect] Client rebuild failed (%d/%d): %s | Topics: %j',\n attempt,\n maxAttempts,\n normalizedError.message,\n this.consumeStartOptions?.topics,\n );\n invokeHook({\n logger: this.logger,\n scope: 'attemptReconnect',\n execution: () =>\n this.onReconnectError\n ? this.onReconnectError({ error: normalizedError, attempt, maxAttempts })\n : errorHandler?.({ error: normalizedError }),\n });\n return;\n }\n }\n\n try {\n this.stream = await this.client.consume({\n topics: this.consumeStartOptions.topics,\n mode: this.consumeStartOptions.mode ?? KafkaDefaults.CONSUME_MODE,\n fallbackMode: this.consumeStartOptions.fallbackMode ?? KafkaDefaults.CONSUME_FALLBACK_MODE,\n });\n\n // Always attached, hook or not, like the listener in start(): a stream 'error' with ZERO listeners is rethrown by EventEmitter and takes the process down.\n const reconnectedStream = this.stream;\n reconnectedStream.on(KafkaClientEvents.STREAM_ERROR, (streamError: Error) => {\n this.logger.for('attemptReconnect').error('Kafka stream ERROR | Error: %s', streamError);\n this.reportStreamError({\n error: streamError,\n scope: 'attemptReconnect',\n stream: reconnectedStream,\n });\n });\n\n this.sessionLikelyStale = false;\n\n this.logger.info(\n '[attemptReconnect] Reconnected successfully | Topics: %j | Attempt: %d | Rebuilt: %s',\n this.consumeStartOptions.topics,\n attempt,\n shouldRebuildClient,\n );\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[attemptReconnect] Failed (%d/%d): %s | Topics: %j | ConnectedBrokers: %d',\n attempt,\n maxAttempts,\n normalizedError.message,\n this.consumeStartOptions?.topics,\n this.getConnectedBrokerCount(),\n );\n invokeHook({\n logger: this.logger,\n scope: 'attemptReconnect',\n execution: () =>\n this.onReconnectError\n ? this.onReconnectError({ error: normalizedError, attempt, maxAttempts })\n : errorHandler?.({ error: normalizedError }),\n });\n }\n }\n\n protected async rebuildClient(): Promise<void> {\n this.logger.warn(\n '[rebuildClient] All brokers were disconnected; rebuilding @platformatic/kafka ' +\n 'Consumer to force a clean group rejoin (cached session state is stale)',\n );\n\n const oldClient = this.client;\n const newClient = this.buildClient({ options: this.initialOptions });\n\n this.swapClient(newClient);\n\n if (this.lagMonitoringOptions) {\n const opts = this.lagMonitoringOptions;\n this.lagMonitoringActive = false; // reset so startLagMonitoring won't refuse\n try {\n this.startLagMonitoring(opts);\n this.logger.info(\n '[rebuildClient] Lag monitoring re-armed on new client | Topics: %j',\n opts.topics,\n );\n } catch (error) {\n this.logger.warn(\n '[rebuildClient] Failed to restart lag monitoring on new client | Error: %s',\n toError(error).message,\n );\n }\n }\n\n this.closeOldClient(oldClient).catch((error) => {\n this.logger.warn(\n '[rebuildClient] background close of old client failed (ignored) | Error: %s',\n toError(error).message,\n );\n });\n }\n\n protected async closeOldClient(\n oldClient: Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>,\n ): Promise<void> {\n let timeoutHandle: NodeJS.Timeout | null = null;\n try {\n await Promise.race([\n new Promise<void>((resolve, reject) => {\n oldClient.close(true, (normalizedError?: Error | null) => {\n if (normalizedError) {\n reject(normalizedError);\n } else {\n resolve();\n }\n });\n }),\n new Promise<void>((resolve) => {\n timeoutHandle = setTimeout(resolve, this.shutdownTimeout);\n }),\n ]);\n } finally {\n if (timeoutHandle !== null) {\n clearTimeout(timeoutHandle);\n }\n }\n }\n\n protected handleAllBrokersDown(reason: 'disconnected' | 'failed'): void {\n if (this.getConnectedBrokerCount() !== 0) {\n return;\n }\n this.sessionLikelyStale = true;\n if (this.stream) {\n this.logger.warn(\n '[configureBrokerEvents] All brokers %s, destroying stream to trigger reconnect',\n reason,\n );\n this.destroyDeadStream();\n }\n }\n\n protected destroyDeadStream(): void {\n this.stream?.destroy(getError({ message: '[destroyDeadStream] All brokers disconnected' }));\n this.stream = null;\n }\n\n protected async closeStream(): Promise<void> {\n const stream = this.stream;\n this.stream = null;\n this.consumeStartOptions = null;\n\n try {\n await stream?.close();\n } catch (error) {\n this.logger.warn('[closeStream] Error closing stream: %s', toError(error).message);\n }\n\n await this.consumeLoop;\n this.consumeLoop = null;\n }\n\n protected override unconfigureBrokerEvents(): void {\n super.unconfigureBrokerEvents();\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_JOIN);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_LEAVE);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_REBALANCE);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_HEARTBEAT_ERROR);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_LAG);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_LAG_ERROR);\n }\n\n protected override configureBrokerEvents(): void {\n super.configureBrokerEvents();\n\n this.client.on(KafkaClientEvents.BROKER_DISCONNECT, () => {\n this.handleAllBrokersDown('disconnected');\n });\n this.client.on(KafkaClientEvents.BROKER_FAILED, () => {\n this.handleAllBrokersDown('failed');\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_GROUP_JOIN, (payload: ConsumerGroupJoinPayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group JOINED | GroupId: %s | MemberId: %s | GenerationId: %d',\n payload.groupId,\n payload.memberId,\n payload.generationId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onGroupJoin?.({\n groupId: payload.groupId,\n memberId: payload.memberId,\n generationId: payload.generationId,\n }),\n });\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_GROUP_LEAVE, (payload: ConsumerGroupLeavePayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group LEFT | GroupId: %s | MemberId: %s',\n payload.groupId,\n payload.memberId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onGroupLeave?.({\n groupId: payload.groupId,\n memberId: payload.memberId,\n }),\n });\n });\n\n this.client.on(\n KafkaClientEvents.CONSUMER_GROUP_REBALANCE,\n (payload: ConsumerGroupRebalancePayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group REBALANCE | GroupId: %s',\n payload.groupId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onGroupRebalance?.({ groupId: payload.groupId }),\n });\n },\n );\n\n this.client.on(\n KafkaClientEvents.CONSUMER_HEARTBEAT_ERROR,\n (payload: ConsumerHeartbeatErrorPayload) => {\n this.logger.error(\n '[configureConsumerEvents] Heartbeat ERROR | GroupId: %s | MemberId: %s | Error: %s',\n payload.groupId,\n payload.memberId,\n payload.error,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onHeartbeatError?.({\n error: payload.error,\n groupId: payload.groupId,\n memberId: payload.memberId,\n }),\n });\n },\n );\n\n this.client.on(KafkaClientEvents.CONSUMER_LAG, (lag: Offsets) => {\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onLag?.({ lag }),\n });\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_LAG_ERROR, (error: Error) => {\n this.logger.error('[configureConsumerEvents] Lag monitoring ERROR: %s', error);\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onLagError?.({ error }),\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/consumer.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,6DAAkD;AAClD,iEAAsD;AAStD,+CAA+C;AAC/C,sCAAuC;AACvC,iCAAyC;AACzC,kDAM4B;AAiB5B;;;;GAIG;AACH,MAAa,mBAKX,SAAQ,sBAA6E;IA6CrF,YAAY,IAA+E;QACzF,KAAK,CAAC;YACJ,KAAK,EAAE,mBAAmB,CAAC,IAAI;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,gBAAgB;YAC/C,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC;YACrD,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAC;QApDK,WAAM,GACd,IAAI,CAAC;QACG,gBAAW,GAAyB,IAAI,CAAC;QACzC,wBAAmB,GAAqC,IAAI,CAAC;QAC7D,wBAAmB,GAAG,KAAK,CAAC;QAC5B,yBAAoB,GAAmD,IAAI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,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,uBAAuB;gBAC9B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;aAC9C,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9qBD,kDA8qBC","sourcesContent":["import { getError } from '@/modules/error';\nimport { sleep } from '@/utilities/sleep.utility';\nimport { toError } from '@/utilities/promise.utility';\nimport type {\n ConsumerGroupJoinPayload,\n ConsumerGroupLeavePayload,\n ConsumerGroupRebalancePayload,\n ConsumerHeartbeatErrorPayload,\n MessagesStream,\n Offsets,\n} from '@platformatic/kafka';\nimport { Consumer } from '@platformatic/kafka';\nimport { invokeHook } from '../common';\nimport { BaseKafkaHelper } from './base';\nimport {\n KafkaBrokersDownReasons,\n KafkaClientEvents,\n KafkaDefaults,\n KafkaHealthStatuses,\n type TKafkaBrokersDownReason,\n} from './common/constants';\nimport type {\n IKafkaConsumeStartOptions,\n IKafkaConsumerOptions,\n TKafkaGroupJoinCallback,\n TKafkaGroupLeaveCallback,\n TKafkaGroupRebalanceCallback,\n TKafkaHeartbeatErrorCallback,\n TKafkaLagCallback,\n TKafkaLagErrorCallback,\n TKafkaMessageCallback,\n TKafkaMessageDoneCallback,\n TKafkaMessageErrorCallback,\n TKafkaReconnectErrorCallback,\n TKafkaStreamErrorCallback,\n} from './common/types';\n\n/**\n * Wrapper around `@platformatic/kafka` Consumer with lifecycle management, health tracking, graceful shutdown, message callbacks, and lag monitoring.\n *\n * Every member below is `protected`, not `private`, so a consumer extends this class instead of forking it. That visibility is not a stable contract between minor versions.\n */\nexport class KafkaConsumerHelper<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n> extends BaseKafkaHelper<Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>> {\n protected stream: MessagesStream<KeyType, ValueType, HeaderKeyType, HeaderValueType> | null =\n null;\n protected consumeLoop: Promise<void> | null = null;\n protected consumeStartOptions: IKafkaConsumeStartOptions | null = null;\n protected lagMonitoringActive = false;\n protected lagMonitoringOptions: { topics: string[]; interval?: number } | null = null;\n protected sessionLikelyStale = false;\n\n protected readonly onMessage?: TKafkaMessageCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onMessageDone?: TKafkaMessageDoneCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onMessageError?: TKafkaMessageErrorCallback<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n protected readonly onStreamError?: TKafkaStreamErrorCallback;\n protected readonly onReconnectError?: TKafkaReconnectErrorCallback;\n\n protected readonly onGroupJoin?: TKafkaGroupJoinCallback;\n protected readonly onGroupLeave?: TKafkaGroupLeaveCallback;\n protected readonly onGroupRebalance?: TKafkaGroupRebalanceCallback;\n protected readonly onHeartbeatError?: TKafkaHeartbeatErrorCallback;\n\n protected readonly onLag?: TKafkaLagCallback;\n protected readonly onLagError?: TKafkaLagErrorCallback;\n\n protected readonly initialOptions: IKafkaConsumerOptions<\n KeyType,\n ValueType,\n HeaderKeyType,\n HeaderValueType\n >;\n\n constructor(opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>) {\n super({\n scope: KafkaConsumerHelper.name,\n identifier: opts.identifier ?? 'kafka-consumer',\n shutdownTimeout: opts.shutdownTimeout,\n client: KafkaConsumerHelper.buildConsumerClient(opts),\n onBrokerConnect: opts.onBrokerConnect,\n onBrokerDisconnect: opts.onBrokerDisconnect,\n });\n\n this.initialOptions = opts;\n this.onMessage = opts.onMessage;\n this.onMessageDone = opts.onMessageDone;\n this.onMessageError = opts.onMessageError;\n this.onStreamError = opts.onStreamError;\n this.onReconnectError = opts.onReconnectError;\n this.onGroupJoin = opts.onGroupJoin;\n this.onGroupLeave = opts.onGroupLeave;\n this.onGroupRebalance = opts.onGroupRebalance;\n this.onHeartbeatError = opts.onHeartbeatError;\n this.onLag = opts.onLag;\n this.onLagError = opts.onLagError;\n\n this.configureBrokerEvents();\n\n this.logger.info(\n '[constructor] Kafka Consumer CREATED | ClientId: %s | GroupId: %s | Brokers: %j',\n opts.clientId,\n opts.groupId,\n opts.bootstrapBrokers,\n );\n }\n\n static newInstance<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n >(opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>) {\n return new KafkaConsumerHelper<KeyType, ValueType, HeaderKeyType, HeaderValueType>(opts);\n }\n\n /** The instance seam every rebuild goes through; the constructor alone uses the static factory because no instance exists yet. Override this to hand a rebuilt consumer different options or a test double. */\n protected buildClient(opts: {\n options: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return KafkaConsumerHelper.buildConsumerClient(opts.options);\n }\n\n protected static buildConsumerClient<\n KeyType = string,\n ValueType = string,\n HeaderKeyType = string,\n HeaderValueType = string,\n >(\n opts: IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueType>,\n ): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return new Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>({\n clientId: opts.clientId,\n bootstrapBrokers: opts.bootstrapBrokers,\n sasl: opts.sasl,\n tls: opts.tls,\n ssl: opts.ssl,\n connectTimeout: opts.connectTimeout,\n requestTimeout: opts.requestTimeout,\n groupId: opts.groupId,\n groupInstanceId: opts.groupInstanceId,\n groupProtocol: opts.groupProtocol ?? KafkaDefaults.GROUP_PROTOCOL,\n deserializers: opts.deserializers,\n autocommit: opts.autocommit ?? KafkaDefaults.AUTOCOMMIT,\n sessionTimeout: opts.sessionTimeout ?? KafkaDefaults.SESSION_TIMEOUT,\n heartbeatInterval: opts.heartbeatInterval ?? KafkaDefaults.HEARTBEAT_INTERVAL,\n rebalanceTimeout:\n opts.rebalanceTimeout ?? opts.sessionTimeout ?? KafkaDefaults.SESSION_TIMEOUT,\n highWaterMark: opts.highWaterMark ?? KafkaDefaults.HIGH_WATER_MARK,\n minBytes: opts.minBytes ?? KafkaDefaults.MIN_BYTES,\n maxBytes: opts.maxBytes ?? KafkaDefaults.MAX_BYTES,\n maxWaitTime: opts.maxWaitTime ?? KafkaDefaults.MAX_WAIT_TIME,\n metadataMaxAge: opts.metadataMaxAge ?? KafkaDefaults.METADATA_MAX_AGE,\n retries: opts.retries ?? KafkaDefaults.RETRIES,\n retryDelay: opts.retryDelay ?? KafkaDefaults.RETRY_DELAY,\n registry: opts.registry,\n });\n }\n\n getConsumer(): Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType> {\n return this.client;\n }\n\n getStream(): MessagesStream<KeyType, ValueType, HeaderKeyType, HeaderValueType> | null {\n return this.stream;\n }\n\n override isReady(): boolean {\n return this.healthStatus === KafkaHealthStatuses.CONNECTED && this.client.isActive();\n }\n\n async start(opts: IKafkaConsumeStartOptions): Promise<void> {\n if (this.stream) {\n this.logger.warn('[start] Consumer already started, ignoring duplicate start call');\n return;\n }\n\n this.logger.info('[start] Starting consumer | Topics: %j', opts.topics);\n\n this.consumeStartOptions = opts;\n this.stream = await this.client.consume({\n topics: opts.topics,\n mode: opts.mode ?? KafkaDefaults.CONSUME_MODE,\n fallbackMode: opts.fallbackMode ?? KafkaDefaults.CONSUME_FALLBACK_MODE,\n });\n\n // Successful consume() means we're freshly joined to the group; clear any stale-session flag set during initial broker negotiation (e.g. a transient BROKER_DISCONNECT during bootstrap).\n this.sessionLikelyStale = false;\n\n // Always attached, hook or not: a stream 'error' with ZERO listeners is rethrown by EventEmitter as an uncaught exception, so a pull-style consumer (start() + getStream(), no onMessage/onMessageError) would take the whole process down on the first broker drop.\n const startedStream = this.stream;\n startedStream.on(KafkaClientEvents.STREAM_ERROR, (streamError: Error) => {\n this.logger.for('start').error('Kafka stream ERROR | Error: %s', streamError);\n this.reportStreamError({ error: streamError, scope: 'start', stream: startedStream });\n });\n\n if (this.onMessage) {\n const loop = this.startConsumeLoop({\n messageHandler: this.onMessage,\n doneHandler: this.onMessageDone,\n errorHandler: this.onMessageError,\n reconnectDelayMs: opts.reconnectDelayMs ?? KafkaDefaults.RECONNECT_DELAY,\n maxReconnectAttempts: opts.maxReconnectAttempts ?? KafkaDefaults.MAX_RECONNECT_ATTEMPTS,\n }).finally(() => {\n // A finished loop (exhausted reconnects or shutdown) no longer reports stream errors; the listeners take over.\n if (this.consumeLoop === loop) {\n this.consumeLoop = null;\n }\n });\n this.consumeLoop = loop;\n }\n\n this.logger.info('[start] Consumer started | Topics: %j', opts.topics);\n }\n\n startLagMonitoring(opts: { topics: string[]; interval?: number }): void {\n if (this.lagMonitoringActive) {\n this.logger.warn(\n '[startLagMonitoring] Lag monitoring already active, ignoring duplicate call',\n );\n return;\n }\n\n const interval = opts.interval ?? KafkaDefaults.LAG_MONITOR_INTERVAL;\n this.client.startLagMonitoring({ topics: opts.topics }, interval);\n this.lagMonitoringActive = true;\n this.lagMonitoringOptions = { topics: opts.topics, interval };\n\n this.logger.info(\n '[startLagMonitoring] Lag monitoring STARTED | Topics: %j | Interval: %dms',\n opts.topics,\n interval,\n );\n }\n\n stopLagMonitoring(): void {\n if (!this.lagMonitoringActive) {\n return;\n }\n\n this.client.stopLagMonitoring();\n this.lagMonitoringActive = false;\n this.lagMonitoringOptions = null;\n\n this.logger.info('[stopLagMonitoring] Lag monitoring STOPPED');\n }\n\n protected override closeClient(): Promise<void> {\n return this.closeClientWithCallback();\n }\n\n async close(opts?: { isForce?: boolean }): Promise<void> {\n const force = opts?.isForce ?? false;\n\n this.stopLagMonitoring();\n await this.closeStream();\n\n if (force) {\n await this.closeClient();\n } else {\n try {\n await this.gracefulCloseClient();\n } catch (error) {\n this.logger.warn('[close] Graceful shutdown timed out, forcing close | Error: %s', error);\n await this.closeClient();\n }\n }\n\n this.resetHealthState();\n this.logger.info('[close] Consumer closed | Force: %s', force);\n }\n\n protected async startConsumeLoop(opts: {\n messageHandler: TKafkaMessageCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n doneHandler?: TKafkaMessageDoneCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n reconnectDelayMs: number;\n maxReconnectAttempts: number;\n }): Promise<void> {\n const { messageHandler, doneHandler, errorHandler, reconnectDelayMs, maxReconnectAttempts } =\n opts;\n\n const messages = this.consumeMessages({\n reconnectDelayMs,\n maxReconnectAttempts,\n errorHandler,\n });\n for await (const message of messages) {\n try {\n await messageHandler({ message });\n await doneHandler?.({ message });\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[startConsumeLoop] Message processing error: %s',\n normalizedError.message,\n );\n invokeHook({\n logger: this.logger,\n scope: 'startConsumeLoop',\n execution: () => errorHandler?.({ error: normalizedError, message }),\n });\n }\n }\n }\n\n protected async *consumeMessages(opts: {\n reconnectDelayMs: number;\n maxReconnectAttempts: number;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }) {\n const { reconnectDelayMs, maxReconnectAttempts, errorHandler } = opts;\n let consecutiveErrors = 0;\n\n while (true) {\n if (this.stream) {\n yield* this.drainStream({ errorHandler });\n }\n\n if (!this.consumeStartOptions) {\n this.logger.info('[consumeMessages] Shutdown requested, exiting consume loop');\n return;\n }\n\n consecutiveErrors++;\n if (consecutiveErrors > maxReconnectAttempts) {\n this.logger.error(\n '[consumeMessages] All %d reconnect attempts exhausted | Topics: %j',\n maxReconnectAttempts,\n this.consumeStartOptions?.topics,\n );\n return;\n }\n\n await this.attemptReconnect({\n attempt: consecutiveErrors,\n maxAttempts: maxReconnectAttempts,\n delayMs: reconnectDelayMs,\n errorHandler,\n });\n\n if (!this.consumeStartOptions) {\n this.logger.info(\n '[consumeMessages] Shutdown requested during reconnect, exiting consume loop',\n );\n return;\n }\n\n if (this.stream) {\n consecutiveErrors = 0;\n }\n }\n }\n\n /** Silent only while the consume loop is alive AND the erroring stream is the one it drains - the iterator then reports the same error once. A dead or replaced stream, or pull mode, reports here. */\n protected reportStreamError(opts: { error: Error; scope: string; stream: unknown }): void {\n if (this.consumeLoop && this.stream === opts.stream) {\n return;\n }\n\n invokeHook({\n logger: this.logger,\n scope: opts.scope,\n execution: () =>\n this.onStreamError\n ? this.onStreamError({ error: opts.error })\n : this.onMessageError?.({ error: opts.error }),\n });\n }\n\n protected async *drainStream(opts: {\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }) {\n this.logger.debug('[drainStream] Consuming | Topics: %j', this.consumeStartOptions?.topics);\n\n try {\n yield* this.stream!;\n this.logger.warn(\n '[drainStream] Stream ended normally | Topics: %j',\n this.consumeStartOptions?.topics,\n );\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[drainStream] Stream error: %s | Topics: %j',\n normalizedError.message,\n this.consumeStartOptions?.topics,\n );\n invokeHook({\n logger: this.logger,\n scope: 'drainStream',\n execution: () =>\n this.onStreamError\n ? this.onStreamError({ error: normalizedError })\n : opts.errorHandler?.({ error: normalizedError }),\n });\n }\n\n this.destroyDeadStream();\n }\n\n protected async attemptReconnect(opts: {\n attempt: number;\n maxAttempts: number;\n delayMs: number;\n errorHandler?: TKafkaMessageErrorCallback<KeyType, ValueType, HeaderKeyType, HeaderValueType>;\n }): Promise<void> {\n const { attempt, maxAttempts, delayMs, errorHandler } = opts;\n\n this.logger.info(\n '[attemptReconnect] Reconnecting %d/%d in %dms | Topics: %j | ConnectedBrokers: %d',\n attempt,\n maxAttempts,\n delayMs,\n this.consumeStartOptions?.topics,\n this.getConnectedBrokerCount(),\n );\n await sleep(delayMs);\n\n if (!this.consumeStartOptions) {\n return;\n }\n\n const shouldRebuildClient = this.sessionLikelyStale;\n\n if (shouldRebuildClient) {\n this.logger.warn(\n '[attemptReconnect] Session stale flag is set, will rebuild client | Attempt: %d',\n attempt,\n );\n }\n\n if (shouldRebuildClient) {\n try {\n await this.rebuildClient();\n this.sessionLikelyStale = false;\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[attemptReconnect] Client rebuild failed (%d/%d): %s | Topics: %j',\n attempt,\n maxAttempts,\n normalizedError.message,\n this.consumeStartOptions?.topics,\n );\n invokeHook({\n logger: this.logger,\n scope: 'attemptReconnect',\n execution: () =>\n this.onReconnectError\n ? this.onReconnectError({ error: normalizedError, attempt, maxAttempts })\n : errorHandler?.({ error: normalizedError }),\n });\n return;\n }\n }\n\n try {\n this.stream = await this.client.consume({\n topics: this.consumeStartOptions.topics,\n mode: this.consumeStartOptions.mode ?? KafkaDefaults.CONSUME_MODE,\n fallbackMode: this.consumeStartOptions.fallbackMode ?? KafkaDefaults.CONSUME_FALLBACK_MODE,\n });\n\n // Always attached, hook or not, like the listener in start(): a stream 'error' with ZERO listeners is rethrown by EventEmitter and takes the process down.\n const reconnectedStream = this.stream;\n reconnectedStream.on(KafkaClientEvents.STREAM_ERROR, (streamError: Error) => {\n this.logger.for('attemptReconnect').error('Kafka stream ERROR | Error: %s', streamError);\n this.reportStreamError({\n error: streamError,\n scope: 'attemptReconnect',\n stream: reconnectedStream,\n });\n });\n\n this.sessionLikelyStale = false;\n\n this.logger.info(\n '[attemptReconnect] Reconnected successfully | Topics: %j | Attempt: %d | Rebuilt: %s',\n this.consumeStartOptions.topics,\n attempt,\n shouldRebuildClient,\n );\n } catch (error) {\n const normalizedError = toError(error);\n this.logger.error(\n '[attemptReconnect] Failed (%d/%d): %s | Topics: %j | ConnectedBrokers: %d',\n attempt,\n maxAttempts,\n normalizedError.message,\n this.consumeStartOptions?.topics,\n this.getConnectedBrokerCount(),\n );\n invokeHook({\n logger: this.logger,\n scope: 'attemptReconnect',\n execution: () =>\n this.onReconnectError\n ? this.onReconnectError({ error: normalizedError, attempt, maxAttempts })\n : errorHandler?.({ error: normalizedError }),\n });\n }\n }\n\n protected async rebuildClient(): Promise<void> {\n this.logger.warn(\n '[rebuildClient] All brokers were disconnected; rebuilding @platformatic/kafka ' +\n 'Consumer to force a clean group rejoin (cached session state is stale)',\n );\n\n const oldClient = this.client;\n const newClient = this.buildClient({ options: this.initialOptions });\n\n this.swapClient(newClient);\n\n if (this.lagMonitoringOptions) {\n const opts = this.lagMonitoringOptions;\n this.lagMonitoringActive = false; // reset so startLagMonitoring won't refuse\n try {\n this.startLagMonitoring(opts);\n this.logger.info(\n '[rebuildClient] Lag monitoring re-armed on new client | Topics: %j',\n opts.topics,\n );\n } catch (error) {\n this.logger.warn(\n '[rebuildClient] Failed to restart lag monitoring on new client | Error: %s',\n toError(error).message,\n );\n }\n }\n\n this.closeOldClient(oldClient).catch((error) => {\n this.logger.warn(\n '[rebuildClient] background close of old client failed (ignored) | Error: %s',\n toError(error).message,\n );\n });\n }\n\n protected async closeOldClient(\n oldClient: Consumer<KeyType, ValueType, HeaderKeyType, HeaderValueType>,\n ): Promise<void> {\n let timeoutHandle: NodeJS.Timeout | null = null;\n try {\n await Promise.race([\n new Promise<void>((resolve, reject) => {\n oldClient.close(true, (normalizedError?: Error | null) => {\n if (normalizedError) {\n reject(normalizedError);\n } else {\n resolve();\n }\n });\n }),\n new Promise<void>((resolve) => {\n timeoutHandle = setTimeout(resolve, this.shutdownTimeout);\n }),\n ]);\n } finally {\n if (timeoutHandle !== null) {\n clearTimeout(timeoutHandle);\n }\n }\n }\n\n protected handleAllBrokersDown(reason: TKafkaBrokersDownReason): void {\n if (this.getConnectedBrokerCount() !== 0) {\n return;\n }\n this.sessionLikelyStale = true;\n if (this.stream) {\n this.logger.warn(\n '[configureBrokerEvents] All brokers %s, destroying stream to trigger reconnect',\n reason,\n );\n this.destroyDeadStream();\n }\n }\n\n protected destroyDeadStream(): void {\n this.stream?.destroy(getError({ message: '[destroyDeadStream] All brokers disconnected' }));\n this.stream = null;\n }\n\n protected async closeStream(): Promise<void> {\n const stream = this.stream;\n this.stream = null;\n this.consumeStartOptions = null;\n\n try {\n await stream?.close();\n } catch (error) {\n this.logger.warn('[closeStream] Error closing stream: %s', toError(error).message);\n }\n\n await this.consumeLoop;\n this.consumeLoop = null;\n }\n\n protected override unconfigureBrokerEvents(): void {\n super.unconfigureBrokerEvents();\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_JOIN);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_LEAVE);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_GROUP_REBALANCE);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_HEARTBEAT_ERROR);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_LAG);\n this.client.removeAllListeners(KafkaClientEvents.CONSUMER_LAG_ERROR);\n }\n\n protected override configureBrokerEvents(): void {\n super.configureBrokerEvents();\n\n this.client.on(KafkaClientEvents.BROKER_DISCONNECT, () => {\n this.handleAllBrokersDown(KafkaBrokersDownReasons.DISCONNECTED);\n });\n this.client.on(KafkaClientEvents.BROKER_FAILED, () => {\n this.handleAllBrokersDown(KafkaBrokersDownReasons.FAILED);\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_GROUP_JOIN, (payload: ConsumerGroupJoinPayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group JOINED | GroupId: %s | MemberId: %s | GenerationId: %d',\n payload.groupId,\n payload.memberId,\n payload.generationId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onGroupJoin?.({\n groupId: payload.groupId,\n memberId: payload.memberId,\n generationId: payload.generationId,\n }),\n });\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_GROUP_LEAVE, (payload: ConsumerGroupLeavePayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group LEFT | GroupId: %s | MemberId: %s',\n payload.groupId,\n payload.memberId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onGroupLeave?.({\n groupId: payload.groupId,\n memberId: payload.memberId,\n }),\n });\n });\n\n this.client.on(\n KafkaClientEvents.CONSUMER_GROUP_REBALANCE,\n (payload: ConsumerGroupRebalancePayload) => {\n this.logger.info(\n '[configureConsumerEvents] Group REBALANCE | GroupId: %s',\n payload.groupId,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onGroupRebalance?.({ groupId: payload.groupId }),\n });\n },\n );\n\n this.client.on(\n KafkaClientEvents.CONSUMER_HEARTBEAT_ERROR,\n (payload: ConsumerHeartbeatErrorPayload) => {\n this.logger.error(\n '[configureConsumerEvents] Heartbeat ERROR | GroupId: %s | MemberId: %s | Error: %s',\n payload.groupId,\n payload.memberId,\n payload.error,\n );\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () =>\n this.onHeartbeatError?.({\n error: payload.error,\n groupId: payload.groupId,\n memberId: payload.memberId,\n }),\n });\n },\n );\n\n this.client.on(KafkaClientEvents.CONSUMER_LAG, (lag: Offsets) => {\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onLag?.({ lag }),\n });\n });\n\n this.client.on(KafkaClientEvents.CONSUMER_LAG_ERROR, (error: Error) => {\n this.logger.error('[configureConsumerEvents] Lag monitoring ERROR: %s', error);\n invokeHook({\n logger: this.logger,\n scope: 'configureBrokerEvents',\n execution: () => this.onLagError?.({ error }),\n });\n });\n }\n}\n"]}
@@ -40,4 +40,25 @@ export declare class TemporalInclusivities {
40
40
  static isValid(input: string): input is TTemporalInclusivity;
41
41
  }
42
42
  export type TTemporalInclusivity = TConstValue<typeof TemporalInclusivities>;
43
+ /** How long a month or weekday name is written: NARROW (`M`), SHORT (`Mon`) or LONG (`Monday`). */
44
+ export declare class TemporalNameWidths {
45
+ static readonly NARROW = "narrow";
46
+ static readonly SHORT = "short";
47
+ static readonly LONG = "long";
48
+ static readonly SCHEME_SET: Set<string>;
49
+ static isValid(value: string): boolean;
50
+ }
51
+ /** Valid name width values. */
52
+ export type TTemporalNameWidth = TConstValue<typeof TemporalNameWidths>;
53
+ /** A month name has no narrow form here: SHORT or LONG. */
54
+ export type TTemporalMonthNameWidth = Exclude<TTemporalNameWidth, typeof TemporalNameWidths.NARROW>;
55
+ /** How `writtenDate` writes a date: NUMERIC is `10/14/2026`, LONG is `October 14, 2026`. */
56
+ export declare class TemporalWrittenDateStyles {
57
+ static readonly NUMERIC = "numeric";
58
+ static readonly LONG = "long";
59
+ static readonly SCHEME_SET: Set<string>;
60
+ static isValid(value: string): boolean;
61
+ }
62
+ /** Valid written date style values. */
63
+ export type TTemporalWrittenDateStyle = TConstValue<typeof TemporalWrittenDateStyles>;
43
64
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/modules/temporal/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,kLAAkL;AAClL,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAiB;IAC5C,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAUvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa;CAGtD;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,2G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AAC,QAAQ,CAAC,UAAU,QAAQ;IAClC,MAAM,CAAC,QAAQ,CAAC,QAAQ,QAAQ;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAKvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,oBAAoB;CAG7D;AAED,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE7E,mGAAmG;AACnG,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAyD;IAEnF,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,+BAA+B;AAC/B,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE,2DAA2D;AAC3D,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEpG,4FAA4F;AAC5F,qBAAa,yBAAyB;IACpC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA8C;IAExE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,uCAAuC;AACvC,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemporalInclusivities = exports.TemporalDurationStyles = exports.DEFAULT_TEMPORAL_LOCALE = exports.DEFAULT_TEMPORAL_PATTERN = exports.DEFAULT_TEMPORAL_TZ = exports.TemporalUnits = void 0;
3
+ exports.TemporalWrittenDateStyles = exports.TemporalNameWidths = exports.TemporalInclusivities = exports.TemporalDurationStyles = exports.DEFAULT_TEMPORAL_LOCALE = exports.DEFAULT_TEMPORAL_PATTERN = exports.DEFAULT_TEMPORAL_TZ = exports.TemporalUnits = void 0;
4
4
  /** Units `add`, `subtract`, `startOf` and `endOf` accept. Weeks are ISO weeks - they start on Monday; a quarter is three calendar months from January, April, July or October. */
5
5
  class TemporalUnits {
6
6
  static { this.MILLISECOND = 'millisecond'; }
@@ -63,4 +63,25 @@ class TemporalInclusivities {
63
63
  }
64
64
  }
65
65
  exports.TemporalInclusivities = TemporalInclusivities;
66
+ /** How long a month or weekday name is written: NARROW (`M`), SHORT (`Mon`) or LONG (`Monday`). */
67
+ class TemporalNameWidths {
68
+ static { this.NARROW = 'narrow'; }
69
+ static { this.SHORT = 'short'; }
70
+ static { this.LONG = 'long'; }
71
+ static { this.SCHEME_SET = new Set([this.NARROW, this.SHORT, this.LONG]); }
72
+ static isValid(value) {
73
+ return this.SCHEME_SET.has(value);
74
+ }
75
+ }
76
+ exports.TemporalNameWidths = TemporalNameWidths;
77
+ /** How `writtenDate` writes a date: NUMERIC is `10/14/2026`, LONG is `October 14, 2026`. */
78
+ class TemporalWrittenDateStyles {
79
+ static { this.NUMERIC = 'numeric'; }
80
+ static { this.LONG = 'long'; }
81
+ static { this.SCHEME_SET = new Set([this.NUMERIC, this.LONG]); }
82
+ static isValid(value) {
83
+ return this.SCHEME_SET.has(value);
84
+ }
85
+ }
86
+ exports.TemporalWrittenDateStyles = TemporalWrittenDateStyles;
66
87
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/temporal/common/constants.ts"],"names":[],"mappings":";;;AAEA,kLAAkL;AAClL,MAAa,aAAa;aACR,gBAAW,GAAG,aAAa,CAAC;aAC5B,WAAM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ID,0FAA0F;AAC1F,MAAa,qBAAqB;aAChB,cAAS,GAAG,IAAI,CAAC;aACjB,cAAS,GAAG,IAAI,CAAC;aACjB,eAAU,GAAG,IAAI,CAAC;aAClB,aAAQ,GAAG,IAAI,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,QAAQ;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAfH,sDAgBC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\n/** Units `add`, `subtract`, `startOf` and `endOf` accept. Weeks are ISO weeks - they start on Monday; a quarter is three calendar months from January, April, July or October. */\nexport class TemporalUnits {\n static readonly MILLISECOND = 'millisecond';\n static readonly SECOND = 'second';\n static readonly MINUTE = 'minute';\n static readonly HOUR = 'hour';\n static readonly DAY = 'day';\n static readonly WEEK = 'week';\n static readonly MONTH = 'month';\n static readonly QUARTER = 'quarter';\n static readonly YEAR = 'year';\n\n static readonly SCHEME_SET = new Set([\n this.MILLISECOND,\n this.SECOND,\n this.MINUTE,\n this.HOUR,\n this.DAY,\n this.WEEK,\n this.MONTH,\n this.QUARTER,\n this.YEAR,\n ]);\n\n static isValid(input: string): input is TTemporalUnit {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalUnit = TConstValue<typeof TemporalUnits>;\n\n/** A helper built without a `tz` computes in UTC - never in the host's zone, which differs per machine. */\nexport const DEFAULT_TEMPORAL_TZ = 'UTC';\n\n/** `format` with no pattern writes ISO 8601 with the zone's offset: `2026-09-19T12:00:00.000+07:00`. */\nexport const DEFAULT_TEMPORAL_PATTERN = 'YYYY-MM-DDTHH:mm:ss.SSSZ';\n\n/** The locale name tokens and `formatIntl` write in when a helper is built without one. */\nexport const DEFAULT_TEMPORAL_LOCALE = 'en-US';\n\n/** How `formatDuration` writes: `compact` is `1d1h30m`; the others are the locale's own unit words. */\nexport class TemporalDurationStyles {\n static readonly COMPACT = 'compact';\n static readonly NARROW = 'narrow';\n static readonly SHORT = 'short';\n static readonly LONG = 'long';\n\n static readonly SCHEME_SET = new Set([this.COMPACT, this.NARROW, this.SHORT, this.LONG]);\n\n static isValid(input: string): input is TTemporalDurationStyle {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalDurationStyle = TConstValue<typeof TemporalDurationStyles>;\n\n/** Which ends of the range `isBetween` counts: `[` includes an end, `(` leaves it out. */\nexport class TemporalInclusivities {\n static readonly EXCLUSIVE = '()';\n static readonly INCLUSIVE = '[]';\n static readonly START_ONLY = '[)';\n static readonly END_ONLY = '(]';\n\n static readonly SCHEME_SET = new Set([\n this.EXCLUSIVE,\n this.INCLUSIVE,\n this.START_ONLY,\n this.END_ONLY,\n ]);\n\n static isValid(input: string): input is TTemporalInclusivity {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalInclusivity = TConstValue<typeof TemporalInclusivities>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/temporal/common/constants.ts"],"names":[],"mappings":";;;AAEA,kLAAkL;AAClL,MAAa,aAAa;aACR,gBAAW,GAAG,aAAa,CAAC;aAC5B,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,SAAI,GAAG,MAAM,CAAC;aACd,QAAG,GAAG,KAAK,CAAC;aACZ,SAAI,GAAG,MAAM,CAAC;aACd,UAAK,GAAG,OAAO,CAAC;aAChB,YAAO,GAAG,SAAS,CAAC;aACpB,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,IAAI;QACT,IAAI,C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AC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAfH,sDAgBC;AAID,mGAAmG;AACnG,MAAa,kBAAkB;aACb,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAChB,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AATH,gDAUC;AAQD,4FAA4F;AAC5F,MAAa,yBAAyB;aACpB,YAAO,GAAG,SAAS,CAAC;aACpB,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,8DASC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\n/** Units `add`, `subtract`, `startOf` and `endOf` accept. Weeks are ISO weeks - they start on Monday; a quarter is three calendar months from January, April, July or October. */\nexport class TemporalUnits {\n static readonly MILLISECOND = 'millisecond';\n static readonly SECOND = 'second';\n static readonly MINUTE = 'minute';\n static readonly HOUR = 'hour';\n static readonly DAY = 'day';\n static readonly WEEK = 'week';\n static readonly MONTH = 'month';\n static readonly QUARTER = 'quarter';\n static readonly YEAR = 'year';\n\n static readonly SCHEME_SET = new Set([\n this.MILLISECOND,\n this.SECOND,\n this.MINUTE,\n this.HOUR,\n this.DAY,\n this.WEEK,\n this.MONTH,\n this.QUARTER,\n this.YEAR,\n ]);\n\n static isValid(input: string): input is TTemporalUnit {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalUnit = TConstValue<typeof TemporalUnits>;\n\n/** A helper built without a `tz` computes in UTC - never in the host's zone, which differs per machine. */\nexport const DEFAULT_TEMPORAL_TZ = 'UTC';\n\n/** `format` with no pattern writes ISO 8601 with the zone's offset: `2026-09-19T12:00:00.000+07:00`. */\nexport const DEFAULT_TEMPORAL_PATTERN = 'YYYY-MM-DDTHH:mm:ss.SSSZ';\n\n/** The locale name tokens and `formatIntl` write in when a helper is built without one. */\nexport const DEFAULT_TEMPORAL_LOCALE = 'en-US';\n\n/** How `formatDuration` writes: `compact` is `1d1h30m`; the others are the locale's own unit words. */\nexport class TemporalDurationStyles {\n static readonly COMPACT = 'compact';\n static readonly NARROW = 'narrow';\n static readonly SHORT = 'short';\n static readonly LONG = 'long';\n\n static readonly SCHEME_SET = new Set([this.COMPACT, this.NARROW, this.SHORT, this.LONG]);\n\n static isValid(input: string): input is TTemporalDurationStyle {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalDurationStyle = TConstValue<typeof TemporalDurationStyles>;\n\n/** Which ends of the range `isBetween` counts: `[` includes an end, `(` leaves it out. */\nexport class TemporalInclusivities {\n static readonly EXCLUSIVE = '()';\n static readonly INCLUSIVE = '[]';\n static readonly START_ONLY = '[)';\n static readonly END_ONLY = '(]';\n\n static readonly SCHEME_SET = new Set([\n this.EXCLUSIVE,\n this.INCLUSIVE,\n this.START_ONLY,\n this.END_ONLY,\n ]);\n\n static isValid(input: string): input is TTemporalInclusivity {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TTemporalInclusivity = TConstValue<typeof TemporalInclusivities>;\n\n/** How long a month or weekday name is written: NARROW (`M`), SHORT (`Mon`) or LONG (`Monday`). */\nexport class TemporalNameWidths {\n static readonly NARROW = 'narrow';\n static readonly SHORT = 'short';\n static readonly LONG = 'long';\n\n static readonly SCHEME_SET = new Set<string>([this.NARROW, this.SHORT, this.LONG]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid name width values. */\nexport type TTemporalNameWidth = TConstValue<typeof TemporalNameWidths>;\n\n/** A month name has no narrow form here: SHORT or LONG. */\nexport type TTemporalMonthNameWidth = Exclude<TTemporalNameWidth, typeof TemporalNameWidths.NARROW>;\n\n/** How `writtenDate` writes a date: NUMERIC is `10/14/2026`, LONG is `October 14, 2026`. */\nexport class TemporalWrittenDateStyles {\n static readonly NUMERIC = 'numeric';\n static readonly LONG = 'long';\n\n static readonly SCHEME_SET = new Set<string>([this.NUMERIC, this.LONG]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid written date style values. */\nexport type TTemporalWrittenDateStyle = TConstValue<typeof TemporalWrittenDateStyles>;\n"]}
@@ -1,3 +1,4 @@
1
+ import { type TTemporalMonthNameWidth, type TTemporalNameWidth, type TTemporalWrittenDateStyle } from '../common/constants';
1
2
  import type { ITemporalParts } from '../common/types';
2
3
  /**
3
4
  * Month and weekday names, the AM/PM marker and the written date of one locale, as `Intl` spells
@@ -19,12 +20,12 @@ export declare class TemporalLocale {
19
20
  /** `month` is 1-12. */
20
21
  monthName(opts: {
21
22
  month: number;
22
- width: 'short' | 'long';
23
+ width: TTemporalMonthNameWidth;
23
24
  }): string;
24
25
  /** `dayOfWeek` is ISO: 1 Monday - 7 Sunday. */
25
26
  weekdayName(opts: {
26
27
  dayOfWeek: number;
27
- width: 'narrow' | 'short' | 'long';
28
+ width: TTemporalNameWidth;
28
29
  }): string;
29
30
  /** The AM or PM marker the locale writes for `hour` (0-23), lower-cased by the locale's own rules when asked. */
30
31
  dayPeriod(opts: {
@@ -35,7 +36,7 @@ export declare class TemporalLocale {
35
36
  /** The wall-clock date the way the locale writes it: `numeric` is `10/14/2026`, `long` is `October 14, 2026`. */
36
37
  writtenDate(opts: {
37
38
  parts: ITemporalParts;
38
- style: 'numeric' | 'long';
39
+ style: TTemporalWrittenDateStyle;
39
40
  }): string;
40
41
  }
41
42
  //# sourceMappingURL=locale.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../../../src/modules/temporal/locale/locale.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAatD;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAEpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IAErE,OAAO;IAIP,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;IA4BnD,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,OAAO;IAef,uBAAuB;IACvB,SAAS,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM;IAWnE,+CAA+C;IAC/C,WAAW,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM;IAWpF,iHAAiH;IACjH,SAAS,CAAC,IAAI,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,GAAG,MAAM;IAcV,iHAAiH;IACjH,WAAW,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM;CAWhF"}
1
+ {"version":3,"file":"locale.d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"__esModule", { value: true });
3
3
  exports.TemporalLocale = void 0;
4
4
  const http_1 = require("../../../common/constants/http");
5
5
  const error_1 = require("../../error");
6
+ const constants_1 = require("../common/constants");
6
7
  /** A service writes a handful of locales; capped so caller-fed locales cannot grow it. */
7
8
  const MAX_CACHED_LOCALES = 32;
8
9
  const MONTHS = 12;
@@ -112,7 +113,7 @@ class TemporalLocale {
112
113
  /** The wall-clock date the way the locale writes it: `numeric` is `10/14/2026`, `long` is `October 14, 2026`. */
113
114
  writtenDate(opts) {
114
115
  const { parts, style } = opts;
115
- const formatter = style === 'numeric'
116
+ const formatter = style === constants_1.TemporalWrittenDateStyles.NUMERIC
116
117
  ? this.formatterOf({ year: 'numeric', month: '2-digit', day: '2-digit' })
117
118
  : this.formatterOf({ dateStyle: 'long' });
118
119
  const date = new Date(0);
@@ -1 +1 @@
1
- {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../../../../src/modules/temporal/locale/locale.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAA2C;AAG3C,0FAA0F;AAC1F,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,IAAI,GAAG,EAAE,CAAC;AAEhB,gEAAgE;AAChE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAEpC;;;;GAIG;AACH,MAAa,cAAc;aACD,YAAO,GAAG,IAAI,GAAG,EAA0B,AAApC,CAAqC;IAMpE,YAAoB,IAAwB;QAH3B,WAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;QAC1C,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAGnE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,oDAAoD;IACpD,MAA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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;SACrF,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3E,CAAC;IAED,iHAAiH;IACjH,WAAW,CAAC,IAA0D;QACpE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAC9B,MAAM,SAAS,GACb,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACzE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAE9C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;;AA9HH,wCA+HC","sourcesContent":["import { HTTP } from '@/common/constants/http';\nimport { getError } from '@/modules/error';\nimport type { ITemporalParts } from '../common/types';\n\n/** A service writes a handful of locales; capped so caller-fed locales cannot grow it. */\nconst MAX_CACHED_LOCALES = 32;\n\nconst MONTHS = 12;\nconst WEEKDAYS = 7;\nconst NOON = 12;\n\n/** A Monday: ISO weekday `n` is this date plus `n - 1` days. */\nconst MONDAY = Date.UTC(2024, 0, 1);\nconst DAY_MILLISECONDS = 86_400_000;\n\n/**\n * Month and weekday names, the AM/PM marker and the written date of one locale, as `Intl` spells\n * them. Every table is read once, on first use, from a fixed UTC date: the names belong to the\n * calendar, not to a time zone, so the wall clock is formatted as if it were UTC.\n */\nexport class TemporalLocale {\n private static readonly locales = new Map<string, TemporalLocale>();\n\n private readonly locale: string;\n private readonly tables = new Map<string, Array<string>>();\n private readonly formatters = new Map<string, Intl.DateTimeFormat>();\n\n private constructor(opts: { locale: string }) {\n this.locale = opts.locale;\n }\n\n /** The locale's names; a malformed tag is a 400. */\n static of(opts: { locale: string }): TemporalLocale {\n const { locale } = opts;\n const cached = TemporalLocale.locales.get(locale);\n if (cached) {\n return cached;\n }\n\n try {\n Intl.getCanonicalLocales(locale);\n } catch (error) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[TemporalLocale] invalid locale '${locale}' | ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n // Full: the oldest locale makes room, so the 33rd locale is not rebuilt on every call.\n if (TemporalLocale.locales.size >= MAX_CACHED_LOCALES) {\n const oldest = TemporalLocale.locales.keys().next().value;\n if (oldest !== undefined) {\n TemporalLocale.locales.delete(oldest);\n }\n }\n const created = new TemporalLocale({ locale });\n TemporalLocale.locales.set(locale, created);\n return created;\n }\n\n private formatterOf(opts: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = JSON.stringify(opts);\n const cached = this.formatters.get(key);\n if (cached) {\n return cached;\n }\n\n // Gregorian always: the numeric tokens are, and a name from another calendar would sit beside them.\n const formatter = new Intl.DateTimeFormat(this.locale, {\n ...opts,\n calendar: 'gregory',\n timeZone: 'UTC',\n });\n this.formatters.set(key, formatter);\n return formatter;\n }\n\n private tableOf(opts: {\n key: string;\n size: number;\n read: (index: number) => string;\n }): Array<string> {\n const cached = this.tables.get(opts.key);\n if (cached) {\n return cached;\n }\n\n const table = Array.from({ length: opts.size }, (_, index) => opts.read(index));\n this.tables.set(opts.key, table);\n return table;\n }\n\n /** `month` is 1-12. */\n monthName(opts: { month: number; width: 'short' | 'long' }): string {\n const { month, width } = opts;\n const formatter = this.formatterOf({ month: width });\n const table = this.tableOf({\n key: `month-${width}`,\n size: MONTHS,\n read: (index) => formatter.format(Date.UTC(2024, index, 15)),\n });\n return table[month - 1];\n }\n\n /** `dayOfWeek` is ISO: 1 Monday - 7 Sunday. */\n weekdayName(opts: { dayOfWeek: number; width: 'narrow' | 'short' | 'long' }): string {\n const { dayOfWeek, width } = opts;\n const formatter = this.formatterOf({ weekday: width });\n const table = this.tableOf({\n key: `weekday-${width}`,\n size: WEEKDAYS,\n read: (index) => formatter.format(MONDAY + index * DAY_MILLISECONDS),\n });\n return table[dayOfWeek - 1];\n }\n\n /** The AM or PM marker the locale writes for `hour` (0-23), lower-cased by the locale's own rules when asked. */\n dayPeriod(opts: {\n hour: number;\n meridiem?: readonly [string, string];\n isLowerCase?: boolean;\n }): string {\n const formatter = this.formatterOf({ hour: 'numeric', hourCycle: 'h12' });\n const table = this.tableOf({\n key: 'day-period',\n size: 2,\n read: (index) =>\n formatter\n .formatToParts(Date.UTC(2024, 0, 1, index === 0 ? 1 : NOON + 1))\n .find((part) => part.type === 'dayPeriod')?.value ?? (index === 0 ? 'AM' : 'PM'),\n });\n const marker = (opts.meridiem ?? table)[opts.hour < NOON ? 0 : 1];\n return opts.isLowerCase ? marker.toLocaleLowerCase(this.locale) : marker;\n }\n\n /** The wall-clock date the way the locale writes it: `numeric` is `10/14/2026`, `long` is `October 14, 2026`. */\n writtenDate(opts: { parts: ITemporalParts; style: 'numeric' | 'long' }): string {\n const { parts, style } = opts;\n const formatter =\n style === 'numeric'\n ? this.formatterOf({ year: 'numeric', month: '2-digit', day: '2-digit' })\n : this.formatterOf({ dateStyle: 'long' });\n\n const date = new Date(0);\n date.setUTCFullYear(parts.year, parts.month - 1, parts.day);\n return formatter.format(date);\n }\n}\n"]}
1
+ {"version":3,"file":"locale.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;YACzC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACzE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAE9C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;;AA9HH,wCA+HC","sourcesContent":["import { HTTP } from '@/common/constants/http';\nimport { getError } from '@/modules/error';\nimport {\n TemporalWrittenDateStyles,\n type TTemporalMonthNameWidth,\n type TTemporalNameWidth,\n type TTemporalWrittenDateStyle,\n} from '../common/constants';\nimport type { ITemporalParts } from '../common/types';\n\n/** A service writes a handful of locales; capped so caller-fed locales cannot grow it. */\nconst MAX_CACHED_LOCALES = 32;\n\nconst MONTHS = 12;\nconst WEEKDAYS = 7;\nconst NOON = 12;\n\n/** A Monday: ISO weekday `n` is this date plus `n - 1` days. */\nconst MONDAY = Date.UTC(2024, 0, 1);\nconst DAY_MILLISECONDS = 86_400_000;\n\n/**\n * Month and weekday names, the AM/PM marker and the written date of one locale, as `Intl` spells\n * them. Every table is read once, on first use, from a fixed UTC date: the names belong to the\n * calendar, not to a time zone, so the wall clock is formatted as if it were UTC.\n */\nexport class TemporalLocale {\n private static readonly locales = new Map<string, TemporalLocale>();\n\n private readonly locale: string;\n private readonly tables = new Map<string, Array<string>>();\n private readonly formatters = new Map<string, Intl.DateTimeFormat>();\n\n private constructor(opts: { locale: string }) {\n this.locale = opts.locale;\n }\n\n /** The locale's names; a malformed tag is a 400. */\n static of(opts: { locale: string }): TemporalLocale {\n const { locale } = opts;\n const cached = TemporalLocale.locales.get(locale);\n if (cached) {\n return cached;\n }\n\n try {\n Intl.getCanonicalLocales(locale);\n } catch (error) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[TemporalLocale] invalid locale '${locale}' | ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n // Full: the oldest locale makes room, so the 33rd locale is not rebuilt on every call.\n if (TemporalLocale.locales.size >= MAX_CACHED_LOCALES) {\n const oldest = TemporalLocale.locales.keys().next().value;\n if (oldest !== undefined) {\n TemporalLocale.locales.delete(oldest);\n }\n }\n const created = new TemporalLocale({ locale });\n TemporalLocale.locales.set(locale, created);\n return created;\n }\n\n private formatterOf(opts: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = JSON.stringify(opts);\n const cached = this.formatters.get(key);\n if (cached) {\n return cached;\n }\n\n // Gregorian always: the numeric tokens are, and a name from another calendar would sit beside them.\n const formatter = new Intl.DateTimeFormat(this.locale, {\n ...opts,\n calendar: 'gregory',\n timeZone: 'UTC',\n });\n this.formatters.set(key, formatter);\n return formatter;\n }\n\n private tableOf(opts: {\n key: string;\n size: number;\n read: (index: number) => string;\n }): Array<string> {\n const cached = this.tables.get(opts.key);\n if (cached) {\n return cached;\n }\n\n const table = Array.from({ length: opts.size }, (_, index) => opts.read(index));\n this.tables.set(opts.key, table);\n return table;\n }\n\n /** `month` is 1-12. */\n monthName(opts: { month: number; width: TTemporalMonthNameWidth }): string {\n const { month, width } = opts;\n const formatter = this.formatterOf({ month: width });\n const table = this.tableOf({\n key: `month-${width}`,\n size: MONTHS,\n read: (index) => formatter.format(Date.UTC(2024, index, 15)),\n });\n return table[month - 1];\n }\n\n /** `dayOfWeek` is ISO: 1 Monday - 7 Sunday. */\n weekdayName(opts: { dayOfWeek: number; width: TTemporalNameWidth }): string {\n const { dayOfWeek, width } = opts;\n const formatter = this.formatterOf({ weekday: width });\n const table = this.tableOf({\n key: `weekday-${width}`,\n size: WEEKDAYS,\n read: (index) => formatter.format(MONDAY + index * DAY_MILLISECONDS),\n });\n return table[dayOfWeek - 1];\n }\n\n /** The AM or PM marker the locale writes for `hour` (0-23), lower-cased by the locale's own rules when asked. */\n dayPeriod(opts: {\n hour: number;\n meridiem?: readonly [string, string];\n isLowerCase?: boolean;\n }): string {\n const formatter = this.formatterOf({ hour: 'numeric', hourCycle: 'h12' });\n const table = this.tableOf({\n key: 'day-period',\n size: 2,\n read: (index) =>\n formatter\n .formatToParts(Date.UTC(2024, 0, 1, index === 0 ? 1 : NOON + 1))\n .find((part) => part.type === 'dayPeriod')?.value ?? (index === 0 ? 'AM' : 'PM'),\n });\n const marker = (opts.meridiem ?? table)[opts.hour < NOON ? 0 : 1];\n return opts.isLowerCase ? marker.toLocaleLowerCase(this.locale) : marker;\n }\n\n /** The wall-clock date the way the locale writes it: `numeric` is `10/14/2026`, `long` is `October 14, 2026`. */\n writtenDate(opts: { parts: ITemporalParts; style: TTemporalWrittenDateStyle }): string {\n const { parts, style } = opts;\n const formatter =\n style === TemporalWrittenDateStyles.NUMERIC\n ? this.formatterOf({ year: 'numeric', month: '2-digit', day: '2-digit' })\n : this.formatterOf({ dateStyle: 'long' });\n\n const date = new Date(0);\n date.setUTCFullYear(parts.year, parts.month - 1, parts.day);\n return formatter.format(date);\n }\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import type { TConstValue } from '../../../../common/types';
2
+ /**
3
+ * The pattern dialect: `YYYY YY MM M DD D HH H mm m ss s SSS Z ZZ` both ways, plus
4
+ * `MMMM MMM dddd ddd dd A a hh h LL L Q` for writing only, with text in `[brackets]`.
5
+ */
6
+ export declare class PatternTokens {
7
+ static readonly YEAR_4 = "YYYY";
8
+ static readonly YEAR_2 = "YY";
9
+ static readonly MONTH_2 = "MM";
10
+ static readonly MONTH = "M";
11
+ static readonly DAY_2 = "DD";
12
+ static readonly DAY = "D";
13
+ static readonly HOUR_24_2 = "HH";
14
+ static readonly HOUR_24 = "H";
15
+ static readonly MINUTE_2 = "mm";
16
+ static readonly MINUTE = "m";
17
+ static readonly SECOND_2 = "ss";
18
+ static readonly SECOND = "s";
19
+ static readonly MILLISECOND = "SSS";
20
+ static readonly OFFSET_COLON = "Z";
21
+ static readonly OFFSET = "ZZ";
22
+ /** Written only: names and the written date come from a locale, the quarter from the month. */
23
+ static readonly MONTH_NAME_LONG = "MMMM";
24
+ static readonly MONTH_NAME_SHORT = "MMM";
25
+ static readonly WEEKDAY_LONG = "dddd";
26
+ static readonly WEEKDAY_SHORT = "ddd";
27
+ static readonly WEEKDAY_MIN = "dd";
28
+ static readonly MERIDIEM_UPPER = "A";
29
+ static readonly MERIDIEM_LOWER = "a";
30
+ static readonly HOUR_12_2 = "hh";
31
+ static readonly HOUR_12 = "h";
32
+ static readonly DATE_LONG = "LL";
33
+ static readonly DATE_NUMERIC = "L";
34
+ static readonly QUARTER = "Q";
35
+ static readonly WRITE_ONLY_SET: ReadonlySet<TWriteOnlyToken>;
36
+ static readonly SCHEME_SET: Set<string>;
37
+ static isValid(value: string): boolean;
38
+ }
39
+ /** Tokens a pattern can write but never read: names and the written date come from a locale, the quarter from the month, and a parse stays numeric and strict. */
40
+ export type TWriteOnlyToken = typeof PatternTokens.MONTH_NAME_LONG | typeof PatternTokens.MONTH_NAME_SHORT | typeof PatternTokens.WEEKDAY_LONG | typeof PatternTokens.WEEKDAY_SHORT | typeof PatternTokens.WEEKDAY_MIN | typeof PatternTokens.MERIDIEM_UPPER | typeof PatternTokens.MERIDIEM_LOWER | typeof PatternTokens.HOUR_12_2 | typeof PatternTokens.HOUR_12 | typeof PatternTokens.DATE_LONG | typeof PatternTokens.DATE_NUMERIC | typeof PatternTokens.QUARTER;
41
+ /** Every token of the pattern dialect, one for every adapter. */
42
+ export type TPatternToken = TConstValue<typeof PatternTokens>;
43
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/constants.ts"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ACjC,MAAM,CAAC,QAAQ,CAAC,YAAY,OAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,OAAO,OAAO;IAE9B,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,eAAe,CAAC,CAazD;IAEH,MAAM,CAAC,QAAQ,CAAC,UAAU,cAiBvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,kKAAkK;AAClK,MAAM,MAAM,eAAe,GACvB,OAAO,aAAa,CAAC,eAAe,GACpC,OAAO,aAAa,CAAC,gBAAgB,GACrC,OAAO,aAAa,CAAC,YAAY,GACjC,OAAO,aAAa,CAAC,aAAa,GAClC,OAAO,aAAa,CAAC,WAAW,GAChC,OAAO,aAAa,CAAC,cAAc,GACnC,OAAO,aAAa,CAAC,cAAc,GACnC,OAAO,aAAa,CAAC,SAAS,GAC9B,OAAO,aAAa,CAAC,OAAO,GAC5B,OAAO,aAAa,CAAC,SAAS,GAC9B,OAAO,aAAa,CAAC,YAAY,GACjC,OAAO,aAAa,CAAC,OAAO,CAAC;AAEjC,iEAAiE;AACjE,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PatternTokens = void 0;
4
+ /**
5
+ * The pattern dialect: `YYYY YY MM M DD D HH H mm m ss s SSS Z ZZ` both ways, plus
6
+ * `MMMM MMM dddd ddd dd A a hh h LL L Q` for writing only, with text in `[brackets]`.
7
+ */
8
+ class PatternTokens {
9
+ static { this.YEAR_4 = 'YYYY'; }
10
+ static { this.YEAR_2 = 'YY'; }
11
+ static { this.MONTH_2 = 'MM'; }
12
+ static { this.MONTH = 'M'; }
13
+ static { this.DAY_2 = 'DD'; }
14
+ static { this.DAY = 'D'; }
15
+ static { this.HOUR_24_2 = 'HH'; }
16
+ static { this.HOUR_24 = 'H'; }
17
+ static { this.MINUTE_2 = 'mm'; }
18
+ static { this.MINUTE = 'm'; }
19
+ static { this.SECOND_2 = 'ss'; }
20
+ static { this.SECOND = 's'; }
21
+ static { this.MILLISECOND = 'SSS'; }
22
+ static { this.OFFSET_COLON = 'Z'; }
23
+ static { this.OFFSET = 'ZZ'; }
24
+ /** Written only: names and the written date come from a locale, the quarter from the month. */
25
+ static { this.MONTH_NAME_LONG = 'MMMM'; }
26
+ static { this.MONTH_NAME_SHORT = 'MMM'; }
27
+ static { this.WEEKDAY_LONG = 'dddd'; }
28
+ static { this.WEEKDAY_SHORT = 'ddd'; }
29
+ static { this.WEEKDAY_MIN = 'dd'; }
30
+ static { this.MERIDIEM_UPPER = 'A'; }
31
+ static { this.MERIDIEM_LOWER = 'a'; }
32
+ static { this.HOUR_12_2 = 'hh'; }
33
+ static { this.HOUR_12 = 'h'; }
34
+ static { this.DATE_LONG = 'LL'; }
35
+ static { this.DATE_NUMERIC = 'L'; }
36
+ static { this.QUARTER = 'Q'; }
37
+ static { this.WRITE_ONLY_SET = new Set([
38
+ this.MONTH_NAME_LONG,
39
+ this.MONTH_NAME_SHORT,
40
+ this.WEEKDAY_LONG,
41
+ this.WEEKDAY_SHORT,
42
+ this.WEEKDAY_MIN,
43
+ this.MERIDIEM_UPPER,
44
+ this.MERIDIEM_LOWER,
45
+ this.HOUR_12_2,
46
+ this.HOUR_12,
47
+ this.DATE_LONG,
48
+ this.DATE_NUMERIC,
49
+ this.QUARTER,
50
+ ]); }
51
+ static { this.SCHEME_SET = new Set([
52
+ this.YEAR_4,
53
+ this.YEAR_2,
54
+ this.MONTH_2,
55
+ this.MONTH,
56
+ this.DAY_2,
57
+ this.DAY,
58
+ this.HOUR_24_2,
59
+ this.HOUR_24,
60
+ this.MINUTE_2,
61
+ this.MINUTE,
62
+ this.SECOND_2,
63
+ this.SECOND,
64
+ this.MILLISECOND,
65
+ this.OFFSET_COLON,
66
+ this.OFFSET,
67
+ ...this.WRITE_ONLY_SET,
68
+ ]); }
69
+ static isValid(value) {
70
+ return this.SCHEME_SET.has(value);
71
+ }
72
+ }
73
+ exports.PatternTokens = PatternTokens;
74
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/constants.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAa,aAAa;aACR,WAAM,GAAG,MAAM,CAAC;aAChB,WAAM,GAAG,IAAI,CAAC;aACd,YAAO,GAAG,IAAI,CAAC;aACf,UAAK,GAAG,GAAG,CAAC;aACZ,UAAK,GAAG,IAAI,CAAC;aACb,QAAG,GAAG,GAAG,CAAC;aACV,cAAS,GAAG,IAAI,CAAC;aACjB,YAAO,GAAG,GAAG,CAAC;aACd,aAAQ,GAAG,IAAI,CAAC;aAChB,WAAM,GAAG,GAAG,CAAC;aACb,aAAQ,GAAG,IAAI,CAAC;aAChB,WAAM,GAAG,GAAG,CAAC;aACb,gBAAW,GAAG,KAAK,CAAC;aACpB,iBAAY,GAAG,GAAG,CAAC;aACnB,WAAM,GAAG,IAAI,CAAC;IAE9B,+FAA+F;aAC/E,oBAAe,GAAG,MAAM,CAAC;aACzB,qBAAgB,GAAG,KAAK,CAAC;aACzB,iBAAY,GAAG,MAAM,CAAC;aACtB,kBAAa,GAAG,KAAK,CAAC;aACtB,gBAAW,GAAG,IAAI,CAAC;aACnB,mBAAc,GAAG,GAAG,CAAC;aACrB,mBAAc,GAAG,GAAG,CAAC;aACrB,cAAS,GAAG,IAAI,CAAC;aACjB,YAAO,GAAG,GAAG,CAAC;aACd,cAAS,GAAG,IAAI,CAAC;aACjB,iBAAY,GAAG,GAAG,CAAC;aACnB,YAAO,GAAG,GAAG,CAAC;aAEd,mBAAc,GAAiC,IAAI,GAAG,CAAkB;QACtF,IAAI,CAAC,eAAe;QACpB,IAAI,CAAC,gBAAgB;QACrB,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,OAAO;KACb,CAAC,CAAC;aAEa,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,GAAG;QACR,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,MAAM;QACX,GAAG,IAAI,CAAC,cAAc;KACvB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAnEH,sCAoEC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\n/**\n * The pattern dialect: `YYYY YY MM M DD D HH H mm m ss s SSS Z ZZ` both ways, plus\n * `MMMM MMM dddd ddd dd A a hh h LL L Q` for writing only, with text in `[brackets]`.\n */\nexport class PatternTokens {\n static readonly YEAR_4 = 'YYYY';\n static readonly YEAR_2 = 'YY';\n static readonly MONTH_2 = 'MM';\n static readonly MONTH = 'M';\n static readonly DAY_2 = 'DD';\n static readonly DAY = 'D';\n static readonly HOUR_24_2 = 'HH';\n static readonly HOUR_24 = 'H';\n static readonly MINUTE_2 = 'mm';\n static readonly MINUTE = 'm';\n static readonly SECOND_2 = 'ss';\n static readonly SECOND = 's';\n static readonly MILLISECOND = 'SSS';\n static readonly OFFSET_COLON = 'Z';\n static readonly OFFSET = 'ZZ';\n\n /** Written only: names and the written date come from a locale, the quarter from the month. */\n static readonly MONTH_NAME_LONG = 'MMMM';\n static readonly MONTH_NAME_SHORT = 'MMM';\n static readonly WEEKDAY_LONG = 'dddd';\n static readonly WEEKDAY_SHORT = 'ddd';\n static readonly WEEKDAY_MIN = 'dd';\n static readonly MERIDIEM_UPPER = 'A';\n static readonly MERIDIEM_LOWER = 'a';\n static readonly HOUR_12_2 = 'hh';\n static readonly HOUR_12 = 'h';\n static readonly DATE_LONG = 'LL';\n static readonly DATE_NUMERIC = 'L';\n static readonly QUARTER = 'Q';\n\n static readonly WRITE_ONLY_SET: ReadonlySet<TWriteOnlyToken> = new Set<TWriteOnlyToken>([\n this.MONTH_NAME_LONG,\n this.MONTH_NAME_SHORT,\n this.WEEKDAY_LONG,\n this.WEEKDAY_SHORT,\n this.WEEKDAY_MIN,\n this.MERIDIEM_UPPER,\n this.MERIDIEM_LOWER,\n this.HOUR_12_2,\n this.HOUR_12,\n this.DATE_LONG,\n this.DATE_NUMERIC,\n this.QUARTER,\n ]);\n\n static readonly SCHEME_SET = new Set<string>([\n this.YEAR_4,\n this.YEAR_2,\n this.MONTH_2,\n this.MONTH,\n this.DAY_2,\n this.DAY,\n this.HOUR_24_2,\n this.HOUR_24,\n this.MINUTE_2,\n this.MINUTE,\n this.SECOND_2,\n this.SECOND,\n this.MILLISECOND,\n this.OFFSET_COLON,\n this.OFFSET,\n ...this.WRITE_ONLY_SET,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Tokens a pattern can write but never read: names and the written date come from a locale, the quarter from the month, and a parse stays numeric and strict. */\nexport type TWriteOnlyToken =\n | typeof PatternTokens.MONTH_NAME_LONG\n | typeof PatternTokens.MONTH_NAME_SHORT\n | typeof PatternTokens.WEEKDAY_LONG\n | typeof PatternTokens.WEEKDAY_SHORT\n | typeof PatternTokens.WEEKDAY_MIN\n | typeof PatternTokens.MERIDIEM_UPPER\n | typeof PatternTokens.MERIDIEM_LOWER\n | typeof PatternTokens.HOUR_12_2\n | typeof PatternTokens.HOUR_12\n | typeof PatternTokens.DATE_LONG\n | typeof PatternTokens.DATE_NUMERIC\n | typeof PatternTokens.QUARTER;\n\n/** Every token of the pattern dialect, one for every adapter. */\nexport type TPatternToken = TConstValue<typeof PatternTokens>;\n"]}
@@ -1,2 +1,3 @@
1
+ export * from './constants';
1
2
  export * from './types';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants"), exports);
17
18
  __exportStar(require("./types"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
@@ -1,21 +1,12 @@
1
+ import type { PatternTokens, TPatternToken, TWriteOnlyToken } from './constants';
1
2
  import type { ITemporalLocaleNames, IZonedTemporalParts } from '../../common/types';
2
3
  import type { TemporalLocale } from '../../locale';
3
- /**
4
- * Tokens a pattern can write but never read: names and the written date come from a locale, the
5
- * quarter from the month, and a parse stays numeric and strict.
6
- */
7
- export type TWriteOnlyToken = 'MMMM' | 'MMM' | 'dddd' | 'ddd' | 'dd' | 'A' | 'a' | 'hh' | 'h' | 'LL' | 'L' | 'Q';
8
- /**
9
- * The pattern dialect, one for every adapter: `YYYY YY MM M DD D HH H mm m ss s SSS Z ZZ` both ways,
10
- * plus `MMMM MMM dddd ddd dd A a hh h LL L Q` for writing only, with text in `[brackets]`.
11
- */
12
- export type TPatternToken = TWriteOnlyToken | 'YYYY' | 'YY' | 'MM' | 'M' | 'DD' | 'D' | 'HH' | 'H' | 'mm' | 'm' | 'ss' | 's' | 'SSS' | 'Z' | 'ZZ';
13
4
  export type TPatternSegment = {
14
5
  token: TPatternToken;
15
6
  } | {
16
7
  literal: string;
17
8
  };
18
- export type TNumericToken = Exclude<TPatternToken, 'Z' | 'ZZ' | 'YY' | TWriteOnlyToken>;
9
+ export type TNumericToken = Exclude<TPatternToken, typeof PatternTokens.OFFSET_COLON | typeof PatternTokens.OFFSET | typeof PatternTokens.YEAR_2 | TWriteOnlyToken>;
19
10
  /** What a writer reads: the wall clock, and the locale - resolved only when a locale token asks for it. */
20
11
  export interface ITokenWriterInput {
21
12
  parts: IZonedTemporalParts;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,IAAI,GACJ,GAAG,GACH,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,GAAG,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,KAAK,GACL,GAAG,GACH,IAAI,CAAC;AAET,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,eAAe,CAAC,CAAC;AAExF,2GAA2G;AAC3G,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,MAAM,cAAc,CAAC;IAC7B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/temporal/pattern/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC,aAAa,EACX,OAAO,aAAa,CAAC,YAAY,GACjC,OAAO,aAAa,CAAC,MAAM,GAC3B,OAAO,aAAa,CAAC,MAAM,GAC3B,eAAe,CAClB,C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