@wildo-ai/saas-backend-lib 1.1.8 → 1.1.9

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 (174) hide show
  1. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts +8 -0
  2. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  3. package/dist/esm/data-seeding/models/data-seed.shared.schemas.js +17 -0
  4. package/dist/esm/data-seeding/models/data-seed.shared.schemas.js.map +1 -1
  5. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  6. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js +9 -1
  7. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js.map +1 -1
  8. package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts +23 -0
  9. package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts.map +1 -0
  10. package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js +25 -0
  11. package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js.map +1 -0
  12. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts +6 -0
  13. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  14. package/dist/esm/databases/services/postgresql-migration-runner.backend.js +8 -1
  15. package/dist/esm/databases/services/postgresql-migration-runner.backend.js.map +1 -1
  16. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +0 -1
  17. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  18. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +4 -39
  19. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  20. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +15 -4
  21. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  22. package/dist/esm/flows-actors/services/agents.backend.service.js +21 -11
  23. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  24. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +47 -2
  25. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  26. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +56 -8
  27. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  28. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  29. package/dist/esm/queue/job-consumer.backend.service.js +21 -8
  30. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  31. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  32. package/dist/esm/queue/job-status-tracking.backend.service.js +4 -1
  33. package/dist/esm/queue/job-status-tracking.backend.service.js.map +1 -1
  34. package/dist/esm/queue/queue.backend.service.d.ts +14 -0
  35. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  36. package/dist/esm/queue/queue.backend.service.js +68 -12
  37. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  38. package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts +8 -0
  39. package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts.map +1 -1
  40. package/dist/esm/queue/scheduled-evidence-coverage.backend.js +20 -2
  41. package/dist/esm/queue/scheduled-evidence-coverage.backend.js.map +1 -1
  42. package/dist/esm/queue/scheduled-execution.backend.service.d.ts +44 -1
  43. package/dist/esm/queue/scheduled-execution.backend.service.d.ts.map +1 -1
  44. package/dist/esm/queue/scheduled-execution.backend.service.js +180 -10
  45. package/dist/esm/queue/scheduled-execution.backend.service.js.map +1 -1
  46. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts +73 -21
  47. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  48. package/dist/esm/queue/scheduled-message-verifier.backend.service.js +162 -88
  49. package/dist/esm/queue/scheduled-message-verifier.backend.service.js.map +1 -1
  50. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  51. package/dist/esm/runtime/services/start-application.backend.service.js +16 -1
  52. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  53. package/package.json +10 -10
  54. package/dist/esm/__tests__/fixture-deep-partial.d.ts +0 -18
  55. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +0 -1
  56. package/dist/esm/__tests__/fixture-deep-partial.js +0 -1
  57. package/dist/esm/__tests__/fixture-deep-partial.js.map +0 -1
  58. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts +0 -26
  59. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +0 -1
  60. package/dist/esm/__tests__/integration/redis-integration-gate.js +0 -105
  61. package/dist/esm/__tests__/integration/redis-integration-gate.js.map +0 -1
  62. package/dist/esm/__tests__/setup.d.ts +0 -7
  63. package/dist/esm/__tests__/setup.d.ts.map +0 -1
  64. package/dist/esm/__tests__/setup.js +0 -14
  65. package/dist/esm/__tests__/setup.js.map +0 -1
  66. package/dist/esm/__tests__/test-container.d.ts +0 -41
  67. package/dist/esm/__tests__/test-container.d.ts.map +0 -1
  68. package/dist/esm/__tests__/test-container.js +0 -98
  69. package/dist/esm/__tests__/test-container.js.map +0 -1
  70. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +0 -47
  71. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +0 -1
  72. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js +0 -82
  73. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js.map +0 -1
  74. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts +0 -57
  75. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +0 -1
  76. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js +0 -172
  77. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js.map +0 -1
  78. package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts +0 -41
  79. package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts.map +0 -1
  80. package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js +0 -54
  81. package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js.map +0 -1
  82. package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts +0 -20
  83. package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts.map +0 -1
  84. package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js +0 -33
  85. package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js.map +0 -1
  86. package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts +0 -22
  87. package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts.map +0 -1
  88. package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js +0 -92
  89. package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js.map +0 -1
  90. package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts +0 -15
  91. package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts.map +0 -1
  92. package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js +0 -61
  93. package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js.map +0 -1
  94. package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts +0 -21
  95. package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts.map +0 -1
  96. package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js +0 -32
  97. package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js.map +0 -1
  98. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +0 -52
  99. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +0 -1
  100. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +0 -74
  101. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +0 -1
  102. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts +0 -60
  103. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +0 -1
  104. package/dist/esm/config/services/__tests__/mock-app-configuration.service.js +0 -156
  105. package/dist/esm/config/services/__tests__/mock-app-configuration.service.js.map +0 -1
  106. package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts +0 -31
  107. package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts.map +0 -1
  108. package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js +0 -47
  109. package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js.map +0 -1
  110. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts +0 -20
  111. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +0 -1
  112. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js +0 -424
  113. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js.map +0 -1
  114. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts +0 -19
  115. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +0 -1
  116. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js +0 -49
  117. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js.map +0 -1
  118. package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts +0 -43
  119. package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts.map +0 -1
  120. package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js +0 -61
  121. package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js.map +0 -1
  122. package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts +0 -25
  123. package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts.map +0 -1
  124. package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js +0 -92
  125. package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js.map +0 -1
  126. package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts +0 -7
  127. package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +0 -1
  128. package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js +0 -194
  129. package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js.map +0 -1
  130. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts +0 -34
  131. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +0 -1
  132. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js +0 -59
  133. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js.map +0 -1
  134. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts +0 -48
  135. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +0 -1
  136. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js +0 -53
  137. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js.map +0 -1
  138. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts +0 -3
  139. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts.map +0 -1
  140. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js +0 -19
  141. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js.map +0 -1
  142. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts +0 -51
  143. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts.map +0 -1
  144. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js +0 -24
  145. package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js.map +0 -1
  146. package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts +0 -8
  147. package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts.map +0 -1
  148. package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js +0 -9
  149. package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js.map +0 -1
  150. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts +0 -10
  151. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +0 -1
  152. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js +0 -18
  153. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js.map +0 -1
  154. package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts +0 -11
  155. package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts.map +0 -1
  156. package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js +0 -34
  157. package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js.map +0 -1
  158. package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts +0 -105
  159. package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts.map +0 -1
  160. package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js +0 -140
  161. package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js.map +0 -1
  162. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts +0 -35
  163. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +0 -1
  164. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js +0 -46
  165. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js.map +0 -1
  166. package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts +0 -2
  167. package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts.map +0 -1
  168. package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js +0 -18
  169. package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js.map +0 -1
  170. package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts +0 -20
  171. package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts.map +0 -1
  172. package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js +0 -56
  173. package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js.map +0 -1
  174. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildo-ai/saas-backend-lib",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Complete Express + Inversify backend SaaS infrastructure",
6
6
  "author": "Wildo AI",
@@ -116,14 +116,14 @@
116
116
  "@react-pdf/renderer": "^4.5.1",
117
117
  "@simplewebauthn/server": "^13.2.2",
118
118
  "@socket.io/redis-adapter": "^8.3.0",
119
- "@wildo-ai/external-connectors-models": "1.1.8",
120
- "@wildo-ai/external-connectors-private": "1.1.8",
121
- "@wildo-ai/external-connectors-public": "1.1.8",
122
- "@wildo-ai/platform-config-lib": "1.1.8",
123
- "@wildo-ai/platform-core-shared": "1.1.8",
124
- "@wildo-ai/presets-components-models": "1.1.8",
125
- "@wildo-ai/saas-models": "1.1.8",
126
- "@wildo-ai/zod-decorators": "1.1.8",
119
+ "@wildo-ai/external-connectors-models": "1.1.9",
120
+ "@wildo-ai/external-connectors-private": "1.1.9",
121
+ "@wildo-ai/external-connectors-public": "1.1.9",
122
+ "@wildo-ai/platform-config-lib": "1.1.9",
123
+ "@wildo-ai/platform-core-shared": "1.1.9",
124
+ "@wildo-ai/presets-components-models": "1.1.9",
125
+ "@wildo-ai/saas-models": "1.1.9",
126
+ "@wildo-ai/zod-decorators": "1.1.9",
127
127
  "@xmldom/xmldom": "^0.8.11",
128
128
  "ai": "7.0.29",
129
129
  "amqplib": "^0.10.9",
@@ -165,7 +165,7 @@
165
165
  "uuid": "^11.1.0"
166
166
  },
167
167
  "devDependencies": {
168
- "@wildo-ai/systems-of-record": "1.1.8",
168
+ "@wildo-ai/systems-of-record": "1.1.9",
169
169
  "@types/amqplib": "^0.10.8",
170
170
  "@types/cookie-parser": "1.4.10",
171
171
  "@types/cors": "^2.8.17",
@@ -1,18 +0,0 @@
1
- /**
2
- * `DeepPartial` for test fixtures that stand in for a large engine contract.
3
- *
4
- * A fixture usually authors only the slices the code under test reads, so a direct annotation is
5
- * rejected for the fields it legitimately omits — and the reflex fix, `as unknown as TContract`,
6
- * accepts ANY object, including one whose field names have drifted away from the contract it
7
- * claims to represent. Writing `{ … } satisfies DeepPartial<TContract> as unknown as TContract`
8
- * keeps the middle ground: omissions are allowed, and a renamed, misspelled or retyped field is
9
- * still a compile error.
10
- *
11
- * Arrays are mapped element-wise, `Date` is preserved, and a PRIMITIVE is returned before the object
12
- * test (#864): a zod brand is `string & $brand<'X'>`, whose `$brand` half is an object type, so a
13
- * deep-partial that tests for an object first descends into the brand and maps a string as `{}`.
14
- */
15
- export type DeepPartial<TValue> = TValue extends string | number | boolean | bigint | symbol | null | undefined ? TValue : TValue extends ReadonlyArray<infer TItem> ? ReadonlyArray<DeepPartial<TItem>> : TValue extends Date ? TValue : TValue extends object ? {
16
- [TKey in keyof TValue]?: DeepPartial<TValue[TKey]>;
17
- } : TValue;
18
- //# sourceMappingURL=fixture-deep-partial.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture-deep-partial.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixture-deep-partial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAC3G,MAAM,GACN,MAAM,SAAS,aAAa,CAAC,MAAM,KAAK,CAAC,GACzC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GACjC,MAAM,SAAS,IAAI,GACjB,MAAM,GACN,MAAM,SAAS,MAAM,GACnB;KAAG,IAAI,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAAE,GACtD,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=fixture-deep-partial.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture-deep-partial.js","sourceRoot":"","sources":["../../../../src/__tests__/fixture-deep-partial.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * `DeepPartial` for test fixtures that stand in for a large engine contract.\n *\n * A fixture usually authors only the slices the code under test reads, so a direct annotation is\n * rejected for the fields it legitimately omits — and the reflex fix, `as unknown as TContract`,\n * accepts ANY object, including one whose field names have drifted away from the contract it\n * claims to represent. Writing `{ … } satisfies DeepPartial<TContract> as unknown as TContract`\n * keeps the middle ground: omissions are allowed, and a renamed, misspelled or retyped field is\n * still a compile error.\n *\n * Arrays are mapped element-wise, `Date` is preserved, and a PRIMITIVE is returned before the object\n * test (#864): a zod brand is `string & $brand<'X'>`, whose `$brand` half is an object type, so a\n * deep-partial that tests for an object first descends into the brand and maps a string as `{}`.\n */\nexport type DeepPartial<TValue> = TValue extends string | number | boolean | bigint | symbol | null | undefined\n ? TValue\n : TValue extends ReadonlyArray<infer TItem>\n ? ReadonlyArray<DeepPartial<TItem>>\n : TValue extends Date\n ? TValue\n : TValue extends object\n ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> }\n : TValue;\n"]}
@@ -1,26 +0,0 @@
1
- import { RedisService } from '../../databases/services/redis.service';
2
- /**
3
- * The one member of vitest's test context this gate needs. Declared structurally rather than imported
4
- * from vitest so the gate does not pin a runner version for a single method.
5
- */
6
- export interface RedisSkippableTestContext {
7
- readonly skip: () => void;
8
- }
9
- export interface RedisIntegrationGate {
10
- /** Boot a real Redis. Call from `beforeAll`. Never throws — an unavailable Redis is recorded, not raised. */
11
- start(): Promise<void>;
12
- /** Best-effort teardown. Call from `afterAll`. */
13
- stop(): Promise<void>;
14
- /**
15
- * The connected service, or an aborted (skipped) test when Redis is unavailable.
16
- * Call this FIRST in every test body — the returned service is the only handle to Redis.
17
- */
18
- serviceOrSkip(ctx: RedisSkippableTestContext): RedisService;
19
- /** Empty when Redis is available; otherwise the operator-facing reason the suite skipped. */
20
- readonly skipReason: string;
21
- }
22
- /**
23
- * @param suiteLabel identifies the suite in the `[SKIP]` banner — use the test file's own base name.
24
- */
25
- export declare function createRedisIntegrationGate(suiteLabel: string): RedisIntegrationGate;
26
- //# sourceMappingURL=redis-integration-gate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redis-integration-gate.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/integration/redis-integration-gate.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAInF;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,6GAA6G;IAC7G,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,kDAAkD;IAClD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,yBAAyB,GAAG,YAAY,CAAC;IAC5D,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CA0DnF"}
@@ -1,105 +0,0 @@
1
- /**
2
- * The single gate every `*.redis.integration.test.ts` suite passes through to reach a real Redis.
3
- *
4
- * ## Why this exists rather than a guard repeated per suite
5
- *
6
- * Four suites needed "run against a real Redis, or skip cleanly when there is none". Each was written
7
- * separately, and the four copies drifted into TWO different mechanisms, BOTH of which were wrong — in
8
- * opposite directions, which is why neither was noticed:
9
- *
10
- * | mechanism | suites | what a missing redis actually reported |
11
- * |---|---|---|
12
- * | `it.skipIf(!!skipReason)(…)` | 1 | **FAILED** — `TypeError: Cannot read properties of undefined` |
13
- * | `if (skipReason) return;` inside the body | 3 | **PASSED** — having executed no assertion at all |
14
- *
15
- * The first looks the most correct and is the one that broke. `it.skipIf` takes its condition EAGERLY,
16
- * at collection time — before any `beforeAll` has run. `skipReason` is assigned inside `beforeAll`, so at
17
- * collection it is still `''`, `skipIf(false)` declines to skip, and the test then runs against an
18
- * undefined service. The suite printed a `[SKIP]` banner and failed two tests directly underneath it.
19
- *
20
- * The second is worse in a quieter way. An early `return` inside `it()` does not skip a test, it PASSES
21
- * it. Eleven tests across three suites reported green while asserting nothing — a suite that claims
22
- * coverage it never ran is harder to catch than one that fails, because nothing ever draws the eye.
23
- *
24
- * ## The mechanism
25
- *
26
- * `ctx.skip()` is the only vitest primitive evaluated at RUN time. It sets `test.pending` and throws
27
- * `PendingError`, so execution genuinely aborts and the reporter says `skipped` (verified against
28
- * `@vitest/runner@1.6.1` `createTestContext`). It therefore handles both reasons a suite cannot run —
29
- * no `redis-server` binary, and a `RedisMemoryServer.create()` that fails for any other reason — which a
30
- * collection-time condition cannot see at all.
31
- *
32
- * ## Why the service is returned BY the guard
33
- *
34
- * `serviceOrSkip(ctx)` is the only way to obtain the `RedisService`. A suite cannot reach the service
35
- * without passing the check, so the invariant is unbypassable rather than re-applied per test. That is
36
- * deliberate: re-applying it four times is exactly what produced the two divergent guards above.
37
- */
38
- import { execSync } from 'node:child_process';
39
- import { RedisMemoryServer } from 'redis-memory-server';
40
- import { RedisService } from '../../databases/services/redis.service.js';
41
- import { MockLoggerService } from '../../monitoring/logger/services/__tests__/mock-logger.service.js';
42
- import { MockErrorBuilderService } from '../../errors/services/__tests__/mock-error-builder.service.js';
43
- /**
44
- * @param suiteLabel identifies the suite in the `[SKIP]` banner — use the test file's own base name.
45
- */
46
- export function createRedisIntegrationGate(suiteLabel) {
47
- let redis;
48
- let redisService;
49
- let skipReason = '';
50
- return {
51
- get skipReason() {
52
- return skipReason;
53
- },
54
- async start() {
55
- try {
56
- // Prefer an installed binary: `redis-memory-server` otherwise compiles Redis from source, which
57
- // needs GNU Make >= 4 + cmake + rust and takes minutes when it works at all.
58
- let systemBinary;
59
- try {
60
- systemBinary = execSync('which redis-server 2>/dev/null', { encoding: 'utf8' }).trim() || undefined;
61
- }
62
- catch {
63
- /* no binary on PATH — fall through to the packaged download/compile path */
64
- }
65
- redis = await RedisMemoryServer.create(systemBinary ? { binary: { systemBinary } } : undefined);
66
- const host = await redis.getHost();
67
- const port = await redis.getPort();
68
- const configService = {
69
- config: { database: { redis: { host, port, db: 0 } } },
70
- secrets: { database: { redis: {} } },
71
- };
72
- redisService = new RedisService(new MockLoggerService(), configService, new MockErrorBuilderService());
73
- await redisService.connect();
74
- }
75
- catch (e) {
76
- skipReason =
77
- 'real-Redis unavailable. EASIEST fix: install a redis-server binary (`brew install redis` / `apt install redis-server`) — ' +
78
- `these suites auto-detect it and skip the source compile. Cause: ${e instanceof Error ? e.message.slice(0, 140) : 'unknown'}`;
79
- // eslint-disable-next-line no-console
80
- console.warn(`[SKIP] ${suiteLabel} — ${skipReason}`);
81
- }
82
- },
83
- async stop() {
84
- try {
85
- await redisService?.disconnect();
86
- }
87
- catch {
88
- /* best-effort */
89
- }
90
- try {
91
- await redis?.stop();
92
- }
93
- catch {
94
- /* best-effort */
95
- }
96
- },
97
- serviceOrSkip(ctx) {
98
- if (skipReason || !redisService) {
99
- ctx.skip(); // throws PendingError — nothing below this line runs
100
- }
101
- return redisService;
102
- },
103
- };
104
- }
105
- //# sourceMappingURL=redis-integration-gate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redis-integration-gate.js","sourceRoot":"","sources":["../../../../../src/__tests__/integration/redis-integration-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6EAA6E,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yEAAyE,CAAC;AAwBlH;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAkB;IAC3D,IAAI,KAAoC,CAAC;IACzC,IAAI,YAAsC,CAAC;IAC3C,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,OAAO;QACL,IAAI,UAAU;YACZ,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,KAAK,CAAC,KAAK;YACT,IAAI,CAAC;gBACH,gGAAgG;gBAChG,6EAA6E;gBAC7E,IAAI,YAAgC,CAAC;gBACrC,IAAI,CAAC;oBACH,YAAY,GAAG,QAAQ,CAAC,gCAAgC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;gBACtG,CAAC;gBAAC,MAAM,CAAC;oBACP,4EAA4E;gBAC9E,CAAC;gBACD,KAAK,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;gBAChG,MAAM,IAAI,GAAG,MAAM,KAAK,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tC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The single gate every `*.redis.integration.test.ts` suite passes through to reach a real Redis.\n *\n * ## Why this exists rather than a guard repeated per suite\n *\n * Four suites needed \"run against a real Redis, or skip cleanly when there is none\". Each was written\n * separately, and the four copies drifted into TWO different mechanisms, BOTH of which were wrong — in\n * opposite directions, which is why neither was noticed:\n *\n * | mechanism | suites | what a missing redis actually reported |\n * |---|---|---|\n * | `it.skipIf(!!skipReason)(…)` | 1 | **FAILED** — `TypeError: Cannot read properties of undefined` |\n * | `if (skipReason) return;` inside the body | 3 | **PASSED** — having executed no assertion at all |\n *\n * The first looks the most correct and is the one that broke. `it.skipIf` takes its condition EAGERLY,\n * at collection time — before any `beforeAll` has run. `skipReason` is assigned inside `beforeAll`, so at\n * collection it is still `''`, `skipIf(false)` declines to skip, and the test then runs against an\n * undefined service. The suite printed a `[SKIP]` banner and failed two tests directly underneath it.\n *\n * The second is worse in a quieter way. An early `return` inside `it()` does not skip a test, it PASSES\n * it. Eleven tests across three suites reported green while asserting nothing — a suite that claims\n * coverage it never ran is harder to catch than one that fails, because nothing ever draws the eye.\n *\n * ## The mechanism\n *\n * `ctx.skip()` is the only vitest primitive evaluated at RUN time. It sets `test.pending` and throws\n * `PendingError`, so execution genuinely aborts and the reporter says `skipped` (verified against\n * `@vitest/runner@1.6.1` `createTestContext`). It therefore handles both reasons a suite cannot run —\n * no `redis-server` binary, and a `RedisMemoryServer.create()` that fails for any other reason — which a\n * collection-time condition cannot see at all.\n *\n * ## Why the service is returned BY the guard\n *\n * `serviceOrSkip(ctx)` is the only way to obtain the `RedisService`. A suite cannot reach the service\n * without passing the check, so the invariant is unbypassable rather than re-applied per test. That is\n * deliberate: re-applying it four times is exactly what produced the two divergent guards above.\n */\nimport { execSync } from 'node:child_process';\nimport { RedisMemoryServer } from 'redis-memory-server';\nimport { RedisService } from '~wildo-backend-lib/databases/services/redis.service';\nimport { MockLoggerService } from '~wildo-backend-lib/monitoring/logger/services/__tests__/mock-logger.service';\nimport { MockErrorBuilderService } from '~wildo-backend-lib/errors/services/__tests__/mock-error-builder.service';\n\n/**\n * The one member of vitest's test context this gate needs. Declared structurally rather than imported\n * from vitest so the gate does not pin a runner version for a single method.\n */\nexport interface RedisSkippableTestContext {\n readonly skip: () => void;\n}\n\nexport interface RedisIntegrationGate {\n /** Boot a real Redis. Call from `beforeAll`. Never throws — an unavailable Redis is recorded, not raised. */\n start(): Promise<void>;\n /** Best-effort teardown. Call from `afterAll`. */\n stop(): Promise<void>;\n /**\n * The connected service, or an aborted (skipped) test when Redis is unavailable.\n * Call this FIRST in every test body — the returned service is the only handle to Redis.\n */\n serviceOrSkip(ctx: RedisSkippableTestContext): RedisService;\n /** Empty when Redis is available; otherwise the operator-facing reason the suite skipped. */\n readonly skipReason: string;\n}\n\n/**\n * @param suiteLabel identifies the suite in the `[SKIP]` banner — use the test file's own base name.\n */\nexport function createRedisIntegrationGate(suiteLabel: string): RedisIntegrationGate {\n let redis: RedisMemoryServer | undefined;\n let redisService: RedisService | undefined;\n let skipReason = '';\n\n return {\n get skipReason(): string {\n return skipReason;\n },\n\n async start(): Promise<void> {\n try {\n // Prefer an installed binary: `redis-memory-server` otherwise compiles Redis from source, which\n // needs GNU Make >= 4 + cmake + rust and takes minutes when it works at all.\n let systemBinary: string | undefined;\n try {\n systemBinary = execSync('which redis-server 2>/dev/null', { encoding: 'utf8' }).trim() || undefined;\n } catch {\n /* no binary on PATH — fall through to the packaged download/compile path */\n }\n redis = await RedisMemoryServer.create(systemBinary ? { binary: { systemBinary } } : undefined);\n const host = await redis.getHost();\n const port = await redis.getPort();\n const configService = {\n config: { database: { redis: { host, port, db: 0 } } },\n secrets: { database: { redis: {} } },\n } as any;\n redisService = new RedisService(new MockLoggerService() as any, configService, new MockErrorBuilderService() as any);\n await redisService.connect();\n } catch (e) {\n skipReason =\n 'real-Redis unavailable. EASIEST fix: install a redis-server binary (`brew install redis` / `apt install redis-server`) — ' +\n `these suites auto-detect it and skip the source compile. Cause: ${e instanceof Error ? e.message.slice(0, 140) : 'unknown'}`;\n // eslint-disable-next-line no-console\n console.warn(`[SKIP] ${suiteLabel} — ${skipReason}`);\n }\n },\n\n async stop(): Promise<void> {\n try {\n await redisService?.disconnect();\n } catch {\n /* best-effort */\n }\n try {\n await redis?.stop();\n } catch {\n /* best-effort */\n }\n },\n\n serviceOrSkip(ctx: RedisSkippableTestContext): RedisService {\n if (skipReason || !redisService) {\n ctx.skip(); // throws PendingError — nothing below this line runs\n }\n return redisService as RedisService;\n },\n };\n}\n"]}
@@ -1,7 +0,0 @@
1
- /**
2
- * Vitest setup for saas-backend-lib integration tests.
3
- *
4
- * Initializes reflect-metadata for Inversify decorators and Zod decorators.
5
- */
6
- import 'reflect-metadata';
7
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,kBAAkB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Vitest setup for saas-backend-lib integration tests.
3
- *
4
- * Initializes reflect-metadata for Inversify decorators and Zod decorators.
5
- */
6
- import 'reflect-metadata';
7
- import { z } from 'zod';
8
- import { ensureZodDecoratorsLoaded } from '@wildo-ai/zod-decorators';
9
- import { beforeAll } from 'vitest';
10
- // Ensure Zod decorators are loaded before all tests
11
- beforeAll(() => {
12
- ensureZodDecoratorsLoaded(z);
13
- });
14
- //# sourceMappingURL=setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,oDAAoD;AACpD,SAAS,CAAC,GAAG,EAAE;IACb,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Vitest setup for saas-backend-lib integration tests.\n *\n * Initializes reflect-metadata for Inversify decorators and Zod decorators.\n */\n\nimport 'reflect-metadata';\nimport { z } from 'zod';\nimport { ensureZodDecoratorsLoaded } from '@wildo-ai/zod-decorators';\nimport { beforeAll } from 'vitest';\n\n// Ensure Zod decorators are loaded before all tests\nbeforeAll(() => {\n ensureZodDecoratorsLoaded(z);\n});\n"]}
@@ -1,41 +0,0 @@
1
- /**
2
- * Test Container for Backend Integration Tests
3
- *
4
- * Sets up an Inversify container with:
5
- * - Real backend services
6
- * - Mocked external dependencies (MongoDB, Redis, Config)
7
- * - Core resource definitions
8
- */
9
- import 'reflect-metadata';
10
- import { Container } from 'inversify';
11
- import { MockLoggerService } from '../monitoring/logger/services/__tests__/mock-logger.service';
12
- import { MockErrorBuilderService } from '../errors/services/__tests__/mock-error-builder.service';
13
- import { MockAppConfigurationService } from '../config/services/__tests__/mock-app-configuration.service';
14
- import { MockZodToMongooseSchemaConvertorBackendService } from '../databases/services/__tests__/mock-zod-mongoose-schema-convertor.service';
15
- import { MockResourceOperationHelperBackendService } from '../base-classes/services/__tests__/mock-resource-operation-helper.service';
16
- import { MockMongoDBService } from '../databases/services/__tests__/mock-mongodb.service';
17
- export interface TestContainerOptions {
18
- /** Enable debug logging in tests */
19
- debug?: boolean;
20
- }
21
- /**
22
- * Creates a test container with mocked external dependencies
23
- * and real backend services for integration testing.
24
- */
25
- export declare function createTestContainer(options?: TestContainerOptions): Container;
26
- /**
27
- * Gets the mock instances from the container for assertions
28
- */
29
- export declare function getMocks(container: Container): {
30
- logger: MockLoggerService;
31
- errorBuilder: MockErrorBuilderService;
32
- config: MockAppConfigurationService;
33
- zodConverter: MockZodToMongooseSchemaConvertorBackendService;
34
- operationHelper: MockResourceOperationHelperBackendService;
35
- mongoDBService: MockMongoDBService;
36
- };
37
- /**
38
- * Resets all mock call counts
39
- */
40
- export declare function resetMocks(container: Container): void;
41
- //# sourceMappingURL=test-container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-container.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/test-container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6EAA6E,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yEAAyE,CAAC;AAClH,OAAO,EAAE,2BAA2B,EAAE,MAAM,6EAA6E,CAAC;AAC1H,OAAO,EAAE,8CAA8C,EAAE,MAAM,4FAA4F,CAAC;AAC5J,OAAO,EAAE,yCAAyC,EAAE,MAAM,2FAA2F,CAAC;AACtJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,sEAAsE,CAAC;AAa1G,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,SAAS,CAoDjF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS;;;;;;;EAa5C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAOrD"}
@@ -1,98 +0,0 @@
1
- /**
2
- * Test Container for Backend Integration Tests
3
- *
4
- * Sets up an Inversify container with:
5
- * - Real backend services
6
- * - Mocked external dependencies (MongoDB, Redis, Config)
7
- * - Core resource definitions
8
- */
9
- import 'reflect-metadata';
10
- import { Container } from 'inversify';
11
- import { SAAS_SERVICE_TYPES } from '../inject/models/service-types.js';
12
- // Mock services (`mock-*.service.ts` — shared modules, not collected as Vitest suites)
13
- import { MockLoggerService } from '../monitoring/logger/services/__tests__/mock-logger.service.js';
14
- import { MockErrorBuilderService } from '../errors/services/__tests__/mock-error-builder.service.js';
15
- import { MockAppConfigurationService } from '../config/services/__tests__/mock-app-configuration.service.js';
16
- import { MockZodToMongooseSchemaConvertorBackendService } from '../databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js';
17
- import { MockResourceOperationHelperBackendService } from '../base-classes/services/__tests__/mock-resource-operation-helper.service.js';
18
- import { MockMongoDBService } from '../databases/services/__tests__/mock-mongodb.service.js';
19
- // Real backend services we want to test
20
- import { ResourcesRegistryBackendService } from '../resources/services/resources-registry.backend.service.js';
21
- import { RepositoriesRegistryHandlerBackendService } from '../base-classes/services/repositories/repositories-registry-handler.backend.service.js';
22
- import { ZodToSqlHybridSchemaPlannerBackendService } from '../databases/services/zod-to-sql-hybrid-schema.planner.js';
23
- import { PostgreSQLDatabaseBackendService } from '../databases/services/postgresql-database.backend.service.js';
24
- import { ResourceIdBackendService } from '../resources/services/resource-id.backend.service.js';
25
- /**
26
- * Creates a test container with mocked external dependencies
27
- * and real backend services for integration testing.
28
- */
29
- export function createTestContainer(options = {}) {
30
- const container = new Container({
31
- defaultScope: 'Singleton',
32
- });
33
- // Bind the container itself
34
- container.bind(SAAS_SERVICE_TYPES.Container).toConstantValue(container);
35
- container.bind('Container').toConstantValue(container);
36
- // Create mock instances
37
- const mockLogger = new MockLoggerService();
38
- const mockErrorBuilder = new MockErrorBuilderService();
39
- const mockConfig = new MockAppConfigurationService();
40
- const mockZodConverter = new MockZodToMongooseSchemaConvertorBackendService();
41
- const mockOperationHelper = new MockResourceOperationHelperBackendService();
42
- const mockMongoDBService = new MockMongoDBService();
43
- // Enable debug if requested
44
- if (options.debug) {
45
- mockLogger.setDebugTypeLogging('ResourcesRegistryBackendService', true);
46
- mockLogger.setDebugTypeLogging('RepositoriesRegistryHandler', true);
47
- }
48
- // Bind mock services
49
- container.bind(SAAS_SERVICE_TYPES.Logger).toConstantValue(mockLogger);
50
- container.bind(SAAS_SERVICE_TYPES.ErrorBuilderService).toConstantValue(mockErrorBuilder);
51
- container.bind(SAAS_SERVICE_TYPES.AppConfigService).toConstantValue(mockConfig);
52
- container.bind(SAAS_SERVICE_TYPES.ZodToMongooseSchemaConvertorService).toConstantValue(mockZodConverter);
53
- container.bind(SAAS_SERVICE_TYPES.ResourceOperationHelperService).toConstantValue(mockOperationHelper);
54
- container.bind(SAAS_SERVICE_TYPES.MongoDBService).toConstantValue(mockMongoDBService);
55
- // Dependencies of RepositoriesRegistryHandlerBackendService (production container binds these)
56
- container.bind(SAAS_SERVICE_TYPES.ZodToSqlHybridSchemaPlannerService)
57
- .to(ZodToSqlHybridSchemaPlannerBackendService)
58
- .inSingletonScope();
59
- container.bind(SAAS_SERVICE_TYPES.PostgreSQLDatabaseService)
60
- .to(PostgreSQLDatabaseBackendService)
61
- .inSingletonScope();
62
- container.bind(SAAS_SERVICE_TYPES.ResourceIdBackendService)
63
- .to(ResourceIdBackendService)
64
- .inSingletonScope();
65
- // Bind real services we want to test
66
- container.bind(SAAS_SERVICE_TYPES.ResourceRegistryService)
67
- .to(ResourcesRegistryBackendService)
68
- .inSingletonScope();
69
- container.bind(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService)
70
- .to(RepositoriesRegistryHandlerBackendService)
71
- .inSingletonScope();
72
- return container;
73
- }
74
- /**
75
- * Gets the mock instances from the container for assertions
76
- */
77
- export function getMocks(container) {
78
- return {
79
- logger: container.get(SAAS_SERVICE_TYPES.Logger),
80
- errorBuilder: container.get(SAAS_SERVICE_TYPES.ErrorBuilderService),
81
- config: container.get(SAAS_SERVICE_TYPES.AppConfigService),
82
- zodConverter: container.get(SAAS_SERVICE_TYPES.ZodToMongooseSchemaConvertorService),
83
- operationHelper: container.get(SAAS_SERVICE_TYPES.ResourceOperationHelperService),
84
- mongoDBService: container.get(SAAS_SERVICE_TYPES.MongoDBService),
85
- };
86
- }
87
- /**
88
- * Resets all mock call counts
89
- */
90
- export function resetMocks(container) {
91
- const mocks = getMocks(container);
92
- mocks.logger.reset();
93
- mocks.errorBuilder.reset();
94
- mocks.config.reset();
95
- mocks.zodConverter.reset();
96
- mocks.operationHelper.reset();
97
- }
98
- //# sourceMappingURL=test-container.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-container.js","sourceRoot":"","sources":["../../../../src/__tests__/test-container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,uFAAuF;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6EAA6E,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yEAAyE,CAAC;AAClH,OAAO,EAAE,2BAA2B,EAAE,MAAM,6EAA6E,CAAC;AAC1H,OAAO,EAAE,8CAA8C,EAAE,MAAM,4FAA4F,CAAC;AAC5J,OAAO,EAAE,yCAAyC,EAAE,MAAM,2FAA2F,CAAC;AACtJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,sEAAsE,CAAC;AAE1G,wCAAwC;AACxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAChK,OAAO,EAAE,yCAAyC,EAAE,MAAM,wEAAwE,CAAC;AACnI,OAAO,EAAE,gCAAgC,EAAE,MAAM,2EAA2E,CAAC;AAC7H,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAC;AAW7G;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAgC,EAAE;IACpE,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC9B,YAAY,EAAE,WAAW;KAC1B,CAAC,CAAC;IAEH,4BAA4B;IAC5B,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,e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,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC3B,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC3B,KAAK,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Test Container for Backend Integration Tests\n *\n * Sets up an Inversify container with:\n * - Real backend services\n * - Mocked external dependencies (MongoDB, Redis, Config)\n * - Core resource definitions\n */\n\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\n\n// Mock services (`mock-*.service.ts` — shared modules, not collected as Vitest suites)\nimport { MockLoggerService } from '~wildo-backend-lib/monitoring/logger/services/__tests__/mock-logger.service';\nimport { MockErrorBuilderService } from '~wildo-backend-lib/errors/services/__tests__/mock-error-builder.service';\nimport { MockAppConfigurationService } from '~wildo-backend-lib/config/services/__tests__/mock-app-configuration.service';\nimport { MockZodToMongooseSchemaConvertorBackendService } from '~wildo-backend-lib/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service';\nimport { MockResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/__tests__/mock-resource-operation-helper.service';\nimport { MockMongoDBService } from '~wildo-backend-lib/databases/services/__tests__/mock-mongodb.service';\n\n// Real backend services we want to test\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport { ZodToSqlHybridSchemaPlannerBackendService } from '~wildo-backend-lib/databases/services/zod-to-sql-hybrid-schema.planner';\nimport { PostgreSQLDatabaseBackendService } from '~wildo-backend-lib/databases/services/postgresql-database.backend.service';\nimport { ResourceIdBackendService } from '~wildo-backend-lib/resources/services/resource-id.backend.service';\n\n// =============================================================================\n// TEST CONTAINER FACTORY\n// =============================================================================\n\nexport interface TestContainerOptions {\n /** Enable debug logging in tests */\n debug?: boolean;\n}\n\n/**\n * Creates a test container with mocked external dependencies\n * and real backend services for integration testing.\n */\nexport function createTestContainer(options: TestContainerOptions = {}): Container {\n const container = new Container({\n defaultScope: 'Singleton',\n });\n\n // Bind the container itself\n container.bind(SAAS_SERVICE_TYPES.Container).toConstantValue(container);\n container.bind('Container').toConstantValue(container);\n\n // Create mock instances\n const mockLogger = new MockLoggerService();\n const mockErrorBuilder = new MockErrorBuilderService();\n const mockConfig = new MockAppConfigurationService();\n const mockZodConverter = new MockZodToMongooseSchemaConvertorBackendService();\n const mockOperationHelper = new MockResourceOperationHelperBackendService();\n const mockMongoDBService = new MockMongoDBService();\n\n // Enable debug if requested\n if (options.debug) {\n mockLogger.setDebugTypeLogging('ResourcesRegistryBackendService', true);\n mockLogger.setDebugTypeLogging('RepositoriesRegistryHandler', true);\n }\n\n // Bind mock services\n container.bind(SAAS_SERVICE_TYPES.Logger).toConstantValue(mockLogger);\n container.bind(SAAS_SERVICE_TYPES.ErrorBuilderService).toConstantValue(mockErrorBuilder);\n container.bind(SAAS_SERVICE_TYPES.AppConfigService).toConstantValue(mockConfig);\n container.bind(SAAS_SERVICE_TYPES.ZodToMongooseSchemaConvertorService).toConstantValue(mockZodConverter);\n container.bind(SAAS_SERVICE_TYPES.ResourceOperationHelperService).toConstantValue(mockOperationHelper);\n container.bind(SAAS_SERVICE_TYPES.MongoDBService).toConstantValue(mockMongoDBService);\n\n // Dependencies of RepositoriesRegistryHandlerBackendService (production container binds these)\n container.bind(SAAS_SERVICE_TYPES.ZodToSqlHybridSchemaPlannerService)\n .to(ZodToSqlHybridSchemaPlannerBackendService)\n .inSingletonScope();\n container.bind(SAAS_SERVICE_TYPES.PostgreSQLDatabaseService)\n .to(PostgreSQLDatabaseBackendService)\n .inSingletonScope();\n container.bind(SAAS_SERVICE_TYPES.ResourceIdBackendService)\n .to(ResourceIdBackendService)\n .inSingletonScope();\n\n // Bind real services we want to test\n container.bind(SAAS_SERVICE_TYPES.ResourceRegistryService)\n .to(ResourcesRegistryBackendService)\n .inSingletonScope();\n\n container.bind(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService)\n .to(RepositoriesRegistryHandlerBackendService)\n .inSingletonScope();\n\n return container;\n}\n\n/**\n * Gets the mock instances from the container for assertions\n */\nexport function getMocks(container: Container) {\n return {\n logger: container.get<MockLoggerService>(SAAS_SERVICE_TYPES.Logger),\n errorBuilder: container.get<MockErrorBuilderService>(SAAS_SERVICE_TYPES.ErrorBuilderService),\n config: container.get<MockAppConfigurationService>(SAAS_SERVICE_TYPES.AppConfigService),\n zodConverter: container.get<MockZodToMongooseSchemaConvertorBackendService>(\n SAAS_SERVICE_TYPES.ZodToMongooseSchemaConvertorService\n ),\n operationHelper: container.get<MockResourceOperationHelperBackendService>(\n SAAS_SERVICE_TYPES.ResourceOperationHelperService\n ),\n mongoDBService: container.get<MockMongoDBService>(SAAS_SERVICE_TYPES.MongoDBService),\n };\n}\n\n/**\n * Resets all mock call counts\n */\nexport function resetMocks(container: Container): void {\n const mocks = getMocks(container);\n mocks.logger.reset();\n mocks.errorBuilder.reset();\n mocks.config.reset();\n mocks.zodConverter.reset();\n mocks.operationHelper.reset();\n}\n"]}
@@ -1,47 +0,0 @@
1
- /**
2
- * Vitest-oriented mock resource operation helper for integration tests (`vi.fn` on methods).
3
- *
4
- * **Naming**: `mock-*.service.ts` — canonical mock module, not a test suite.
5
- * Plain `.ts` keeps it barrel-compilable, and Vitest also excludes these files
6
- * explicitly as a defensive guard.
7
- */
8
- import 'reflect-metadata';
9
- export declare class MockResourceOperationHelperBackendService {
10
- /** Inferred mock — `vi.fn<...>` type param is the **args tuple**, not the full function signature. */
11
- validateData: import("vitest").Mock<any, any>;
12
- transformData: import("vitest").Mock<any, any>;
13
- cleanInputData: import("vitest").Mock<any, any>;
14
- cleanInputDataArray: import("vitest").Mock<any, any>;
15
- enrichDataWithContext: import("vitest").Mock<any, any>;
16
- injectNonDiscriminatorLiteralValues: import("vitest").Mock<any, any>;
17
- extractIdsFromExecutionContext: import("vitest").Mock<any, any>;
18
- getInitiatorId: import("vitest").Mock<[context: {
19
- initiatorIds?: {
20
- organizationId?: string;
21
- organization?: string;
22
- applicationId?: string;
23
- userId?: string;
24
- user?: string;
25
- } | null;
26
- organizationId?: string;
27
- applicationId?: string;
28
- }, type: "user" | "application" | "organization"], string>;
29
- findNestedFieldPathsFromZodSchema: import("vitest").Mock<[zodSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, fieldIdentifier: string], string[]>;
30
- findRequiredNestedFieldPathsFromZodSchema: import("vitest").Mock<[zodSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, fieldIdentifier: string, executionContext: import("../../..").ExecutionContext<any>, details: {
31
- reason: "context_enrichment" | "context_filter" | "fk_filter";
32
- message: string;
33
- resourceIdentifier?: string;
34
- }], string[]>;
35
- hasNestedPath: import("vitest").Mock<[obj: any, path: string], boolean>;
36
- setNestedValue: import("vitest").Mock<[obj: any, path: string, value: any], void>;
37
- resolveQueryableFilterPath: import("vitest").Mock<[mainSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, fieldPath: string], string>;
38
- /**
39
- * Delegated for the same reason as its siblings, and load-bearing at CONSTRUCTION time: the
40
- * PostgreSQL repository resolves the surrogate primary key in its constructor, so a stub that
41
- * omits this method does not fail the test that needs it — it fails EVERY suite that builds a
42
- * PostgreSQL repository at all, with `getSurrogatePrimaryKeyFieldName is not a function`.
43
- */
44
- getSurrogatePrimaryKeyFieldName: import("vitest").Mock<[mainSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>], string>;
45
- reset(): void;
46
- }
47
- //# sourceMappingURL=mock-resource-operation-helper.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-resource-operation-helper.service.d.ts","sourceRoot":"","sources":["../../../../../../src/base-classes/services/__tests__/mock-resource-operation-helper.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,kBAAkB,CAAC;AAyB1B,qBACa,yCAAyC;IACpD,sGAAsG;IACtG,YAAY,kCAA4D;IACxE,aAAa,kCAAmD;IAChE,cAAc,kCAAmD;IACjE,mBAAmB,kCAAqD;IACxE,qBAAqB,kCAAmD;IACxE,mCAAmC,kCAAmD;IACtF,8BAA8B,kCAA+C;IAC7E,cAAc;uBAGO;YACb,cAAc,CAAC,EAAE,MAAM,CAAC;YACxB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,GAAG,IAAI;yBACS,MAAM;wBACP,MAAM;+DAgB1B;IAIF,iCAAiC,4KAEoC;IACrE,yCAAyC;;;;kBAEoC;IAC7E,aAAa,2DAEoC;IACjD,cAAc,oEAEoC;IAClD,0BAA0B,qKAEoC;IAC9D;;;;;OAKG;IACH,+BAA+B,kJAEoC;IAEnE,KAAK;CAWN"}
@@ -1,82 +0,0 @@
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
- /**
8
- * Vitest-oriented mock resource operation helper for integration tests (`vi.fn` on methods).
9
- *
10
- * **Naming**: `mock-*.service.ts` — canonical mock module, not a test suite.
11
- * Plain `.ts` keeps it barrel-compilable, and Vitest also excludes these files
12
- * explicitly as a defensive guard.
13
- */
14
- import 'reflect-metadata';
15
- import { injectable } from 'inversify';
16
- import { vi } from 'vitest';
17
- import { ResourceOperationHelperBackendService } from '../../../base-classes/services/resource-operations-helper.backend.service.js';
18
- import { MockLoggerService } from '../../../monitoring/logger/services/__tests__/mock-logger.service.js';
19
- import { MockPayloadAssigningErrorBuilderService } from '../../../errors/services/__tests__/mock-error-builder.service.js';
20
- /**
21
- * Schema navigation is delegated to the REAL helper, not stubbed.
22
- *
23
- * These are pure functions over a Zod schema — there is no meaningful "mock" of them, and a stub
24
- * returning `[]` would silently disable whatever rule asked. They were previously left undefined
25
- * so that tests exercising `buildContextualFilter` had to opt in via `Object.assign`. That premise
26
- * held while only some paths needed them; the initiator-organization confinement (D3) made the
27
- * lookup unconditional, and the opt-in immediately produced nine failures across five integration
28
- * suites — every one a missing collaborator, none a real defect. Opting in per suite was the
29
- * fragile half of the arrangement, so the real implementation lives here instead.
30
- */
31
- const realSchemaNavigation = new ResourceOperationHelperBackendService(new MockLoggerService(), new MockPayloadAssigningErrorBuilderService(), undefined);
32
- let MockResourceOperationHelperBackendService = class MockResourceOperationHelperBackendService {
33
- /** Inferred mock — `vi.fn<...>` type param is the **args tuple**, not the full function signature. */
34
- validateData = vi.fn().mockResolvedValue({ isValid: true, errors: [] });
35
- transformData = vi.fn().mockImplementation((data) => data);
36
- cleanInputData = vi.fn().mockImplementation((data) => data);
37
- cleanInputDataArray = vi.fn().mockImplementation((data) => data);
38
- enrichDataWithContext = vi.fn().mockImplementation((data) => data);
39
- injectNonDiscriminatorLiteralValues = vi.fn().mockImplementation((data) => data);
40
- extractIdsFromExecutionContext = vi.fn().mockImplementation(() => undefined);
41
- getInitiatorId = vi.fn((context, type) => {
42
- if (type === 'organization') {
43
- return context.initiatorIds?.organizationId
44
- ?? context.initiatorIds?.organization
45
- ?? context.organizationId;
46
- }
47
- if (type === 'application') {
48
- return context.initiatorIds?.applicationId ?? context.applicationId;
49
- }
50
- return context.initiatorIds?.userId ?? context.initiatorIds?.user;
51
- });
52
- // Schema navigation — REAL implementations (see the note above the delegate). A suite may
53
- // still override any of these with `Object.assign` when it needs to force a specific path.
54
- findNestedFieldPathsFromZodSchema = vi.fn((...args) => realSchemaNavigation.findNestedFieldPathsFromZodSchema(...args));
55
- findRequiredNestedFieldPathsFromZodSchema = vi.fn((...args) => realSchemaNavigation.findRequiredNestedFieldPathsFromZodSchema(...args));
56
- hasNestedPath = vi.fn((...args) => realSchemaNavigation.hasNestedPath(...args));
57
- setNestedValue = vi.fn((...args) => realSchemaNavigation.setNestedValue(...args));
58
- resolveQueryableFilterPath = vi.fn((...args) => realSchemaNavigation.resolveQueryableFilterPath(...args));
59
- /**
60
- * Delegated for the same reason as its siblings, and load-bearing at CONSTRUCTION time: the
61
- * PostgreSQL repository resolves the surrogate primary key in its constructor, so a stub that
62
- * omits this method does not fail the test that needs it — it fails EVERY suite that builds a
63
- * PostgreSQL repository at all, with `getSurrogatePrimaryKeyFieldName is not a function`.
64
- */
65
- getSurrogatePrimaryKeyFieldName = vi.fn((...args) => realSchemaNavigation.getSurrogatePrimaryKeyFieldName(...args));
66
- reset() {
67
- this.validateData.mockClear();
68
- this.transformData.mockClear();
69
- this.cleanInputData.mockClear();
70
- this.cleanInputDataArray.mockClear();
71
- this.enrichDataWithContext.mockClear();
72
- this.getSurrogatePrimaryKeyFieldName.mockClear();
73
- this.injectNonDiscriminatorLiteralValues.mockClear();
74
- this.extractIdsFromExecutionContext.mockClear();
75
- this.getInitiatorId.mockClear();
76
- }
77
- };
78
- MockResourceOperationHelperBackendService = __decorate([
79
- injectable()
80
- ], MockResourceOperationHelperBackendService);
81
- export { MockResourceOperationHelperBackendService };
82
- //# sourceMappingURL=mock-resource-operation-helper.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-resource-operation-helper.service.js","sourceRoot":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EAAE,CAChC,CAAC,GAAG,IAAqF,EAAE,EAAE,CAC3F,oBAAoB,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC9D;;;;;OAKG;IACH,+BAA+B,GAAG,EAAE,CAAC,EAAE,CACrC,CAAC,GAAG,IAA0F,EAAE,EAAE,CAChG,oBAAoB,CAAC,+BAA+B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAEnE,KAAK;QACH,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC,+BAA+B,CAAC,SAAS,EAAE,CAAC;QACjD,IAAI,CAAC,mCAAmC,CAAC,SAAS,EAAE,CAAC;QACrD,IAAI,CAAC,8BAA8B,CAAC,SAAS,EAAE,CAAC;QAChD,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;CACF,CAAA;AA5EY,yCAAyC;IADrD,UAAU,EAAE;GACA,yCAAyC,CA4ErD","sourcesContent":["/**\n * Vitest-oriented mock resource operation helper for integration tests (`vi.fn` on methods).\n *\n * **Naming**: `mock-*.service.ts` — canonical mock module, not a test suite.\n * Plain `.ts` keeps it barrel-compilable, and Vitest also excludes these files\n * explicitly as a defensive guard.\n */\nimport 'reflect-metadata';\nimport { injectable } from 'inversify';\nimport { vi } from 'vitest';\n\nimport { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport { MockLoggerService } from '~wildo-backend-lib/monitoring/logger/services/__tests__/mock-logger.service';\nimport { MockPayloadAssigningErrorBuilderService } from '~wildo-backend-lib/errors/services/__tests__/mock-error-builder.service';\n\n/**\n * Schema navigation is delegated to the REAL helper, not stubbed.\n *\n * These are pure functions over a Zod schema — there is no meaningful \"mock\" of them, and a stub\n * returning `[]` would silently disable whatever rule asked. They were previously left undefined\n * so that tests exercising `buildContextualFilter` had to opt in via `Object.assign`. That premise\n * held while only some paths needed them; the initiator-organization confinement (D3) made the\n * lookup unconditional, and the opt-in immediately produced nine failures across five integration\n * suites — every one a missing collaborator, none a real defect. Opting in per suite was the\n * fragile half of the arrangement, so the real implementation lives here instead.\n */\nconst realSchemaNavigation = new ResourceOperationHelperBackendService(\n new MockLoggerService() as never,\n new MockPayloadAssigningErrorBuilderService() as never,\n undefined as never,\n);\n\n@injectable()\nexport class MockResourceOperationHelperBackendService {\n /** Inferred mock — `vi.fn<...>` type param is the **args tuple**, not the full function signature. */\n validateData = vi.fn().mockResolvedValue({ isValid: true, errors: [] });\n transformData = vi.fn().mockImplementation((data: any) => data);\n cleanInputData = vi.fn().mockImplementation((data: any) => data);\n cleanInputDataArray = vi.fn().mockImplementation((data: any[]) => data);\n enrichDataWithContext = vi.fn().mockImplementation((data: any) => data);\n injectNonDiscriminatorLiteralValues = vi.fn().mockImplementation((data: any) => data);\n extractIdsFromExecutionContext = vi.fn().mockImplementation(() => undefined);\n getInitiatorId = vi.fn(\n (\n context: {\n initiatorIds?: {\n organizationId?: string;\n organization?: string;\n applicationId?: string;\n userId?: string;\n user?: string;\n } | null;\n organizationId?: string;\n applicationId?: string;\n },\n type: 'organization' | 'user' | 'application'\n ): string | undefined => {\n if (type === 'organization') {\n return context.initiatorIds?.organizationId\n ?? context.initiatorIds?.organization\n ?? context.organizationId;\n }\n\n if (type === 'application') {\n return context.initiatorIds?.applicationId ?? context.applicationId;\n }\n\n return context.initiatorIds?.userId ?? context.initiatorIds?.user;\n }\n );\n\n // Schema navigation — REAL implementations (see the note above the delegate). A suite may\n // still override any of these with `Object.assign` when it needs to force a specific path.\n findNestedFieldPathsFromZodSchema = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['findNestedFieldPathsFromZodSchema']>) =>\n realSchemaNavigation.findNestedFieldPathsFromZodSchema(...args));\n findRequiredNestedFieldPathsFromZodSchema = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['findRequiredNestedFieldPathsFromZodSchema']>) =>\n realSchemaNavigation.findRequiredNestedFieldPathsFromZodSchema(...args));\n hasNestedPath = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['hasNestedPath']>) =>\n realSchemaNavigation.hasNestedPath(...args));\n setNestedValue = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['setNestedValue']>) =>\n realSchemaNavigation.setNestedValue(...args));\n resolveQueryableFilterPath = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['resolveQueryableFilterPath']>) =>\n realSchemaNavigation.resolveQueryableFilterPath(...args));\n /**\n * Delegated for the same reason as its siblings, and load-bearing at CONSTRUCTION time: the\n * PostgreSQL repository resolves the surrogate primary key in its constructor, so a stub that\n * omits this method does not fail the test that needs it — it fails EVERY suite that builds a\n * PostgreSQL repository at all, with `getSurrogatePrimaryKeyFieldName is not a function`.\n */\n getSurrogatePrimaryKeyFieldName = vi.fn(\n (...args: Parameters<ResourceOperationHelperBackendService['getSurrogatePrimaryKeyFieldName']>) =>\n realSchemaNavigation.getSurrogatePrimaryKeyFieldName(...args));\n\n reset() {\n this.validateData.mockClear();\n this.transformData.mockClear();\n this.cleanInputData.mockClear();\n this.cleanInputDataArray.mockClear();\n this.enrichDataWithContext.mockClear();\n this.getSurrogatePrimaryKeyFieldName.mockClear();\n this.injectNonDiscriminatorLiteralValues.mockClear();\n this.extractIdsFromExecutionContext.mockClear();\n this.getInitiatorId.mockClear();\n }\n}\n"]}