@pattern-stack/codegen 0.12.1 → 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/CHANGELOG.md +102 -0
- package/README.md +44 -0
- package/dist/runtime/subsystems/index.d.ts +6 -2
- package/dist/runtime/subsystems/index.js +171 -1
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/integration/detection-config.schema.d.ts +110 -1
- package/dist/runtime/subsystems/integration/detection-config.schema.js +25 -2
- package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -1
- package/dist/runtime/subsystems/integration/incremental-read.d.ts +221 -0
- package/dist/runtime/subsystems/integration/incremental-read.js +146 -0
- package/dist/runtime/subsystems/integration/incremental-read.js.map +1 -0
- package/dist/runtime/subsystems/integration/index.d.ts +2 -1
- package/dist/runtime/subsystems/integration/index.js +169 -2
- package/dist/runtime/subsystems/integration/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +1 -1
- package/dist/src/cli/index.js +704 -93
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.d.ts +103 -15
- package/dist/src/index.js +54 -36
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/index.ts +34 -0
- package/runtime/subsystems/integration/detection-config.schema.ts +55 -0
- package/runtime/subsystems/integration/incremental-read.ts +345 -0
- package/runtime/subsystems/integration/index.ts +15 -0
- package/templates/entity/new/clean-lite-ps/prompt-extension.js +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -282,6 +282,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
282
282
|
patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
283
283
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
284
284
|
scopeable: z.ZodOptional<z.ZodBoolean>;
|
|
285
|
+
surface: z.ZodOptional<z.ZodString>;
|
|
286
|
+
context: z.ZodOptional<z.ZodString>;
|
|
285
287
|
}, "strict", z.ZodTypeAny, {
|
|
286
288
|
name: string;
|
|
287
289
|
table: string;
|
|
@@ -294,6 +296,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
294
296
|
pattern?: string | undefined;
|
|
295
297
|
patterns?: string[] | undefined;
|
|
296
298
|
scopeable?: boolean | undefined;
|
|
299
|
+
surface?: string | undefined;
|
|
300
|
+
context?: string | undefined;
|
|
297
301
|
}, {
|
|
298
302
|
name: string;
|
|
299
303
|
table: string;
|
|
@@ -306,6 +310,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
306
310
|
pattern?: string | undefined;
|
|
307
311
|
patterns?: string[] | undefined;
|
|
308
312
|
scopeable?: boolean | undefined;
|
|
313
|
+
surface?: string | undefined;
|
|
314
|
+
context?: string | undefined;
|
|
309
315
|
}>, {
|
|
310
316
|
name: string;
|
|
311
317
|
table: string;
|
|
@@ -318,6 +324,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
318
324
|
pattern?: string | undefined;
|
|
319
325
|
patterns?: string[] | undefined;
|
|
320
326
|
scopeable?: boolean | undefined;
|
|
327
|
+
surface?: string | undefined;
|
|
328
|
+
context?: string | undefined;
|
|
321
329
|
}, {
|
|
322
330
|
name: string;
|
|
323
331
|
table: string;
|
|
@@ -330,6 +338,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
330
338
|
pattern?: string | undefined;
|
|
331
339
|
patterns?: string[] | undefined;
|
|
332
340
|
scopeable?: boolean | undefined;
|
|
341
|
+
surface?: string | undefined;
|
|
342
|
+
context?: string | undefined;
|
|
333
343
|
}>;
|
|
334
344
|
fields: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
335
345
|
type: z.ZodEnum<["string", "integer", "decimal", "boolean", "uuid", "date", "datetime", "json", "entity_ref", "string_array", "enum"]>;
|
|
@@ -1511,6 +1521,24 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1511
1521
|
}, {
|
|
1512
1522
|
field: string;
|
|
1513
1523
|
kind: "eventId";
|
|
1524
|
+
}>, z.ZodObject<{
|
|
1525
|
+
kind: z.ZodLiteral<"historyId">;
|
|
1526
|
+
field: z.ZodString;
|
|
1527
|
+
}, "strip", z.ZodTypeAny, {
|
|
1528
|
+
field: string;
|
|
1529
|
+
kind: "historyId";
|
|
1530
|
+
}, {
|
|
1531
|
+
field: string;
|
|
1532
|
+
kind: "historyId";
|
|
1533
|
+
}>, z.ZodObject<{
|
|
1534
|
+
kind: z.ZodLiteral<"syncToken">;
|
|
1535
|
+
field: z.ZodString;
|
|
1536
|
+
}, "strip", z.ZodTypeAny, {
|
|
1537
|
+
field: string;
|
|
1538
|
+
kind: "syncToken";
|
|
1539
|
+
}, {
|
|
1540
|
+
field: string;
|
|
1541
|
+
kind: "syncToken";
|
|
1514
1542
|
}>]>;
|
|
1515
1543
|
provenance: z.ZodOptional<z.ZodEnum<["poll", "cdc"]>>;
|
|
1516
1544
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1526,6 +1554,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1526
1554
|
} | {
|
|
1527
1555
|
field: string;
|
|
1528
1556
|
kind: "eventId";
|
|
1557
|
+
} | {
|
|
1558
|
+
field: string;
|
|
1559
|
+
kind: "historyId";
|
|
1560
|
+
} | {
|
|
1561
|
+
field: string;
|
|
1562
|
+
kind: "syncToken";
|
|
1529
1563
|
};
|
|
1530
1564
|
provenance?: "poll" | "cdc" | undefined;
|
|
1531
1565
|
}, {
|
|
@@ -1541,6 +1575,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1541
1575
|
} | {
|
|
1542
1576
|
field: string;
|
|
1543
1577
|
kind: "eventId";
|
|
1578
|
+
} | {
|
|
1579
|
+
field: string;
|
|
1580
|
+
kind: "historyId";
|
|
1581
|
+
} | {
|
|
1582
|
+
field: string;
|
|
1583
|
+
kind: "syncToken";
|
|
1544
1584
|
};
|
|
1545
1585
|
provenance?: "poll" | "cdc" | undefined;
|
|
1546
1586
|
}>;
|
|
@@ -1584,6 +1624,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1584
1624
|
} | {
|
|
1585
1625
|
field: string;
|
|
1586
1626
|
kind: "eventId";
|
|
1627
|
+
} | {
|
|
1628
|
+
field: string;
|
|
1629
|
+
kind: "historyId";
|
|
1630
|
+
} | {
|
|
1631
|
+
field: string;
|
|
1632
|
+
kind: "syncToken";
|
|
1587
1633
|
};
|
|
1588
1634
|
provenance?: "poll" | "cdc" | undefined;
|
|
1589
1635
|
};
|
|
@@ -1612,6 +1658,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1612
1658
|
} | {
|
|
1613
1659
|
field: string;
|
|
1614
1660
|
kind: "eventId";
|
|
1661
|
+
} | {
|
|
1662
|
+
field: string;
|
|
1663
|
+
kind: "historyId";
|
|
1664
|
+
} | {
|
|
1665
|
+
field: string;
|
|
1666
|
+
kind: "syncToken";
|
|
1615
1667
|
};
|
|
1616
1668
|
provenance?: "poll" | "cdc" | undefined;
|
|
1617
1669
|
};
|
|
@@ -1692,8 +1744,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
1692
1744
|
value?: unknown;
|
|
1693
1745
|
}[] | undefined;
|
|
1694
1746
|
}>]>>>;
|
|
1695
|
-
surface: z.ZodOptional<z.ZodString>;
|
|
1696
|
-
context: z.ZodOptional<z.ZodString>;
|
|
1697
1747
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1698
1748
|
name: z.ZodString;
|
|
1699
1749
|
queue: z.ZodString;
|
|
@@ -2024,6 +2074,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2024
2074
|
pattern?: string | undefined;
|
|
2025
2075
|
patterns?: string[] | undefined;
|
|
2026
2076
|
scopeable?: boolean | undefined;
|
|
2077
|
+
surface?: string | undefined;
|
|
2078
|
+
context?: string | undefined;
|
|
2027
2079
|
};
|
|
2028
2080
|
behaviors: (string | {
|
|
2029
2081
|
name: string;
|
|
@@ -2082,6 +2134,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2082
2134
|
} | {
|
|
2083
2135
|
field: string;
|
|
2084
2136
|
kind: "eventId";
|
|
2137
|
+
} | {
|
|
2138
|
+
field: string;
|
|
2139
|
+
kind: "historyId";
|
|
2140
|
+
} | {
|
|
2141
|
+
field: string;
|
|
2142
|
+
kind: "syncToken";
|
|
2085
2143
|
};
|
|
2086
2144
|
provenance?: "poll" | "cdc" | undefined;
|
|
2087
2145
|
};
|
|
@@ -2112,8 +2170,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2112
2170
|
value?: unknown;
|
|
2113
2171
|
}[];
|
|
2114
2172
|
}> | undefined;
|
|
2115
|
-
surface?: string | undefined;
|
|
2116
|
-
context?: string | undefined;
|
|
2117
2173
|
events?: {
|
|
2118
2174
|
name: string;
|
|
2119
2175
|
queue: string;
|
|
@@ -2228,6 +2284,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2228
2284
|
pattern?: string | undefined;
|
|
2229
2285
|
patterns?: string[] | undefined;
|
|
2230
2286
|
scopeable?: boolean | undefined;
|
|
2287
|
+
surface?: string | undefined;
|
|
2288
|
+
context?: string | undefined;
|
|
2231
2289
|
};
|
|
2232
2290
|
relationships?: Record<string, {
|
|
2233
2291
|
type: "belongs_to" | "has_many" | "has_one";
|
|
@@ -2286,6 +2344,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2286
2344
|
} | {
|
|
2287
2345
|
field: string;
|
|
2288
2346
|
kind: "eventId";
|
|
2347
|
+
} | {
|
|
2348
|
+
field: string;
|
|
2349
|
+
kind: "historyId";
|
|
2350
|
+
} | {
|
|
2351
|
+
field: string;
|
|
2352
|
+
kind: "syncToken";
|
|
2289
2353
|
};
|
|
2290
2354
|
provenance?: "poll" | "cdc" | undefined;
|
|
2291
2355
|
};
|
|
@@ -2316,8 +2380,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2316
2380
|
value?: unknown;
|
|
2317
2381
|
}[] | undefined;
|
|
2318
2382
|
}> | undefined;
|
|
2319
|
-
surface?: string | undefined;
|
|
2320
|
-
context?: string | undefined;
|
|
2321
2383
|
events?: {
|
|
2322
2384
|
name: string;
|
|
2323
2385
|
queue: string;
|
|
@@ -2432,6 +2494,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2432
2494
|
pattern?: string | undefined;
|
|
2433
2495
|
patterns?: string[] | undefined;
|
|
2434
2496
|
scopeable?: boolean | undefined;
|
|
2497
|
+
surface?: string | undefined;
|
|
2498
|
+
context?: string | undefined;
|
|
2435
2499
|
};
|
|
2436
2500
|
behaviors: (string | {
|
|
2437
2501
|
name: string;
|
|
@@ -2490,6 +2554,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2490
2554
|
} | {
|
|
2491
2555
|
field: string;
|
|
2492
2556
|
kind: "eventId";
|
|
2557
|
+
} | {
|
|
2558
|
+
field: string;
|
|
2559
|
+
kind: "historyId";
|
|
2560
|
+
} | {
|
|
2561
|
+
field: string;
|
|
2562
|
+
kind: "syncToken";
|
|
2493
2563
|
};
|
|
2494
2564
|
provenance?: "poll" | "cdc" | undefined;
|
|
2495
2565
|
};
|
|
@@ -2520,8 +2590,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2520
2590
|
value?: unknown;
|
|
2521
2591
|
}[];
|
|
2522
2592
|
}> | undefined;
|
|
2523
|
-
surface?: string | undefined;
|
|
2524
|
-
context?: string | undefined;
|
|
2525
2593
|
events?: {
|
|
2526
2594
|
name: string;
|
|
2527
2595
|
queue: string;
|
|
@@ -2636,6 +2704,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2636
2704
|
pattern?: string | undefined;
|
|
2637
2705
|
patterns?: string[] | undefined;
|
|
2638
2706
|
scopeable?: boolean | undefined;
|
|
2707
|
+
surface?: string | undefined;
|
|
2708
|
+
context?: string | undefined;
|
|
2639
2709
|
};
|
|
2640
2710
|
relationships?: Record<string, {
|
|
2641
2711
|
type: "belongs_to" | "has_many" | "has_one";
|
|
@@ -2694,6 +2764,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2694
2764
|
} | {
|
|
2695
2765
|
field: string;
|
|
2696
2766
|
kind: "eventId";
|
|
2767
|
+
} | {
|
|
2768
|
+
field: string;
|
|
2769
|
+
kind: "historyId";
|
|
2770
|
+
} | {
|
|
2771
|
+
field: string;
|
|
2772
|
+
kind: "syncToken";
|
|
2697
2773
|
};
|
|
2698
2774
|
provenance?: "poll" | "cdc" | undefined;
|
|
2699
2775
|
};
|
|
@@ -2724,8 +2800,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2724
2800
|
value?: unknown;
|
|
2725
2801
|
}[] | undefined;
|
|
2726
2802
|
}> | undefined;
|
|
2727
|
-
surface?: string | undefined;
|
|
2728
|
-
context?: string | undefined;
|
|
2729
2803
|
events?: {
|
|
2730
2804
|
name: string;
|
|
2731
2805
|
queue: string;
|
|
@@ -2840,6 +2914,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2840
2914
|
pattern?: string | undefined;
|
|
2841
2915
|
patterns?: string[] | undefined;
|
|
2842
2916
|
scopeable?: boolean | undefined;
|
|
2917
|
+
surface?: string | undefined;
|
|
2918
|
+
context?: string | undefined;
|
|
2843
2919
|
};
|
|
2844
2920
|
behaviors: (string | {
|
|
2845
2921
|
name: string;
|
|
@@ -2898,6 +2974,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2898
2974
|
} | {
|
|
2899
2975
|
field: string;
|
|
2900
2976
|
kind: "eventId";
|
|
2977
|
+
} | {
|
|
2978
|
+
field: string;
|
|
2979
|
+
kind: "historyId";
|
|
2980
|
+
} | {
|
|
2981
|
+
field: string;
|
|
2982
|
+
kind: "syncToken";
|
|
2901
2983
|
};
|
|
2902
2984
|
provenance?: "poll" | "cdc" | undefined;
|
|
2903
2985
|
};
|
|
@@ -2928,8 +3010,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
2928
3010
|
value?: unknown;
|
|
2929
3011
|
}[];
|
|
2930
3012
|
}> | undefined;
|
|
2931
|
-
surface?: string | undefined;
|
|
2932
|
-
context?: string | undefined;
|
|
2933
3013
|
events?: {
|
|
2934
3014
|
name: string;
|
|
2935
3015
|
queue: string;
|
|
@@ -3044,6 +3124,8 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
3044
3124
|
pattern?: string | undefined;
|
|
3045
3125
|
patterns?: string[] | undefined;
|
|
3046
3126
|
scopeable?: boolean | undefined;
|
|
3127
|
+
surface?: string | undefined;
|
|
3128
|
+
context?: string | undefined;
|
|
3047
3129
|
};
|
|
3048
3130
|
relationships?: Record<string, {
|
|
3049
3131
|
type: "belongs_to" | "has_many" | "has_one";
|
|
@@ -3102,6 +3184,12 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
3102
3184
|
} | {
|
|
3103
3185
|
field: string;
|
|
3104
3186
|
kind: "eventId";
|
|
3187
|
+
} | {
|
|
3188
|
+
field: string;
|
|
3189
|
+
kind: "historyId";
|
|
3190
|
+
} | {
|
|
3191
|
+
field: string;
|
|
3192
|
+
kind: "syncToken";
|
|
3105
3193
|
};
|
|
3106
3194
|
provenance?: "poll" | "cdc" | undefined;
|
|
3107
3195
|
};
|
|
@@ -3132,8 +3220,6 @@ declare const EntityDefinitionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
3132
3220
|
value?: unknown;
|
|
3133
3221
|
}[] | undefined;
|
|
3134
3222
|
}> | undefined;
|
|
3135
|
-
surface?: string | undefined;
|
|
3136
|
-
context?: string | undefined;
|
|
3137
3223
|
events?: {
|
|
3138
3224
|
name: string;
|
|
3139
3225
|
queue: string;
|
|
@@ -3712,7 +3798,9 @@ interface LoadEntitiesResult {
|
|
|
3712
3798
|
/**
|
|
3713
3799
|
* Load all entity YAML files from a directory
|
|
3714
3800
|
*/
|
|
3715
|
-
declare function loadEntities(entitiesDir: string
|
|
3801
|
+
declare function loadEntities(entitiesDir: string, opts?: {
|
|
3802
|
+
excludeDirs?: string[];
|
|
3803
|
+
}): LoadEntitiesResult;
|
|
3716
3804
|
interface LoadRelationshipsResult {
|
|
3717
3805
|
relationships: ParsedRelationshipDefinition[];
|
|
3718
3806
|
issues: AnalysisIssue[];
|
package/dist/src/index.js
CHANGED
|
@@ -19,14 +19,17 @@ import { join, resolve } from "path";
|
|
|
19
19
|
function isYaml(name) {
|
|
20
20
|
return name.endsWith(".yaml") || name.endsWith(".yml");
|
|
21
21
|
}
|
|
22
|
-
function findYamlFiles(dir) {
|
|
22
|
+
function findYamlFiles(dir, opts) {
|
|
23
23
|
const root = resolve(dir);
|
|
24
24
|
const out = [];
|
|
25
|
+
const excluded = new Set((opts?.excludeDirs ?? []).map((d) => resolve(d)));
|
|
25
26
|
const walk = (current) => {
|
|
26
27
|
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
27
28
|
if (entry.isDirectory()) {
|
|
28
29
|
if (entry.name.startsWith(".")) continue;
|
|
29
|
-
|
|
30
|
+
const child = join(current, entry.name);
|
|
31
|
+
if (excluded.has(resolve(child))) continue;
|
|
32
|
+
walk(child);
|
|
30
33
|
} else if (isYaml(entry.name)) {
|
|
31
34
|
out.push(join(current, entry.name));
|
|
32
35
|
}
|
|
@@ -79,11 +82,21 @@ var EventIdCursorSchema = z2.object({
|
|
|
79
82
|
kind: z2.literal("eventId"),
|
|
80
83
|
field: z2.string().min(1)
|
|
81
84
|
});
|
|
85
|
+
var HistoryIdCursorSchema = z2.object({
|
|
86
|
+
kind: z2.literal("historyId"),
|
|
87
|
+
field: z2.string().min(1)
|
|
88
|
+
});
|
|
89
|
+
var SyncTokenCursorSchema = z2.object({
|
|
90
|
+
kind: z2.literal("syncToken"),
|
|
91
|
+
field: z2.string().min(1)
|
|
92
|
+
});
|
|
82
93
|
var CursorStrategySchema = z2.discriminatedUnion("kind", [
|
|
83
94
|
SystemModstampCursorSchema,
|
|
84
95
|
ReplayIdCursorSchema,
|
|
85
96
|
TimestampCursorSchema,
|
|
86
|
-
EventIdCursorSchema
|
|
97
|
+
EventIdCursorSchema,
|
|
98
|
+
HistoryIdCursorSchema,
|
|
99
|
+
SyncTokenCursorSchema
|
|
87
100
|
]);
|
|
88
101
|
var PollDetectionSchema = z2.object({
|
|
89
102
|
cursor: CursorStrategySchema,
|
|
@@ -1274,7 +1287,37 @@ var EntityConfigSchema = z3.object({
|
|
|
1274
1287
|
// JOB-7: marks this entity as a valid scope target for job scoping.
|
|
1275
1288
|
// Drives the generated ScopeEntityType union in
|
|
1276
1289
|
// runtime/subsystems/jobs/generated/scope-entity-type.ts.
|
|
1277
|
-
scopeable: z3.boolean().optional()
|
|
1290
|
+
scopeable: z3.boolean().optional(),
|
|
1291
|
+
// RFC-0001 §1/§8: the integration *surface* this entity belongs to
|
|
1292
|
+
// (e.g. 'calendar', 'mail', 'crm'). Surfaces span provider contexts
|
|
1293
|
+
// (ADR-0006) — one Google OAuth feeds calendar+mail+transcript. The union
|
|
1294
|
+
// of `surface:` values across all entity YAML is the closed set that a
|
|
1295
|
+
// provider's `surfaces:` must be a subset of (cross-checked in
|
|
1296
|
+
// src/parser/validate-providers.ts). Optional: entities without an
|
|
1297
|
+
// integration surface omit it. The surface-package *emission* convention
|
|
1298
|
+
// is Track C (#329); this field is only the declarative input both tracks
|
|
1299
|
+
// read. Lives inside the `entity:` block (next to `pattern:`/`name:`/`table:`).
|
|
1300
|
+
surface: z3.string().optional(),
|
|
1301
|
+
// Bounded-context declaration (ADR-0004) — "which bounded context this
|
|
1302
|
+
// entity belongs to". This is the DURABLE decision; it is a plain
|
|
1303
|
+
// bounded-context slug, NOT a folder knob. Different features consume it:
|
|
1304
|
+
//
|
|
1305
|
+
// - #403 (the FIRST consumer): drives the generated code's
|
|
1306
|
+
// module output folder. clean-lite-ps nests the entity's module under
|
|
1307
|
+
// `<modules>/<context>/<entity>/` so same-context entities group
|
|
1308
|
+
// together; untagged entities stay flat (`<modules>/<entity>/`).
|
|
1309
|
+
// - ADR-0004 (deferred): a later `naming: prefix | schema` knob reads
|
|
1310
|
+
// this SAME field to drive the Postgres physical layout —
|
|
1311
|
+
// `prefix` → `pgTable('<context>__<table>')`, then the flip to
|
|
1312
|
+
// `schema` → `pgSchema('<context>').table('<table>')`. NOT wired here.
|
|
1313
|
+
//
|
|
1314
|
+
// Sibling to `surface:` and orthogonal to it (ADR-0006): context = model
|
|
1315
|
+
// cohesion (which domain), surface = vendor composition (which integration).
|
|
1316
|
+
// Lives inside the `entity:` block (next to `pattern:`/`name:`/`table:`).
|
|
1317
|
+
context: z3.string().regex(
|
|
1318
|
+
/^[a-z][a-z0-9_]*$/,
|
|
1319
|
+
"context must be lowercase snake_case (e.g. 'integration')"
|
|
1320
|
+
).optional()
|
|
1278
1321
|
}).strict().refine((d) => !(d.pattern && d.patterns), {
|
|
1279
1322
|
message: "'pattern' and 'patterns' are mutually exclusive"
|
|
1280
1323
|
});
|
|
@@ -1427,36 +1470,11 @@ var EntityDefinitionSchema = z3.object({
|
|
|
1427
1470
|
// appear in `integration.providers` — see the superRefine on
|
|
1428
1471
|
// `EntityDefinitionSchema` below.
|
|
1429
1472
|
detection: z3.record(z3.string(), DetectionConfigSchema).optional(),
|
|
1430
|
-
//
|
|
1431
|
-
//
|
|
1432
|
-
//
|
|
1433
|
-
//
|
|
1434
|
-
//
|
|
1435
|
-
// src/parser/validate-providers.ts). Optional: entities without an
|
|
1436
|
-
// integration surface omit it. The surface-package *emission* convention
|
|
1437
|
-
// is Track C (#329); this field is only the declarative input both tracks
|
|
1438
|
-
// read.
|
|
1439
|
-
surface: z3.string().optional(),
|
|
1440
|
-
// Bounded-context declaration (ADR-0004) — "which bounded context this
|
|
1441
|
-
// entity belongs to". This is the DURABLE decision; it is a plain
|
|
1442
|
-
// bounded-context slug, NOT a folder knob. Different features consume it:
|
|
1443
|
-
//
|
|
1444
|
-
// - #403 (this PR, the FIRST consumer): drives the generated code's
|
|
1445
|
-
// module output folder. clean-lite-ps nests the entity's module under
|
|
1446
|
-
// `<modules>/<context>/<entity>/` so same-context entities group
|
|
1447
|
-
// together; untagged entities stay flat (`<modules>/<entity>/`).
|
|
1448
|
-
// - ADR-0004 (deferred): a later `naming: prefix | schema` knob reads
|
|
1449
|
-
// this SAME field to drive the Postgres physical layout —
|
|
1450
|
-
// `prefix` → `pgTable('<context>__<table>')`, then the flip to
|
|
1451
|
-
// `schema` → `pgSchema('<context>').table('<table>')`. NOT wired here;
|
|
1452
|
-
// #403 makes no table/column/schema changes.
|
|
1453
|
-
//
|
|
1454
|
-
// Sibling to `surface:` and orthogonal to it (ADR-0006): context = model
|
|
1455
|
-
// cohesion (which domain), surface = vendor composition (which integration).
|
|
1456
|
-
context: z3.string().regex(
|
|
1457
|
-
/^[a-z][a-z0-9_]*$/,
|
|
1458
|
-
"context must be lowercase snake_case (e.g. 'integration')"
|
|
1459
|
-
).optional(),
|
|
1473
|
+
// NOTE: `surface:` and `context:` moved INTO EntityConfigSchema (the
|
|
1474
|
+
// `entity:` block) in 0.12.2 — consumers write them next to
|
|
1475
|
+
// `pattern:`/`name:`/`table:`, which is the natural place. They are
|
|
1476
|
+
// read via `entity.surface` / `entity.context`. Clean break: no
|
|
1477
|
+
// root-level placement is accepted.
|
|
1460
1478
|
// v2: Domain event declarations (CODEGEN-EVOLUTION-PLAN Phase 2)
|
|
1461
1479
|
// Generates typed event classes, handlers, and queue registration
|
|
1462
1480
|
events: z3.array(EventDeclarationSchema).optional(),
|
|
@@ -2246,13 +2264,13 @@ function loadErrorToIssue(error) {
|
|
|
2246
2264
|
}
|
|
2247
2265
|
return issues;
|
|
2248
2266
|
}
|
|
2249
|
-
function loadEntities(entitiesDir) {
|
|
2267
|
+
function loadEntities(entitiesDir, opts) {
|
|
2250
2268
|
const entities = [];
|
|
2251
2269
|
const issues = [];
|
|
2252
2270
|
const resolvedDir = resolve2(entitiesDir);
|
|
2253
2271
|
let files;
|
|
2254
2272
|
try {
|
|
2255
|
-
files = findYamlFiles(resolvedDir);
|
|
2273
|
+
files = findYamlFiles(resolvedDir, { excludeDirs: opts?.excludeDirs });
|
|
2256
2274
|
} catch (err) {
|
|
2257
2275
|
issues.push({
|
|
2258
2276
|
severity: "error",
|