@bimetal/calendar-rules 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,129 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Andreas Biederbeck (https://bimetal.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or any agreement made under them,
97
+ you have 32 calendar days to come into compliance. If you come
98
+ into compliance, your licenses revive and continue as if you had
99
+ never violated.
100
+
101
+ ## No Liability
102
+
103
+ ***As far as the law allows, the software comes as is, without
104
+ any warranty or condition, and the licensor will not be liable
105
+ to you for any damages arising out of these terms or the use
106
+ or nature of the software, under any kind of legal claim.***
107
+
108
+ ## Definitions
109
+
110
+ The **licensor** is the individual or entity offering these
111
+ terms, and the **software** is the software the licensor makes
112
+ available under these terms.
113
+
114
+ **You** refers to the individual or entity agreeing to these
115
+ terms.
116
+
117
+ **Your company** is any legal entity, sole proprietorship,
118
+ or other kind of organization that you work for, plus all
119
+ organizations that have control over, are under the control of,
120
+ or are under common control with that organization. **Control**
121
+ means ownership of substantially all the assets of an entity,
122
+ or the power to direct its management and policies by vote,
123
+ contract, or otherwise. Control can be direct or indirect.
124
+
125
+ **Your licenses** are all the licenses granted to you for the
126
+ software under these terms.
127
+
128
+ **Use** means anything you do with the software requiring one
129
+ of your licenses.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @bimetal/calendar-rules
2
+
3
+ Calendar-domain rule pack: concrete rules, the `domainRule` factory, and `withRules` store integration. Built on `@bimetal/rule-engine` + `@bimetal/calendar-data`.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @bimetal/calendar-rules
9
+ ```
10
+
11
+ ## Built-in Rules
12
+
13
+ - **`noOverlap(options?)`** — rejects overlapping events
14
+ - **`warnOnOverlap(options?)`** — same check, but warning instead of error
15
+ - **`workingHoursOnly`** — rejects events outside `config.workingHours`
16
+ - **`minDuration(minutes)`**, **`maxDuration(minutes)`** — duration guards
17
+ - **`minGranularityDuration`** — derives min duration from `config.granularity`
18
+ - **`domainRule({ id, description, domainKey, appliesTo?, evaluate })`** — factory for rules that target events carrying a specific domain model
19
+
20
+ ## Store Integration
21
+
22
+ - **`withRules(store, engine, config, caller?)`** — wraps a `CalendarStore` so every dispatch evaluates rules first; throws `RuleViolationError` on error-severity results
23
+ - **`RuleAwareStore`** — `CalendarStore` plus `lastWarnings` for the most recent dispatch
24
+ - **`RuleViolationError`** — thrown when a rule's `evaluate` returns `{ passed: false, severity: 'error' }`
25
+
26
+ ## Calendar-flavored Types
27
+
28
+ - **`CalendarRule`** — extends `Rule<CalendarCommand, RuleContext>` with optional `domainKey`
29
+ - **`CalendarRuleResult`** — alias of the generic `RuleResult`
30
+ - **`RuleContext`** — pinned to `CalendarReadModel`, `CoreConfig`, `CalendarDateTime`
31
+ - **`RuleEngine`** — `RuleEngine<CalendarCommand, RuleContext>`
32
+
33
+ ## Convenience
34
+
35
+ `createRuleEngine` is re-exported from `@bimetal/rule-engine` so calendar consumers don't need a second import.
36
+
37
+ ## Example
38
+
39
+ ```typescript
40
+ import { createCalendarStore, createEvent } from '@bimetal/calendar-data';
41
+ import {
42
+ createRuleEngine,
43
+ noOverlap,
44
+ workingHoursOnly,
45
+ withRules,
46
+ } from '@bimetal/calendar-rules';
47
+ import { defaultConfig } from '@bimetal/core';
48
+
49
+ const store = createCalendarStore();
50
+ const engine = createRuleEngine([noOverlap(), workingHoursOnly]);
51
+ const guarded = withRules(store, engine, defaultConfig);
52
+
53
+ await guarded.dispatch(createEvent(/* ... */)); // throws RuleViolationError on conflict
54
+ ```
55
+
56
+ ## Note on Domain Filtering
57
+
58
+ `CalendarRule.domainKey` is an opaque hint. The generic engine does **not** filter rules by it (that would couple `@bimetal/rule-engine` to the calendar event shape). Instead, `domainRule()` checks the target event's `domains[domainKey]` inside its own `evaluate` and returns `PASS` when the domain is absent — same behavior as before, but cleanly decoupled.
59
+
60
+ ## Replaces
61
+
62
+ This package contains the calendar-specific portion of the (removed) `@bimetal/rules`. The generic engine lives in `@bimetal/rule-engine`.
63
+
64
+ ## License
65
+
66
+ PolyForm Noncommercial License 1.0.0
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../core/dist/types.d.ts","../../core/dist/errors.d.ts","../../core/dist/constants.d.ts","../../core/dist/datetime.d.ts","../../core/dist/time-range.d.ts","../../core/dist/duration.d.ts","../../core/dist/granularity.d.ts","../../core/dist/grid.d.ts","../../core/dist/visible-range.d.ts","../../core/dist/segmentation.d.ts","../../core/dist/collision.d.ts","../../core/dist/layout.d.ts","../../core/dist/axis.d.ts","../../core/dist/domains.d.ts","../../core/dist/rules.d.ts","../../core/dist/interactions.d.ts","../../core/dist/recurrence.d.ts","../../core/dist/recurrence-instance.d.ts","../../core/dist/format.d.ts","../../core/dist/config.d.ts","../../core/dist/index.d.ts","../../event-sourcing/dist/types.d.ts","../../event-sourcing/dist/errors.d.ts","../../event-sourcing/dist/in-memory-store.d.ts","../../event-sourcing/dist/event-bus.d.ts","../../event-sourcing/dist/in-memory-snapshot-store.d.ts","../../event-sourcing/dist/index.d.ts","../../calendar-data/dist/types.d.ts","../../calendar-data/dist/in-memory-snapshot-store.d.ts","../../calendar-data/dist/commands.d.ts","../../calendar-data/dist/aggregate.d.ts","../../calendar-data/dist/projection.d.ts","../../calendar-data/dist/store.d.ts","../../calendar-data/dist/index.d.ts","../../rule-engine/dist/types.d.ts","../../rule-engine/dist/engine.d.ts","../../rule-engine/dist/index.d.ts","../src/types.ts","../src/utils.ts","../src/calendar-rules.ts","../src/store-integration.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/@types/node/web-globals/blob.d.ts","../../../node_modules/@types/node/web-globals/console.d.ts","../../../node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/@types/node/web-globals/encoding.d.ts","../../../node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/undici-types/utility.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client-stats.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/round-robin-pool.d.ts","../../../node_modules/undici-types/h2c-client.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/socks5-proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/@types/node/web-globals/importmeta.d.ts","../../../node_modules/@types/node/web-globals/messaging.d.ts","../../../node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/@types/node/web-globals/performance.d.ts","../../../node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/@types/node/web-globals/timers.d.ts","../../../node_modules/@types/node/web-globals/url.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/@types/node/inspector/promises.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/path/posix.d.ts","../../../node_modules/@types/node/path/win32.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/quic.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/test/reporters.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/util/types.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/better-sqlite3/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/deep-eql/index.d.ts","../../../node_modules/assertion-error/index.d.ts","../../../node_modules/@types/chai/index.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/http-errors/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/@types/google-protobuf/index.d.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/react/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/trusted-types/lib/index.d.ts","../../../node_modules/@types/trusted-types/index.d.ts","../../../node_modules/@types/whatwg-mimetype/index.d.ts"],"fileIdsList":[[109,173,181,185,188,190,191,192,205],[109,173,181,185,188,190,191,192,205,230],[109,173,181,185,187,188,190,191,192,205,230,232],[109,173,181,185,188,190,191,192,205,234,235],[109,173,181,185,187,188,190,191,192,205,230],[109,173,181,185,188,190,191,192,205,237],[109,173,181,184,185,187,188,190,191,192,205,230,240,241,242],[109,173,181,185,188,190,191,192,205,233,243,245],[109,170,171,173,181,185,188,190,191,192,205],[109,172,173,181,185,188,190,191,192,205],[173,181,185,188,190,191,192,205],[109,173,181,185,188,190,191,192,205,213],[109,173,174,179,181,184,185,188,190,191,192,194,205,210,222],[109,173,174,175,181,184,185,188,190,191,192,205],[109,173,176,181,185,188,190,191,192,205,223],[109,173,177,178,181,185,188,190,191,192,196,205],[109,173,178,181,185,188,190,191,192,205,210,219],[109,173,179,181,184,185,188,190,191,192,194,205],[109,172,173,180,181,185,188,190,191,192,205],[109,173,181,182,185,188,190,191,192,205],[109,173,181,183,184,185,188,190,191,192,205],[109,172,173,181,184,185,188,190,191,192,205],[109,173,181,184,185,186,188,190,191,192,205,210,222],[109,173,181,184,185,186,188,190,191,192,205,210,213],[109,160,173,181,184,185,187,188,190,191,192,194,205,210,222],[109,173,181,184,185,187,188,190,191,192,194,205,210,219,222],[109,173,181,185,187,188,189,190,191,192,205,210,219,222],[107,108,109,110,111,112,113,114,115,116,117,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229],[109,173,181,184,185,188,190,191,192,205],[109,173,181,185,188,190,192,205],[109,173,181,185,188,190,191,192,193,205,222],[109,173,181,184,185,188,190,191,192,194,205,210],[109,173,181,185,188,190,191,192,196,205],[109,173,181,185,188,190,191,192,197,205],[109,173,181,184,185,188,190,191,192,200,205],[109,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229],[109,173,181,185,188,190,191,192,202,205],[109,173,181,185,188,190,191,192,203,205],[109,173,178,181,185,188,190,191,192,194,205,213],[109,173,181,184,185,188,190,191,192,205,206],[109,173,181,185,188,190,191,192,205,207,223,226],[109,173,181,184,185,188,190,191,192,205,210,212,213],[109,173,181,185,188,190,191,192,205,211,213],[109,173,181,185,188,190,191,192,205,213,223],[109,173,181,185,188,190,191,192,205,214],[109,170,173,181,185,188,190,191,192,205,210,216,222],[109,173,181,185,188,190,191,192,205,210,215],[109,173,181,184,185,188,190,191,192,205,217,218],[109,173,181,185,188,190,191,192,205,217,218],[109,173,178,181,185,188,190,191,192,194,205,210,219],[109,173,181,185,188,190,191,192,205,220],[109,173,181,185,188,190,191,192,194,205,221],[109,173,181,185,187,188,190,191,192,203,205,222],[109,173,181,185,188,190,191,192,205,223,224],[109,173,178,181,185,188,190,191,192,205,224],[109,173,181,185,188,190,191,192,205,210,225],[109,173,181,185,188,190,191,192,193,205,226],[109,173,181,185,188,190,191,192,205,227],[109,173,176,181,185,188,190,191,192,205],[109,173,178,181,185,188,190,191,192,205],[109,173,181,185,188,190,191,192,205,223],[109,160,173,181,185,188,190,191,192,205],[109,173,181,185,188,190,191,192,205,222],[109,173,181,185,188,190,191,192,205,228],[109,173,181,185,188,190,191,192,200,205],[109,173,181,185,188,190,191,192,205,218],[109,160,173,181,184,185,186,188,190,191,192,200,205,210,213,222,225,226,228],[109,173,181,185,188,190,191,192,205,210,229],[109,173,181,185,188,190,191,192,205,250],[109,173,181,185,188,190,191,192,205,248,249],[109,173,181,185,188,190,191,192,205,210,230],[109,173,181,185,187,188,190,191,192,205,230,244],[109,173,181,185,188,190,191,192,205,252],[109,124,127,130,131,173,181,185,188,190,191,192,205,222],[109,127,173,181,185,188,190,191,192,205,210,222],[109,127,131,173,181,185,188,190,191,192,205,222],[109,173,181,185,188,190,191,192,205,210],[109,121,173,181,185,188,190,191,192,205],[109,125,173,181,185,188,190,191,192,205],[109,123,124,127,173,181,185,188,190,191,192,205,222],[109,173,181,185,188,190,191,192,194,205,219],[109,121,173,181,185,188,190,191,192,205,230],[109,123,127,173,181,185,188,190,191,192,194,205,222],[109,118,119,120,122,126,173,181,184,185,188,190,191,192,205,210,222],[109,127,136,144,173,181,185,188,190,191,192,205],[109,119,125,173,181,185,188,190,191,192,205],[109,127,154,155,173,181,185,188,190,191,192,205],[109,119,122,127,173,181,185,188,190,191,192,205,213,222,230],[109,127,173,181,185,188,190,191,192,205],[109,123,127,173,181,185,188,190,191,192,205,222],[109,118,173,181,185,188,190,191,192,205],[109,121,122,123,125,126,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,155,156,157,158,159,173,181,185,188,190,191,192,205],[109,127,147,150,173,181,185,188,190,191,192,205],[109,127,136,137,138,173,181,185,188,190,191,192,205],[109,125,127,137,139,173,181,185,188,190,191,192,205],[109,126,173,181,185,188,190,191,192,205],[109,119,121,127,173,181,185,188,190,191,192,205],[109,127,131,137,139,173,181,185,188,190,191,192,205],[109,131,173,181,185,188,190,191,192,205],[109,125,127,130,173,181,185,188,190,191,192,205,222],[109,119,123,127,136,173,181,185,188,190,191,192,205],[109,127,147,173,181,185,188,190,191,192,205],[109,139,173,181,185,188,190,191,192,205],[109,119,123,127,131,173,181,185,188,190,191,192,205],[109,121,127,154,173,181,185,188,190,191,192,205,213,228,230],[90,91,109,173,181,185,188,190,191,192,205],[84,91,109,173,181,185,188,190,191,192,205],[91,109,173,181,185,188,190,191,192,205],[90,91,92,93,94,95,96,109,173,181,185,188,190,191,192,205],[84,90,109,173,181,185,188,190,191,192,205],[84,97,101,102,109,173,181,185,188,190,191,192,205],[100,101,102,103,104,109,173,181,185,188,190,191,192,205],[84,97,101,109,173,181,185,188,190,191,192,205],[84,97,100,109,173,181,185,188,190,191,192,205],[64,109,173,181,185,188,190,191,192,205],[64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,109,173,181,185,188,190,191,192,205],[85,109,173,181,185,188,190,191,192,205],[85,86,87,88,89,109,173,181,185,188,190,191,192,205],[98,109,173,181,185,188,190,191,192,205],[98,99,109,173,181,185,188,190,191,192,205]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"d8313dccec31e5204276ad4fc8bcf2ed8d907e53e9dbdb22b5b08054fa3790d6","af1d08ad27c74802dfcdbf3d330244f6fc5788299845a006686538b66f9833e1","c8d50640061a6230888848ffd49c5779b1bcf402e9f4beda5d89ec4c2abcb539","8d872a45abc0b7f80777900fa6d56118d9164efa7b55d53b351d37fac640dfdc","1b8253fe15f9b77b0d945da581728d06d5db9d496a7189a44407733808dcfd93","70552c3d0b0f65e587e0588102c594d67a15405d6e9dc12fe8aa66a03cb299fe","b68625e443c4c7693517ec8b10cb29adca73bc7f954f16da89bb3bd54861d605","bbe083d46869cc672b68a8d3d7d26a8dfab721b0d7109cd0c5f73a076f72fb8a","d3a026f036e719bb932018d689f5aa090eeafc9247ccf49bb321157dc6ecf8cc","1625307eddd3d990b4b24d07e22950faf9d9337a32c3059e1026447b8f699253","1a60b1a496a658d634f486c8b697ef2ac3129f52400d0c97a16edccd7d4887f9","53023181ba903f2b8695f3abcd1697703970afe0617daacf54bf0bbfbab06860","554c57eeb87a2fff7009294ab9a02fc7119ffee6b6bf7fe18288dcf2275338fc","e343885a58cabe10bb9208fcee9450edf3dea99d72b6ec81de0105f80df01a5e","c7bf42f9b14573553f3f73ea4fa3db120c0b8076048484241b173f2e35a42578","14def66b1c958fbd621e7b22d565adbee512f68948178a720ddda27ecc544287","11b4f9f945a1943f1cd8b2c6af293c35177ac7b447069e01d743085e56c192f6","14f680cda04bcc590431bdb66c63ac9b0c3b082842b035509b603957fb9e9d15","777a8dba9366f037fb208685916c0f7cee5a39665ca1ee658fc4273b30b08d4c","b0bcee95a3a1097da02dd11f3fad00269d9d4d5258638bc2ba1776c4fdbc86a7","f48f4b77225204ddf5bd6261c3ce137a0f83cb17c5b91dc3d70b847b197fdf6c","36ec76ae224216d817be48e4ce4b12ca0b15094af164c930c6d96bf2d69dce4e","eedcb9d5cb4359a781662caed3fe1f272c0837d9d6f6e4be5dc5f47891d232ec","e66e30a26be9f4e4aca05d1e159634b0728dff5077d83f6dc48b9a9b117ef5de","91a9e7fe477539623392444a3d866e27ff0ed28cf220026ac4c7ca169007fae0","68c6bba43ac9b6477d7843d770ae1d14ac495f52ae6d9f1f99cf44024623804c","78e1e45d965b05e50897ad8febee84684a7d0e90237ae3250c8a61e01f848121","9d4ad38ea21216ed5ad0a5a5a4728670d48aeb8f7c16ed76c27d318fcf6c0079","0d76ecc4fe95cce6ca4b4cfe1e6b604e0a69c0e72ab46053f9a6d875a2017af2","9375849aa8c198f43049200e7bfdeaac9f4111b48c017741445910a029c4f95b","27208324bed279a6d8a7c3b6600cfed472181c9727d1ad62152b528bf49da71d","1fdf0d8a3ce018e82f6bba8fe2d5f8599443a804251ccdb37622d1d7caba23cb","047f0d68a83ab9c981dbf3b542d863e8acca575490cb7ce97a026f4c6050896b","9a2288ca5f92c1f3be20442dcbdd2a7ce0aa1e2f8507f7264450c661fe4fb1d6","e37ff2a2bad93b4820cf703008b965f3c40e00cae63fff2de4c8691693a07e43","d1537bb90c7b43698ff136fc2a0fb62f361b7184023c95281cf7a33046660a50","39aa5838393944bf2620a869d1030cae4d38bb1ec810b6495276efc7811931a5",{"version":"08fc143328dd9aaf5b30f79baa5f6d4803739f77345ddb05a5a0724a6b06d723","signature":"237bf1bc35af4f769e2e56129c2ec0cac647e8d888ed0392946c423cf54be55f"},{"version":"4c84dc06aebf67d0b4a3180d006abb136029727a55ea45b9ea0e0ee74c9acc86","signature":"f0732e4ccc4d036157b5a8c59b6d127e1f0afcbd186d2757e943570f15efe46e"},{"version":"8114070cc3184ee5c4d949299cd7f6d6474fa078e0fafaa50b98f92ac0115de7","signature":"870e5ae3fd133283a3097a08cf2fc43076665d2f6f2735cc1a6c16e853d05255"},{"version":"d7af4ef785fbc8a05893ac1bdadf3db2186fe226fda87eccbd6989c273063498","signature":"5416aa1d93c2eaba92d0db96ad7feb18375991cb11033ad474f6291b5c621e1c"},{"version":"02313e04838dbcac669c1b41848685f1bb9c7c1f4ffce46e1641c57279af2daf","signature":"573d0a341f873d13fc551852f2d6217bfca56b498bbe404dd9a7a5da167bddbc"},{"version":"ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ccdaa19852d25ecd84eec365c3bfa16e7859cadecf6e9ca6d0dbbbee439743f","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc2110f7decca6bfb9392e30421cfa1436479e4a6756e8fec6cbc22625d4f881","affectsGlobalScope":true,"impliedFormat":1},{"version":"096116f8fedc1765d5bd6ef360c257b4a9048e5415054b3bf3c41b07f8951b0b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5e01375c9e124a83b52ee4b3244ed1a4d214a6cfb54ac73e164a823a4a7860a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f90ae2bbce1505e67f2f6502392e318f5714bae82d2d969185c4a6cecc8af2fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b58e207b93a8f1c88bbf2a95ddc686ac83962b13830fe8ad3f404ffc7051fb4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1fefabcb2b06736a66d2904074d56268753654805e829989a46a0161cd8412c5","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"c18a99f01eb788d849ad032b31cafd49de0b19e083fe775370834c5675d7df8e","affectsGlobalScope":true,"impliedFormat":1},{"version":"5247874c2a23b9a62d178ae84f2db6a1d54e6c9a2e7e057e178cc5eea13757fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"156a859e21ef3244d13afeeba4e49760a6afa035c149dda52f0c45ea8903b338","impliedFormat":1},{"version":"10ec5e82144dfac6f04fa5d1d6c11763b3e4dbbac6d99101427219ab3e2ae887","impliedFormat":1},{"version":"615754924717c0b1e293e083b83503c0a872717ad5aa60ed7f1a699eb1b4ea5c","impliedFormat":1},{"version":"14e9acf826baba0ef4b5665704084896e7bcc06f65a9ab13af7e93d27d6b7069","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"21adf13435b9b748529c8cedf80f884e5130b9684188120a686cd2b26a2059c7","impliedFormat":1},{"version":"eec76bf6b9346f3f95fa402621b889489e96930e72295b0369022f332e9b4a6a","impliedFormat":1},{"version":"0ecd58f413f9bc3b7d4383eae31b0c8fc576985cd7404d6f99f8c643543ade74","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"9c32412007b5662fd34a8eb04292fb5314ec370d7016d1c2fb8aa193c807fe22","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"4d327f7d72ad0918275cea3eee49a6a8dc8114ae1d5b7f3f5d0774de75f7439a","impliedFormat":1},{"version":"6ebe8ebb8659aaa9d1acbf3710d7dae3e923e97610238b9511c25dc39023a166","impliedFormat":1},{"version":"e85d7f8068f6a26710bff0cc8c0fc5e47f71089c3780fbede05857331d2ddec9","impliedFormat":1},{"version":"7befaf0e76b5671be1d47b77fcc65f2b0aad91cc26529df1904f4a7c46d216e9","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"d33ce35e3f9cfcc1d94eca415bdd3bde94d5b153ffdd33e6c4455c029986c630","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"8aee8b6d4f9f62cf3776cda1305fb18763e2aade7e13cea5bbe699112df85214","impliedFormat":1},{"version":"98498b101803bb3dde9f76a56e65c14b75db1cc8bec5f4db72be541570f74fc5","impliedFormat":1},{"version":"4dc59f6e1dbf3d5f66660fceabe6c174d3261b37b696ae1854f0dbaf255fc753","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"436d7b4543b340b0f3eef4310d524242e41369b9652aa9c70428767c4dcac455","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"12950411eeab8563b349cb7959543d92d8d02c289ed893d78499a19becb5a8cc","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"114f493b30f364255290472111b5a4791d5902c308645670cd0401429cbc6930","impliedFormat":1},{"version":"c3f5289820990ab66b70c7fb5b63cb674001009ff84b13de40619619a9c8175f","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3275d55fac10b799c9546804126239baf020d220136163f763b55a74e50e750","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa68a0a3b7cb32c00e39ee3cd31f8f15b80cac97dce51b6ee7fc14a1e8deb30b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c36e755bced82df7fb6ce8169265d0a7bb046ab4e2cb6d0da0cb72b22033e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"7a93de4ff8a63bafe62ba86b89af1df0ccb5e40bb85b0c67d6bbcfdcf96bf3d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"90e85f9bc549dfe2b5749b45fe734144e96cd5d04b38eae244028794e142a77e","affectsGlobalScope":true,"impliedFormat":1},{"version":"e0a5deeb610b2a50a6350bd23df6490036a1773a8a71d70f2f9549ab009e67ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"d2ae155afe8a01cc0ae612d99117cf8ef16692ba7c4366590156fdec1bcf2d8c","impliedFormat":1},{"version":"3f5e5d9be35913db9fea42a63f3df0b7e3c8703b97670a2125587b4dbbd56d7c","impliedFormat":1},{"version":"8caeb65fdc3bfe0d13f86f67324fcb2d858ed1c55f1f0cce892eb1acfb9f3239","impliedFormat":1},{"version":"57c23df0b5f7a8e26363a3849b0bc7763f6b241207157c8e40089d1df4116f35","affectsGlobalScope":true,"impliedFormat":1},{"version":"3b8bc0c17b54081b0878673989216229e575d67a10874e84566a21025a2461ee","impliedFormat":1},{"version":"5b0db5a58b73498792a29bfebc333438e61906fef75da898b410e24e52229e6f","impliedFormat":1},{"version":"dbe055b2b29a7bab2c1ca8f259436306adb43f469dca7e639a02cd3695d3f621","impliedFormat":1},{"version":"1678b04557dca52feab73cc67610918a7f5e25bfdba3e7fa081acd625d93106d","impliedFormat":1},{"version":"e3905f6902f0b69e5eefc230daa69fdd4ab707a973ec2d086d65af1b3ea47ef0","impliedFormat":1},{"version":"2ea729503db9793f2691162fec3dd1118cab62e96d025f8eeb376d43ec293395","impliedFormat":1},{"version":"9ec87fea42b92894b0f209931a880789d43c3397d09dd99c631ae40a2f7071d1","impliedFormat":1},{"version":"c68e88cdfadfb6c8ba5fc38e58a3a166b0beae77b1f05b7d921150a32a5ffb8d","impliedFormat":1},{"version":"2bc7aa4fba46df0bd495425a7c8201437a7d465f83854fac859df2d67f664df3","impliedFormat":1},{"version":"41d17e1ad9a002feb11c8cdd2777e5bbc0cdb1e3f595d237e4dded0b6949983b","impliedFormat":1},{"version":"1fede9296beac11ce8e6b425396a1791f64341f2be85deebb6286faf6e16306e","affectsGlobalScope":true,"impliedFormat":1},{"version":"80219a97fd3ce5f91af5c355a264844027a899b3d9a3cd41cf6f3bc5947edc95","impliedFormat":1},{"version":"89444c76f16bf7994e230d98e1bc3f01d654de04ef02f60430d9a98d5b450a8b","impliedFormat":1},{"version":"0eb5d0cbf09de5d34542b977fd6a933bb2e0817bffe8e1a541b2f1ad1b9af1ff","impliedFormat":1},{"version":"fac3e88881b35d3a757ed891ac912b2674792c25e2a1a74e1f5fbc72d19a9792","impliedFormat":1},{"version":"2c2bdaa1d8ead9f68628d6d9d250e46ee8e81aa4898b4769a36956ae15e060fe","impliedFormat":1},{"version":"c32c840c62d8bd7aeb3147aa6754cd2d922b990a6b6634530cb2ebdce5adc8e9","impliedFormat":1},{"version":"e1c1a0b4d1ead0de9eca52203aeb1f771f21e6238d6fcd15aa56ac2a02f1b7bf","impliedFormat":1},{"version":"82b91e4e42e6c41bc7fc1b6c2dc5eba6a2ba98375eb1f210e6ff6bba2d54177e","impliedFormat":1},{"version":"6fe28249ac0c7bc19a79aa9264baf00efbd080e868dbe1d3052033ad1c64f206","affectsGlobalScope":true,"impliedFormat":1},{"version":"cbed824fec91efefc7bbdcb8b43d1a531fdbebd0e2ef19481501ff365a93cb70","impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"d0716593b3f2b0451bcf0c24cfa86dec2235c325c89f201934248b7c742715fc","impliedFormat":1},{"version":"ec501101c2a96133a6c695f934c8f6642149cc728571b29cbb7b770984c1088e","impliedFormat":1},{"version":"b214ebcf76c51b115453f69729ee8aa7b7f8eccdae2a922b568a45c2d7ff52f7","impliedFormat":1},{"version":"429c9cdfa7d126255779efd7e6d9057ced2d69c81859bbab32073bad52e9ba76","impliedFormat":1},{"version":"2991bca2cc0f0628a278df2a2ccdb8d6cbcb700f3761abbed62bba137d5b1790","impliedFormat":1},{"version":"c51b3c3f6c5aa5b121124f4b593996826aab90667f95de88c1ff13c1736e11ba","affectsGlobalScope":true,"impliedFormat":1},{"version":"230763250f20449fa7b3c9273e1967adb0023dc890d4be1553faca658ee65971","impliedFormat":1},{"version":"c3e9078b60cb329d1221f5878e88cecfa3e74460550e605a58fcfb41a66029ff","impliedFormat":1},{"version":"a74edb3bab7394a9dbde529d60632be590def2f5f01024dbd85441587fbfbbe0","impliedFormat":1},{"version":"0ea59f7d3e51440baa64f429253759b106cfcbaf51e474cae606e02265b37cf8","impliedFormat":1},{"version":"bc18a1991ba681f03e13285fa1d7b99b03b67ee671b7bc936254467177543890","impliedFormat":1},{"version":"00049ccc87f3f37726db03c01ca68fe74fd9c0109b68c29eb9923ebec2c76b13","impliedFormat":1},{"version":"fa94bbf532b7af8f394b95fa310980d6e20bd2d4c871c6a6cb9f70f03750a44b","impliedFormat":1},{"version":"7fde0e1be5c8be204ffbf428abfcf01da2eb0f130e1bc3f539eb7275f4fd1f58","impliedFormat":1},{"version":"e284328553df5f425a5d33d36a0c3fa66b46af9d097cad6f4d2e8696dfdeb0f1","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fa2214bb0d64701bc6f9ce8cde2fd2ff8c571e0b23065fa04a8a5a6beb91511","impliedFormat":1},{"version":"f1c93e046fb3d9b7f8249629f4b63dc068dd839b824dd0aa39a5e68476dc9420","impliedFormat":1},{"version":"016b29bf4926b80255a108c53a1451717350059da04fcae64d1075f5e93bbb39","impliedFormat":1},{"version":"841983e39bd4cbb463be385e92fda11057cab368bf27100a801c492f1d86cbaa","impliedFormat":1},{"version":"3856f7d31d0c47ec0dded3ec552519a3cd6639c1ad7be279dd1b31abffd8cc85","impliedFormat":1},{"version":"e16b319e5aca1031168de823c4946ff8e29629c4c8cc0ec0fcfe2a8ab2155043","impliedFormat":1},{"version":"e4156ddb25aa0e3b5303d372f26957b36778f0f6bbd4326359269873295e3058","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc1b433a84cae05ddc5672d4823170af78606ad21ecef60dbc4570190cbf1357","impliedFormat":1},{"version":"9d3821bc75c59577e52643324cec92fc2145642e8d17cf7ee07a3181f21d985d","impliedFormat":1},{"version":"7f78cfb2b343838612c192cb251746e3a7c62ac7675726a47e130d9b213f6580","impliedFormat":1},{"version":"201db9cf1687fab1adf5282fcba861f382b32303dc4f67c89d59655e78a25461","impliedFormat":1},{"version":"2c3c5c0f54055e87640f5d233716fd889f3034fc7911d603b642369b0dbeb2a7","impliedFormat":1},{"version":"0a20eaf2e4b1e3c1e1f87f7bccb0c936375b23b022baeea750519b7c9bc6ce83","impliedFormat":1},{"version":"b484ec11ba00e3a2235562a41898d55372ccabe607986c6fa4f4aba72093749f","impliedFormat":1},{"version":"a16b91b27bd6b706c687c88cbc8a7d4ee98e5ed6043026d6b84bda923c0aed67","impliedFormat":1},{"version":"4ebf086fa2e5ef2b65133a944cb3f8ab518a22087727dfbfc802a3654c396f2f","impliedFormat":1},{"version":"99ab6d0d660ce4d21efb52288a39fd35bb3f556980ec5463b1ae8f304a3bbc85","impliedFormat":1},{"version":"6eeded8c7e352be6e0efb83f4935ec752513c4d22043b52522b90849a49a3a11","impliedFormat":1},{"version":"6c1ad90050ffbb151cacc68e2d06ea1a26a945659391e32651f5d42b86fd7f2c","impliedFormat":1},{"version":"55cdbeebe76a1fa18bbd7e7bf73350a2173926bd3085bb050cf5a5397025ee4e","impliedFormat":1},{"version":"c2a6a737189ced24ffe0634e9239b087e4c26378d0490f95141b9b9b042b746c","impliedFormat":1},{"version":"104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","impliedFormat":1},{"version":"cc0d0b339f31ce0ab3b7a5b714d8e578ce698f1e13d7f8c60bfb766baeb1d35c","impliedFormat":1},{"version":"427fe2004642504828c1476d0af4270e6ad4db6de78c0b5da3e4c5ca95052a99","impliedFormat":1},{"version":"2eeffcee5c1661ddca53353929558037b8cf305ffb86a803512982f99bcab50d","impliedFormat":99},{"version":"9afb4cb864d297e4092a79ee2871b5d3143ea14153f62ef0bb04ede25f432030","affectsGlobalScope":true,"impliedFormat":99},{"version":"fb893a0dfc3c9fb0f9ca93d0648694dd95f33cbad2c0f2c629f842981dfd4e2e","impliedFormat":1},{"version":"89e326922cadcc2331d7e851011cf9f0456a681aaf3c95b48b81f8d80e8cdfba","impliedFormat":1},{"version":"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","impliedFormat":1},{"version":"d34aa8df2d0b18fb56b1d772ff9b3c7aea7256cf0d692f969be6e1d27b74d660","impliedFormat":1},{"version":"93a3b8e57c68e348fc4054b245bd7cf4893225f56c991028844b693c2fa8c03c","impliedFormat":1},{"version":"2f5747b1508ccf83fad0c251ba1e5da2f5a30b78b09ffa1cfaf633045160afed","impliedFormat":1},{"version":"6823ccc7b5b77bbf898d878dbcad18aa45e0fa96bdd0abd0de98d514845d9ed9","affectsGlobalScope":true,"impliedFormat":1},{"version":"b71c603a539078a5e3a039b20f2b0a0d1708967530cf97dec8850a9ca45baa2b","impliedFormat":1},{"version":"168d88e14e0d81fe170e0dadd38ae9d217476c11435ea640ddb9b7382bdb6c1f","impliedFormat":1},{"version":"8e04cf0688e0d921111659c2b55851957017148fa7b977b02727477d155b3c47","impliedFormat":1},{"version":"4f817d326453d8d578758889131c3cab8665a0aa252df1ea254a83b653422efa","impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"dc0a7f107690ee5cd8afc8dbf05c4df78085471ce16bdd9881642ec738bc81fe","impliedFormat":1},{"version":"be1cc4d94ea60cbe567bc29ed479d42587bf1e6cba490f123d329976b0fe4ee5","impliedFormat":1},{"version":"15fe687c59d62741b4494d5e623d497d55eb38966ecf5bea7f36e48fc3fbe15e","impliedFormat":1},{"version":"2c3b8be03577c98530ef9cb1a76e2c812636a871f367e9edf4c5f3ce702b77f8","affectsGlobalScope":true,"impliedFormat":1},{"version":"18942319aff2c9619e05c379641b571f0958506472a4b539f906be08fcccf806","impliedFormat":1}],"root":[[101,105]],"options":{"composite":true,"declaration":true,"declarationMap":true,"module":99,"noFallthroughCasesInSwitch":true,"noUncheckedSideEffectImports":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":10,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[106,1],[231,2],[233,3],[236,4],[232,5],[238,6],[234,1],[239,1],[243,7],[246,8],[247,1],[244,1],[237,1],[170,9],[171,9],[172,10],[109,11],[173,12],[174,13],[175,14],[107,1],[176,15],[177,16],[178,17],[179,18],[180,19],[181,20],[182,20],[183,21],[184,22],[185,23],[186,24],[110,1],[108,1],[187,25],[188,26],[189,27],[230,28],[190,29],[191,30],[192,29],[193,31],[194,32],[196,33],[197,34],[198,34],[199,34],[200,35],[201,36],[202,37],[203,38],[204,39],[205,40],[206,40],[207,41],[208,1],[209,1],[210,42],[211,43],[212,42],[213,44],[214,45],[215,46],[216,47],[217,48],[218,49],[219,50],[220,51],[221,52],[222,53],[223,54],[224,55],[225,56],[226,57],[227,58],[111,29],[112,1],[113,59],[114,60],[115,1],[116,61],[117,1],[161,62],[162,63],[163,64],[164,64],[165,65],[166,1],[167,12],[168,66],[169,63],[228,67],[229,68],[241,1],[242,1],[251,69],[248,1],[250,70],[240,71],[245,72],[253,73],[252,1],[254,1],[235,1],[195,1],[249,1],[62,1],[63,1],[12,1],[11,1],[2,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[3,1],[21,1],[22,1],[4,1],[23,1],[27,1],[24,1],[25,1],[26,1],[28,1],[29,1],[30,1],[5,1],[31,1],[32,1],[33,1],[34,1],[6,1],[38,1],[35,1],[36,1],[37,1],[39,1],[7,1],[40,1],[45,1],[46,1],[41,1],[42,1],[43,1],[44,1],[8,1],[50,1],[47,1],[48,1],[49,1],[51,1],[9,1],[52,1],[53,1],[54,1],[56,1],[55,1],[57,1],[58,1],[10,1],[59,1],[1,1],[60,1],[61,1],[136,74],[149,75],[133,76],[150,77],[159,78],[124,79],[125,80],[123,81],[158,2],[153,82],[157,83],[127,84],[146,85],[126,86],[156,87],[121,88],[122,82],[128,89],[129,1],[135,90],[132,89],[119,91],[160,92],[151,93],[139,94],[138,89],[140,95],[143,96],[137,97],[141,98],[154,2],[130,99],[131,100],[144,101],[120,77],[148,102],[147,89],[134,100],[142,103],[145,104],[152,1],[118,1],[155,105],[94,106],[93,107],[92,108],[97,109],[95,106],[96,108],[91,110],[103,111],[105,112],[104,113],[101,114],[102,113],[76,115],[74,115],[83,115],[66,1],[67,115],[77,115],[69,115],[65,1],[82,115],[70,115],[71,115],[84,116],[79,115],[75,115],[81,115],[80,115],[78,115],[73,115],[68,115],[64,1],[72,115],[86,117],[88,117],[89,117],[87,117],[90,118],[85,1],[99,119],[100,120],[98,1]],"latestChangedDtsFile":"./utils.d.ts","version":"5.8.3"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Generic calendar rules that ship with the rules package.
3
+ * These cover common constraints applicable to any calendar.
4
+ * Consumers add domain-specific rules on top.
5
+ */
6
+ import type { CalendarEvent } from '@bimetal/core';
7
+ import type { CalendarCommand } from '@bimetal/calendar-data';
8
+ import type { CalendarRule, CalendarRuleResult, RuleContext } from './types.js';
9
+ /**
10
+ * Prevents overlapping events.
11
+ * Expands recurring events to check against concrete instances.
12
+ * Applies to: CreateCalendarEvent, UpdateCalendarEvent, ModifyInstance
13
+ */
14
+ export declare const noOverlap: CalendarRule;
15
+ /**
16
+ * Warns (but does not block) on overlapping events.
17
+ */
18
+ export declare const warnOnOverlap: CalendarRule;
19
+ /**
20
+ * Events must fall within configured working hours.
21
+ * Only applies to non-allDay events.
22
+ */
23
+ export declare const workingHoursOnly: CalendarRule;
24
+ /**
25
+ * Creates a rule that enforces a minimum event duration.
26
+ */
27
+ export declare function minDuration(minutes: number): CalendarRule;
28
+ /**
29
+ * Creates a rule that enforces a maximum event duration.
30
+ */
31
+ export declare function maxDuration(minutes: number): CalendarRule;
32
+ /**
33
+ * Events must be at least as long as the configured granularity.
34
+ * Derives minimum duration from context.config.granularity (day/week view).
35
+ * No hardcoded values — adapts automatically to config changes.
36
+ */
37
+ export declare const minGranularityDuration: CalendarRule;
38
+ /**
39
+ * Creates a rule that only applies to events with a specific domain.
40
+ * The evaluate function receives the typed domain data.
41
+ */
42
+ export declare function domainRule<D>(config: {
43
+ id: string;
44
+ description: string;
45
+ domainKey: string;
46
+ appliesTo?: readonly CalendarCommand['type'][];
47
+ evaluate: (event: CalendarEvent, domain: D, command: CalendarCommand, context: RuleContext) => CalendarRuleResult;
48
+ }): CalendarRule;
49
+ //# sourceMappingURL=calendar-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-rules.d.ts","sourceRoot":"","sources":["../src/calendar-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAW,MAAM,eAAe,CAAC;AAO5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqChF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,YA0BvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAuB3B,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAoC9B,CAAC;AAIF;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAiBzD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAiBzD;AAID;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,YAoBpC,CAAC;AAIF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,KAAK,kBAAkB,CAAC;CACnH,GAAG,YAAY,CAcf"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Generic calendar rules that ship with the rules package.
3
+ * These cover common constraints applicable to any calendar.
4
+ * Consumers add domain-specific rules on top.
5
+ */
6
+ import { overlaps, getDomain, getDayOfWeek, isSameDay, expandRecurrence, addDays, toMinutesOfDay, durationInMinutes, MINUTES_PER_HOUR, } from '@bimetal/core';
7
+ import { resolveTargetEvent } from './utils.js';
8
+ const PASS = { passed: true };
9
+ function reject(ruleId, message) {
10
+ return { passed: false, severity: 'error', ruleId, message };
11
+ }
12
+ function warn(ruleId, message) {
13
+ return { passed: false, severity: 'warning', ruleId, message };
14
+ }
15
+ // ── No Overlap ──────────────────────────────────────────────────
16
+ /**
17
+ * Prevents overlapping events.
18
+ * Applies to: CreateCalendarEvent, UpdateCalendarEvent
19
+ */
20
+ /**
21
+ * Collect all concrete time ranges from events, expanding recurring ones
22
+ * within a relevant range around the target event.
23
+ */
24
+ function getConcreteEvents(events, excludeId, aroundRange) {
25
+ const result = [];
26
+ for (const e of events) {
27
+ if (e.id === excludeId)
28
+ continue;
29
+ if (e.recurrence) {
30
+ const instances = expandRecurrence(e, aroundRange);
31
+ for (const inst of instances) {
32
+ result.push({ id: e.id, title: inst.event.title, timeRange: inst.event.timeRange });
33
+ }
34
+ }
35
+ else if (overlaps(e.timeRange, aroundRange)) {
36
+ result.push({ id: e.id, title: e.title, timeRange: e.timeRange });
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+ /**
42
+ * Prevents overlapping events.
43
+ * Expands recurring events to check against concrete instances.
44
+ * Applies to: CreateCalendarEvent, UpdateCalendarEvent, ModifyInstance
45
+ */
46
+ export const noOverlap = {
47
+ id: 'calendar.noOverlap',
48
+ description: 'Events must not overlap with existing events',
49
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent', 'ModifyInstance'],
50
+ evaluate(command, context) {
51
+ const event = resolveTargetEvent(command, context);
52
+ if (!event)
53
+ return PASS;
54
+ // Build a search range around the target event (±30 days for recurring expansion)
55
+ const searchRange = {
56
+ start: addDays(event.timeRange.start, -30),
57
+ end: addDays(event.timeRange.end, 30),
58
+ };
59
+ const excludeId = command.type === 'ModifyInstance'
60
+ ? command.payload.masterEventId
61
+ : event.id;
62
+ const concrete = getConcreteEvents(context.readModel.events, excludeId, searchRange);
63
+ const conflicting = concrete.find(e => overlaps(e.timeRange, event.timeRange));
64
+ return conflicting
65
+ ? reject(this.id, `Overlaps with "${conflicting.title}"`)
66
+ : PASS;
67
+ },
68
+ };
69
+ /**
70
+ * Warns (but does not block) on overlapping events.
71
+ */
72
+ export const warnOnOverlap = {
73
+ id: 'calendar.warnOnOverlap',
74
+ description: 'Warns when events overlap',
75
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent', 'ModifyInstance'],
76
+ evaluate(command, context) {
77
+ const event = resolveTargetEvent(command, context);
78
+ if (!event)
79
+ return PASS;
80
+ const searchRange = {
81
+ start: addDays(event.timeRange.start, -30),
82
+ end: addDays(event.timeRange.end, 30),
83
+ };
84
+ const excludeId = command.type === 'ModifyInstance'
85
+ ? command.payload.masterEventId
86
+ : event.id;
87
+ const concrete = getConcreteEvents(context.readModel.events, excludeId, searchRange);
88
+ const conflicting = concrete.find(e => overlaps(e.timeRange, event.timeRange));
89
+ return conflicting
90
+ ? warn(this.id, `Overlaps with "${conflicting.title}"`)
91
+ : PASS;
92
+ },
93
+ };
94
+ // ── Working Hours ───────────────────────────────────────────────
95
+ /**
96
+ * Events must fall within configured working hours.
97
+ * Only applies to non-allDay events.
98
+ */
99
+ export const workingHoursOnly = {
100
+ id: 'calendar.workingHoursOnly',
101
+ description: 'Events must be within working hours',
102
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent'],
103
+ evaluate(command, context) {
104
+ const event = resolveTargetEvent(command, context);
105
+ if (!event || event.allDay)
106
+ return PASS;
107
+ const wh = context.config.workingHours;
108
+ if (!wh)
109
+ return PASS; // no working hours configured
110
+ // Timed events must start and end on the same calendar day
111
+ if (!isSameDay(event.timeRange.start, event.timeRange.end)) {
112
+ return reject(this.id, 'Timed event spans multiple days — must start and end on the same day');
113
+ }
114
+ // Check working days (start day — same as end day per check above)
115
+ if (wh.days && wh.days.length > 0) {
116
+ const startDay = getDayOfWeek(event.timeRange.start);
117
+ if (!wh.days.includes(startDay)) {
118
+ return reject(this.id, `Event on non-working day`);
119
+ }
120
+ }
121
+ // Check working hours (minute-accurate)
122
+ const startMinutes = toMinutesOfDay(event.timeRange.start);
123
+ const endMinutes = toMinutesOfDay(event.timeRange.end);
124
+ const whStartMinutes = wh.start * MINUTES_PER_HOUR;
125
+ const whEndMinutes = wh.end * MINUTES_PER_HOUR;
126
+ if (startMinutes < whStartMinutes || endMinutes > whEndMinutes) {
127
+ return reject(this.id, `Event outside working hours (${wh.start}:00–${wh.end}:00)`);
128
+ }
129
+ return PASS;
130
+ },
131
+ };
132
+ // ── Duration Constraints ────────────────────────────────────────
133
+ /**
134
+ * Creates a rule that enforces a minimum event duration.
135
+ */
136
+ export function minDuration(minutes) {
137
+ return {
138
+ id: `calendar.minDuration.${minutes}`,
139
+ description: `Events must be at least ${minutes} minutes`,
140
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent'],
141
+ evaluate(command, context) {
142
+ const event = resolveTargetEvent(command, context);
143
+ if (!event || event.allDay)
144
+ return PASS;
145
+ const durationMin = durationInMinutes(event.timeRange);
146
+ return durationMin >= minutes
147
+ ? PASS
148
+ : reject(this.id, `Event duration ${Math.round(durationMin)} min is below minimum ${minutes} min`);
149
+ },
150
+ };
151
+ }
152
+ /**
153
+ * Creates a rule that enforces a maximum event duration.
154
+ */
155
+ export function maxDuration(minutes) {
156
+ return {
157
+ id: `calendar.maxDuration.${minutes}`,
158
+ description: `Events must be at most ${minutes} minutes`,
159
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent'],
160
+ evaluate(command, context) {
161
+ const event = resolveTargetEvent(command, context);
162
+ if (!event || event.allDay)
163
+ return PASS;
164
+ const durationMin = durationInMinutes(event.timeRange);
165
+ return durationMin <= minutes
166
+ ? PASS
167
+ : reject(this.id, `Event duration ${Math.round(durationMin)} min exceeds maximum ${minutes} min`);
168
+ },
169
+ };
170
+ }
171
+ // ── Granularity-aware Duration ───────────────────────────────────
172
+ /**
173
+ * Events must be at least as long as the configured granularity.
174
+ * Derives minimum duration from context.config.granularity (day/week view).
175
+ * No hardcoded values — adapts automatically to config changes.
176
+ */
177
+ export const minGranularityDuration = {
178
+ id: 'calendar.minGranularityDuration',
179
+ description: 'Event duration must be at least one granularity slot',
180
+ appliesTo: ['CreateCalendarEvent', 'UpdateCalendarEvent'],
181
+ evaluate(command, context) {
182
+ const event = resolveTargetEvent(command, context);
183
+ if (!event || event.allDay)
184
+ return PASS;
185
+ const minMinutes = Math.min(context.config.granularity.day.minutes, context.config.granularity.week.minutes);
186
+ const durationMin = durationInMinutes(event.timeRange);
187
+ return durationMin >= minMinutes
188
+ ? PASS
189
+ : reject(this.id, `Event duration ${Math.round(durationMin)} min is below minimum granularity of ${minMinutes} min`);
190
+ },
191
+ };
192
+ // ── Domain-aware Rule Factory ───────────────────────────────────
193
+ /**
194
+ * Creates a rule that only applies to events with a specific domain.
195
+ * The evaluate function receives the typed domain data.
196
+ */
197
+ export function domainRule(config) {
198
+ return {
199
+ id: config.id,
200
+ description: config.description,
201
+ domainKey: config.domainKey,
202
+ appliesTo: config.appliesTo,
203
+ evaluate(command, context) {
204
+ const event = resolveTargetEvent(command, context);
205
+ if (!event)
206
+ return PASS;
207
+ const domain = getDomain(event, config.domainKey);
208
+ if (!domain)
209
+ return PASS;
210
+ return config.evaluate(event, domain, command, context);
211
+ },
212
+ };
213
+ }
214
+ //# sourceMappingURL=calendar-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-rules.js","sourceRoot":"","sources":["../src/calendar-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EACvE,cAAc,EAAE,iBAAiB,EACjC,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,IAAI,GAAuB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAClD,SAAS,MAAM,CAAC,MAAc,EAAE,OAAe;IAC7C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC/D,CAAC;AACD,SAAS,IAAI,CAAC,MAAc,EAAE,OAAe;IAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACjE,CAAC;AAED,mEAAmE;AAEnE;;;GAGG;AACH;;;GA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QAC1D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module @bimetal/calendar-rules
3
+ *
4
+ * Calendar-domain rule pack. Provides concrete rules (noOverlap,
5
+ * workingHoursOnly, min/maxDuration, …), the `domainRule` factory and
6
+ * `withRules` store integration. Built on `@bimetal/rule-engine`.
7
+ *
8
+ * For consumer convenience the engine factory and core types are
9
+ * re-exported here so callers building calendar applications don't need
10
+ * a second import line per file.
11
+ */
12
+ export type { CalendarRule, CalendarRuleResult, RuleContext, RuleEngine, RuleEngineResult, RuleSeverity, CallerInfo, Rule, } from './types.js';
13
+ export { createRuleEngine } from '@bimetal/rule-engine';
14
+ export { noOverlap, warnOnOverlap, workingHoursOnly, minDuration, maxDuration, minGranularityDuration, domainRule, } from './calendar-rules.js';
15
+ export { withRules, RuleViolationError } from './store-integration.js';
16
+ export type { RuleAwareStore } from './store-integration.js';
17
+ export { resolveTargetEvent } from './utils.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,IAAI,GACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module @bimetal/calendar-rules
3
+ *
4
+ * Calendar-domain rule pack. Provides concrete rules (noOverlap,
5
+ * workingHoursOnly, min/maxDuration, …), the `domainRule` factory and
6
+ * `withRules` store integration. Built on `@bimetal/rule-engine`.
7
+ *
8
+ * For consumer convenience the engine factory and core types are
9
+ * re-exported here so callers building calendar applications don't need
10
+ * a second import line per file.
11
+ */
12
+ // ── Engine (re-exported from @bimetal/rule-engine) ──────────────
13
+ export { createRuleEngine } from '@bimetal/rule-engine';
14
+ // ── Generic Calendar Rules ──────────────────────────────────────
15
+ export { noOverlap, warnOnOverlap, workingHoursOnly, minDuration, maxDuration, minGranularityDuration, domainRule, } from './calendar-rules.js';
16
+ // ── Store Integration ───────────────────────────────────────────
17
+ export { withRules, RuleViolationError } from './store-integration.js';
18
+ // ── Utility (occasionally useful for custom rules) ──────────────
19
+ export { resolveTargetEvent } from './utils.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkBH,mEAAmE;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,mEAAmE;AACnE,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAE7B,mEAAmE;AACnE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGvE,mEAAmE;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Integration of the Rules Engine into the CalendarStore dispatch pipeline.
3
+ *
4
+ * Wraps a CalendarStore so that rules are evaluated before every dispatch.
5
+ * Errors block the command. Warnings are collected and available to the consumer.
6
+ */
7
+ import type { CoreConfig } from '@bimetal/core';
8
+ import type { CalendarStore } from '@bimetal/calendar-data';
9
+ import type { RuleEngine, CallerInfo, CalendarRuleResult } from './types.js';
10
+ export declare class RuleViolationError extends Error {
11
+ readonly violations: CalendarRuleResult[];
12
+ constructor(violations: CalendarRuleResult[]);
13
+ }
14
+ export interface RuleAwareStore extends CalendarStore {
15
+ /** Warnings from the last dispatch (if rules produced warnings but no errors). */
16
+ readonly lastWarnings: readonly CalendarRuleResult[];
17
+ }
18
+ /**
19
+ * Wrap a CalendarStore with rule evaluation.
20
+ *
21
+ * Every dispatch() call runs the rule engine first.
22
+ * If any rule produces an error → RuleViolationError is thrown.
23
+ * If rules only produce warnings → dispatch proceeds, warnings are stored.
24
+ */
25
+ export declare function withRules(store: CalendarStore, engine: RuleEngine, config: CoreConfig, caller?: CallerInfo): RuleAwareStore;
26
+ //# sourceMappingURL=store-integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-integration.d.ts","sourceRoot":"","sources":["../src/store-integration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAoB,UAAU,EAAiB,MAAM,eAAe,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAwC,MAAM,wBAAwB,CAAC;AAElG,OAAO,KAAK,EAAE,UAAU,EAAoB,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE/F,qBAAa,kBAAmB,SAAQ,KAAK;aACf,UAAU,EAAE,kBAAkB,EAAE;gBAAhC,UAAU,EAAE,kBAAkB,EAAE;CAI7D;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,kFAAkF;IAClF,QAAQ,CAAC,YAAY,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,UAAU,GAClB,cAAc,CA+EhB"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Integration of the Rules Engine into the CalendarStore dispatch pipeline.
3
+ *
4
+ * Wraps a CalendarStore so that rules are evaluated before every dispatch.
5
+ * Errors block the command. Warnings are collected and available to the consumer.
6
+ */
7
+ import { now as coreNow } from '@bimetal/core';
8
+ import { undoLastChange, calendarAggregate, calendarProjection } from '@bimetal/calendar-data';
9
+ export class RuleViolationError extends Error {
10
+ violations;
11
+ constructor(violations) {
12
+ super(violations.map(v => !v.passed ? v.message : '').filter(Boolean).join('; '));
13
+ this.violations = violations;
14
+ this.name = 'RuleViolationError';
15
+ }
16
+ }
17
+ /**
18
+ * Wrap a CalendarStore with rule evaluation.
19
+ *
20
+ * Every dispatch() call runs the rule engine first.
21
+ * If any rule produces an error → RuleViolationError is thrown.
22
+ * If rules only produce warnings → dispatch proceeds, warnings are stored.
23
+ */
24
+ export function withRules(store, engine, config, caller) {
25
+ let lastWarnings = [];
26
+ const guarded = {
27
+ async dispatch(command) {
28
+ // Clear warnings before each evaluation
29
+ lastWarnings = [];
30
+ const context = {
31
+ readModel: { events: store.getEvents(), version: store.version },
32
+ config,
33
+ now: coreNow(config.timezone, config.clock),
34
+ caller,
35
+ };
36
+ const result = engine.evaluate(command, context);
37
+ if (!result.passed) {
38
+ throw new RuleViolationError(result.errors);
39
+ }
40
+ lastWarnings = result.warnings;
41
+ return store.dispatch(command);
42
+ },
43
+ // Batch: evaluate rules with progressive state from real aggregate
44
+ async dispatchBatch(commands) {
45
+ lastWarnings = [];
46
+ const batchWarnings = [];
47
+ // Use the real aggregate state (includes undo stack, processed IDs)
48
+ let previewAggregate = store.getAggregateSnapshot();
49
+ let previewReadModel = { events: [...store.getEvents()], version: store.version };
50
+ for (const command of commands) {
51
+ const context = {
52
+ readModel: previewReadModel,
53
+ config,
54
+ now: coreNow(config.timezone, config.clock),
55
+ caller,
56
+ };
57
+ const result = engine.evaluate(command, context);
58
+ if (!result.passed) {
59
+ throw new RuleViolationError(result.errors);
60
+ }
61
+ batchWarnings.push(...result.warnings);
62
+ // Advance preview using same aggregate+projection as Data
63
+ try {
64
+ const rawEvents = calendarAggregate.handle(previewAggregate, command);
65
+ for (const event of rawEvents) {
66
+ const enriched = { ...event, id: `preview-${previewAggregate.version + 1}`, aggregateId: '', timestamp: 0, version: previewAggregate.version + 1 };
67
+ previewAggregate = calendarAggregate.apply(previewAggregate, enriched);
68
+ previewReadModel = calendarProjection.apply(previewReadModel, enriched);
69
+ }
70
+ }
71
+ catch {
72
+ // Aggregate errors during preview are not rule violations —
73
+ // Data catches them during actual dispatch
74
+ }
75
+ }
76
+ lastWarnings = batchWarnings;
77
+ return store.dispatchBatch(commands);
78
+ },
79
+ // Delegate everything else to the underlying store
80
+ getEvents: () => store.getEvents(),
81
+ getEventsInRange: (start, end) => store.getEventsInRange(start, end),
82
+ getHistory: (entityId) => store.getHistory(entityId),
83
+ // Route undo through dispatch so UndoLastChange rules are evaluated
84
+ undo: (entityId) => guarded.dispatch(undoLastChange(entityId)),
85
+ subscribe: (handler) => store.subscribe(handler),
86
+ getAggregateSnapshot: () => store.getAggregateSnapshot(),
87
+ destroy: () => store.destroy?.(),
88
+ get version() { return store.version; },
89
+ get lastWarnings() { return structuredClone(lastWarnings); },
90
+ };
91
+ return guarded;
92
+ }
93
+ //# sourceMappingURL=store-integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-integration.js","sourceRoot":"","sources":["../src/store-integration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG/F,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACf;IAA5B,YAA4B,UAAgC;QAC1D,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CA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ACP,4DAA4D;oBAC5D,2CAA2C;gBAC7C,CAAC;YACH,CAAC;YAED,YAAY,GAAG,aAAa,CAAC;YAC7B,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,mDAAmD;QACnD,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;QAClC,gBAAgB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC;QACpE,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC;QACpD,oEAAoE;QACpE,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC9D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;QAChD,oBAAoB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE;QACxD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE;QAChC,IAAI,OAAO,KAAK,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACvC,IAAI,YAAY,KAAK,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KAC7D,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @bimetal/calendar-rules — Type Definitions
3
+ *
4
+ * Calendar-flavored rule types built on top of `@bimetal/rule-engine`.
5
+ *
6
+ * Adds `domainKey` to the calendar Rule shape so consumers can scope
7
+ * rules to events carrying a specific domain (e.g. only training events).
8
+ * The actual domain-aware filtering is implemented inside `domainRule`
9
+ * itself; the generic engine ignores `domainKey`.
10
+ */
11
+ import type { CalendarDateTime, CoreConfig } from '@bimetal/core';
12
+ import type { CalendarCommand, CalendarReadModel } from '@bimetal/calendar-data';
13
+ import type { Rule, RuleContext as GenericRuleContext, RuleEngine as GenericRuleEngine, RuleResult, RuleEngineResult, RuleSeverity, CallerInfo } from '@bimetal/rule-engine';
14
+ /**
15
+ * Calendar-flavored rule context. Pins read-model, config and `now` to
16
+ * the calendar shapes so consumers don't have to specify them.
17
+ */
18
+ export interface RuleContext extends GenericRuleContext<CalendarReadModel> {
19
+ readonly config: CoreConfig;
20
+ readonly now: CalendarDateTime;
21
+ readonly caller?: CallerInfo;
22
+ }
23
+ /**
24
+ * Calendar-specific rule. Extends the generic `Rule` with `domainKey`,
25
+ * an opaque hint that domain-aware rules use to target events with a
26
+ * specific domain model.
27
+ */
28
+ export interface CalendarRule extends Rule<CalendarCommand, RuleContext> {
29
+ /** Which domain key this rule inspects. Undefined = no domain filter. */
30
+ readonly domainKey?: string;
31
+ }
32
+ /** Calendar-specific alias of {@link RuleResult}. */
33
+ export type CalendarRuleResult = RuleResult;
34
+ export type RuleEngine = GenericRuleEngine<CalendarCommand, RuleContext>;
35
+ export type { RuleEngineResult, RuleSeverity, CallerInfo };
36
+ export type { Rule } from '@bimetal/rule-engine';
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EACV,IAAI,EACJ,WAAW,IAAI,kBAAkB,EACjC,UAAU,IAAI,iBAAiB,EAC/B,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACX,MAAM,sBAAsB,CAAC;AAI9B;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,kBAAkB,CAAC,iBAAiB,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC9B;AAID;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC;IACtE,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qDAAqD;AACrD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAI5C,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;AASzE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3D,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @bimetal/calendar-rules — Type Definitions
3
+ *
4
+ * Calendar-flavored rule types built on top of `@bimetal/rule-engine`.
5
+ *
6
+ * Adds `domainKey` to the calendar Rule shape so consumers can scope
7
+ * rules to events carrying a specific domain (e.g. only training events).
8
+ * The actual domain-aware filtering is implemented inside `domainRule`
9
+ * itself; the generic engine ignores `domainKey`.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,6 @@
1
+ import type { CalendarEvent } from '@bimetal/core';
2
+ import type { CalendarCommand } from '@bimetal/calendar-data';
3
+ import type { RuleContext } from './types.js';
4
+ /** Resolve the event that a command targets (new or existing, with merged changes). */
5
+ export declare function resolveTargetEvent(command: CalendarCommand, context: RuleContext): CalendarEvent | undefined;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,CA2B5G"}
package/dist/utils.js ADDED
@@ -0,0 +1,33 @@
1
+ import { shiftRange } from '@bimetal/core';
2
+ /** Resolve the event that a command targets (new or existing, with merged changes). */
3
+ export function resolveTargetEvent(command, context) {
4
+ switch (command.type) {
5
+ case 'CreateCalendarEvent':
6
+ return command.payload.event;
7
+ case 'UpdateCalendarEvent': {
8
+ const existing = context.readModel.events.find(e => e.id === command.payload.eventId);
9
+ if (!existing)
10
+ return undefined;
11
+ // Must match Data's update semantics exactly: shallow spread replacement
12
+ return { ...existing, ...command.payload.changes };
13
+ }
14
+ case 'DeleteCalendarEvent':
15
+ return context.readModel.events.find(e => e.id === command.payload.eventId);
16
+ case 'UndoLastChange':
17
+ return context.readModel.events.find(e => e.id === command.payload.entityId);
18
+ case 'ModifyInstance': {
19
+ const master = context.readModel.events.find(e => e.id === command.payload.masterEventId);
20
+ if (!master)
21
+ return undefined;
22
+ // Compute concrete instance range from master + originalDate, then apply changes
23
+ const { originalDate } = command.payload;
24
+ const instanceRange = shiftRange(master.timeRange, originalDate);
25
+ return { ...master, timeRange: instanceRange, ...command.payload.changes, recurrence: undefined, exceptions: undefined };
26
+ }
27
+ case 'DeleteInstance':
28
+ return context.readModel.events.find(e => e.id === command.payload.masterEventId);
29
+ default:
30
+ return undefined;
31
+ }
32
+ }
33
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot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iFAAiF;YACjF,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;YACzC,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YACjE,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;QAC3H,CAAC;QACD,KAAK,gBAAgB;YACnB,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACpF;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@bimetal/calendar-rules",
3
+ "version": "0.13.0",
4
+ "description": "Calendar-domain rule pack: noOverlap, workingHoursOnly, min/maxDuration, domainRule, withRules store integration. Built on @bimetal/rule-engine.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -b",
21
+ "dev": "tsc -b --watch",
22
+ "typecheck": "tsc --noEmit -p tsconfig.test.json",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "dependencies": {
28
+ "@bimetal/calendar-data": "^0.13.0",
29
+ "@bimetal/core": "^0.13.0",
30
+ "@bimetal/event-sourcing": "^0.13.0",
31
+ "@bimetal/rule-engine": "^0.13.0"
32
+ },
33
+ "devDependencies": {
34
+ "vitest": "^3.2.1"
35
+ },
36
+ "sideEffects": false,
37
+ "license": "PolyForm-Noncommercial-1.0.0",
38
+ "author": "Andreas Biederbeck",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/bimetal/bimetal.git",
42
+ "directory": "packages/calendar-rules"
43
+ },
44
+ "keywords": [
45
+ "calendar",
46
+ "rules",
47
+ "validation",
48
+ "constraints",
49
+ "headless"
50
+ ]
51
+ }