@dv4resi/dvss-backend-module-calendar-im 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -0
- package/dist/index.d.ts +229 -117
- package/dist/index.js +1507 -2061
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# @dv4resi/dvss-backend-module-calendar-im
|
|
2
|
+
|
|
3
|
+
Calendar Integration Manager module for UIF. This app aggregates and bundles the internal calendar packages into a single publishable npm package that consuming microservices (e.g. `dvss-backend-calendar-ms`) install.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Overview](#overview)
|
|
10
|
+
- [What Gets Bundled](#what-gets-bundled)
|
|
11
|
+
- [How Consuming Microservices Use This](#how-consuming-microservices-use-this)
|
|
12
|
+
- [Bundling Configuration](#bundling-configuration)
|
|
13
|
+
- [Scripts](#scripts)
|
|
14
|
+
- [Local Development](#local-development)
|
|
15
|
+
- [Local Linking with yarn link](#local-linking-with-yarn-link)
|
|
16
|
+
- [Release Checklist](#release-checklist)
|
|
17
|
+
- [Dependencies](#dependencies)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
This is the **published app** for the calendar integration domain. It acts as an aggregator module that:
|
|
24
|
+
|
|
25
|
+
1. Imports `IntegrationLibsModule` and `IntegrationMicrosoftModule` (microsoft already imports `IntegrationOauthModule`)
|
|
26
|
+
2. Registers thin provider handlers and adapter factories (calendar-im does **not** import oauth directly)
|
|
27
|
+
3. Bundles the internal packages into `dist/` using `tsup` so consumers only install this single package
|
|
28
|
+
|
|
29
|
+
```mermaid
|
|
30
|
+
graph TB
|
|
31
|
+
subgraph "UIF Monorepo (Internal)"
|
|
32
|
+
libs["@dvss/dvss-integration-libs"]
|
|
33
|
+
oauth["@dvss/dvss-integration-oauth"]
|
|
34
|
+
microsoft["@dvss/dvss-integration-microsoft"]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
subgraph "This Package"
|
|
38
|
+
calendar["@dv4resi/dvss-backend-module-calendar-im<br/><b>CalendarIntegrationManager</b>"]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
subgraph "Consuming Microservices"
|
|
42
|
+
calms["dvss-backend-calendar-ms"]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
libs -->|bundled into| calendar
|
|
46
|
+
oauth -->|bundled into| calendar
|
|
47
|
+
microsoft -->|bundled into| calendar
|
|
48
|
+
oauth --> microsoft
|
|
49
|
+
calendar -->|"npm install"| calms
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## What Gets Bundled
|
|
55
|
+
|
|
56
|
+
At build time, `tsup` bundles the following internal packages into `dist/`:
|
|
57
|
+
|
|
58
|
+
| Internal Package | What It Provides |
|
|
59
|
+
| ---------------------------------- | --------------------------------------------------------- |
|
|
60
|
+
| `@dvss/dvss-integration-libs` | Base classes, DAOs, traffic router, common utilities |
|
|
61
|
+
| `@dvss/dvss-integration-oauth` | OAuth2 token lifecycle (`OAuth2Provider`, grant handlers) |
|
|
62
|
+
| `@dvss/dvss-integration-microsoft` | Microsoft Graph calendar capability implementations |
|
|
63
|
+
|
|
64
|
+
The following are kept **external** (not bundled) and must be present in the consuming microservice:
|
|
65
|
+
|
|
66
|
+
- `@nestjs/*` packages
|
|
67
|
+
- `@dv4resi/dvss-backend-module-datastore`
|
|
68
|
+
- `@dv4resi/dvss-backend-module-utility`
|
|
69
|
+
- `rxjs`, `reflect-metadata`, `class-transformer`, `class-validator`
|
|
70
|
+
- `drizzle-orm`
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## How Consuming Microservices Use This
|
|
75
|
+
|
|
76
|
+
### Installation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
yarn add @dv4resi/dvss-backend-module-calendar-im
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Importing `CalendarIntegrationManager`
|
|
83
|
+
|
|
84
|
+
The primary export is `CalendarIntegrationManager` -- a NestJS module that wraps libs, microsoft (and oauth via microsoft), plus calendar adapter factories. Consuming microservices only need this single import:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { CalendarIntegrationManager } from '@dv4resi/dvss-backend-module-calendar-im';
|
|
88
|
+
|
|
89
|
+
@Module({
|
|
90
|
+
imports: [
|
|
91
|
+
CalendarIntegrationManager,
|
|
92
|
+
// ... other modules
|
|
93
|
+
],
|
|
94
|
+
})
|
|
95
|
+
export class SomeFeatureModule {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Once imported, adapter factories and Microsoft services are available for injection:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import {
|
|
102
|
+
CalendarAuthAdapterFactory,
|
|
103
|
+
CalendarBookingAdapterFactory,
|
|
104
|
+
MicrosoftAuthService,
|
|
105
|
+
MicrosoftCalendarBookingService,
|
|
106
|
+
} from '@dv4resi/dvss-backend-module-calendar-im';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### What `CalendarIntegrationManager` provides under the hood
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// apps/dvss-backend-module-calendar-im/src/app.module.ts
|
|
113
|
+
@Module({
|
|
114
|
+
imports: [IntegrationLibsModule, IntegrationMicrosoftModule],
|
|
115
|
+
providers: [...microsoftHandlers, ...adapterFactories],
|
|
116
|
+
exports: [IntegrationLibsModule, IntegrationMicrosoftModule, ...microsoftHandlers, ...adapterFactories],
|
|
117
|
+
})
|
|
118
|
+
export class CalendarIntegrationManager {}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// apps/dvss-backend-module-calendar-im/src/index.ts
|
|
123
|
+
export { AppModule as CalendarIntegrationManager } from './app.module';
|
|
124
|
+
export { IntegrationLibsModule } from '@dvss/dvss-integration-libs';
|
|
125
|
+
export { IntegrationMicrosoftModule } from '@dvss/dvss-integration-microsoft';
|
|
126
|
+
export * from '@dvss/dvss-integration-libs';
|
|
127
|
+
export * from '@dvss/dvss-integration-microsoft';
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Bundling Configuration
|
|
133
|
+
|
|
134
|
+
The `tsup.config.ts` handles:
|
|
135
|
+
|
|
136
|
+
- **Internal package resolution** - Resolves `@dvss/dvss-integration-libs`, `@dvss/dvss-integration-oauth`, and `@dvss/dvss-integration-microsoft` to their source files and bundles them
|
|
137
|
+
- **Path resolution** - Fixes `__dirname` references for `.env` file resolution so it works in both monorepo and installed contexts
|
|
138
|
+
- **Output format** - CommonJS (for NestJS compatibility)
|
|
139
|
+
- **Type declarations** - Generates `.d.ts` files for TypeScript consumers
|
|
140
|
+
- **Source maps** - Enabled for debugging
|
|
141
|
+
- **SWC** - Used for decorator metadata support
|
|
142
|
+
- **Tree-shaking** - Enabled to remove unused code
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Scripts
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Start in dev mode with watch on dependent packages
|
|
150
|
+
# Watches: ./src, libs, oauth, microsoft
|
|
151
|
+
yarn run start:dev
|
|
152
|
+
|
|
153
|
+
# Build the package (tsup)
|
|
154
|
+
yarn run build
|
|
155
|
+
|
|
156
|
+
# Watch builds (tsup)
|
|
157
|
+
yarn run build:dev
|
|
158
|
+
|
|
159
|
+
# Build all local dependencies first, then build this package
|
|
160
|
+
yarn run build:with-deps
|
|
161
|
+
|
|
162
|
+
# Tests
|
|
163
|
+
yarn run test
|
|
164
|
+
yarn run test:watch
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Local Development
|
|
170
|
+
|
|
171
|
+
From the monorepo root:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Build this app with all its internal deps in order
|
|
175
|
+
yarn --cwd apps/dvss-backend-module-calendar-im run build:with-deps
|
|
176
|
+
|
|
177
|
+
# Watch mode - auto-rebuilds when libs, oauth, or microsoft source files change
|
|
178
|
+
yarn --cwd apps/dvss-backend-module-calendar-im run start:dev
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The `start:dev` script uses `nodemon` to watch source files across:
|
|
182
|
+
|
|
183
|
+
- `./src` (this app)
|
|
184
|
+
- `../../packages/dvss-integration-libs/src`
|
|
185
|
+
- `../../packages/dvss-integration-oauth/src`
|
|
186
|
+
- `../../packages/dvss-integration-microsoft/src`
|
|
187
|
+
|
|
188
|
+
Any `.ts` file change in these directories triggers a `tsup` rebuild.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Local Linking with yarn link
|
|
193
|
+
|
|
194
|
+
To test local changes in a consuming microservice without publishing:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# 1. Build with deps
|
|
198
|
+
yarn --cwd apps/dvss-backend-module-calendar-im run build:with-deps
|
|
199
|
+
|
|
200
|
+
# 2. Register the link (from the app directory)
|
|
201
|
+
cd apps/dvss-backend-module-calendar-im
|
|
202
|
+
yarn link
|
|
203
|
+
|
|
204
|
+
# 3. Use the link in the consuming microservice
|
|
205
|
+
cd /path/to/dvss-backend-calendar-ms
|
|
206
|
+
yarn link "@dv4resi/dvss-backend-module-calendar-im"
|
|
207
|
+
|
|
208
|
+
# 4. Unlink when done
|
|
209
|
+
yarn unlink "@dv4resi/dvss-backend-module-calendar-im"
|
|
210
|
+
yarn install --force
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
> **Tip:** Run `start:dev` in the UIF monorepo while linked so changes to `libs`, `oauth`, or `microsoft` automatically rebuild this package, and the consuming microservice picks them up.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Release Checklist
|
|
218
|
+
|
|
219
|
+
1. Bump the `version` field in this app's `package.json`
|
|
220
|
+
2. Lint and tests run automatically on commit via Husky
|
|
221
|
+
3. Merge to `master` to trigger the CI lint/build pipeline
|
|
222
|
+
4. After the pipeline passes, trigger the publish pipeline from the latest merged commit on `master`
|
|
223
|
+
5. Tag format: `dvss-backend-module-calendar-im-vX.Y.Z`
|
|
224
|
+
- Version must be exactly the next patch/minor/major from npm (no skipping)
|
|
225
|
+
- The tag prefix must be in the `ALLOWED_NPM_PACKAGES` allowlist in `scripts/validate-tag-and-publish.sh`
|
|
226
|
+
|
|
227
|
+
> The `package.json` version must match the tag version.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Dependencies
|
|
232
|
+
|
|
233
|
+
**Runtime** (must be present in consuming microservice):
|
|
234
|
+
|
|
235
|
+
| Dependency | Purpose |
|
|
236
|
+
| ------------------------------------------------------------ | ------------------- |
|
|
237
|
+
| `@nestjs/common`, `@nestjs/core`, `@nestjs/platform-express` | NestJS framework |
|
|
238
|
+
| `rxjs` | Reactive extensions |
|
|
239
|
+
| `reflect-metadata` | Decorator metadata |
|
|
240
|
+
|
|
241
|
+
**Dev / Bundled** (bundled into `dist/`, not required by consumers):
|
|
242
|
+
|
|
243
|
+
| Dependency | Purpose |
|
|
244
|
+
| ---------------------------------- | -------------------------------------------- |
|
|
245
|
+
| `@dvss/dvss-integration-libs` | Internal: base classes, DAOs, traffic router |
|
|
246
|
+
| `@dvss/dvss-integration-oauth` | Internal: OAuth2 token lifecycle |
|
|
247
|
+
| `@dvss/dvss-integration-microsoft` | Internal: Microsoft Graph calendar |
|