@integromat/module-migrator-core 0.0.1
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 +11 -0
- package/cjs/lib/blueprint-parser.d.ts +7 -0
- package/cjs/lib/blueprint-parser.js +60 -0
- package/cjs/lib/blueprint-parser.js.map +1 -0
- package/cjs/lib/domain/field-entry.d.ts +16 -0
- package/cjs/lib/domain/field-entry.js +36 -0
- package/cjs/lib/domain/field-entry.js.map +1 -0
- package/cjs/lib/domain/field-mapping.d.ts +32 -0
- package/cjs/lib/domain/field-mapping.js +104 -0
- package/cjs/lib/domain/field-mapping.js.map +1 -0
- package/cjs/lib/domain/migration.d.ts +12 -0
- package/cjs/lib/domain/migration.js +19 -0
- package/cjs/lib/domain/migration.js.map +1 -0
- package/cjs/lib/errors/migration-error.d.ts +37 -0
- package/cjs/lib/errors/migration-error.js +53 -0
- package/cjs/lib/errors/migration-error.js.map +1 -0
- package/cjs/lib/expression-parser.d.ts +26 -0
- package/cjs/lib/expression-parser.js +155 -0
- package/cjs/lib/expression-parser.js.map +1 -0
- package/cjs/lib/migrator.d.ts +16 -0
- package/cjs/lib/migrator.js +264 -0
- package/cjs/lib/migrator.js.map +1 -0
- package/cjs/lib/ports/config-repository.d.ts +19 -0
- package/cjs/lib/ports/migration-service.d.ts +28 -0
- package/cjs/lib/schemas.d.ts +246 -0
- package/cjs/lib/types.d.ts +322 -0
- package/cjs/lib/types.js +81 -0
- package/cjs/lib/types.js.map +1 -0
- package/cjs/lib/utils/path.d.ts +25 -0
- package/cjs/lib/utils/path.js +55 -0
- package/cjs/lib/utils/path.js.map +1 -0
- package/cjs/lib/utils/type-guards.d.ts +16 -0
- package/cjs/lib/utils/type-guards.js +22 -0
- package/cjs/lib/utils/type-guards.js.map +1 -0
- package/cjs/lib/validation.d.ts +17 -0
- package/cjs/lib/validation.js +55 -0
- package/cjs/lib/validation.js.map +1 -0
- package/cjs/main.d.ts +9 -0
- package/cjs/main.js +24 -0
- package/cjs/main.js.map +1 -0
- package/esm/lib/blueprint-parser.d.ts +7 -0
- package/esm/lib/blueprint-parser.js +54 -0
- package/esm/lib/blueprint-parser.js.map +1 -0
- package/esm/lib/domain/field-entry.d.ts +16 -0
- package/esm/lib/domain/field-entry.js +32 -0
- package/esm/lib/domain/field-entry.js.map +1 -0
- package/esm/lib/domain/field-mapping.d.ts +32 -0
- package/esm/lib/domain/field-mapping.js +100 -0
- package/esm/lib/domain/field-mapping.js.map +1 -0
- package/esm/lib/domain/migration.d.ts +12 -0
- package/esm/lib/domain/migration.js +17 -0
- package/esm/lib/domain/migration.js.map +1 -0
- package/esm/lib/errors/migration-error.d.ts +37 -0
- package/esm/lib/errors/migration-error.js +50 -0
- package/esm/lib/errors/migration-error.js.map +1 -0
- package/esm/lib/expression-parser.d.ts +26 -0
- package/esm/lib/expression-parser.js +151 -0
- package/esm/lib/expression-parser.js.map +1 -0
- package/esm/lib/migrator.d.ts +16 -0
- package/esm/lib/migrator.js +262 -0
- package/esm/lib/migrator.js.map +1 -0
- package/esm/lib/ports/config-repository.d.ts +19 -0
- package/esm/lib/ports/migration-service.d.ts +28 -0
- package/esm/lib/schemas.d.ts +246 -0
- package/esm/lib/types.d.ts +322 -0
- package/esm/lib/types.js +74 -0
- package/esm/lib/types.js.map +1 -0
- package/esm/lib/utils/path.d.ts +25 -0
- package/esm/lib/utils/path.js +52 -0
- package/esm/lib/utils/path.js.map +1 -0
- package/esm/lib/utils/type-guards.d.ts +16 -0
- package/esm/lib/utils/type-guards.js +20 -0
- package/esm/lib/utils/type-guards.js.map +1 -0
- package/esm/lib/validation.d.ts +17 -0
- package/esm/lib/validation.js +51 -0
- package/esm/lib/validation.js.map +1 -0
- package/esm/main.d.ts +9 -0
- package/esm/main.js +6 -0
- package/esm/main.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +35 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
type KeepField = {
|
|
2
|
+
op: 'keep';
|
|
3
|
+
fields?: FieldMappings;
|
|
4
|
+
items?: FieldMappings;
|
|
5
|
+
};
|
|
6
|
+
type MapField = {
|
|
7
|
+
op: 'map';
|
|
8
|
+
to?: string;
|
|
9
|
+
toSection?: 'parameters' | 'mapper';
|
|
10
|
+
fields?: FieldMappings;
|
|
11
|
+
items?: FieldMappings;
|
|
12
|
+
};
|
|
13
|
+
type RemoveField = {
|
|
14
|
+
op: 'remove';
|
|
15
|
+
note?: string;
|
|
16
|
+
};
|
|
17
|
+
type FieldEntry = KeepField | MapField | RemoveField;
|
|
18
|
+
type FieldMappings = Record<string, FieldEntry>;
|
|
19
|
+
declare const FieldEntrySchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
20
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
21
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
22
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
23
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
24
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
25
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
27
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
28
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
29
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
30
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
31
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
|
+
}>]>;
|
|
33
|
+
declare const FieldMappingsSchema: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
34
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
35
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
36
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
37
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
38
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
39
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
40
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
41
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
42
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
43
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
44
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
45
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
46
|
+
}>]>>;
|
|
47
|
+
type MigrationConfigV1 = {
|
|
48
|
+
configVersion: '1.0';
|
|
49
|
+
from: {
|
|
50
|
+
module: string;
|
|
51
|
+
version: number;
|
|
52
|
+
};
|
|
53
|
+
to: {
|
|
54
|
+
module: string;
|
|
55
|
+
version: number;
|
|
56
|
+
};
|
|
57
|
+
parameters?: FieldMappings;
|
|
58
|
+
mapper?: FieldMappings;
|
|
59
|
+
outputs?: FieldMappings;
|
|
60
|
+
};
|
|
61
|
+
type Bundle = {
|
|
62
|
+
generatedAt: string;
|
|
63
|
+
migrations: MigrationConfigV1[];
|
|
64
|
+
};
|
|
65
|
+
declare const MigrationConfigV1Schema: import("@sinclair/typebox").TObject<{
|
|
66
|
+
configVersion: import("@sinclair/typebox").TLiteral<"1.0">;
|
|
67
|
+
from: import("@sinclair/typebox").TObject<{
|
|
68
|
+
module: import("@sinclair/typebox").TString;
|
|
69
|
+
version: import("@sinclair/typebox").TNumber;
|
|
70
|
+
}>;
|
|
71
|
+
to: import("@sinclair/typebox").TObject<{
|
|
72
|
+
module: import("@sinclair/typebox").TString;
|
|
73
|
+
version: import("@sinclair/typebox").TNumber;
|
|
74
|
+
}>;
|
|
75
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
76
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
77
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
78
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
79
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
80
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
81
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
82
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
83
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
84
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
85
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
86
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
87
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
88
|
+
}>]>>>;
|
|
89
|
+
mapper: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
90
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
91
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
92
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
93
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
94
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
95
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
96
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
97
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
98
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
99
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
100
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
101
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
102
|
+
}>]>>>;
|
|
103
|
+
outputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
104
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
105
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
106
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
107
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
108
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
109
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
110
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
111
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
112
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
113
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
114
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
115
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
116
|
+
}>]>>>;
|
|
117
|
+
}>;
|
|
118
|
+
declare const BundleSchema: import("@sinclair/typebox").TObject<{
|
|
119
|
+
generatedAt: import("@sinclair/typebox").TString;
|
|
120
|
+
migrations: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
121
|
+
configVersion: import("@sinclair/typebox").TLiteral<"1.0">;
|
|
122
|
+
from: import("@sinclair/typebox").TObject<{
|
|
123
|
+
module: import("@sinclair/typebox").TString;
|
|
124
|
+
version: import("@sinclair/typebox").TNumber;
|
|
125
|
+
}>;
|
|
126
|
+
to: import("@sinclair/typebox").TObject<{
|
|
127
|
+
module: import("@sinclair/typebox").TString;
|
|
128
|
+
version: import("@sinclair/typebox").TNumber;
|
|
129
|
+
}>;
|
|
130
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
131
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
132
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
133
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
134
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
135
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
136
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
137
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
138
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
139
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
140
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
141
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
142
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
143
|
+
}>]>>>;
|
|
144
|
+
mapper: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
145
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
146
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
147
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
148
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
149
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
150
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
151
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
152
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
153
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
154
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
155
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
156
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
157
|
+
}>]>>>;
|
|
158
|
+
outputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
159
|
+
op: import("@sinclair/typebox").TLiteral<"keep">;
|
|
160
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
161
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
162
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
163
|
+
op: import("@sinclair/typebox").TLiteral<"map">;
|
|
164
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
165
|
+
toSection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"parameters">, import("@sinclair/typebox").TLiteral<"mapper">]>>;
|
|
166
|
+
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
167
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRef<import("@sinclair/typebox").TSchema>>;
|
|
168
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
169
|
+
op: import("@sinclair/typebox").TLiteral<"remove">;
|
|
170
|
+
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
171
|
+
}>]>>>;
|
|
172
|
+
}>>;
|
|
173
|
+
}>;
|
|
174
|
+
type FlowModule = {
|
|
175
|
+
id: number;
|
|
176
|
+
module: string;
|
|
177
|
+
version: number;
|
|
178
|
+
parameters?: Record<string, unknown> | undefined;
|
|
179
|
+
mapper?: Record<string, unknown> | undefined;
|
|
180
|
+
metadata?: {
|
|
181
|
+
designer?: {
|
|
182
|
+
x: number;
|
|
183
|
+
y: number;
|
|
184
|
+
} | undefined;
|
|
185
|
+
expect?: unknown[] | undefined;
|
|
186
|
+
interface?: unknown[] | undefined;
|
|
187
|
+
restore?: Record<string, unknown> | undefined;
|
|
188
|
+
parameters?: unknown[] | undefined;
|
|
189
|
+
};
|
|
190
|
+
routes?: {
|
|
191
|
+
flow: FlowModule[];
|
|
192
|
+
}[] | undefined;
|
|
193
|
+
};
|
|
194
|
+
type Blueprint = {
|
|
195
|
+
name: string;
|
|
196
|
+
flow: FlowModule[];
|
|
197
|
+
metadata: {
|
|
198
|
+
instant: boolean;
|
|
199
|
+
version: number;
|
|
200
|
+
scenario: Record<string, unknown>;
|
|
201
|
+
designer: {
|
|
202
|
+
orphans: FlowModule[];
|
|
203
|
+
};
|
|
204
|
+
zone: string;
|
|
205
|
+
notes: unknown[];
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
declare const FlowModuleSchema: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TObject<{
|
|
209
|
+
id: import("@sinclair/typebox").TNumber;
|
|
210
|
+
module: import("@sinclair/typebox").TString;
|
|
211
|
+
version: import("@sinclair/typebox").TNumber;
|
|
212
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
213
|
+
mapper: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
214
|
+
metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
215
|
+
designer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
216
|
+
x: import("@sinclair/typebox").TNumber;
|
|
217
|
+
y: import("@sinclair/typebox").TNumber;
|
|
218
|
+
}>>;
|
|
219
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
220
|
+
interface: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
221
|
+
restore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
222
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
223
|
+
}>>;
|
|
224
|
+
routes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
225
|
+
flow: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>;
|
|
226
|
+
}>>>;
|
|
227
|
+
}>>;
|
|
228
|
+
declare const BlueprintSchema: import("@sinclair/typebox").TObject<{
|
|
229
|
+
name: import("@sinclair/typebox").TString;
|
|
230
|
+
flow: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TObject<{
|
|
231
|
+
id: import("@sinclair/typebox").TNumber;
|
|
232
|
+
module: import("@sinclair/typebox").TString;
|
|
233
|
+
version: import("@sinclair/typebox").TNumber;
|
|
234
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
235
|
+
mapper: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
236
|
+
metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
237
|
+
designer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
238
|
+
x: import("@sinclair/typebox").TNumber;
|
|
239
|
+
y: import("@sinclair/typebox").TNumber;
|
|
240
|
+
}>>;
|
|
241
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
242
|
+
interface: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
243
|
+
restore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
244
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
245
|
+
}>>;
|
|
246
|
+
routes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
247
|
+
flow: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>;
|
|
248
|
+
}>>>;
|
|
249
|
+
}>>>;
|
|
250
|
+
metadata: import("@sinclair/typebox").TObject<{
|
|
251
|
+
instant: import("@sinclair/typebox").TBoolean;
|
|
252
|
+
version: import("@sinclair/typebox").TNumber;
|
|
253
|
+
scenario: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
254
|
+
designer: import("@sinclair/typebox").TObject<{
|
|
255
|
+
orphans: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TObject<{
|
|
256
|
+
id: import("@sinclair/typebox").TNumber;
|
|
257
|
+
module: import("@sinclair/typebox").TString;
|
|
258
|
+
version: import("@sinclair/typebox").TNumber;
|
|
259
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
260
|
+
mapper: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
261
|
+
metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
262
|
+
designer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
263
|
+
x: import("@sinclair/typebox").TNumber;
|
|
264
|
+
y: import("@sinclair/typebox").TNumber;
|
|
265
|
+
}>>;
|
|
266
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
267
|
+
interface: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
268
|
+
restore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
269
|
+
parameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>>;
|
|
270
|
+
}>>;
|
|
271
|
+
routes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
272
|
+
flow: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>;
|
|
273
|
+
}>>>;
|
|
274
|
+
}>>>;
|
|
275
|
+
}>;
|
|
276
|
+
zone: import("@sinclair/typebox").TString;
|
|
277
|
+
notes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>;
|
|
278
|
+
}>;
|
|
279
|
+
}>;
|
|
280
|
+
type MigrationReport = {
|
|
281
|
+
summary: {
|
|
282
|
+
totalModules: number;
|
|
283
|
+
deprecatedFound: number;
|
|
284
|
+
migrated: number;
|
|
285
|
+
warnings: number;
|
|
286
|
+
infos: number;
|
|
287
|
+
};
|
|
288
|
+
modules: ModuleReport[];
|
|
289
|
+
};
|
|
290
|
+
type ModuleReport = {
|
|
291
|
+
moduleId: number;
|
|
292
|
+
fromModule: string;
|
|
293
|
+
toModule: string;
|
|
294
|
+
messages: ReportMessage[];
|
|
295
|
+
};
|
|
296
|
+
type ReportMessage = {
|
|
297
|
+
type: 'warning' | 'info';
|
|
298
|
+
category: 'input' | 'output' | 'reference';
|
|
299
|
+
field: string;
|
|
300
|
+
message: string;
|
|
301
|
+
note?: string | undefined;
|
|
302
|
+
certain: boolean;
|
|
303
|
+
referencedBy?: number[] | undefined;
|
|
304
|
+
autoFixed?: boolean | undefined;
|
|
305
|
+
};
|
|
306
|
+
type DeprecatedModule = {
|
|
307
|
+
id: number;
|
|
308
|
+
fromModule: string;
|
|
309
|
+
toModule: string;
|
|
310
|
+
toVersion: number;
|
|
311
|
+
flowModule: FlowModule;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Flattened representation of a field entry with full path.
|
|
315
|
+
*/
|
|
316
|
+
type FlatFieldEntry = {
|
|
317
|
+
field: string;
|
|
318
|
+
mapsTo: string | undefined;
|
|
319
|
+
note?: string | undefined;
|
|
320
|
+
};
|
|
321
|
+
export { BlueprintSchema, BundleSchema, FieldEntrySchema, FieldMappingsSchema, FlowModuleSchema, MigrationConfigV1Schema, };
|
|
322
|
+
export type { Blueprint, Bundle, DeprecatedModule, FieldEntry, FieldMappings, FlatFieldEntry, FlowModule, KeepField, MapField, MigrationConfigV1, MigrationReport, ModuleReport, RemoveField, ReportMessage, };
|
package/cjs/lib/types.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var typebox = require('@sinclair/typebox');
|
|
4
|
+
|
|
5
|
+
// Field Entry Schemas (mirror the types above)
|
|
6
|
+
const KeepFieldSchema = typebox.Type.Object({
|
|
7
|
+
op: typebox.Type.Literal('keep'),
|
|
8
|
+
fields: typebox.Type.Optional(typebox.Type.Ref('FieldMappings')),
|
|
9
|
+
items: typebox.Type.Optional(typebox.Type.Ref('FieldMappings')),
|
|
10
|
+
});
|
|
11
|
+
const MapFieldSchema = typebox.Type.Object({
|
|
12
|
+
op: typebox.Type.Literal('map'),
|
|
13
|
+
to: typebox.Type.Optional(typebox.Type.String()),
|
|
14
|
+
toSection: typebox.Type.Optional(typebox.Type.Union([typebox.Type.Literal('parameters'), typebox.Type.Literal('mapper')])),
|
|
15
|
+
fields: typebox.Type.Optional(typebox.Type.Ref('FieldMappings')),
|
|
16
|
+
items: typebox.Type.Optional(typebox.Type.Ref('FieldMappings')),
|
|
17
|
+
});
|
|
18
|
+
const RemoveFieldSchema = typebox.Type.Object({
|
|
19
|
+
op: typebox.Type.Literal('remove'),
|
|
20
|
+
note: typebox.Type.Optional(typebox.Type.String()),
|
|
21
|
+
});
|
|
22
|
+
const FieldEntrySchema = typebox.Type.Union([KeepFieldSchema, MapFieldSchema, RemoveFieldSchema], {
|
|
23
|
+
$id: 'FieldEntry',
|
|
24
|
+
});
|
|
25
|
+
const FieldMappingsSchema = typebox.Type.Record(typebox.Type.String(), FieldEntrySchema, {
|
|
26
|
+
$id: 'FieldMappings',
|
|
27
|
+
});
|
|
28
|
+
// Migration Config Schemas
|
|
29
|
+
const ModuleRefSchema = typebox.Type.Object({
|
|
30
|
+
module: typebox.Type.String(),
|
|
31
|
+
version: typebox.Type.Number(),
|
|
32
|
+
});
|
|
33
|
+
const MigrationConfigV1Schema = typebox.Type.Object({
|
|
34
|
+
configVersion: typebox.Type.Literal('1.0'),
|
|
35
|
+
from: ModuleRefSchema,
|
|
36
|
+
to: ModuleRefSchema,
|
|
37
|
+
parameters: typebox.Type.Optional(FieldMappingsSchema),
|
|
38
|
+
mapper: typebox.Type.Optional(FieldMappingsSchema),
|
|
39
|
+
outputs: typebox.Type.Optional(FieldMappingsSchema),
|
|
40
|
+
});
|
|
41
|
+
const BundleSchema = typebox.Type.Object({
|
|
42
|
+
generatedAt: typebox.Type.String(),
|
|
43
|
+
migrations: typebox.Type.Array(MigrationConfigV1Schema),
|
|
44
|
+
});
|
|
45
|
+
// Flow Module Schemas
|
|
46
|
+
const FlowModuleMetadataSchema = typebox.Type.Optional(typebox.Type.Object({
|
|
47
|
+
designer: typebox.Type.Optional(typebox.Type.Object({ x: typebox.Type.Number(), y: typebox.Type.Number() })),
|
|
48
|
+
expect: typebox.Type.Optional(typebox.Type.Array(typebox.Type.Unknown())),
|
|
49
|
+
interface: typebox.Type.Optional(typebox.Type.Array(typebox.Type.Unknown())),
|
|
50
|
+
restore: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown())),
|
|
51
|
+
parameters: typebox.Type.Optional(typebox.Type.Array(typebox.Type.Unknown())),
|
|
52
|
+
}));
|
|
53
|
+
const FlowModuleSchema = typebox.Type.Recursive((self) => typebox.Type.Object({
|
|
54
|
+
id: typebox.Type.Number(),
|
|
55
|
+
module: typebox.Type.String(),
|
|
56
|
+
version: typebox.Type.Number(),
|
|
57
|
+
parameters: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown())),
|
|
58
|
+
mapper: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown())),
|
|
59
|
+
metadata: FlowModuleMetadataSchema,
|
|
60
|
+
routes: typebox.Type.Optional(typebox.Type.Array(typebox.Type.Object({ flow: typebox.Type.Array(self) }))),
|
|
61
|
+
}));
|
|
62
|
+
const BlueprintSchema = typebox.Type.Object({
|
|
63
|
+
name: typebox.Type.String(),
|
|
64
|
+
flow: typebox.Type.Array(FlowModuleSchema),
|
|
65
|
+
metadata: typebox.Type.Object({
|
|
66
|
+
instant: typebox.Type.Boolean(),
|
|
67
|
+
version: typebox.Type.Number(),
|
|
68
|
+
scenario: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()),
|
|
69
|
+
designer: typebox.Type.Object({ orphans: typebox.Type.Array(FlowModuleSchema) }),
|
|
70
|
+
zone: typebox.Type.String(),
|
|
71
|
+
notes: typebox.Type.Array(typebox.Type.Unknown()),
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
exports.BlueprintSchema = BlueprintSchema;
|
|
76
|
+
exports.BundleSchema = BundleSchema;
|
|
77
|
+
exports.FieldEntrySchema = FieldEntrySchema;
|
|
78
|
+
exports.FieldMappingsSchema = FieldMappingsSchema;
|
|
79
|
+
exports.FlowModuleSchema = FlowModuleSchema;
|
|
80
|
+
exports.MigrationConfigV1Schema = MigrationConfigV1Schema;
|
|
81
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/lib/types.ts"],"sourcesContent":[null],"names":["Type"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path parsing utilities for field references.
|
|
3
|
+
* Handles paths like "a.b[0].c" → ["a", "b", 0, "c"]
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parses a dot/bracket notation path into an array of segments.
|
|
7
|
+
* Numbers are parsed as numeric indices.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* parsePath("a.b[0].c") // ["a", "b", 0, "c"]
|
|
11
|
+
* parsePath("1.key.0.asdasd[1].hello") // [1, "key", 0, "asdasd", 1, "hello"]
|
|
12
|
+
* parsePath("items[0].name") // ["items", 0, "name"]
|
|
13
|
+
*/
|
|
14
|
+
declare const parsePath: (path: string) => (string | number)[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets the root field name from a path.
|
|
17
|
+
* Returns empty string if path is empty.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* getRootField("user.name") // "user"
|
|
21
|
+
* getRootField("items[0].value") // "items"
|
|
22
|
+
* getRootField("") // ""
|
|
23
|
+
*/
|
|
24
|
+
declare const getRootField: (path: string) => string;
|
|
25
|
+
export { getRootField, parsePath };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Path parsing utilities for field references.
|
|
5
|
+
* Handles paths like "a.b[0].c" → ["a", "b", 0, "c"]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parses a dot/bracket notation path into an array of segments.
|
|
9
|
+
* Numbers are parsed as numeric indices.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* parsePath("a.b[0].c") // ["a", "b", 0, "c"]
|
|
13
|
+
* parsePath("1.key.0.asdasd[1].hello") // [1, "key", 0, "asdasd", 1, "hello"]
|
|
14
|
+
* parsePath("items[0].name") // ["items", 0, "name"]
|
|
15
|
+
*/
|
|
16
|
+
const parsePath = (path) => {
|
|
17
|
+
if (!path) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const segments = [];
|
|
21
|
+
// Match either bracket notation [index] or dot notation segments
|
|
22
|
+
const regex = /\[(\d+)\]|([^.[\]]+)/g;
|
|
23
|
+
let match;
|
|
24
|
+
while ((match = regex.exec(path)) !== null) {
|
|
25
|
+
if (match[1] !== undefined) {
|
|
26
|
+
// Bracket notation - always numeric index
|
|
27
|
+
segments.push(Number(match[1]));
|
|
28
|
+
}
|
|
29
|
+
else if (match[2] !== undefined) {
|
|
30
|
+
// Dot notation segment - could be number or string
|
|
31
|
+
const segment = match[2];
|
|
32
|
+
const asNumber = Number(segment);
|
|
33
|
+
segments.push(Number.isNaN(asNumber) ? segment : asNumber);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return segments;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Gets the root field name from a path.
|
|
40
|
+
* Returns empty string if path is empty.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* getRootField("user.name") // "user"
|
|
44
|
+
* getRootField("items[0].value") // "items"
|
|
45
|
+
* getRootField("") // ""
|
|
46
|
+
*/
|
|
47
|
+
const getRootField = (path) => {
|
|
48
|
+
const segments = parsePath(path);
|
|
49
|
+
const first = segments.at(0);
|
|
50
|
+
return first === undefined ? '' : String(first);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.getRootField = getRootField;
|
|
54
|
+
exports.parsePath = parsePath;
|
|
55
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sources":["../../../src/lib/utils/path.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;;;;;;;AAQG;AACH,MAAM,SAAS,GAAG,CAAC,IAAY,KAAyB;IACvD,IAAI,CAAC,IAAI,EAAE;AACV,QAAA,OAAO,EAAE;IACV;IAEA,MAAM,QAAQ,GAAwB,EAAE;;IAExC,MAAM,KAAK,GAAG,uBAAuB;AACrC,IAAA,IAAI,KAA6B;AAEjC,IAAA,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE;AAC3C,QAAA,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;;YAE3B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC;AAAO,aAAA,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;;AAElC,YAAA,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;AACxB,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;AAChC,YAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,QAAQ,CAAC;QAC3D;IACD;AAEA,IAAA,OAAO,QAAQ;AAChB;AAEA;;;;;;;;AAQG;AACH,MAAM,YAAY,GAAG,CAAC,IAAY,KAAY;AAC7C,IAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC;IAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,IAAA,OAAO,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;AAChD;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard utilities for runtime type checking.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a value is a plain object (not null, not an array).
|
|
6
|
+
* This is a type guard that narrows the type to Record<string, unknown>.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* isPlainObject({}) // true
|
|
10
|
+
* isPlainObject({ a: 1 }) // true
|
|
11
|
+
* isPlainObject([]) // false
|
|
12
|
+
* isPlainObject(null) // false
|
|
13
|
+
* isPlainObject("string") // false
|
|
14
|
+
*/
|
|
15
|
+
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
16
|
+
export { isPlainObject };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type guard utilities for runtime type checking.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a value is a plain object (not null, not an array).
|
|
8
|
+
* This is a type guard that narrows the type to Record<string, unknown>.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* isPlainObject({}) // true
|
|
12
|
+
* isPlainObject({ a: 1 }) // true
|
|
13
|
+
* isPlainObject([]) // false
|
|
14
|
+
* isPlainObject(null) // false
|
|
15
|
+
* isPlainObject("string") // false
|
|
16
|
+
*/
|
|
17
|
+
const isPlainObject = (value) => {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.isPlainObject = isPlainObject;
|
|
22
|
+
//# sourceMappingURL=type-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.js","sources":["../../../src/lib/utils/type-guards.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;AAEG;AAEH;;;;;;;;;;AAUG;AACH,MAAM,aAAa,GAAG,CAAC,KAAc,KAAsC;AAC1E,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC5E;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Blueprint, Bundle } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a blueprint using TypeBox schema.
|
|
4
|
+
* Throws MigrationError if validation fails.
|
|
5
|
+
*/
|
|
6
|
+
declare const validateBlueprint: (value: unknown) => Blueprint;
|
|
7
|
+
/**
|
|
8
|
+
* Validates a bundle using TypeBox schema.
|
|
9
|
+
* Throws MigrationError if validation fails.
|
|
10
|
+
*/
|
|
11
|
+
declare const validateBundle: (value: unknown) => Bundle;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an array of module IDs.
|
|
14
|
+
* Throws MigrationError if validation fails.
|
|
15
|
+
*/
|
|
16
|
+
declare const validateModuleIds: (value: unknown) => number[];
|
|
17
|
+
export { validateBlueprint, validateBundle, validateModuleIds };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var typebox = require('@sinclair/typebox');
|
|
4
|
+
var value = require('@sinclair/typebox/value');
|
|
5
|
+
var migrationError = require('./errors/migration-error.js');
|
|
6
|
+
var types = require('./types.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validates a blueprint using TypeBox schema.
|
|
10
|
+
* Throws MigrationError if validation fails.
|
|
11
|
+
*/
|
|
12
|
+
const validateBlueprint = (value$1) => {
|
|
13
|
+
if (!value.Value.Check(types.BlueprintSchema, value$1)) {
|
|
14
|
+
const errors = [...value.Value.Errors(types.BlueprintSchema, value$1)];
|
|
15
|
+
const firstError = errors[0];
|
|
16
|
+
const errorMessage = firstError
|
|
17
|
+
? `Invalid blueprint: ${firstError.message} at ${firstError.path}`
|
|
18
|
+
: 'Invalid blueprint structure';
|
|
19
|
+
throw new migrationError.MigrationError(migrationError.MigrationErrorCode.INVALID_BLUEPRINT, errorMessage);
|
|
20
|
+
}
|
|
21
|
+
// TypeBox validation guarantees structure, cast is safe
|
|
22
|
+
return value$1;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Validates a bundle using TypeBox schema.
|
|
26
|
+
* Throws MigrationError if validation fails.
|
|
27
|
+
*/
|
|
28
|
+
const validateBundle = (value$1) => {
|
|
29
|
+
if (!value.Value.Check(types.BundleSchema, value$1)) {
|
|
30
|
+
const errors = [...value.Value.Errors(types.BundleSchema, value$1)];
|
|
31
|
+
const firstError = errors[0];
|
|
32
|
+
const errorMessage = firstError
|
|
33
|
+
? `Invalid bundle: ${firstError.message} at ${firstError.path}`
|
|
34
|
+
: 'Invalid bundle structure';
|
|
35
|
+
throw new migrationError.MigrationError(migrationError.MigrationErrorCode.INVALID_BUNDLE, errorMessage);
|
|
36
|
+
}
|
|
37
|
+
// TypeBox validation guarantees structure, cast is safe
|
|
38
|
+
return value$1;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Validates an array of module IDs.
|
|
42
|
+
* Throws MigrationError if validation fails.
|
|
43
|
+
*/
|
|
44
|
+
const validateModuleIds = (value$1) => {
|
|
45
|
+
const ModuleIdsSchema = typebox.Type.Array(typebox.Type.Integer());
|
|
46
|
+
if (!value.Value.Check(ModuleIdsSchema, value$1)) {
|
|
47
|
+
throw new migrationError.MigrationError(migrationError.MigrationErrorCode.INVALID_BLUEPRINT, 'Module IDs must be an array of integers');
|
|
48
|
+
}
|
|
49
|
+
return value$1;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.validateBlueprint = validateBlueprint;
|
|
53
|
+
exports.validateBundle = validateBundle;
|
|
54
|
+
exports.validateModuleIds = validateModuleIds;
|
|
55
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../src/lib/validation.ts"],"sourcesContent":[null],"names":["value","Value","BlueprintSchema","MigrationError","MigrationErrorCode","BundleSchema","Type"],"mappings":";;;;;;;AAOA;;;AAGG;AACH,MAAM,iBAAiB,GAAG,CAACA,OAAc,KAAe;IACvD,IAAI,CAACC,WAAK,CAAC,KAAK,CAACC,qBAAe,EAAEF,OAAK,CAAC,EAAE;AACzC,QAAA,MAAM,MAAM,GAAG,CAAC,GAAGC,WAAK,CAAC,MAAM,CAACC,qBAAe,EAAEF,OAAK,CAAC,CAAC;AACxD,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;QAC5B,MAAM,YAAY,GAAG;cAClB,sBAAsB,UAAU,CAAC,OAAO,CAAA,IAAA,EAAO,UAAU,CAAC,IAAI,CAAA;cAC9D,6BAA6B;QAChC,MAAM,IAAIG,6BAAc,CAACC,iCAAkB,CAAC,iBAAiB,EAAE,YAAY,CAAC;IAC7E;;AAEA,IAAA,OAAOJ,OAAkB;AAC1B;AAEA;;;AAGG;AACH,MAAM,cAAc,GAAG,CAACA,OAAc,KAAY;IACjD,IAAI,CAACC,WAAK,CAAC,KAAK,CAACI,kBAAY,EAAEL,OAAK,CAAC,EAAE;AACtC,QAAA,MAAM,MAAM,GAAG,CAAC,GAAGC,WAAK,CAAC,MAAM,CAACI,kBAAY,EAAEL,OAAK,CAAC,CAAC;AACrD,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;QAC5B,MAAM,YAAY,GAAG;cAClB,mBAAmB,UAAU,CAAC,OAAO,CAAA,IAAA,EAAO,UAAU,CAAC,IAAI,CAAA;cAC3D,0BAA0B;QAC7B,MAAM,IAAIG,6BAAc,CAACC,iCAAkB,CAAC,cAAc,EAAE,YAAY,CAAC;IAC1E;;AAEA,IAAA,OAAOJ,OAAe;AACvB;AAEA;;;AAGG;AACH,MAAM,iBAAiB,GAAG,CAACA,OAAc,KAAc;IACtD,MAAM,eAAe,GAAGM,YAAI,CAAC,KAAK,CAACA,YAAI,CAAC,OAAO,EAAE,CAAC;IAClD,IAAI,CAACL,WAAK,CAAC,KAAK,CAAC,eAAe,EAAED,OAAK,CAAC,EAAE;QACzC,MAAM,IAAIG,6BAAc,CACvBC,iCAAkB,CAAC,iBAAiB,EACpC,yCAAyC,CACzC;IACF;AACA,IAAA,OAAOJ,OAAK;AACb;;;;;;"}
|
package/cjs/main.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { cloneBlueprint, collectAllModules, findDeprecatedModules, parseBlueprint, serializeBlueprint, } from './lib/blueprint-parser.ts';
|
|
2
|
+
export { getFieldMapsTo, getFieldNote, isFieldRemoved } from './lib/domain/field-entry.ts';
|
|
3
|
+
export { findMigration } from './lib/domain/migration.ts';
|
|
4
|
+
export type { FieldReference } from './lib/expression-parser.ts';
|
|
5
|
+
export { findAllReferences, parseExpressions, rewriteReferences } from './lib/expression-parser.ts';
|
|
6
|
+
export { migrateBlueprint } from './lib/migrator.ts';
|
|
7
|
+
export type { ConfigRepository } from './lib/ports/config-repository.ts';
|
|
8
|
+
export type { MigrationService } from './lib/ports/migration-service.ts';
|
|
9
|
+
export type { Blueprint, Bundle, DeprecatedModule, FieldEntry, FieldMappings, FlowModule, KeepField, MapField, MigrationConfigV1, MigrationReport, ModuleReport, RemoveField, ReportMessage, } from './lib/types.ts';
|