@soddong/agentic-domain-methodology 0.11.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.
Files changed (90) hide show
  1. package/.tbls.yml +64 -0
  2. package/CHANGELOG.md +97 -0
  3. package/README.md +501 -0
  4. package/dist/database.d.ts +8 -0
  5. package/dist/database.d.ts.map +1 -0
  6. package/dist/database.js +76 -0
  7. package/dist/database.js.map +1 -0
  8. package/dist/fixtures.d.ts +13 -0
  9. package/dist/fixtures.d.ts.map +1 -0
  10. package/dist/fixtures.js +413 -0
  11. package/dist/fixtures.js.map +1 -0
  12. package/dist/index.d.ts +31 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +19 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/repositories.d.ts +54 -0
  17. package/dist/repositories.d.ts.map +1 -0
  18. package/dist/repositories.js +652 -0
  19. package/dist/repositories.js.map +1 -0
  20. package/dist/seed-apply.d.ts +20 -0
  21. package/dist/seed-apply.d.ts.map +1 -0
  22. package/dist/seed-apply.js +728 -0
  23. package/dist/seed-apply.js.map +1 -0
  24. package/dist/service.d.ts +107 -0
  25. package/dist/service.d.ts.map +1 -0
  26. package/dist/service.js +225 -0
  27. package/dist/service.js.map +1 -0
  28. package/dist/types.d.ts +356 -0
  29. package/dist/types.d.ts.map +1 -0
  30. package/dist/types.js +2 -0
  31. package/dist/types.js.map +1 -0
  32. package/dist/validators.d.ts +17 -0
  33. package/dist/validators.d.ts.map +1 -0
  34. package/dist/validators.js +297 -0
  35. package/dist/validators.js.map +1 -0
  36. package/docs/build.md +47 -0
  37. package/docs/configuration.md +33 -0
  38. package/docs/delivery.md +52 -0
  39. package/docs/operations.md +55 -0
  40. package/docs/publishing.md +84 -0
  41. package/docs/schema/generated/README.md +39 -0
  42. package/docs/schema/generated/methodology_activities.md +121 -0
  43. package/docs/schema/generated/methodology_activities.svg +143 -0
  44. package/docs/schema/generated/methodology_activity_artifact_requirements.md +129 -0
  45. package/docs/schema/generated/methodology_activity_artifact_requirements.svg +52 -0
  46. package/docs/schema/generated/methodology_activity_criteria.md +112 -0
  47. package/docs/schema/generated/methodology_activity_criteria.svg +52 -0
  48. package/docs/schema/generated/methodology_baseline_requirements.md +103 -0
  49. package/docs/schema/generated/methodology_baseline_requirements.svg +27 -0
  50. package/docs/schema/generated/methodology_code_groups.md +70 -0
  51. package/docs/schema/generated/methodology_code_groups.svg +49 -0
  52. package/docs/schema/generated/methodology_codes.md +88 -0
  53. package/docs/schema/generated/methodology_codes.svg +49 -0
  54. package/docs/schema/generated/methodology_common_blueprint_policies.md +104 -0
  55. package/docs/schema/generated/methodology_common_blueprint_policies.svg +72 -0
  56. package/docs/schema/generated/methodology_common_blueprint_policy_nodes.md +118 -0
  57. package/docs/schema/generated/methodology_common_blueprint_policy_nodes.svg +59 -0
  58. package/docs/schema/generated/methodology_handoff_requirements.md +130 -0
  59. package/docs/schema/generated/methodology_handoff_requirements.svg +27 -0
  60. package/docs/schema/generated/methodology_lifecycles.md +105 -0
  61. package/docs/schema/generated/methodology_lifecycles.svg +71 -0
  62. package/docs/schema/generated/methodology_methodologies.md +92 -0
  63. package/docs/schema/generated/methodology_methodologies.svg +92 -0
  64. package/docs/schema/generated/methodology_phase_processes.md +106 -0
  65. package/docs/schema/generated/methodology_phase_processes.svg +77 -0
  66. package/docs/schema/generated/methodology_phases.md +107 -0
  67. package/docs/schema/generated/methodology_phases.svg +77 -0
  68. package/docs/schema/generated/methodology_processes.md +98 -0
  69. package/docs/schema/generated/methodology_processes.svg +118 -0
  70. package/docs/schema/generated/methodology_schema_migrations.md +52 -0
  71. package/docs/schema/generated/methodology_schema_migrations.svg +27 -0
  72. package/docs/schema/generated/methodology_stage_activities.md +106 -0
  73. package/docs/schema/generated/methodology_stage_activities.svg +77 -0
  74. package/docs/schema/generated/methodology_stage_artifact_requirements.md +109 -0
  75. package/docs/schema/generated/methodology_stage_artifact_requirements.svg +52 -0
  76. package/docs/schema/generated/methodology_stage_criteria.md +112 -0
  77. package/docs/schema/generated/methodology_stage_criteria.svg +52 -0
  78. package/docs/schema/generated/methodology_stages.md +117 -0
  79. package/docs/schema/generated/methodology_stages.svg +121 -0
  80. package/docs/schema/generated/methodology_steps.md +105 -0
  81. package/docs/schema/generated/methodology_steps.svg +52 -0
  82. package/docs/schema/generated/methodology_trace_policies.md +121 -0
  83. package/docs/schema/generated/methodology_trace_policies.svg +27 -0
  84. package/docs/schema/generated/schema.json +4253 -0
  85. package/docs/schema/generated/schema.mmd +296 -0
  86. package/docs/schema/generated/schema.svg +446 -0
  87. package/docs/schema/migrations.md +24 -0
  88. package/docs/usage.md +39 -0
  89. package/package.json +29 -0
  90. package/src/database/migrations/0001_methodology_base.sql +1190 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.d.ts","sourceRoot":"","sources":["../src/repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EACV,mCAAmC,EACnC,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,gCAAgC,EAChC,oCAAoC,EACpC,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,4CAA4C,EAC5C,yBAAyB,EACzB,0CAA0C,EAC1C,sCAAsC,EACtC,mCAAmC,EACnC,0BAA0B,EAC1B,iBAAiB,EACjB,6BAA6B,EAC7B,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAkQpB,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAElD,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,iBAAiB;I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EAAE,KAAK,EAAE,6BAA6B,GAAG,mCAAmC;IA6BjI,qBAAqB,CAAC,oBAAoB,EAAE,MAAM,GAAG,mCAAmC;IAYxF,+BAA+B,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,mCAAmC,EAAE;IAcpH,+BAA+B,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,mCAAmC,EAAE;IAcpH,8BAA8B,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,mCAAmC,GAAG,4CAA4C;IA4B/I,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,4CAA4C;IAYnG,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,4CAA4C,EAAE;IAapG,eAAe,IAAI,MAAM;CAI1B"}
@@ -0,0 +1,652 @@
1
+ function jsonValue(value) {
2
+ return value === undefined || value === null ? null : JSON.stringify(value);
3
+ }
4
+ function parseJson(value) {
5
+ if (typeof value !== "string" || value.length === 0) {
6
+ return undefined;
7
+ }
8
+ return JSON.parse(value);
9
+ }
10
+ function optionalString(value) {
11
+ return typeof value === "string" ? value : undefined;
12
+ }
13
+ function boolToInt(value, defaultValue) {
14
+ return value === undefined ? defaultValue : value ? 1 : 0;
15
+ }
16
+ function methodologyFromRow(row) {
17
+ return {
18
+ methodologyId: row.methodology_id,
19
+ methodologyCode: row.methodology_code,
20
+ methodologyName: row.methodology_name,
21
+ methodologyVersion: row.methodology_version,
22
+ methodologyStatusCode: row.methodology_status_code,
23
+ description: optionalString(row.description),
24
+ isActive: row.is_active,
25
+ createdAt: row.created_at,
26
+ updatedAt: row.updated_at,
27
+ metadata: parseJson(row.metadata_json)
28
+ };
29
+ }
30
+ function lifecycleFromRow(row) {
31
+ return {
32
+ lifecycleId: row.lifecycle_id,
33
+ methodologyId: row.methodology_id,
34
+ lifecycleCode: row.lifecycle_code,
35
+ lifecycleName: row.lifecycle_name,
36
+ lifecycleTypeCode: row.lifecycle_type_code,
37
+ description: optionalString(row.description),
38
+ sortOrder: row.sort_order,
39
+ isActive: row.is_active,
40
+ createdAt: row.created_at,
41
+ updatedAt: row.updated_at,
42
+ metadata: parseJson(row.metadata_json)
43
+ };
44
+ }
45
+ function phaseFromRow(row) {
46
+ return {
47
+ phaseId: row.phase_id,
48
+ lifecycleId: row.lifecycle_id,
49
+ phaseCode: row.phase_code,
50
+ phaseName: row.phase_name,
51
+ phasePurpose: optionalString(row.phase_purpose),
52
+ sortOrder: row.sort_order,
53
+ isRequired: row.is_required,
54
+ isActive: row.is_active,
55
+ createdAt: row.created_at,
56
+ updatedAt: row.updated_at,
57
+ metadata: parseJson(row.metadata_json)
58
+ };
59
+ }
60
+ function processFromRow(row) {
61
+ return {
62
+ processId: row.process_id,
63
+ methodologyId: row.methodology_id,
64
+ processCode: row.process_code,
65
+ processName: row.process_name,
66
+ processPurpose: optionalString(row.process_purpose),
67
+ processTypeCode: row.process_type_code,
68
+ isActive: row.is_active,
69
+ createdAt: row.created_at,
70
+ updatedAt: row.updated_at,
71
+ metadata: parseJson(row.metadata_json)
72
+ };
73
+ }
74
+ function phaseProcessFromRow(row) {
75
+ return {
76
+ phaseProcessId: row.phase_process_id,
77
+ phaseId: row.phase_id,
78
+ processId: row.process_id,
79
+ sortOrder: row.sort_order,
80
+ isRequired: row.is_required,
81
+ tailoringAllowed: row.tailoring_allowed,
82
+ createdAt: row.created_at,
83
+ updatedAt: row.updated_at,
84
+ metadata: parseJson(row.metadata_json)
85
+ };
86
+ }
87
+ function activityFromRow(row) {
88
+ return {
89
+ activityId: row.activity_id,
90
+ processId: row.process_id,
91
+ activityCode: row.activity_code,
92
+ activityName: row.activity_name,
93
+ activityPurpose: optionalString(row.activity_purpose),
94
+ activityTypeCode: row.activity_type_code,
95
+ responsibleRoleCode: optionalString(row.responsible_role_code),
96
+ sortOrder: row.sort_order,
97
+ isRequired: row.is_required,
98
+ tailoringAllowed: row.tailoring_allowed,
99
+ isActive: row.is_active,
100
+ createdAt: row.created_at,
101
+ updatedAt: row.updated_at,
102
+ metadata: parseJson(row.metadata_json)
103
+ };
104
+ }
105
+ function stepFromRow(row) {
106
+ return {
107
+ stepId: row.step_id,
108
+ activityId: row.activity_id,
109
+ stepCode: row.step_code,
110
+ stepName: row.step_name,
111
+ stepInstruction: optionalString(row.step_instruction),
112
+ stepTypeCode: row.step_type_code,
113
+ isRequired: row.is_required,
114
+ sortOrder: row.sort_order,
115
+ createdAt: row.created_at,
116
+ updatedAt: row.updated_at,
117
+ metadata: parseJson(row.metadata_json)
118
+ };
119
+ }
120
+ function stageFromRow(row) {
121
+ return {
122
+ stageId: row.stage_id,
123
+ processId: row.process_id,
124
+ stageCode: row.stage_code,
125
+ stageName: row.stage_name,
126
+ stageObjective: optionalString(row.stage_objective),
127
+ stageTypeCode: row.stage_type_code,
128
+ sortOrder: row.sort_order,
129
+ isRequired: row.is_required,
130
+ tailoringAllowed: row.tailoring_allowed,
131
+ isActive: row.is_active,
132
+ createdAt: row.created_at,
133
+ updatedAt: row.updated_at,
134
+ metadata: parseJson(row.metadata_json)
135
+ };
136
+ }
137
+ function stageActivityFromRow(row) {
138
+ return {
139
+ stageActivityId: row.stage_activity_id,
140
+ stageId: row.stage_id,
141
+ activityId: row.activity_id,
142
+ sortOrder: row.sort_order,
143
+ isRequired: row.is_required,
144
+ tailoringAllowed: row.tailoring_allowed,
145
+ createdAt: row.created_at,
146
+ updatedAt: row.updated_at,
147
+ metadata: parseJson(row.metadata_json)
148
+ };
149
+ }
150
+ function stageCriteriaFromRow(row) {
151
+ return {
152
+ stageCriteriaId: row.stage_criteria_id,
153
+ stageId: row.stage_id,
154
+ criteriaTypeCode: row.criteria_type_code,
155
+ criteriaName: row.criteria_name,
156
+ criteriaText: row.criteria_text,
157
+ isRequired: row.is_required,
158
+ validationRequired: row.validation_required,
159
+ severityCode: row.severity_code,
160
+ sortOrder: row.sort_order,
161
+ createdAt: row.created_at,
162
+ updatedAt: row.updated_at,
163
+ metadata: parseJson(row.metadata_json)
164
+ };
165
+ }
166
+ function handoffRequirementFromRow(row) {
167
+ return {
168
+ handoffRequirementId: row.handoff_requirement_id,
169
+ sourceScopeCode: row.source_scope_code,
170
+ sourceRefId: row.source_ref_id,
171
+ targetScopeCode: row.target_scope_code,
172
+ targetRefId: row.target_ref_id,
173
+ handoffTypeCode: row.handoff_type_code,
174
+ handoffItemName: row.handoff_item_name,
175
+ handoffDescription: optionalString(row.handoff_description),
176
+ artifactStandardCode: optionalString(row.artifact_standard_code),
177
+ artifactStandardVersion: optionalString(row.artifact_standard_version),
178
+ isRequired: row.is_required,
179
+ validationRequired: row.validation_required,
180
+ sortOrder: row.sort_order,
181
+ createdAt: row.created_at,
182
+ updatedAt: row.updated_at,
183
+ metadata: parseJson(row.metadata_json)
184
+ };
185
+ }
186
+ function activityArtifactRequirementFromRow(row) {
187
+ return {
188
+ activityArtifactRequirementId: row.activity_artifact_requirement_id,
189
+ activityId: row.activity_id,
190
+ artifactStandardCode: row.artifact_standard_code,
191
+ artifactStandardVersion: row.artifact_standard_version,
192
+ artifactComponentCode: optionalString(row.artifact_component_code),
193
+ artifactComponentRoleCode: optionalString(row.artifact_component_role_code),
194
+ requirementRoleCode: row.requirement_role_code,
195
+ outputUsageCode: optionalString(row.output_usage_code),
196
+ isPrimary: row.is_primary,
197
+ isRequired: row.is_required,
198
+ validationRequired: row.validation_required,
199
+ sortOrder: row.sort_order,
200
+ createdAt: row.created_at,
201
+ updatedAt: row.updated_at,
202
+ metadata: parseJson(row.metadata_json)
203
+ };
204
+ }
205
+ function commonBlueprintPolicyFromRow(row) {
206
+ return {
207
+ commonBlueprintPolicyId: row.common_blueprint_policy_id,
208
+ methodologyId: row.methodology_id,
209
+ policyCode: row.policy_code,
210
+ policyName: row.policy_name,
211
+ appliesToStandardTypeCode: optionalString(row.applies_to_standard_type_code),
212
+ isDefault: row.is_default,
213
+ statusCode: row.status_code,
214
+ isActive: row.is_active,
215
+ createdAt: row.created_at,
216
+ updatedAt: row.updated_at,
217
+ metadata: parseJson(row.metadata_json)
218
+ };
219
+ }
220
+ function commonBlueprintPolicyNodeFromRow(row) {
221
+ return {
222
+ commonBlueprintPolicyNodeId: row.common_blueprint_policy_node_id,
223
+ commonBlueprintPolicyId: row.common_blueprint_policy_id,
224
+ parentPolicyNodeId: optionalString(row.parent_policy_node_id),
225
+ nodeCode: row.node_code,
226
+ nodeTitle: row.node_title,
227
+ nodeTypeCode: row.node_type_code,
228
+ nodeLevel: row.node_level,
229
+ isRequired: row.is_required,
230
+ sortOrder: row.sort_order,
231
+ createdAt: row.created_at,
232
+ updatedAt: row.updated_at,
233
+ metadata: parseJson(row.metadata_json)
234
+ };
235
+ }
236
+ export class MethodologyRepository {
237
+ db;
238
+ constructor(db) {
239
+ this.db = db;
240
+ }
241
+ createMethodology(methodologyId, input) {
242
+ this.db
243
+ .prepare(`INSERT INTO methodology_methodologies
244
+ (methodology_id, methodology_code, methodology_name, methodology_version, methodology_status_code, description, metadata_json)
245
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
246
+ .run(methodologyId, input.methodologyCode, input.methodologyName, input.methodologyVersion, input.methodologyStatusCode ?? "draft", input.description ?? null, jsonValue(input.metadata));
247
+ return this.getMethodology(methodologyId);
248
+ }
249
+ getMethodology(methodologyId) {
250
+ const row = this.db
251
+ .prepare("SELECT * FROM methodology_methodologies WHERE methodology_id = ?")
252
+ .get(methodologyId);
253
+ if (row === undefined) {
254
+ throw new Error(`Unknown methodology: ${methodologyId}`);
255
+ }
256
+ return methodologyFromRow(row);
257
+ }
258
+ findMethodologyByCodeVersion(methodologyCode, methodologyVersion) {
259
+ const row = this.db
260
+ .prepare(`SELECT *
261
+ FROM methodology_methodologies
262
+ WHERE methodology_code = ?
263
+ AND methodology_version = ?`)
264
+ .get(methodologyCode, methodologyVersion);
265
+ return row === undefined ? undefined : methodologyFromRow(row);
266
+ }
267
+ listMethodologies() {
268
+ const rows = this.db
269
+ .prepare("SELECT * FROM methodology_methodologies ORDER BY methodology_code, methodology_version")
270
+ .all();
271
+ return rows.map(methodologyFromRow);
272
+ }
273
+ createCommonBlueprintPolicy(policyId, input) {
274
+ this.db
275
+ .prepare(`INSERT INTO methodology_common_blueprint_policies
276
+ (common_blueprint_policy_id, methodology_id, policy_code, policy_name, applies_to_standard_type_code, is_default, status_code, metadata_json)
277
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
278
+ .run(policyId, input.methodologyId, input.policyCode, input.policyName, input.appliesToStandardTypeCode ?? null, boolToInt(input.isDefault, 0), input.statusCode ?? "DRAFT", jsonValue(input.metadata));
279
+ return this.getCommonBlueprintPolicy(policyId);
280
+ }
281
+ getCommonBlueprintPolicy(policyId) {
282
+ const row = this.db
283
+ .prepare("SELECT * FROM methodology_common_blueprint_policies WHERE common_blueprint_policy_id = ?")
284
+ .get(policyId);
285
+ if (row === undefined) {
286
+ throw new Error(`Unknown methodology common blueprint policy: ${policyId}`);
287
+ }
288
+ return commonBlueprintPolicyFromRow(row);
289
+ }
290
+ listCommonBlueprintPoliciesByMethodology(methodologyId) {
291
+ const rows = this.db
292
+ .prepare(`SELECT *
293
+ FROM methodology_common_blueprint_policies
294
+ WHERE methodology_id = ?
295
+ ORDER BY is_default DESC, policy_code`)
296
+ .all(methodologyId);
297
+ return rows.map(commonBlueprintPolicyFromRow);
298
+ }
299
+ createCommonBlueprintPolicyNode(nodeId, input) {
300
+ this.db
301
+ .prepare(`INSERT INTO methodology_common_blueprint_policy_nodes
302
+ (common_blueprint_policy_node_id, common_blueprint_policy_id, parent_policy_node_id, node_code, node_title, node_type_code, node_level, is_required, sort_order, metadata_json)
303
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
304
+ .run(nodeId, input.commonBlueprintPolicyId, input.parentPolicyNodeId ?? null, input.nodeCode, input.nodeTitle, input.nodeTypeCode, input.nodeLevel, boolToInt(input.isRequired, 0), input.sortOrder ?? 0, jsonValue(input.metadata));
305
+ return this.getCommonBlueprintPolicyNode(nodeId);
306
+ }
307
+ getCommonBlueprintPolicyNode(nodeId) {
308
+ const row = this.db
309
+ .prepare("SELECT * FROM methodology_common_blueprint_policy_nodes WHERE common_blueprint_policy_node_id = ?")
310
+ .get(nodeId);
311
+ if (row === undefined) {
312
+ throw new Error(`Unknown methodology common blueprint policy node: ${nodeId}`);
313
+ }
314
+ return commonBlueprintPolicyNodeFromRow(row);
315
+ }
316
+ listCommonBlueprintPolicyNodes(policyId) {
317
+ const rows = this.db
318
+ .prepare(`SELECT *
319
+ FROM methodology_common_blueprint_policy_nodes
320
+ WHERE common_blueprint_policy_id = ?
321
+ ORDER BY sort_order, node_code`)
322
+ .all(policyId);
323
+ return rows.map(commonBlueprintPolicyNodeFromRow);
324
+ }
325
+ createLifecycle(lifecycleId, input) {
326
+ this.db
327
+ .prepare(`INSERT INTO methodology_lifecycles
328
+ (lifecycle_id, methodology_id, lifecycle_code, lifecycle_name, lifecycle_type_code, description, sort_order, metadata_json)
329
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
330
+ .run(lifecycleId, input.methodologyId, input.lifecycleCode, input.lifecycleName, input.lifecycleTypeCode ?? "default", input.description ?? null, input.sortOrder ?? 0, jsonValue(input.metadata));
331
+ return this.getLifecycle(lifecycleId);
332
+ }
333
+ getLifecycle(lifecycleId) {
334
+ const row = this.db
335
+ .prepare("SELECT * FROM methodology_lifecycles WHERE lifecycle_id = ?")
336
+ .get(lifecycleId);
337
+ if (row === undefined) {
338
+ throw new Error(`Unknown methodology lifecycle: ${lifecycleId}`);
339
+ }
340
+ return lifecycleFromRow(row);
341
+ }
342
+ listLifecyclesByMethodology(methodologyId) {
343
+ const rows = this.db
344
+ .prepare(`SELECT *
345
+ FROM methodology_lifecycles
346
+ WHERE methodology_id = ?
347
+ ORDER BY sort_order, lifecycle_code`)
348
+ .all(methodologyId);
349
+ return rows.map(lifecycleFromRow);
350
+ }
351
+ createPhase(phaseId, input) {
352
+ this.db
353
+ .prepare(`INSERT INTO methodology_phases
354
+ (phase_id, lifecycle_id, phase_code, phase_name, phase_purpose, sort_order, is_required, metadata_json)
355
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
356
+ .run(phaseId, input.lifecycleId, input.phaseCode, input.phaseName, input.phasePurpose ?? null, input.sortOrder ?? 0, boolToInt(input.isRequired, 1), jsonValue(input.metadata));
357
+ return this.getPhase(phaseId);
358
+ }
359
+ getPhase(phaseId) {
360
+ const row = this.db
361
+ .prepare("SELECT * FROM methodology_phases WHERE phase_id = ?")
362
+ .get(phaseId);
363
+ if (row === undefined) {
364
+ throw new Error(`Unknown methodology phase: ${phaseId}`);
365
+ }
366
+ return phaseFromRow(row);
367
+ }
368
+ listPhasesByLifecycle(lifecycleId) {
369
+ const rows = this.db
370
+ .prepare(`SELECT *
371
+ FROM methodology_phases
372
+ WHERE lifecycle_id = ?
373
+ ORDER BY sort_order, phase_code`)
374
+ .all(lifecycleId);
375
+ return rows.map(phaseFromRow);
376
+ }
377
+ createProcess(processId, input) {
378
+ this.db
379
+ .prepare(`INSERT INTO methodology_processes
380
+ (process_id, methodology_id, process_code, process_name, process_purpose, process_type_code, metadata_json)
381
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
382
+ .run(processId, input.methodologyId, input.processCode, input.processName, input.processPurpose ?? null, input.processTypeCode ?? "default", jsonValue(input.metadata));
383
+ return this.getProcess(processId);
384
+ }
385
+ getProcess(processId) {
386
+ const row = this.db
387
+ .prepare("SELECT * FROM methodology_processes WHERE process_id = ?")
388
+ .get(processId);
389
+ if (row === undefined) {
390
+ throw new Error(`Unknown methodology process: ${processId}`);
391
+ }
392
+ return processFromRow(row);
393
+ }
394
+ listProcessesByMethodology(methodologyId) {
395
+ const rows = this.db
396
+ .prepare(`SELECT *
397
+ FROM methodology_processes
398
+ WHERE methodology_id = ?
399
+ ORDER BY process_code`)
400
+ .all(methodologyId);
401
+ return rows.map(processFromRow);
402
+ }
403
+ listProcessesByPhase(phaseId) {
404
+ const rows = this.db
405
+ .prepare(`SELECT p.*
406
+ FROM methodology_phase_processes pp
407
+ JOIN methodology_processes p ON p.process_id = pp.process_id
408
+ WHERE pp.phase_id = ?
409
+ ORDER BY pp.sort_order, p.process_code`)
410
+ .all(phaseId);
411
+ return rows.map(processFromRow);
412
+ }
413
+ assignProcessToPhase(phaseProcessId, input) {
414
+ this.db
415
+ .prepare(`INSERT INTO methodology_phase_processes
416
+ (phase_process_id, phase_id, process_id, sort_order, is_required, tailoring_allowed, metadata_json)
417
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
418
+ .run(phaseProcessId, input.phaseId, input.processId, input.sortOrder ?? 0, boolToInt(input.isRequired, 1), boolToInt(input.tailoringAllowed, 0), jsonValue(input.metadata));
419
+ return this.getPhaseProcess(phaseProcessId);
420
+ }
421
+ getPhaseProcess(phaseProcessId) {
422
+ const row = this.db
423
+ .prepare("SELECT * FROM methodology_phase_processes WHERE phase_process_id = ?")
424
+ .get(phaseProcessId);
425
+ if (row === undefined) {
426
+ throw new Error(`Unknown methodology phase process: ${phaseProcessId}`);
427
+ }
428
+ return phaseProcessFromRow(row);
429
+ }
430
+ listPhaseProcessesByPhase(phaseId) {
431
+ const rows = this.db
432
+ .prepare(`SELECT *
433
+ FROM methodology_phase_processes
434
+ WHERE phase_id = ?
435
+ ORDER BY sort_order, phase_process_id`)
436
+ .all(phaseId);
437
+ return rows.map(phaseProcessFromRow);
438
+ }
439
+ createActivity(activityId, input) {
440
+ this.db
441
+ .prepare(`INSERT INTO methodology_activities
442
+ (activity_id, process_id, activity_code, activity_name, activity_purpose, activity_type_code, responsible_role_code, sort_order, is_required, tailoring_allowed, metadata_json)
443
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
444
+ .run(activityId, input.processId, input.activityCode, input.activityName, input.activityPurpose ?? null, input.activityTypeCode ?? "default", input.responsibleRoleCode ?? null, input.sortOrder ?? 0, boolToInt(input.isRequired, 1), boolToInt(input.tailoringAllowed, 0), jsonValue(input.metadata));
445
+ return this.getActivity(activityId);
446
+ }
447
+ getActivity(activityId) {
448
+ const row = this.db
449
+ .prepare("SELECT * FROM methodology_activities WHERE activity_id = ?")
450
+ .get(activityId);
451
+ if (row === undefined) {
452
+ throw new Error(`Unknown methodology activity: ${activityId}`);
453
+ }
454
+ return activityFromRow(row);
455
+ }
456
+ listActivitiesByProcess(processId) {
457
+ const rows = this.db
458
+ .prepare(`SELECT *
459
+ FROM methodology_activities
460
+ WHERE process_id = ?
461
+ ORDER BY sort_order, activity_code`)
462
+ .all(processId);
463
+ return rows.map(activityFromRow);
464
+ }
465
+ listActivitiesByStage(stageId) {
466
+ const rows = this.db
467
+ .prepare(`SELECT a.*
468
+ FROM methodology_stage_activities sa
469
+ JOIN methodology_activities a ON a.activity_id = sa.activity_id
470
+ WHERE sa.stage_id = ?
471
+ ORDER BY sa.sort_order, a.activity_code`)
472
+ .all(stageId);
473
+ return rows.map(activityFromRow);
474
+ }
475
+ createStep(stepId, input) {
476
+ this.db
477
+ .prepare(`INSERT INTO methodology_steps
478
+ (step_id, activity_id, step_code, step_name, step_instruction, step_type_code, is_required, sort_order, metadata_json)
479
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
480
+ .run(stepId, input.activityId, input.stepCode, input.stepName, input.stepInstruction ?? null, input.stepTypeCode ?? "default", boolToInt(input.isRequired, 1), input.sortOrder ?? 0, jsonValue(input.metadata));
481
+ return this.getStep(stepId);
482
+ }
483
+ getStep(stepId) {
484
+ const row = this.db
485
+ .prepare("SELECT * FROM methodology_steps WHERE step_id = ?")
486
+ .get(stepId);
487
+ if (row === undefined) {
488
+ throw new Error(`Unknown methodology step: ${stepId}`);
489
+ }
490
+ return stepFromRow(row);
491
+ }
492
+ listStepsByActivity(activityId) {
493
+ const rows = this.db
494
+ .prepare(`SELECT *
495
+ FROM methodology_steps
496
+ WHERE activity_id = ?
497
+ ORDER BY sort_order, step_code`)
498
+ .all(activityId);
499
+ return rows.map(stepFromRow);
500
+ }
501
+ createStage(stageId, input) {
502
+ this.db
503
+ .prepare(`INSERT INTO methodology_stages
504
+ (stage_id, process_id, stage_code, stage_name, stage_objective, stage_type_code, sort_order, is_required, tailoring_allowed, metadata_json)
505
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
506
+ .run(stageId, input.processId, input.stageCode, input.stageName, input.stageObjective ?? null, input.stageTypeCode ?? "default", input.sortOrder ?? 0, boolToInt(input.isRequired, 1), boolToInt(input.tailoringAllowed, 0), jsonValue(input.metadata));
507
+ return this.getStage(stageId);
508
+ }
509
+ getStage(stageId) {
510
+ const row = this.db
511
+ .prepare("SELECT * FROM methodology_stages WHERE stage_id = ?")
512
+ .get(stageId);
513
+ if (row === undefined) {
514
+ throw new Error(`Unknown methodology stage: ${stageId}`);
515
+ }
516
+ return stageFromRow(row);
517
+ }
518
+ listStagesByProcess(processId) {
519
+ const rows = this.db
520
+ .prepare(`SELECT *
521
+ FROM methodology_stages
522
+ WHERE process_id = ?
523
+ ORDER BY sort_order, stage_code`)
524
+ .all(processId);
525
+ return rows.map(stageFromRow);
526
+ }
527
+ assignActivityToStage(stageActivityId, input) {
528
+ this.db
529
+ .prepare(`INSERT INTO methodology_stage_activities
530
+ (stage_activity_id, stage_id, activity_id, sort_order, is_required, tailoring_allowed, metadata_json)
531
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
532
+ .run(stageActivityId, input.stageId, input.activityId, input.sortOrder ?? 0, boolToInt(input.isRequired, 1), boolToInt(input.tailoringAllowed, 0), jsonValue(input.metadata));
533
+ return this.getStageActivity(stageActivityId);
534
+ }
535
+ getStageActivity(stageActivityId) {
536
+ const row = this.db
537
+ .prepare("SELECT * FROM methodology_stage_activities WHERE stage_activity_id = ?")
538
+ .get(stageActivityId);
539
+ if (row === undefined) {
540
+ throw new Error(`Unknown methodology stage activity: ${stageActivityId}`);
541
+ }
542
+ return stageActivityFromRow(row);
543
+ }
544
+ listStageActivitiesByStage(stageId) {
545
+ const rows = this.db
546
+ .prepare(`SELECT *
547
+ FROM methodology_stage_activities
548
+ WHERE stage_id = ?
549
+ ORDER BY sort_order, stage_activity_id`)
550
+ .all(stageId);
551
+ return rows.map(stageActivityFromRow);
552
+ }
553
+ createStageCriteria(stageCriteriaId, input) {
554
+ this.db
555
+ .prepare(`INSERT INTO methodology_stage_criteria
556
+ (stage_criteria_id, stage_id, criteria_type_code, criteria_name, criteria_text,
557
+ is_required, validation_required, severity_code, sort_order, metadata_json)
558
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
559
+ .run(stageCriteriaId, input.stageId, input.criteriaTypeCode, input.criteriaName, input.criteriaText, boolToInt(input.isRequired, 1), boolToInt(input.validationRequired, 0), input.severityCode ?? "error", input.sortOrder ?? 0, jsonValue(input.metadata));
560
+ return this.getStageCriteria(stageCriteriaId);
561
+ }
562
+ getStageCriteria(stageCriteriaId) {
563
+ const row = this.db
564
+ .prepare("SELECT * FROM methodology_stage_criteria WHERE stage_criteria_id = ?")
565
+ .get(stageCriteriaId);
566
+ if (row === undefined) {
567
+ throw new Error(`Unknown methodology stage criteria: ${stageCriteriaId}`);
568
+ }
569
+ return stageCriteriaFromRow(row);
570
+ }
571
+ listStageCriteriaByStage(stageId) {
572
+ const rows = this.db
573
+ .prepare(`SELECT *
574
+ FROM methodology_stage_criteria
575
+ WHERE stage_id = ?
576
+ ORDER BY criteria_type_code, sort_order, stage_criteria_id`)
577
+ .all(stageId);
578
+ return rows.map(stageCriteriaFromRow);
579
+ }
580
+ createHandoffRequirement(handoffRequirementId, input) {
581
+ this.db
582
+ .prepare(`INSERT INTO methodology_handoff_requirements
583
+ (handoff_requirement_id, source_scope_code, source_ref_id, target_scope_code, target_ref_id,
584
+ handoff_type_code, handoff_item_name, handoff_description, artifact_standard_code, artifact_standard_version,
585
+ is_required, validation_required, sort_order, metadata_json)
586
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
587
+ .run(handoffRequirementId, input.sourceScopeCode, input.sourceRefId, input.targetScopeCode, input.targetRefId, input.handoffTypeCode, input.handoffItemName, input.handoffDescription ?? null, input.artifactStandardCode ?? null, input.artifactStandardVersion ?? null, boolToInt(input.isRequired, 1), boolToInt(input.validationRequired, 0), input.sortOrder ?? 0, jsonValue(input.metadata));
588
+ return this.getHandoffRequirement(handoffRequirementId);
589
+ }
590
+ getHandoffRequirement(handoffRequirementId) {
591
+ const row = this.db
592
+ .prepare("SELECT * FROM methodology_handoff_requirements WHERE handoff_requirement_id = ?")
593
+ .get(handoffRequirementId);
594
+ if (row === undefined) {
595
+ throw new Error(`Unknown methodology handoff requirement: ${handoffRequirementId}`);
596
+ }
597
+ return handoffRequirementFromRow(row);
598
+ }
599
+ listHandoffRequirementsBySource(sourceScopeCode, sourceRefId) {
600
+ const rows = this.db
601
+ .prepare(`SELECT *
602
+ FROM methodology_handoff_requirements
603
+ WHERE source_scope_code = ?
604
+ AND source_ref_id = ?
605
+ ORDER BY sort_order, handoff_requirement_id`)
606
+ .all(sourceScopeCode, sourceRefId);
607
+ return rows.map(handoffRequirementFromRow);
608
+ }
609
+ listHandoffRequirementsByTarget(targetScopeCode, targetRefId) {
610
+ const rows = this.db
611
+ .prepare(`SELECT *
612
+ FROM methodology_handoff_requirements
613
+ WHERE target_scope_code = ?
614
+ AND target_ref_id = ?
615
+ ORDER BY sort_order, handoff_requirement_id`)
616
+ .all(targetScopeCode, targetRefId);
617
+ return rows.map(handoffRequirementFromRow);
618
+ }
619
+ addActivityArtifactRequirement(requirementId, input) {
620
+ this.db
621
+ .prepare(`INSERT INTO methodology_activity_artifact_requirements
622
+ (activity_artifact_requirement_id, activity_id, artifact_standard_code, artifact_standard_version,
623
+ artifact_component_code, artifact_component_role_code, requirement_role_code, output_usage_code,
624
+ is_primary, is_required, validation_required, sort_order, metadata_json)
625
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
626
+ .run(requirementId, input.activityId, input.artifactStandardCode, input.artifactStandardVersion, input.artifactComponentCode ?? null, input.artifactComponentRoleCode ?? null, input.requirementRoleCode, input.outputUsageCode ?? (input.requirementRoleCode === "output" ? "produces" : null), boolToInt(input.isPrimary, 0), boolToInt(input.isRequired, 1), boolToInt(input.validationRequired, 0), input.sortOrder ?? 0, jsonValue(input.metadata));
627
+ return this.getActivityArtifactRequirement(requirementId);
628
+ }
629
+ getActivityArtifactRequirement(requirementId) {
630
+ const row = this.db
631
+ .prepare("SELECT * FROM methodology_activity_artifact_requirements WHERE activity_artifact_requirement_id = ?")
632
+ .get(requirementId);
633
+ if (row === undefined) {
634
+ throw new Error(`Unknown methodology activity artifact requirement: ${requirementId}`);
635
+ }
636
+ return activityArtifactRequirementFromRow(row);
637
+ }
638
+ listActivityArtifactRequirements(activityId) {
639
+ const rows = this.db
640
+ .prepare(`SELECT *
641
+ FROM methodology_activity_artifact_requirements
642
+ WHERE activity_id = ?
643
+ ORDER BY sort_order, artifact_standard_code`)
644
+ .all(activityId);
645
+ return rows.map(activityArtifactRequirementFromRow);
646
+ }
647
+ countActivities() {
648
+ const row = this.db.prepare("SELECT count(*) AS count FROM methodology_activities").get();
649
+ return row.count;
650
+ }
651
+ }
652
+ //# sourceMappingURL=repositories.js.map