@bayoudhi/moose-lib-serverless 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,63 @@ This package re-exports the pure-TypeScript surface of the Moose SDK — OlapTab
10
10
  npm install @bayoudhi/moose-lib-serverless
11
11
  ```
12
12
 
13
+ If you use `OlapTable<T>`, `Stream<T>`, or other generic Moose resources that require compile-time schema injection, you also need the compiler plugin dependencies:
14
+
15
+ ```bash
16
+ npm install -D ts-patch typia typescript
17
+ ```
18
+
19
+ ## Compiler Plugin Setup
20
+
21
+ The Moose compiler plugin transforms generic resource declarations like `new OlapTable<MyType>(...)` at compile time, injecting JSON schemas, column definitions, and runtime validators. Without it, you'll get:
22
+
23
+ ```
24
+ Supply the type param T so that the schema is inserted by the compiler plugin.
25
+ ```
26
+
27
+ ### 1. Configure `tsconfig.json`
28
+
29
+ Add the compiler plugin and typia transform to your `tsconfig.json`:
30
+
31
+ ```json
32
+ {
33
+ "compilerOptions": {
34
+ "plugins": [
35
+ {
36
+ "transform": "@bayoudhi/moose-lib-serverless/dist/compilerPlugin.js"
37
+ },
38
+ {
39
+ "transform": "typia/lib/transform"
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ ```
45
+
46
+ ### 2. Install ts-patch
47
+
48
+ ```bash
49
+ npx ts-patch install
50
+ ```
51
+
52
+ ### 3. Build with `tspc` instead of `tsc`
53
+
54
+ ```bash
55
+ npx tspc
56
+ ```
57
+
58
+ Or add it to your `package.json` scripts:
59
+
60
+ ```json
61
+ {
62
+ "scripts": {
63
+ "build": "tspc"
64
+ }
65
+ }
66
+ ```
67
+
68
+ > **Note**: `tspc` is a drop-in replacement for `tsc` that loads the compiler plugins defined in `tsconfig.json`. Standard `tsc` ignores the `plugins` array.
69
+
13
70
  ## Usage
14
71
 
15
72
  ### CommonJS (recommended for Lambda)