@inversifyjs/http-insights 0.5.1 → 0.6.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.
Files changed (166) hide show
  1. package/lib/generated/prisma/browser.d.ts +30 -0
  2. package/lib/generated/prisma/browser.d.ts.map +1 -1
  3. package/lib/generated/prisma/client.d.ts +30 -0
  4. package/lib/generated/prisma/client.d.ts.map +1 -1
  5. package/lib/generated/prisma/commonInputTypes.d.ts +81 -0
  6. package/lib/generated/prisma/commonInputTypes.d.ts.map +1 -1
  7. package/lib/generated/prisma/enums.d.ts +9 -1
  8. package/lib/generated/prisma/enums.d.ts.map +1 -1
  9. package/lib/generated/prisma/enums.js +8 -1
  10. package/lib/generated/prisma/enums.js.map +1 -1
  11. package/lib/generated/prisma/internal/class.d.ts +66 -0
  12. package/lib/generated/prisma/internal/class.d.ts.map +1 -1
  13. package/lib/generated/prisma/internal/class.js +4 -4
  14. package/lib/generated/prisma/internal/class.js.map +1 -1
  15. package/lib/generated/prisma/internal/prismaNamespace.d.ts +533 -1
  16. package/lib/generated/prisma/internal/prismaNamespace.d.ts.map +1 -1
  17. package/lib/generated/prisma/internal/prismaNamespace.js +73 -1
  18. package/lib/generated/prisma/internal/prismaNamespace.js.map +1 -1
  19. package/lib/generated/prisma/internal/prismaNamespaceBrowser.d.ts +78 -0
  20. package/lib/generated/prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -1
  21. package/lib/generated/prisma/internal/prismaNamespaceBrowser.js +73 -1
  22. package/lib/generated/prisma/internal/prismaNamespaceBrowser.js.map +1 -1
  23. package/lib/generated/prisma/models/Controller.d.ts +108 -0
  24. package/lib/generated/prisma/models/Controller.d.ts.map +1 -1
  25. package/lib/generated/prisma/models/Guard.d.ts +112 -0
  26. package/lib/generated/prisma/models/Guard.d.ts.map +1 -1
  27. package/lib/generated/prisma/models/Interceptor.d.ts +108 -0
  28. package/lib/generated/prisma/models/Interceptor.d.ts.map +1 -1
  29. package/lib/generated/prisma/models/Middleware.d.ts +112 -0
  30. package/lib/generated/prisma/models/Middleware.d.ts.map +1 -1
  31. package/lib/generated/prisma/models/Pipe.d.ts +116 -0
  32. package/lib/generated/prisma/models/Pipe.d.ts.map +1 -1
  33. package/lib/generated/prisma/models/Plan.d.ts +1948 -0
  34. package/lib/generated/prisma/models/Plan.d.ts.map +1 -0
  35. package/lib/generated/prisma/models/Plan.js +2 -0
  36. package/lib/generated/prisma/models/Plan.js.map +1 -0
  37. package/lib/generated/prisma/models/PlanBinding.d.ts +1843 -0
  38. package/lib/generated/prisma/models/PlanBinding.d.ts.map +1 -0
  39. package/lib/generated/prisma/models/PlanBinding.js +2 -0
  40. package/lib/generated/prisma/models/PlanBinding.js.map +1 -0
  41. package/lib/generated/prisma/models/PlanBindingDependency.d.ts +1503 -0
  42. package/lib/generated/prisma/models/PlanBindingDependency.d.ts.map +1 -0
  43. package/lib/generated/prisma/models/PlanBindingDependency.js +2 -0
  44. package/lib/generated/prisma/models/PlanBindingDependency.js.map +1 -0
  45. package/lib/generated/prisma/models/PlanService.d.ts +1851 -0
  46. package/lib/generated/prisma/models/PlanService.d.ts.map +1 -0
  47. package/lib/generated/prisma/models/PlanService.js +2 -0
  48. package/lib/generated/prisma/models/PlanService.js.map +1 -0
  49. package/lib/generated/prisma/models/PlanServiceBinding.d.ts +1238 -0
  50. package/lib/generated/prisma/models/PlanServiceBinding.d.ts.map +1 -0
  51. package/lib/generated/prisma/models/PlanServiceBinding.js +2 -0
  52. package/lib/generated/prisma/models/PlanServiceBinding.js.map +1 -0
  53. package/lib/generated/prisma/models/PlanServiceTag.d.ts +1315 -0
  54. package/lib/generated/prisma/models/PlanServiceTag.d.ts.map +1 -0
  55. package/lib/generated/prisma/models/PlanServiceTag.js +2 -0
  56. package/lib/generated/prisma/models/PlanServiceTag.js.map +1 -0
  57. package/lib/generated/prisma/models.d.ts +6 -0
  58. package/lib/generated/prisma/models.d.ts.map +1 -1
  59. package/lib/generated/prisma-migrate/index.d.ts.map +1 -1
  60. package/lib/generated/prisma-migrate/index.js +1 -1
  61. package/lib/generated/prisma-migrate/index.js.map +1 -1
  62. package/lib/insights/adapter/inversify/modules/InsightsContainerModule.d.ts.map +1 -1
  63. package/lib/insights/adapter/inversify/modules/InsightsContainerModule.js +2 -0
  64. package/lib/insights/adapter/inversify/modules/InsightsContainerModule.js.map +1 -1
  65. package/lib/insights/adapter/inversify/services/HttpInsightsProvider.js +1 -1
  66. package/lib/insights/adapter/inversify/services/HttpInsightsProvider.js.map +1 -1
  67. package/lib/insights/adapter/prisma/adapters/PrismaInsightsPersistenceAdapter.d.ts.map +1 -1
  68. package/lib/insights/adapter/prisma/adapters/PrismaInsightsPersistenceAdapter.js +94 -0
  69. package/lib/insights/adapter/prisma/adapters/PrismaInsightsPersistenceAdapter.js.map +1 -1
  70. package/lib/insights/adapter/prisma/builders/CallFromPrismaCallBuilder.d.ts +167 -1
  71. package/lib/insights/adapter/prisma/builders/CallFromPrismaCallBuilder.d.ts.map +1 -1
  72. package/lib/insights/adapter/prisma/builders/CallFromPrismaCallBuilder.js +9 -5
  73. package/lib/insights/adapter/prisma/builders/CallFromPrismaCallBuilder.js.map +1 -1
  74. package/lib/insights/adapter/prisma/builders/ControllerFromPrismaControllerBuilder.d.ts +5 -4
  75. package/lib/insights/adapter/prisma/builders/ControllerFromPrismaControllerBuilder.d.ts.map +1 -1
  76. package/lib/insights/adapter/prisma/builders/ControllerFromPrismaControllerBuilder.js +14 -2
  77. package/lib/insights/adapter/prisma/builders/ControllerFromPrismaControllerBuilder.js.map +1 -1
  78. package/lib/insights/adapter/prisma/builders/GuardFromPrismaGuardBuilder.d.ts +5 -4
  79. package/lib/insights/adapter/prisma/builders/GuardFromPrismaGuardBuilder.d.ts.map +1 -1
  80. package/lib/insights/adapter/prisma/builders/GuardFromPrismaGuardBuilder.js +14 -2
  81. package/lib/insights/adapter/prisma/builders/GuardFromPrismaGuardBuilder.js.map +1 -1
  82. package/lib/insights/adapter/prisma/builders/InterceptorFromPrismaInterceptorBuilder.d.ts +5 -4
  83. package/lib/insights/adapter/prisma/builders/InterceptorFromPrismaInterceptorBuilder.d.ts.map +1 -1
  84. package/lib/insights/adapter/prisma/builders/InterceptorFromPrismaInterceptorBuilder.js +14 -2
  85. package/lib/insights/adapter/prisma/builders/InterceptorFromPrismaInterceptorBuilder.js.map +1 -1
  86. package/lib/insights/adapter/prisma/builders/MiddlewareFromPrismaMiddlewareBuilder.d.ts +5 -4
  87. package/lib/insights/adapter/prisma/builders/MiddlewareFromPrismaMiddlewareBuilder.d.ts.map +1 -1
  88. package/lib/insights/adapter/prisma/builders/MiddlewareFromPrismaMiddlewareBuilder.js +14 -2
  89. package/lib/insights/adapter/prisma/builders/MiddlewareFromPrismaMiddlewareBuilder.js.map +1 -1
  90. package/lib/insights/adapter/prisma/builders/PipeFromPrismaPipeBuilder.d.ts +5 -4
  91. package/lib/insights/adapter/prisma/builders/PipeFromPrismaPipeBuilder.d.ts.map +1 -1
  92. package/lib/insights/adapter/prisma/builders/PipeFromPrismaPipeBuilder.js +14 -2
  93. package/lib/insights/adapter/prisma/builders/PipeFromPrismaPipeBuilder.js.map +1 -1
  94. package/lib/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.d.ts +7 -0
  95. package/lib/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.d.ts.map +1 -0
  96. package/lib/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.js +359 -0
  97. package/lib/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.js.map +1 -0
  98. package/lib/insights/adapter/prisma/builders/prismaPlanInclude.d.ts +83 -0
  99. package/lib/insights/adapter/prisma/builders/prismaPlanInclude.d.ts.map +1 -0
  100. package/lib/insights/adapter/prisma/builders/prismaPlanInclude.js +25 -0
  101. package/lib/insights/adapter/prisma/builders/prismaPlanInclude.js.map +1 -0
  102. package/lib/insights/adapter/prisma/calculations/readPlanRows.d.ts +19 -0
  103. package/lib/insights/adapter/prisma/calculations/readPlanRows.d.ts.map +1 -0
  104. package/lib/insights/adapter/prisma/calculations/readPlanRows.js +160 -0
  105. package/lib/insights/adapter/prisma/calculations/readPlanRows.js.map +1 -0
  106. package/lib/insights/domain/calculations/definePlanJson.d.ts +3 -0
  107. package/lib/insights/domain/calculations/definePlanJson.d.ts.map +1 -0
  108. package/lib/insights/domain/calculations/definePlanJson.js +88 -0
  109. package/lib/insights/domain/calculations/definePlanJson.js.map +1 -0
  110. package/lib/insights/domain/models/Controller.d.ts +2 -0
  111. package/lib/insights/domain/models/Controller.d.ts.map +1 -1
  112. package/lib/insights/domain/models/Guard.d.ts +2 -0
  113. package/lib/insights/domain/models/Guard.d.ts.map +1 -1
  114. package/lib/insights/domain/models/Interceptor.d.ts +2 -0
  115. package/lib/insights/domain/models/Interceptor.d.ts.map +1 -1
  116. package/lib/insights/domain/models/Middleware.d.ts +2 -0
  117. package/lib/insights/domain/models/Middleware.d.ts.map +1 -1
  118. package/lib/insights/domain/models/Pipe.d.ts +2 -0
  119. package/lib/insights/domain/models/Pipe.d.ts.map +1 -1
  120. package/lib/insights/domain/models/Plan.d.ts +6 -0
  121. package/lib/insights/domain/models/Plan.d.ts.map +1 -0
  122. package/lib/insights/domain/models/Plan.js +2 -0
  123. package/lib/insights/domain/models/Plan.js.map +1 -0
  124. package/lib/insights/domain/models/PlanBinding.d.ts +39 -0
  125. package/lib/insights/domain/models/PlanBinding.d.ts.map +1 -0
  126. package/lib/insights/domain/models/PlanBinding.js +15 -0
  127. package/lib/insights/domain/models/PlanBinding.js.map +1 -0
  128. package/lib/insights/domain/models/PlanJsonValue.d.ts +6 -0
  129. package/lib/insights/domain/models/PlanJsonValue.d.ts.map +1 -0
  130. package/lib/insights/domain/models/PlanJsonValue.js +2 -0
  131. package/lib/insights/domain/models/PlanJsonValue.js.map +1 -0
  132. package/lib/insights/domain/models/PlanMetadataKey.d.ts +5 -0
  133. package/lib/insights/domain/models/PlanMetadataKey.d.ts.map +1 -0
  134. package/lib/insights/domain/models/PlanMetadataKey.js +2 -0
  135. package/lib/insights/domain/models/PlanMetadataKey.js.map +1 -0
  136. package/lib/insights/domain/models/PlanProperty.d.ts +7 -0
  137. package/lib/insights/domain/models/PlanProperty.d.ts.map +1 -0
  138. package/lib/insights/domain/models/PlanProperty.js +2 -0
  139. package/lib/insights/domain/models/PlanProperty.js.map +1 -0
  140. package/lib/insights/domain/models/PlanService.d.ts +15 -0
  141. package/lib/insights/domain/models/PlanService.d.ts.map +1 -0
  142. package/lib/insights/domain/models/PlanService.js +2 -0
  143. package/lib/insights/domain/models/PlanService.js.map +1 -0
  144. package/lib/insights/domain/models/PlanServiceIdentifier.d.ts +5 -0
  145. package/lib/insights/domain/models/PlanServiceIdentifier.d.ts.map +1 -0
  146. package/lib/insights/domain/models/PlanServiceIdentifier.js +2 -0
  147. package/lib/insights/domain/models/PlanServiceIdentifier.js.map +1 -0
  148. package/lib/insights/domain/models/PlanTag.d.ts +7 -0
  149. package/lib/insights/domain/models/PlanTag.d.ts.map +1 -0
  150. package/lib/insights/domain/models/PlanTag.js +2 -0
  151. package/lib/insights/domain/models/PlanTag.js.map +1 -0
  152. package/lib/instrumentation/adapter/inversify/calculations/buildHttpInsightsPlan.d.ts +4 -0
  153. package/lib/instrumentation/adapter/inversify/calculations/buildHttpInsightsPlan.d.ts.map +1 -0
  154. package/lib/instrumentation/adapter/inversify/calculations/buildHttpInsightsPlan.js +269 -0
  155. package/lib/instrumentation/adapter/inversify/calculations/buildHttpInsightsPlan.js.map +1 -0
  156. package/lib/instrumentation/adapter/inversify/modules/InstrumentationContainerModule.d.ts +2 -2
  157. package/lib/instrumentation/adapter/inversify/modules/InstrumentationContainerModule.d.ts.map +1 -1
  158. package/lib/instrumentation/adapter/inversify/modules/InstrumentationContainerModule.js +3 -3
  159. package/lib/instrumentation/adapter/inversify/modules/InstrumentationContainerModule.js.map +1 -1
  160. package/lib/instrumentation/adapter/inversify/services/HttpInsightsEventSink.d.ts +2 -1
  161. package/lib/instrumentation/adapter/inversify/services/HttpInsightsEventSink.d.ts.map +1 -1
  162. package/lib/instrumentation/adapter/inversify/services/HttpInsightsEventSink.js +69 -55
  163. package/lib/instrumentation/adapter/inversify/services/HttpInsightsEventSink.js.map +1 -1
  164. package/package.json +7 -7
  165. package/prisma/migrations/20261108202000_add_plan/migration.sql +124 -0
  166. package/prisma/schema.prisma +117 -0
@@ -0,0 +1,7 @@
1
+ import { type Builder } from '../../../../foundation/modules/Builder.js';
2
+ import { type Plan } from '../../../domain/models/Plan.js';
3
+ import { type PrismaPlanWithGraph } from './prismaPlanInclude.js';
4
+ export declare class PlanFromPrismaPlanBuilder implements Builder<PrismaPlanWithGraph, Plan> {
5
+ build(input: PrismaPlanWithGraph): Plan;
6
+ }
7
+ //# sourceMappingURL=PlanFromPrismaPlanBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanFromPrismaPlanBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAGzE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAW3D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAUlE,qBACa,yBAA0B,YAAW,OAAO,CACvD,mBAAmB,EACnB,IAAI,CACL;IACQ,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CA2D7C;CACF"}
@@ -0,0 +1,359 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { injectable } from 'inversify';
8
+ import { definePlanJson } from '../../../domain/calculations/definePlanJson.js';
9
+ let PlanFromPrismaPlanBuilder = class PlanFromPrismaPlanBuilder {
10
+ build(input) {
11
+ const services = new Map();
12
+ for (const row of input.services) {
13
+ if (services.has(row.id)) {
14
+ throw new Error(`Plan "${input.id}" has duplicate service "${row.id}".`);
15
+ }
16
+ services.set(row.id, readServiceShell(row));
17
+ }
18
+ const bindings = new Map();
19
+ for (const row of input.bindings) {
20
+ if (bindings.has(row.id)) {
21
+ throw new Error(`Plan "${input.id}" has duplicate binding "${row.id}".`);
22
+ }
23
+ bindings.set(row.id, readBinding(row, services));
24
+ }
25
+ for (const row of input.services) {
26
+ const service = services.get(row.id);
27
+ if (service === undefined) {
28
+ throw new Error(`Plan service "${row.id}" was not built.`);
29
+ }
30
+ service.bindings.push(...readServiceBindings(row, bindings));
31
+ }
32
+ const roots = input.services.filter((service) => service.is_root);
33
+ if (roots.length !== 1) {
34
+ throw new Error(`Plan "${input.id}" has ${String(roots.length)} roots.`);
35
+ }
36
+ const rootRow = roots[0];
37
+ if (rootRow === undefined) {
38
+ throw new Error(`Plan "${input.id}" has no root.`);
39
+ }
40
+ const root = services.get(rootRow.id);
41
+ if (root === undefined) {
42
+ throw new Error(`Plan service "${rootRow.id}" was not built.`);
43
+ }
44
+ return {
45
+ id: input.id,
46
+ root,
47
+ };
48
+ }
49
+ };
50
+ PlanFromPrismaPlanBuilder = __decorate([
51
+ injectable()
52
+ ], PlanFromPrismaPlanBuilder);
53
+ export { PlanFromPrismaPlanBuilder };
54
+ function readBinding(row, services) {
55
+ const serviceIdentifier = readServiceIdentifier(row.service_identifier_kind, row.service_identifier_value, `Plan binding "${row.id}"`);
56
+ switch (row.type) {
57
+ case 'ConstantValue':
58
+ case 'Factory':
59
+ readAbsentDependencies(row);
60
+ readAbsentImplementation(row);
61
+ readAbsentTarget(row);
62
+ return {
63
+ bindingId: row.binding_identifier,
64
+ id: row.id,
65
+ moduleId: row.module_id,
66
+ scope: readSingletonScope(row.scope, row.id),
67
+ serviceIdentifier,
68
+ type: row.type,
69
+ };
70
+ case 'DynamicValue':
71
+ readAbsentDependencies(row);
72
+ readAbsentImplementation(row);
73
+ readAbsentTarget(row);
74
+ return {
75
+ bindingId: row.binding_identifier,
76
+ id: row.id,
77
+ moduleId: row.module_id,
78
+ scope: readBindingScope(row.scope, row.id),
79
+ serviceIdentifier,
80
+ type: 'DynamicValue',
81
+ };
82
+ case 'Instance':
83
+ readAbsentTarget(row);
84
+ return {
85
+ bindingId: row.binding_identifier,
86
+ constructorArguments: readConstructorArguments(row, services),
87
+ id: row.id,
88
+ implementationType: readImplementationType(row),
89
+ moduleId: row.module_id,
90
+ properties: readProperties(row, services),
91
+ scope: readBindingScope(row.scope, row.id),
92
+ serviceIdentifier,
93
+ type: 'Instance',
94
+ };
95
+ case 'ResolvedValue':
96
+ readAbsentImplementation(row);
97
+ readAbsentTarget(row);
98
+ return {
99
+ arguments: readResolvedArguments(row, services),
100
+ bindingId: row.binding_identifier,
101
+ id: row.id,
102
+ moduleId: row.module_id,
103
+ scope: readBindingScope(row.scope, row.id),
104
+ serviceIdentifier,
105
+ type: 'ResolvedValue',
106
+ };
107
+ case 'ServiceRedirection':
108
+ readAbsentImplementation(row);
109
+ readAbsentScope(row);
110
+ return {
111
+ bindingId: row.binding_identifier,
112
+ id: row.id,
113
+ moduleId: row.module_id,
114
+ redirection: readRedirection(row, services),
115
+ serviceIdentifier,
116
+ targetServiceIdentifier: readTargetServiceIdentifier(row),
117
+ type: 'ServiceRedirection',
118
+ };
119
+ default:
120
+ return throwUnknownBindingType(row.id, row.type);
121
+ }
122
+ }
123
+ function throwUnknownBindingType(bindingId, type) {
124
+ throw new Error(`Plan binding "${bindingId}" has unknown type "${type}".`);
125
+ }
126
+ function readAbsentDependencies(row) {
127
+ readExpectedDependencyKinds(row, []);
128
+ }
129
+ function readAbsentImplementation(row) {
130
+ if (row.implementation_type_kind !== null ||
131
+ row.implementation_type_value !== null) {
132
+ throw new Error(`Plan binding "${row.id}" must not have an implementation type.`);
133
+ }
134
+ }
135
+ function readAbsentScope(row) {
136
+ if (row.scope !== null) {
137
+ throw new Error(`Plan binding "${row.id}" must not have a scope.`);
138
+ }
139
+ }
140
+ function readAbsentTarget(row) {
141
+ if (row.target_service_identifier_kind !== null ||
142
+ row.target_service_identifier_value !== null) {
143
+ throw new Error(`Plan binding "${row.id}" must not have a target service identifier.`);
144
+ }
145
+ }
146
+ function readBindingScope(scope, bindingId) {
147
+ switch (scope) {
148
+ case 'Request':
149
+ case 'Singleton':
150
+ case 'Transient':
151
+ return scope;
152
+ default:
153
+ throw new Error(`Plan binding "${bindingId}" has unknown scope "${scope ?? 'null'}".`);
154
+ }
155
+ }
156
+ function readConstructorArguments(row, services) {
157
+ readExpectedDependencyKinds(row, ['constructorArgument', 'property']);
158
+ return readDependencies(row, 'constructorArgument').map((dependency) => readLinkedService(dependency, services, true));
159
+ }
160
+ function readDependencies(row, kind) {
161
+ const dependencies = row.dependencies
162
+ .filter((dependency) => dependency.kind === kind)
163
+ .sort((left, right) => left.position - right.position);
164
+ for (const [index, dependency] of dependencies.entries()) {
165
+ if (dependency.position !== index) {
166
+ throw new Error(`Plan binding "${row.id}" has a gap in "${kind}" dependencies.`);
167
+ }
168
+ }
169
+ return dependencies;
170
+ }
171
+ function readExpectedDependencyKinds(row, kinds) {
172
+ for (const dependency of row.dependencies) {
173
+ if (!kinds.includes(dependency.kind)) {
174
+ throw new Error(`Plan binding "${row.id}" has unexpected dependency kind "${dependency.kind}".`);
175
+ }
176
+ }
177
+ }
178
+ function readImplementationType(row) {
179
+ if (row.implementation_type_kind !== 'class' ||
180
+ row.implementation_type_value === null) {
181
+ throw new Error(`Plan binding "${row.id}" is missing its implementation type.`);
182
+ }
183
+ return {
184
+ kind: 'class',
185
+ value: row.implementation_type_value,
186
+ };
187
+ }
188
+ function readLinkedService(dependency, services, optional) {
189
+ if (dependency.service_id === null) {
190
+ if (optional) {
191
+ return null;
192
+ }
193
+ throw new Error(`Plan dependency "${dependency.id}" is missing its service.`);
194
+ }
195
+ const service = services.get(dependency.service_id);
196
+ if (service === undefined) {
197
+ throw new Error(`Plan dependency "${dependency.id}" points at missing service "${dependency.service_id}".`);
198
+ }
199
+ return service;
200
+ }
201
+ function readMetadataKey(kind, value, subject) {
202
+ switch (kind) {
203
+ case 'number':
204
+ case 'string':
205
+ case 'symbol':
206
+ return {
207
+ kind,
208
+ value,
209
+ };
210
+ default:
211
+ throw new Error(`${subject} has unknown metadata key kind "${kind}".`);
212
+ }
213
+ }
214
+ function readOptionalMetadataKey(kind, value, subject) {
215
+ if (kind === null && value === null) {
216
+ return null;
217
+ }
218
+ if (kind === null || value === null) {
219
+ throw new Error(`${subject} has an incomplete metadata key.`);
220
+ }
221
+ return readMetadataKey(kind, value, subject);
222
+ }
223
+ function readPlanJsonValue(value, subject) {
224
+ if (value === null ||
225
+ typeof value === 'string' ||
226
+ typeof value === 'number' ||
227
+ typeof value === 'boolean') {
228
+ return value;
229
+ }
230
+ if (Array.isArray(value)) {
231
+ return value.map((item, index) => readPlanJsonValue(item, `${subject}[${String(index)}]`));
232
+ }
233
+ const json = {};
234
+ for (const [key, entry] of Object.entries(value)) {
235
+ if (entry === undefined) {
236
+ continue;
237
+ }
238
+ json[key] = readPlanJsonValue(entry, `${subject}.${key}`);
239
+ }
240
+ return json;
241
+ }
242
+ function readProperties(row, services) {
243
+ return readDependencies(row, 'property').map((dependency) => {
244
+ if (dependency.key_kind === null || dependency.key_value === null) {
245
+ throw new Error(`Plan dependency "${dependency.id}" is missing its key.`);
246
+ }
247
+ const key = readMetadataKey(dependency.key_kind, dependency.key_value, `Plan dependency "${dependency.id}"`);
248
+ if (key.kind === 'number') {
249
+ throw new Error(`Plan dependency "${dependency.id}" has a numeric property key.`);
250
+ }
251
+ const service = readLinkedService(dependency, services, false);
252
+ if (service === null) {
253
+ throw new Error(`Plan dependency "${dependency.id}" is missing its service.`);
254
+ }
255
+ return {
256
+ key,
257
+ service,
258
+ };
259
+ });
260
+ }
261
+ function readRedirection(row, services) {
262
+ readExpectedDependencyKinds(row, ['redirection']);
263
+ const dependencies = readDependencies(row, 'redirection');
264
+ const dependency = dependencies[0];
265
+ if (dependencies.length !== 1 || dependency === undefined) {
266
+ throw new Error(`Plan binding "${row.id}" must redirect to one service.`);
267
+ }
268
+ const service = readLinkedService(dependency, services, false);
269
+ if (service === null) {
270
+ throw new Error(`Plan binding "${row.id}" must redirect to one service.`);
271
+ }
272
+ return service;
273
+ }
274
+ function readResolvedArguments(row, services) {
275
+ readExpectedDependencyKinds(row, ['resolvedArgument']);
276
+ return readDependencies(row, 'resolvedArgument').map((dependency) => {
277
+ const service = readLinkedService(dependency, services, false);
278
+ if (service === null) {
279
+ throw new Error(`Plan dependency "${dependency.id}" is missing its service.`);
280
+ }
281
+ return service;
282
+ });
283
+ }
284
+ function readServiceBindings(row, bindings) {
285
+ const links = [
286
+ ...row.serviceBindings,
287
+ ].sort((left, right) => left.position - right.position);
288
+ const serviceBindings = [];
289
+ for (const [index, link] of links.entries()) {
290
+ if (link.position !== index) {
291
+ throw new Error(`Plan service "${row.id}" has a gap in its bindings.`);
292
+ }
293
+ const binding = bindings.get(link.binding_id);
294
+ if (binding === undefined) {
295
+ throw new Error(`Plan service "${row.id}" points at missing binding "${link.binding_id}".`);
296
+ }
297
+ serviceBindings.push(binding);
298
+ }
299
+ if (!row.is_multiple && serviceBindings.length > 1) {
300
+ throw new Error(`Plan service "${row.id}" is not multiple and has ${String(serviceBindings.length)} bindings.`);
301
+ }
302
+ return serviceBindings;
303
+ }
304
+ function readServiceIdentifier(kind, value, subject) {
305
+ switch (kind) {
306
+ case 'class':
307
+ case 'string':
308
+ case 'symbol':
309
+ return {
310
+ kind,
311
+ value,
312
+ };
313
+ default:
314
+ throw new Error(`${subject} has unknown service identifier kind "${kind}".`);
315
+ }
316
+ }
317
+ function readServiceShell(row) {
318
+ const service = {
319
+ bindings: [],
320
+ chained: readChained(row),
321
+ id: row.id,
322
+ isMultiple: row.is_multiple,
323
+ name: readOptionalMetadataKey(row.name_kind, row.name_value, `Plan service "${row.id}"`),
324
+ optional: row.optional,
325
+ serviceIdentifier: readServiceIdentifier(row.service_identifier_kind, row.service_identifier_value, `Plan service "${row.id}"`),
326
+ tags: row.tags.map((tag) => ({
327
+ key: readMetadataKey(tag.key_kind, tag.key_value, `Plan tag "${tag.id}"`),
328
+ value: readPlanJsonValue(tag.value, `Plan tag "${tag.id}"`),
329
+ })),
330
+ };
331
+ definePlanJson(service);
332
+ return service;
333
+ }
334
+ function readChained(row) {
335
+ if (!row.is_multiple) {
336
+ if (row.chained !== null) {
337
+ throw new Error(`Plan service "${row.id}" is not multiple and must not be chained.`);
338
+ }
339
+ return null;
340
+ }
341
+ if (row.chained === null) {
342
+ throw new Error(`Plan service "${row.id}" is multiple and must be chained or not.`);
343
+ }
344
+ return row.chained;
345
+ }
346
+ function readSingletonScope(scope, bindingId) {
347
+ if (scope !== 'Singleton') {
348
+ throw new Error(`Plan binding "${bindingId}" must have Singleton scope.`);
349
+ }
350
+ return 'Singleton';
351
+ }
352
+ function readTargetServiceIdentifier(row) {
353
+ if (row.target_service_identifier_kind === null ||
354
+ row.target_service_identifier_value === null) {
355
+ throw new Error(`Plan binding "${row.id}" is missing its target service identifier.`);
356
+ }
357
+ return readServiceIdentifier(row.target_service_identifier_kind, row.target_service_identifier_value, `Plan binding "${row.id}"`);
358
+ }
359
+ //# sourceMappingURL=PlanFromPrismaPlanBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanFromPrismaPlanBuilder.js","sourceRoot":"","sources":["../../../../../src/insights/adapter/prisma/builders/PlanFromPrismaPlanBuilder.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM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C,GAAyB;IAC5C,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QACrB,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,iBAAiB,GAAG,CAAC,EAAE,4CAA4C,CACpE,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,iBAAiB,GAAG,CAAC,EAAE,2CAA2C,CACnE,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAoB,EACpB,SAAiB;IAEjB,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,iBAAiB,SAAS,8BAA8B,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,2BAA2B,CAClC,GAAyB;IAEzB,IACE,GAAG,CAAC,8BAA8B,KAAK,IAAI;QAC3C,GAAG,CAAC,+BAA+B,KAAK,IAAI,EAC5C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iBAAiB,GAAG,CAAC,EAAE,6CAA6C,CACrE,CAAC;IACJ,CAAC;IAED,OAAO,qBAAqB,CAC1B,GAAG,CAAC,8BAA8B,EAClC,GAAG,CAAC,+BAA+B,EACnC,iBAAiB,GAAG,CAAC,EAAE,GAAG,CAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { type Prisma } from '../../../../generated/prisma/client.js';
2
+ declare const planInclude: {
3
+ bindings: {
4
+ include: {
5
+ dependencies: {
6
+ orderBy: ({
7
+ kind: "asc";
8
+ position?: never;
9
+ } | {
10
+ kind?: never;
11
+ position: "asc";
12
+ })[];
13
+ };
14
+ };
15
+ };
16
+ services: {
17
+ include: {
18
+ serviceBindings: {
19
+ orderBy: {
20
+ position: "asc";
21
+ };
22
+ };
23
+ tags: {
24
+ orderBy: {
25
+ position: "asc";
26
+ };
27
+ };
28
+ };
29
+ };
30
+ };
31
+ export type PrismaPlanWithGraph = Prisma.PlanGetPayload<{
32
+ include: typeof planInclude;
33
+ }>;
34
+ export declare const stagePlanInclude: {
35
+ plan: {
36
+ include: {
37
+ bindings: {
38
+ include: {
39
+ dependencies: {
40
+ orderBy: ({
41
+ kind: "asc";
42
+ position?: never;
43
+ } | {
44
+ kind?: never;
45
+ position: "asc";
46
+ })[];
47
+ };
48
+ };
49
+ };
50
+ services: {
51
+ include: {
52
+ serviceBindings: {
53
+ orderBy: {
54
+ position: "asc";
55
+ };
56
+ };
57
+ tags: {
58
+ orderBy: {
59
+ position: "asc";
60
+ };
61
+ };
62
+ };
63
+ };
64
+ };
65
+ };
66
+ };
67
+ export type PrismaControllerWithPlan = Prisma.ControllerGetPayload<{
68
+ include: typeof stagePlanInclude;
69
+ }>;
70
+ export type PrismaGuardWithPlan = Prisma.GuardGetPayload<{
71
+ include: typeof stagePlanInclude;
72
+ }>;
73
+ export type PrismaInterceptorWithPlan = Prisma.InterceptorGetPayload<{
74
+ include: typeof stagePlanInclude;
75
+ }>;
76
+ export type PrismaMiddlewareWithPlan = Prisma.MiddlewareGetPayload<{
77
+ include: typeof stagePlanInclude;
78
+ }>;
79
+ export type PrismaPipeWithPlan = Prisma.PipeGetPayload<{
80
+ include: typeof stagePlanInclude;
81
+ }>;
82
+ export {};
83
+ //# sourceMappingURL=prismaPlanInclude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prismaPlanInclude.d.ts","sourceRoot":"","sources":["../../../../../src/insights/adapter/prisma/builders/prismaPlanInclude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAErE,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBa,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,cAAc,CAAC;IACtD,OAAO,EAAE,OAAO,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;QAEzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEyB,CAAC;AAErC,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,oBAAoB,CAAC;IACjE,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,eAAe,CAAC;IACvD,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,qBAAqB,CAAC;IACnE,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,oBAAoB,CAAC;IACjE,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC;IACrD,OAAO,EAAE,OAAO,gBAAgB,CAAC;CAClC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ const planInclude = {
2
+ bindings: {
3
+ include: {
4
+ dependencies: {
5
+ orderBy: [{ kind: 'asc' }, { position: 'asc' }],
6
+ },
7
+ },
8
+ },
9
+ services: {
10
+ include: {
11
+ serviceBindings: {
12
+ orderBy: { position: 'asc' },
13
+ },
14
+ tags: {
15
+ orderBy: { position: 'asc' },
16
+ },
17
+ },
18
+ },
19
+ };
20
+ export const stagePlanInclude = {
21
+ plan: {
22
+ include: planInclude,
23
+ },
24
+ };
25
+ //# sourceMappingURL=prismaPlanInclude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prismaPlanInclude.js","sourceRoot":"","sources":["../../../../../src/insights/adapter/prisma/builders/prismaPlanInclude.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,YAAY,EAAE;gBACZ,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;aAChD;SACF;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,eAAe,EAAE;gBACf,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;aAC7B;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;aAC7B;SACF;KACF;CAC2B,CAAC;AAM/B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE;QACJ,OAAO,EAAE,WAAW;KACrB;CACiC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Prisma } from '../../../../generated/prisma/client.js';
2
+ import { type Plan } from '../../../domain/models/Plan.js';
3
+ export interface PlanOwner {
4
+ readonly controllerId: string | null;
5
+ readonly guardId: string | null;
6
+ readonly interceptorId: string | null;
7
+ readonly middlewareId: string | null;
8
+ readonly pipeId: string | null;
9
+ }
10
+ export interface PlanRows {
11
+ readonly bindings: readonly Prisma.PlanBindingCreateManyInput[];
12
+ readonly dependencies: readonly Prisma.PlanBindingDependencyCreateManyInput[];
13
+ readonly plan: Prisma.PlanCreateManyInput;
14
+ readonly serviceBindings: readonly Prisma.PlanServiceBindingCreateManyInput[];
15
+ readonly services: readonly Prisma.PlanServiceCreateManyInput[];
16
+ readonly tags: readonly Prisma.PlanServiceTagCreateManyInput[];
17
+ }
18
+ export declare function readPlanRows(plan: Plan, owner: PlanOwner, readId?: () => string): PlanRows;
19
+ //# sourceMappingURL=readPlanRows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readPlanRows.d.ts","sourceRoot":"","sources":["../../../../../src/insights/adapter/prisma/calculations/readPlanRows.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAK3D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,CAAC,0BAA0B,EAAE,CAAC;IAChE,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,CAAC,oCAAoC,EAAE,CAAC;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,CAAC,iCAAiC,EAAE,CAAC;IAC9E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,CAAC,0BAA0B,EAAE,CAAC;IAChE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,CAAC,6BAA6B,EAAE,CAAC;CAChE;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,MAAM,GAAE,MAAM,MAAmB,GAChC,QAAQ,CAoIV"}