@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.
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts +8 -0
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.js +17 -0
- package/dist/esm/data-seeding/models/data-seed.shared.schemas.js.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js +9 -1
- package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.js.map +1 -1
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts +23 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.d.ts.map +1 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js +25 -0
- package/dist/esm/data-seeding/services/data-seed-environment-admission.backend.js.map +1 -0
- package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts +6 -0
- package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
- package/dist/esm/databases/services/postgresql-migration-runner.backend.js +8 -1
- package/dist/esm/databases/services/postgresql-migration-runner.backend.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +0 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +4 -39
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +15 -4
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +21 -11
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +47 -2
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +56 -8
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.js +21 -8
- package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-status-tracking.backend.service.js +4 -1
- package/dist/esm/queue/job-status-tracking.backend.service.js.map +1 -1
- package/dist/esm/queue/queue.backend.service.d.ts +14 -0
- package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue.backend.service.js +68 -12
- package/dist/esm/queue/queue.backend.service.js.map +1 -1
- package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts +8 -0
- package/dist/esm/queue/scheduled-evidence-coverage.backend.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-evidence-coverage.backend.js +20 -2
- package/dist/esm/queue/scheduled-evidence-coverage.backend.js.map +1 -1
- package/dist/esm/queue/scheduled-execution.backend.service.d.ts +44 -1
- package/dist/esm/queue/scheduled-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-execution.backend.service.js +180 -10
- package/dist/esm/queue/scheduled-execution.backend.service.js.map +1 -1
- package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts +73 -21
- package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/scheduled-message-verifier.backend.service.js +162 -88
- package/dist/esm/queue/scheduled-message-verifier.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +16 -1
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/package.json +10 -10
- package/dist/esm/__tests__/fixture-deep-partial.d.ts +0 -18
- package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +0 -1
- package/dist/esm/__tests__/fixture-deep-partial.js +0 -1
- package/dist/esm/__tests__/fixture-deep-partial.js.map +0 -1
- package/dist/esm/__tests__/integration/redis-integration-gate.d.ts +0 -26
- package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +0 -1
- package/dist/esm/__tests__/integration/redis-integration-gate.js +0 -105
- package/dist/esm/__tests__/integration/redis-integration-gate.js.map +0 -1
- package/dist/esm/__tests__/setup.d.ts +0 -7
- package/dist/esm/__tests__/setup.d.ts.map +0 -1
- package/dist/esm/__tests__/setup.js +0 -14
- package/dist/esm/__tests__/setup.js.map +0 -1
- package/dist/esm/__tests__/test-container.d.ts +0 -41
- package/dist/esm/__tests__/test-container.d.ts.map +0 -1
- package/dist/esm/__tests__/test-container.js +0 -98
- package/dist/esm/__tests__/test-container.js.map +0 -1
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +0 -47
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +0 -1
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js +0 -82
- package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.js.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts +0 -57
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js +0 -172
- package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.js.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts +0 -41
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.d.ts.map +0 -1
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js +0 -54
- package/dist/esm/base-classes/services/repositories/__tests__/repositories-registry-infrastructure-read.double.js.map +0 -1
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts +0 -20
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js +0 -33
- package/dist/esm/billing/services/__tests__/subscription-provider-projection.test-double.js.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts +0 -22
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.d.ts.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js +0 -92
- package/dist/esm/billing/services/custom-impl/__tests__/plan-change-confirmation.fixture.js.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts +0 -15
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts.map +0 -1
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js +0 -61
- package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts +0 -21
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js +0 -32
- package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +0 -52
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +0 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +0 -74
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +0 -1
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts +0 -60
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +0 -1
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.js +0 -156
- package/dist/esm/config/services/__tests__/mock-app-configuration.service.js.map +0 -1
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts +0 -31
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts.map +0 -1
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js +0 -47
- package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.js.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts +0 -20
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js +0 -424
- package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.js.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts +0 -19
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +0 -1
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js +0 -49
- package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.js.map +0 -1
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts +0 -43
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.d.ts.map +0 -1
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js +0 -61
- package/dist/esm/flows-actors/services/__tests__/pending-decision.fixtures.js.map +0 -1
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts +0 -25
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.d.ts.map +0 -1
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js +0 -92
- package/dist/esm/inbound/services/__tests__/support/in-memory-infrastructure-repositories.js.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts +0 -7
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js +0 -194
- package/dist/esm/meta-workflows/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.js.map +0 -1
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts +0 -34
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +0 -1
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js +0 -59
- package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.js.map +0 -1
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts +0 -48
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +0 -1
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js +0 -53
- package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts +0 -3
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js +0 -19
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/bundle.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts +0 -51
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js +0 -24
- package/dist/esm/notifications/services/__tests__/fixtures/personal-notification-browser/host.js.map +0 -1
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts +0 -8
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.d.ts.map +0 -1
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js +0 -9
- package/dist/esm/notifications/services/__tests__/recipient-language.test-double.js.map +0 -1
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts +0 -10
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +0 -1
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js +0 -18
- package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.js.map +0 -1
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts +0 -11
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.d.ts.map +0 -1
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js +0 -34
- package/dist/esm/security/api-keys/__tests__/api-key-usage-redis.double.js.map +0 -1
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts +0 -105
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.d.ts.map +0 -1
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js +0 -140
- package/dist/esm/security/authentications/__tests__/registration-onboarding.harness.js.map +0 -1
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts +0 -35
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +0 -1
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js +0 -46
- package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.js.map +0 -1
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts +0 -2
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.d.ts.map +0 -1
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js +0 -18
- package/dist/esm/security/connected-accounts/__tests__/support/real-connection-client-methods.js.map +0 -1
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts +0 -20
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.d.ts.map +0 -1
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js +0 -56
- package/dist/esm/systems-of-record/credentials/__tests__/certificate-fixtures.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-keyed-mutation.fixture.d.ts","sourceRoot":"","sources":["../../../../../../../src/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,EAAE,GAAG,EACZ,KAAK,EAAE,GAAG,EACV,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO;WAiDE,GAAG,EAAE;GACjD"}
|
package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CoreResourceType, PersistenceAdapter } from "@wildo-ai/saas-models";
|
|
2
|
-
import { createTransactionContext } from "../../../../databases/models/transaction.shared.schemas.js";
|
|
3
|
-
import { ResourceOperationBeforeTransactionalCoreDisposition } from "../../../../base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js";
|
|
4
|
-
import { slotRegistryFor } from "./plan-change-confirmation.fixture.js";
|
|
5
|
-
/**
|
|
6
|
-
* Runs a subscription mutation admitted under an Idempotency-Key — CANCEL, RESUME, ADD_ADDON or REMOVE_ADDON (#535 S5b) — through its
|
|
7
|
-
* real handlers end to end: the BEFORE_TRANSACTIONAL_CORE phase (read the subscription after the slot, decide, admit, dispatch), then
|
|
8
|
-
* PREFIX (lock the applied generation, re-check the items) and POSTFIX (complete, record, enqueue) inside a transaction context.
|
|
9
|
-
*
|
|
10
|
-
* The slot, completion and outbox rows live in the same per-registry durable-store double the plan-change fixture uses, so consecutive
|
|
11
|
-
* changes in one test see the generation the previous one completed. A double, not proof of native atomicity — the native PostgreSQL
|
|
12
|
-
* add-on pipeline test is that. Answers the patch the core would write.
|
|
13
|
-
*/
|
|
14
|
-
export async function runKeyedMutationFixture(factories, variant, id, input, context, utils, options = {}) {
|
|
15
|
-
const scopeField = variant === 0 ? "organizationId" : "userId";
|
|
16
|
-
const accountField = variant === 0 ? "organizationBillingAccountId" : "userBillingAccountId";
|
|
17
|
-
const subscriptionField = variant === 0 ? "organizationSubscriptionId" : "userSubscriptionId";
|
|
18
|
-
const variantResourceType = variant === 0 ? CoreResourceType.ORGANIZATION_SUBSCRIPTIONS : CoreResourceType.USER_SUBSCRIPTIONS;
|
|
19
|
-
const scope = context[scopeField] ?? "fixture-scope";
|
|
20
|
-
const account = utils.currentObject[accountField] ?? "fixture-account";
|
|
21
|
-
const scopedContext = {
|
|
22
|
-
...context,
|
|
23
|
-
userId: context.userId ?? "fixture-actor",
|
|
24
|
-
[scopeField]: scope,
|
|
25
|
-
getContextResourceIds: () => new Map([
|
|
26
|
-
[scopeField, scope],
|
|
27
|
-
[accountField, account],
|
|
28
|
-
[subscriptionField, id],
|
|
29
|
-
]),
|
|
30
|
-
};
|
|
31
|
-
const currentObject = { ...utils.currentObject, _id: id, [scopeField]: scope, [accountField]: account };
|
|
32
|
-
const slotRegistry = slotRegistryFor(utils.repositoriesRegistry ?? utils);
|
|
33
|
-
const scopedUtils = {
|
|
34
|
-
...utils,
|
|
35
|
-
currentObject,
|
|
36
|
-
requestIdempotencyKey: options.idempotencyKey,
|
|
37
|
-
repositoriesRegistry: {
|
|
38
|
-
...utils.repositoriesRegistry,
|
|
39
|
-
...slotRegistry,
|
|
40
|
-
// The phase re-reads the subscription after the slot read; in this double it is the row the test holds.
|
|
41
|
-
readUnscopedByKey: async (resource, filter) => resource === variantResourceType && filter._id === id ? structuredClone(currentObject) : slotRegistry.readUnscopedByKey(resource, filter),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
// The configured application, never the request context, names the mutation identity; an HTTP context carries none.
|
|
45
|
-
const container = { get: () => ({ applicationId: "fixture-app" }) };
|
|
46
|
-
const implementation = factories[variant]({}, container).implementation;
|
|
47
|
-
const decision = await implementation.beforeTransactionalCore(id, input, scopedContext, scopedUtils);
|
|
48
|
-
if (decision.disposition !== ResourceOperationBeforeTransactionalCoreDisposition.CONTINUE) {
|
|
49
|
-
throw new Error(`The keyed mutation fixture expects a fresh admission, got ${decision.disposition}`);
|
|
50
|
-
}
|
|
51
|
-
const coreUtils = {
|
|
52
|
-
...scopedUtils,
|
|
53
|
-
serviceOptions: { transaction: createTransactionContext({}, PersistenceAdapter.POSTGRESQL) },
|
|
54
|
-
beforeTransactionalCore: Object.freeze({ continuation: decision.continuation }),
|
|
55
|
-
postCommitEffectCapture: { prepareAudit: () => null, deferredContext: () => ({}), notificationInputs: () => ({}) },
|
|
56
|
-
};
|
|
57
|
-
await implementation.prefixCoreOperations(id, { ...input, ...decision.coreInputPatch }, scopedContext, coreUtils);
|
|
58
|
-
await implementation.postfixCoreOperations(id, { ...currentObject, ...decision.coreInputPatch }, scopedContext, coreUtils);
|
|
59
|
-
return decision.coreInputPatch;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=subscription-keyed-mutation.fixture.js.map
|
package/dist/esm/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-keyed-mutation.fixture.js","sourceRoot":"","sources":["../../../../../../../src/billing/services/custom-impl/__tests__/subscription-keyed-mutation.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AACnG,OAAO,EAAE,mDAAmD,EAAE,MAAM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,MAAM,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC;QAC/E,uBAAuB,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE;KACnH,CAAC;IACF,MAAM,cAAc,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAClH,MAAM,cAAc,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,QAAQ,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC3H,OAAO,QAAQ,CAAC,cAAkC,CAAC;AACrD,CAAC","sourcesContent":["import { CoreResourceType, PersistenceAdapter } from \"@wildo-ai/saas-models\";\nimport { createTransactionContext } from \"../../../../databases/models/transaction.shared.schemas\";\nimport { ResourceOperationBeforeTransactionalCoreDisposition } from \"~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service\";\nimport { slotRegistryFor } from \"./plan-change-confirmation.fixture\";\n\n/**\n * Runs a subscription mutation admitted under an Idempotency-Key — CANCEL, RESUME, ADD_ADDON or REMOVE_ADDON (#535 S5b) — through its\n * real handlers end to end: the BEFORE_TRANSACTIONAL_CORE phase (read the subscription after the slot, decide, admit, dispatch), then\n * PREFIX (lock the applied generation, re-check the items) and POSTFIX (complete, record, enqueue) inside a transaction context.\n *\n * The slot, completion and outbox rows live in the same per-registry durable-store double the plan-change fixture uses, so consecutive\n * changes in one test see the generation the previous one completed. A double, not proof of native atomicity — the native PostgreSQL\n * add-on pipeline test is that. Answers the patch the core would write.\n */\nexport async function runKeyedMutationFixture(\n factories: unknown[],\n variant: number,\n id: string,\n input: Record<string, unknown>,\n context: any,\n utils: any,\n options: { idempotencyKey?: string } = {},\n) {\n const scopeField = variant === 0 ? \"organizationId\" : \"userId\";\n const accountField = variant === 0 ? \"organizationBillingAccountId\" : \"userBillingAccountId\";\n const subscriptionField = variant === 0 ? \"organizationSubscriptionId\" : \"userSubscriptionId\";\n const variantResourceType = variant === 0 ? CoreResourceType.ORGANIZATION_SUBSCRIPTIONS : CoreResourceType.USER_SUBSCRIPTIONS;\n const scope = context[scopeField] ?? \"fixture-scope\";\n const account = utils.currentObject[accountField] ?? \"fixture-account\";\n const scopedContext = {\n ...context,\n userId: context.userId ?? \"fixture-actor\",\n [scopeField]: scope,\n getContextResourceIds: () =>\n new Map([\n [scopeField, scope],\n [accountField, account],\n [subscriptionField, id],\n ]),\n };\n const currentObject = { ...utils.currentObject, _id: id, [scopeField]: scope, [accountField]: account };\n const slotRegistry = slotRegistryFor(utils.repositoriesRegistry ?? utils);\n const scopedUtils = {\n ...utils,\n currentObject,\n requestIdempotencyKey: options.idempotencyKey,\n repositoriesRegistry: {\n ...utils.repositoriesRegistry,\n ...slotRegistry,\n // The phase re-reads the subscription after the slot read; in this double it is the row the test holds.\n readUnscopedByKey: async (resource: unknown, filter: { _id: string }) =>\n resource === variantResourceType && filter._id === id ? structuredClone(currentObject) : slotRegistry.readUnscopedByKey(resource, filter),\n },\n };\n // The configured application, never the request context, names the mutation identity; an HTTP context carries none.\n const container = { get: () => ({ applicationId: \"fixture-app\" }) };\n const implementation = (factories[variant] as any)({}, container).implementation;\n\n const decision = await implementation.beforeTransactionalCore(id, input, scopedContext, scopedUtils);\n if (decision.disposition !== ResourceOperationBeforeTransactionalCoreDisposition.CONTINUE) {\n throw new Error(`The keyed mutation fixture expects a fresh admission, got ${decision.disposition}`);\n }\n const coreUtils = {\n ...scopedUtils,\n serviceOptions: { transaction: createTransactionContext({}, PersistenceAdapter.POSTGRESQL) },\n beforeTransactionalCore: Object.freeze({ continuation: decision.continuation }),\n postCommitEffectCapture: { prepareAudit: () => null, deferredContext: () => ({}), notificationInputs: () => ({}) },\n };\n await implementation.prefixCoreOperations(id, { ...input, ...decision.coreInputPatch }, scopedContext, coreUtils);\n await implementation.postfixCoreOperations(id, { ...currentObject, ...decision.coreInputPatch }, scopedContext, coreUtils);\n return decision.coreInputPatch as { items: any[] };\n}\n"]}
|
package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import { type BillingResolvedVariants } from '../../../../billing/services/custom-impl/billing-custom-impl-utils.backend';
|
|
3
|
-
import type { BillingEventAuthority } from '../../../../billing/services/webhooks/billing-webhook-event-router.backend.service';
|
|
4
|
-
/**
|
|
5
|
-
* A {@link BillingEventAuthority} for router unit tests (#1629).
|
|
6
|
-
*
|
|
7
|
-
* The router used to take an execution context and derive its variants from `userId` / `organizationId`;
|
|
8
|
-
* these suites passed `{ userId: 'user-1' }`. The authority now carries the variants, and hands out contexts
|
|
9
|
-
* per operation. This double answers every request with one marker context — the suites here assert WHAT the
|
|
10
|
-
* router writes, and the authorization of each call is pinned against the real authorizer in
|
|
11
|
-
* `billing-inbound-handler.authorization.test.ts`.
|
|
12
|
-
*
|
|
13
|
-
* `contextFor` and `catalogContext` are spies, so a test can assert which authority a call took.
|
|
14
|
-
*/
|
|
15
|
-
export declare function billingEventAuthorityForTest(scope: 'organization' | 'user', context?: Record<string, unknown>): BillingEventAuthority & {
|
|
16
|
-
contextFor: ReturnType<typeof vi.fn>;
|
|
17
|
-
catalogContext: ReturnType<typeof vi.fn>;
|
|
18
|
-
};
|
|
19
|
-
/** The authority for a direct handler call that passes a partial variants object, as the invoice suites do. */
|
|
20
|
-
export declare function billingEventAuthorityWithVariants(variants: Partial<BillingResolvedVariants>): BillingEventAuthority;
|
|
21
|
-
//# sourceMappingURL=billing-event-authority.test-double.d.ts.map
|
package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"billing-event-authority.test-double.d.ts","sourceRoot":"","sources":["../../../../../../../src/billing/services/webhooks/__tests__/billing-event-authority.test-double.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAA6B,KAAK,uBAAuB,EAAE,MAAM,mFAAmF,CAAC;AAC5J,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2FAA2F,CAAC;AAEvI;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,qBAAqB,GAAG;IAC3I,UAAU,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACrC,cAAc,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CAC1C,CASA;AAED,+GAA+G;AAC/G,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,qBAAqB,CAMnH"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import { BILLING_SCOPE_TO_VARIANTS } from '../../../../billing/services/custom-impl/billing-custom-impl-utils.backend.js';
|
|
3
|
-
/**
|
|
4
|
-
* A {@link BillingEventAuthority} for router unit tests (#1629).
|
|
5
|
-
*
|
|
6
|
-
* The router used to take an execution context and derive its variants from `userId` / `organizationId`;
|
|
7
|
-
* these suites passed `{ userId: 'user-1' }`. The authority now carries the variants, and hands out contexts
|
|
8
|
-
* per operation. This double answers every request with one marker context — the suites here assert WHAT the
|
|
9
|
-
* router writes, and the authorization of each call is pinned against the real authorizer in
|
|
10
|
-
* `billing-inbound-handler.authorization.test.ts`.
|
|
11
|
-
*
|
|
12
|
-
* `contextFor` and `catalogContext` are spies, so a test can assert which authority a call took.
|
|
13
|
-
*/
|
|
14
|
-
export function billingEventAuthorityForTest(scope, context = {}) {
|
|
15
|
-
const scopeKey = scope === 'organization' ? 'organizationId' : 'userId';
|
|
16
|
-
const variants = { scopeKey, ...BILLING_SCOPE_TO_VARIANTS[scopeKey] };
|
|
17
|
-
const marker = { ...context, testAuthority: scope };
|
|
18
|
-
return {
|
|
19
|
-
variants,
|
|
20
|
-
contextFor: vi.fn(async () => marker),
|
|
21
|
-
catalogContext: vi.fn(async () => marker),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/** The authority for a direct handler call that passes a partial variants object, as the invoice suites do. */
|
|
25
|
-
export function billingEventAuthorityWithVariants(variants) {
|
|
26
|
-
return {
|
|
27
|
-
variants: variants,
|
|
28
|
-
contextFor: vi.fn(async () => ({ testAuthority: 'organization' })),
|
|
29
|
-
catalogContext: vi.fn(async () => ({ testAuthority: 'catalog' })),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=billing-event-authority.test-double.js.map
|
package/dist/esm/billing/services/webhooks/__tests__/billing-event-authority.test-double.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"billing-event-authority.test-double.js","sourceRoot":"","sources":["../../../../../../../src/billing/services/webhooks/__tests__/billing-event-authority.test-double.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,yBAAyB,EAAgC,MAAM,mFAAmF,CAAC;AAG5J;;;;;;;;;;GAUG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAA8B,EAAE,UAAmC,EAAE;IAIhH,MAAM,QAAQ,GAAG,KAAK,KAAK,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,MAAM,QAAQ,GAA4B,EAAE,QAAQ,EAAE,GAAG,yBAAyB,CAAC,QAAQ,CAAE,EAAE,CAAC;IAChG,MAAM,MAAM,GAAG,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,KAAK,EAAW,CAAC;IAC7D,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC;QACrC,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,iCAAiC,CAAC,QAA0C;IAC1F,OAAO;QACL,QAAQ,EAAE,QAAmC;QAC7C,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,CAAU,CAAC;QAC3E,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAU,CAAC;KAC3E,CAAC;AACJ,CAAC","sourcesContent":["import { vi } from 'vitest';\n\nimport { BILLING_SCOPE_TO_VARIANTS, type BillingResolvedVariants } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\nimport type { BillingEventAuthority } from '~wildo-backend-lib/billing/services/webhooks/billing-webhook-event-router.backend.service';\n\n/**\n * A {@link BillingEventAuthority} for router unit tests (#1629).\n *\n * The router used to take an execution context and derive its variants from `userId` / `organizationId`;\n * these suites passed `{ userId: 'user-1' }`. The authority now carries the variants, and hands out contexts\n * per operation. This double answers every request with one marker context — the suites here assert WHAT the\n * router writes, and the authorization of each call is pinned against the real authorizer in\n * `billing-inbound-handler.authorization.test.ts`.\n *\n * `contextFor` and `catalogContext` are spies, so a test can assert which authority a call took.\n */\nexport function billingEventAuthorityForTest(scope: 'organization' | 'user', context: Record<string, unknown> = {}): BillingEventAuthority & {\n contextFor: ReturnType<typeof vi.fn>;\n catalogContext: ReturnType<typeof vi.fn>;\n} {\n const scopeKey = scope === 'organization' ? 'organizationId' : 'userId';\n const variants: BillingResolvedVariants = { scopeKey, ...BILLING_SCOPE_TO_VARIANTS[scopeKey]! };\n const marker = { ...context, testAuthority: scope } as never;\n return {\n variants,\n contextFor: vi.fn(async () => marker),\n catalogContext: vi.fn(async () => marker),\n };\n}\n\n/** The authority for a direct handler call that passes a partial variants object, as the invoice suites do. */\nexport function billingEventAuthorityWithVariants(variants: Partial<BillingResolvedVariants>): BillingEventAuthority {\n return {\n variants: variants as BillingResolvedVariants,\n contextFor: vi.fn(async () => ({ testAuthority: 'organization' }) as never),\n catalogContext: vi.fn(async () => ({ testAuthority: 'catalog' }) as never),\n };\n}\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An in-memory stand-in for the DURABLE settlement ledger the webhook router deduplicates against.
|
|
3
|
-
*
|
|
4
|
-
* ## Why a shared double rather than one fake per test file
|
|
5
|
-
*
|
|
6
|
-
* Four test files construct the router, and the ledger is now on the money path of every one of
|
|
7
|
-
* them — a file that fakes it slightly differently is a file whose "the grant happened" assertions
|
|
8
|
-
* are measuring a different mechanism from its neighbours'. The ledger's behaviour under
|
|
9
|
-
* concurrency is the whole subject of the fix, so it gets exactly one definition.
|
|
10
|
-
*
|
|
11
|
-
* ## What it models, and what it deliberately does not
|
|
12
|
-
*
|
|
13
|
-
* It models the ONE property the production store is relied on for: a second INSERT of a row whose
|
|
14
|
-
* `_id` already exists raises the engine's CLASSIFIED conflict — the adapter-neutral shape both
|
|
15
|
-
* `handleMongoDBError` (from `E11000`) and `handlePostgresError` (from SQLSTATE `23505`) produce.
|
|
16
|
-
* It does not model transactions, retention hiding, or scope filtering: none of those participate
|
|
17
|
-
* in the claim, and modelling them would make the double a second implementation to keep true.
|
|
18
|
-
*
|
|
19
|
-
* The map is exposed so a test can inspect the ledger's state — how many claims exist, whether a
|
|
20
|
-
* claim was closed — which is what distinguishes "granted nothing because it was already applied"
|
|
21
|
-
* from "granted nothing because the handler refused earlier".
|
|
22
|
-
*/
|
|
23
|
-
export declare const SETTLEMENTS: string;
|
|
24
|
-
/**
|
|
25
|
-
* The classified CONFLICT a unique/primary-key violation becomes before it leaves the repository
|
|
26
|
-
* tier. Shaped for `isWildoBackendError`, which tests for `type`/`statusCode`/`severity`/
|
|
27
|
-
* `customMessageReference` — a plain `Error` would be re-thrown by the router instead of read as
|
|
28
|
-
* "already claimed", which is the distinction this double exists to keep honest.
|
|
29
|
-
*/
|
|
30
|
-
export declare const classifiedPrimaryKeyConflict: () => Error;
|
|
31
|
-
export interface SettlementLedgerDouble {
|
|
32
|
-
/** The ledger rows, keyed by `_id`. Read it to assert what the handler claimed and closed. */
|
|
33
|
-
rows: Map<string, Record<string, unknown>>;
|
|
34
|
-
/** Pass as the router's `repositoriesRegistry` argument. */
|
|
35
|
-
registry: Record<string, unknown>;
|
|
36
|
-
/** Every guarded mutation the router aimed at a resource OTHER than the ledger. */
|
|
37
|
-
otherMutations: Array<{
|
|
38
|
-
resourceType: unknown;
|
|
39
|
-
filter: Record<string, any>;
|
|
40
|
-
mutation: Record<string, unknown>;
|
|
41
|
-
}>;
|
|
42
|
-
}
|
|
43
|
-
export declare function createSettlementLedgerDouble(options?: {
|
|
44
|
-
/**
|
|
45
|
-
* Result for a guarded mutation aimed at anything but the ledger — the promotion counter is the
|
|
46
|
-
* only such caller today. `null` models a compare-and-swap that matched nothing.
|
|
47
|
-
*/
|
|
48
|
-
otherMutationResult?: () => unknown;
|
|
49
|
-
/** Make the ledger INSERT fail with something that is not a conflict, to pin the fail-closed path. */
|
|
50
|
-
insertFailure?: () => Error;
|
|
51
|
-
}): SettlementLedgerDouble;
|
|
52
|
-
//# sourceMappingURL=settlement-ledger.test-double.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settlement-ledger.test-double.d.ts","sourceRoot":"","sources":["../../../../../../../src/billing/services/webhooks/__tests__/settlement-ledger.test-double.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,EAAwE,MAAM,CAAC;AAEvG;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAO,KAO5C,CAAC;AAEL,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,mFAAmF;IACnF,cAAc,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAClH;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE;IACrD;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC;IACpC,sGAAsG;IACtG,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC;CAC7B,GAAG,sBAAsB,CAwCzB"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import { ErrorCustomMessageReference, ErrorType } from '@wildo-ai/saas-models';
|
|
3
|
-
import { BackendResourceType } from '../../../../resources/models/resources-types.backend.schemas.js';
|
|
4
|
-
/**
|
|
5
|
-
* An in-memory stand-in for the DURABLE settlement ledger the webhook router deduplicates against.
|
|
6
|
-
*
|
|
7
|
-
* ## Why a shared double rather than one fake per test file
|
|
8
|
-
*
|
|
9
|
-
* Four test files construct the router, and the ledger is now on the money path of every one of
|
|
10
|
-
* them — a file that fakes it slightly differently is a file whose "the grant happened" assertions
|
|
11
|
-
* are measuring a different mechanism from its neighbours'. The ledger's behaviour under
|
|
12
|
-
* concurrency is the whole subject of the fix, so it gets exactly one definition.
|
|
13
|
-
*
|
|
14
|
-
* ## What it models, and what it deliberately does not
|
|
15
|
-
*
|
|
16
|
-
* It models the ONE property the production store is relied on for: a second INSERT of a row whose
|
|
17
|
-
* `_id` already exists raises the engine's CLASSIFIED conflict — the adapter-neutral shape both
|
|
18
|
-
* `handleMongoDBError` (from `E11000`) and `handlePostgresError` (from SQLSTATE `23505`) produce.
|
|
19
|
-
* It does not model transactions, retention hiding, or scope filtering: none of those participate
|
|
20
|
-
* in the claim, and modelling them would make the double a second implementation to keep true.
|
|
21
|
-
*
|
|
22
|
-
* The map is exposed so a test can inspect the ledger's state — how many claims exist, whether a
|
|
23
|
-
* claim was closed — which is what distinguishes "granted nothing because it was already applied"
|
|
24
|
-
* from "granted nothing because the handler refused earlier".
|
|
25
|
-
*/
|
|
26
|
-
export const SETTLEMENTS = BackendResourceType.BILLING_PROVIDER_EVENT_SETTLEMENTS;
|
|
27
|
-
/**
|
|
28
|
-
* The classified CONFLICT a unique/primary-key violation becomes before it leaves the repository
|
|
29
|
-
* tier. Shaped for `isWildoBackendError`, which tests for `type`/`statusCode`/`severity`/
|
|
30
|
-
* `customMessageReference` — a plain `Error` would be re-thrown by the router instead of read as
|
|
31
|
-
* "already claimed", which is the distinction this double exists to keep honest.
|
|
32
|
-
*/
|
|
33
|
-
export const classifiedPrimaryKeyConflict = () => Object.assign(new Error('Unique constraint violation on _id'), {
|
|
34
|
-
type: ErrorType.CONFLICT,
|
|
35
|
-
statusCode: 409,
|
|
36
|
-
severity: 'low',
|
|
37
|
-
customMessageReference: ErrorCustomMessageReference.UNIQUE_CONSTRAINT_VIOLATION,
|
|
38
|
-
context: { fieldName: '_id', violatedFields: ['_id'] },
|
|
39
|
-
});
|
|
40
|
-
export function createSettlementLedgerDouble(options) {
|
|
41
|
-
const rows = new Map();
|
|
42
|
-
const otherMutations = [];
|
|
43
|
-
const registry = {
|
|
44
|
-
insertDocumentForInfrastructure: vi.fn(async (_resourceType, document) => {
|
|
45
|
-
if (options?.insertFailure)
|
|
46
|
-
throw options.insertFailure();
|
|
47
|
-
const id = String(document._id);
|
|
48
|
-
if (rows.has(id))
|
|
49
|
-
throw classifiedPrimaryKeyConflict();
|
|
50
|
-
rows.set(id, { ...document });
|
|
51
|
-
return document;
|
|
52
|
-
}),
|
|
53
|
-
readUnscopedByKey: vi.fn(async (_resourceType, filter) => rows.get(String(filter._id)) ?? null),
|
|
54
|
-
atomicGuardedMutation: vi.fn(async (resourceType, filter, mutation) => {
|
|
55
|
-
if (String(resourceType) !== SETTLEMENTS) {
|
|
56
|
-
otherMutations.push({ resourceType, filter, mutation });
|
|
57
|
-
return options?.otherMutationResult ? options.otherMutationResult() : { _id: 'mutated' };
|
|
58
|
-
}
|
|
59
|
-
const row = rows.get(String(filter._id));
|
|
60
|
-
if (!row)
|
|
61
|
-
return null;
|
|
62
|
-
// The two guards the router relies on, applied exactly as the store would: a row that has
|
|
63
|
-
// already settled, or whose claim is still fresh, does not match.
|
|
64
|
-
if (filter.appliedAt?.$exists === false && row.appliedAt !== undefined)
|
|
65
|
-
return null;
|
|
66
|
-
if (filter.claimedAt?.$lt && !(row.claimedAt < filter.claimedAt.$lt))
|
|
67
|
-
return null;
|
|
68
|
-
Object.assign(row, mutation.set ?? {});
|
|
69
|
-
return { ...row };
|
|
70
|
-
}),
|
|
71
|
-
};
|
|
72
|
-
return { rows, registry, otherMutations };
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=settlement-ledger.test-double.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settlement-ledger.test-double.js","sourceRoot":"","sources":["../../../../../../../src/billing/services/webhooks/__tests__/settlement-ledger.test-double.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qEAAqE,CAAC;AAE1G;;;;;;;;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AAqB,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAChC,YAAqB,EACrB,MAA2B,EAC3B,QAA6B,EAC7B,EAAE;YACF,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,WAAW,EAAE,CAAC;gBACzC,cAAc,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;gBACxD,OAAO,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YAC3F,CAAC;YAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG;gBAAE,OAAO,IAAI,CAAC;YAEtB,0FAA0F;YAC1F,kEAAkE;YAClE,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,KAAK,KAAK,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YACpF,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAE,GAAG,CAAC,SAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;YAE5F,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;YACvC,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;QACpB,CAAC,CAAC;KACH,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["import { vi } from 'vitest';\nimport { ErrorCustomMessageReference, ErrorType } from '@wildo-ai/saas-models';\n\nimport { BackendResourceType } from '~wildo-backend-lib/resources/models/resources-types.backend.schemas';\n\n/**\n * An in-memory stand-in for the DURABLE settlement ledger the webhook router deduplicates against.\n *\n * ## Why a shared double rather than one fake per test file\n *\n * Four test files construct the router, and the ledger is now on the money path of every one of\n * them — a file that fakes it slightly differently is a file whose \"the grant happened\" assertions\n * are measuring a different mechanism from its neighbours'. The ledger's behaviour under\n * concurrency is the whole subject of the fix, so it gets exactly one definition.\n *\n * ## What it models, and what it deliberately does not\n *\n * It models the ONE property the production store is relied on for: a second INSERT of a row whose\n * `_id` already exists raises the engine's CLASSIFIED conflict — the adapter-neutral shape both\n * `handleMongoDBError` (from `E11000`) and `handlePostgresError` (from SQLSTATE `23505`) produce.\n * It does not model transactions, retention hiding, or scope filtering: none of those participate\n * in the claim, and modelling them would make the double a second implementation to keep true.\n *\n * The map is exposed so a test can inspect the ledger's state — how many claims exist, whether a\n * claim was closed — which is what distinguishes \"granted nothing because it was already applied\"\n * from \"granted nothing because the handler refused earlier\".\n */\nexport const SETTLEMENTS = BackendResourceType.BILLING_PROVIDER_EVENT_SETTLEMENTS as unknown as string;\n\n/**\n * The classified CONFLICT a unique/primary-key violation becomes before it leaves the repository\n * tier. Shaped for `isWildoBackendError`, which tests for `type`/`statusCode`/`severity`/\n * `customMessageReference` — a plain `Error` would be re-thrown by the router instead of read as\n * \"already claimed\", which is the distinction this double exists to keep honest.\n */\nexport const classifiedPrimaryKeyConflict = (): Error =>\n Object.assign(new Error('Unique constraint violation on _id'), {\n type: ErrorType.CONFLICT,\n statusCode: 409,\n severity: 'low',\n customMessageReference: ErrorCustomMessageReference.UNIQUE_CONSTRAINT_VIOLATION,\n context: { fieldName: '_id', violatedFields: ['_id'] },\n });\n\nexport interface SettlementLedgerDouble {\n /** The ledger rows, keyed by `_id`. Read it to assert what the handler claimed and closed. */\n rows: Map<string, Record<string, unknown>>;\n /** Pass as the router's `repositoriesRegistry` argument. */\n registry: Record<string, unknown>;\n /** Every guarded mutation the router aimed at a resource OTHER than the ledger. */\n otherMutations: Array<{ resourceType: unknown; filter: Record<string, any>; mutation: Record<string, unknown> }>;\n}\n\nexport function createSettlementLedgerDouble(options?: {\n /**\n * Result for a guarded mutation aimed at anything but the ledger — the promotion counter is the\n * only such caller today. `null` models a compare-and-swap that matched nothing.\n */\n otherMutationResult?: () => unknown;\n /** Make the ledger INSERT fail with something that is not a conflict, to pin the fail-closed path. */\n insertFailure?: () => Error;\n}): SettlementLedgerDouble {\n const rows = new Map<string, Record<string, unknown>>();\n const otherMutations: SettlementLedgerDouble['otherMutations'] = [];\n\n const registry = {\n insertDocumentForInfrastructure: vi.fn(async (_resourceType: unknown, document: Record<string, unknown>) => {\n if (options?.insertFailure) throw options.insertFailure();\n const id = String(document._id);\n if (rows.has(id)) throw classifiedPrimaryKeyConflict();\n rows.set(id, { ...document });\n return document;\n }),\n\n readUnscopedByKey: vi.fn(async (_resourceType: unknown, filter: Record<string, any>) =>\n rows.get(String(filter._id)) ?? null),\n\n atomicGuardedMutation: vi.fn(async (\n resourceType: unknown,\n filter: Record<string, any>,\n mutation: Record<string, any>,\n ) => {\n if (String(resourceType) !== SETTLEMENTS) {\n otherMutations.push({ resourceType, filter, mutation });\n return options?.otherMutationResult ? options.otherMutationResult() : { _id: 'mutated' };\n }\n\n const row = rows.get(String(filter._id));\n if (!row) return null;\n\n // The two guards the router relies on, applied exactly as the store would: a row that has\n // already settled, or whose claim is still fresh, does not match.\n if (filter.appliedAt?.$exists === false && row.appliedAt !== undefined) return null;\n if (filter.claimedAt?.$lt && !((row.claimedAt as Date) < filter.claimedAt.$lt)) return null;\n\n Object.assign(row, mutation.set ?? {});\n return { ...row };\n }),\n };\n\n return { rows, registry, otherMutations };\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vitest-oriented mock app configuration for integration tests (`vi.fn` where applicable).
|
|
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 MockAppConfigurationService {
|
|
10
|
-
/**
|
|
11
|
-
* Backing store for `config` / `get` — mirrors a minimal {@link AppConfiguration} shape.
|
|
12
|
-
* `defaultAdapter` keeps repository/registry integration on MongoDB unless tests override.
|
|
13
|
-
*/
|
|
14
|
-
private readonly _configData;
|
|
15
|
-
private readonly _secretsData;
|
|
16
|
-
/**
|
|
17
|
-
* The configured application identity, mirroring {@link AppConfigurationService.applicationId}.
|
|
18
|
-
*
|
|
19
|
-
* The mock previously did not implement this member at all, so it answered `undefined` while the
|
|
20
|
-
* real getter returns a `string` (and THROWS when uninitialised). Nothing noticed, because the file
|
|
21
|
-
* subsystem read `executionContext.applicationId || appConfigService.applicationId` and the
|
|
22
|
-
* execution context always carried one in tests — so the mock's gap was masked by the very
|
|
23
|
-
* precedence that turned out to be the defect. With the configured application now authoritative
|
|
24
|
-
* for file storage, a mock that answers `undefined` is a mock of a backend that cannot exist.
|
|
25
|
-
*/
|
|
26
|
-
private _applicationId;
|
|
27
|
-
/** Same contract as {@link AppConfigurationService.applicationId} — always a configured string. */
|
|
28
|
-
get applicationId(): string;
|
|
29
|
-
/** Point the mock at a specific application, for suites that assert on their own id. */
|
|
30
|
-
setApplicationId(applicationId: string): void;
|
|
31
|
-
/** Same contract as {@link AppConfigurationService.isInitialized} */
|
|
32
|
-
isInitialized(): boolean;
|
|
33
|
-
get config(): Record<string, any>;
|
|
34
|
-
get secrets(): Record<string, any>;
|
|
35
|
-
get: import("vitest").Mock<[key: string], any>;
|
|
36
|
-
getAll: import("vitest").Mock<[], Record<string, any>>;
|
|
37
|
-
getAppName: import("vitest").Mock<[], string>;
|
|
38
|
-
getEnvironment: import("vitest").Mock<[], string>;
|
|
39
|
-
getFrontendServiceUserManagementEntry: import("vitest").Mock<[frontendServiceName: string, userType: string], {
|
|
40
|
-
register: boolean;
|
|
41
|
-
auth: boolean;
|
|
42
|
-
isDefault?: boolean;
|
|
43
|
-
}>;
|
|
44
|
-
hasFrontendService: import("vitest").Mock<[frontendServiceName: string], boolean>;
|
|
45
|
-
resolveUserTypeFromFrontendServiceName: import("vitest").Mock<[frontendServiceName: string], string>;
|
|
46
|
-
/**
|
|
47
|
-
* Used by SAML / auth flows to build post-login redirect URLs.
|
|
48
|
-
* Mirrors the real AppConfiguration service behavior closely enough for tests.
|
|
49
|
-
*/
|
|
50
|
-
resolveFrontendServiceNameFromUserType: import("vitest").Mock<[userType: string], string>;
|
|
51
|
-
resolveDefaultFrontendServiceName: import("vitest").Mock<[], string>;
|
|
52
|
-
/**
|
|
53
|
-
* Same contract as {@link AppConfigurationService.applyCapabilityDeclaredConsentPurposes} (#1462).
|
|
54
|
-
* `ResourcesRegistryBackendService.initialize()` calls this unconditionally once the registry is
|
|
55
|
-
* built, in every test that reaches it — so the mock must implement it, not merely tolerate it.
|
|
56
|
-
*/
|
|
57
|
-
applyCapabilityDeclaredConsentPurposes: import("vitest").Mock<[purposes: readonly string[]], void>;
|
|
58
|
-
reset(): void;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=mock-app-configuration.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-app-configuration.service.d.ts","sourceRoot":"","sources":["../../../../../../src/config/services/__tests__/mock-app-configuration.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,kBAAkB,CAAC;AAI1B,qBACa,2BAA2B;IACtC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAyB1B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IAExD;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc,CAA8B;IAEpD,mGAAmG;IACnG,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,wFAAwF;IACxF,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAI7C,qEAAqE;IACrE,aAAa,IAAI,OAAO;IAIxB,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEhC;IAED,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEjC;IAED,GAAG,4CAEA;IAEH,MAAM,iDAAiC;IAEvC,UAAU,oCAA2B;IACrC,cAAc,oCAAuB;IAErC,qCAAqC;kBAC0B,OAAO;cAAQ,OAAO;oBAAc,OAAO;OAGxG;IAEF,kBAAkB,gEAEf;IAEH,sCAAsC,+DAQnC;IAEH;;;OAGG;IACH,sCAAsC,oDAanC;IAEH,iCAAiC,oCAc9B;IAEH;;;;OAIG;IACH,sCAAsC,6DAEnC;IAEH,KAAK;CAYN"}
|
|
@@ -1,156 +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 app configuration for integration tests (`vi.fn` where applicable).
|
|
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
|
-
let MockAppConfigurationService = class MockAppConfigurationService {
|
|
18
|
-
/**
|
|
19
|
-
* Backing store for `config` / `get` — mirrors a minimal {@link AppConfiguration} shape.
|
|
20
|
-
* `defaultAdapter` keeps repository/registry integration on MongoDB unless tests override.
|
|
21
|
-
*/
|
|
22
|
-
_configData = {
|
|
23
|
-
app: {
|
|
24
|
-
name: 'test-app',
|
|
25
|
-
environment: 'test',
|
|
26
|
-
},
|
|
27
|
-
database: {
|
|
28
|
-
mongoUri: 'mongodb://localhost:27017/test',
|
|
29
|
-
defaultAdapter: 'mongodb',
|
|
30
|
-
},
|
|
31
|
-
redis: {
|
|
32
|
-
host: 'localhost',
|
|
33
|
-
port: 6379,
|
|
34
|
-
},
|
|
35
|
-
userTypes: {},
|
|
36
|
-
frontendServices: {},
|
|
37
|
-
runtime: {
|
|
38
|
-
endPoints: {},
|
|
39
|
-
},
|
|
40
|
-
storage: {
|
|
41
|
-
maxFileSize: 100 * 1024 * 1024,
|
|
42
|
-
},
|
|
43
|
-
// Matches the real service's schema default: derived, never authored, always present (#1462).
|
|
44
|
-
compliance: {
|
|
45
|
-
capabilityDeclaredConsentPurposes: [],
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
_secretsData = {};
|
|
49
|
-
/**
|
|
50
|
-
* The configured application identity, mirroring {@link AppConfigurationService.applicationId}.
|
|
51
|
-
*
|
|
52
|
-
* The mock previously did not implement this member at all, so it answered `undefined` while the
|
|
53
|
-
* real getter returns a `string` (and THROWS when uninitialised). Nothing noticed, because the file
|
|
54
|
-
* subsystem read `executionContext.applicationId || appConfigService.applicationId` and the
|
|
55
|
-
* execution context always carried one in tests — so the mock's gap was masked by the very
|
|
56
|
-
* precedence that turned out to be the defect. With the configured application now authoritative
|
|
57
|
-
* for file storage, a mock that answers `undefined` is a mock of a backend that cannot exist.
|
|
58
|
-
*/
|
|
59
|
-
_applicationId = '507f1f77bcf86cd799439099';
|
|
60
|
-
/** Same contract as {@link AppConfigurationService.applicationId} — always a configured string. */
|
|
61
|
-
get applicationId() {
|
|
62
|
-
return this._applicationId;
|
|
63
|
-
}
|
|
64
|
-
/** Point the mock at a specific application, for suites that assert on their own id. */
|
|
65
|
-
setApplicationId(applicationId) {
|
|
66
|
-
this._applicationId = applicationId;
|
|
67
|
-
}
|
|
68
|
-
/** Same contract as {@link AppConfigurationService.isInitialized} */
|
|
69
|
-
isInitialized() {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
get config() {
|
|
73
|
-
return this._configData;
|
|
74
|
-
}
|
|
75
|
-
get secrets() {
|
|
76
|
-
return this._secretsData;
|
|
77
|
-
}
|
|
78
|
-
get = vi.fn((key) => {
|
|
79
|
-
return key.split('.').reduce((obj, k) => obj?.[k], this._configData);
|
|
80
|
-
});
|
|
81
|
-
getAll = vi.fn(() => this._configData);
|
|
82
|
-
getAppName = vi.fn(() => 'test-app');
|
|
83
|
-
getEnvironment = vi.fn(() => 'test');
|
|
84
|
-
getFrontendServiceUserManagementEntry = vi.fn((frontendServiceName, userType) => {
|
|
85
|
-
return this._configData.frontendServices?.[frontendServiceName]?.usersManagement?.[userType] ?? null;
|
|
86
|
-
});
|
|
87
|
-
hasFrontendService = vi.fn((frontendServiceName) => {
|
|
88
|
-
return !!this._configData.frontendServices?.[frontendServiceName];
|
|
89
|
-
});
|
|
90
|
-
resolveUserTypeFromFrontendServiceName = vi.fn((frontendServiceName) => {
|
|
91
|
-
const frontendServiceConfig = this._configData.frontendServices?.[frontendServiceName];
|
|
92
|
-
if (!frontendServiceConfig?.usersManagement)
|
|
93
|
-
return null;
|
|
94
|
-
const entries = Object.entries(frontendServiceConfig.usersManagement);
|
|
95
|
-
const defaultEntry = entries.find(([, value]) => value.isDefault);
|
|
96
|
-
const firstEntry = entries[0];
|
|
97
|
-
return (defaultEntry ?? firstEntry)?.[0] ?? null;
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* Used by SAML / auth flows to build post-login redirect URLs.
|
|
101
|
-
* Mirrors the real AppConfiguration service behavior closely enough for tests.
|
|
102
|
-
*/
|
|
103
|
-
resolveFrontendServiceNameFromUserType = vi.fn((userType) => {
|
|
104
|
-
const frontendServices = this._configData.frontendServices ?? {};
|
|
105
|
-
let fallback = null;
|
|
106
|
-
for (const [frontendServiceName, frontendServiceConfig] of Object.entries(frontendServices)) {
|
|
107
|
-
const entry = frontendServiceConfig
|
|
108
|
-
.usersManagement?.[userType];
|
|
109
|
-
if (!entry)
|
|
110
|
-
continue;
|
|
111
|
-
if (entry.isDefault)
|
|
112
|
-
return frontendServiceName;
|
|
113
|
-
if (entry.auth && !fallback)
|
|
114
|
-
fallback = frontendServiceName;
|
|
115
|
-
}
|
|
116
|
-
return fallback;
|
|
117
|
-
});
|
|
118
|
-
resolveDefaultFrontendServiceName = vi.fn(() => {
|
|
119
|
-
const frontendServices = this._configData.frontendServices ?? {};
|
|
120
|
-
for (const [frontendServiceName, frontendServiceConfig] of Object.entries(frontendServices)) {
|
|
121
|
-
const hasDefault = Object
|
|
122
|
-
.values(frontendServiceConfig.usersManagement ?? {})
|
|
123
|
-
.some((value) => value.isDefault);
|
|
124
|
-
if (hasDefault) {
|
|
125
|
-
return frontendServiceName;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const firstFrontendServiceName = Object.keys(frontendServices)[0];
|
|
129
|
-
return firstFrontendServiceName ?? null;
|
|
130
|
-
});
|
|
131
|
-
/**
|
|
132
|
-
* Same contract as {@link AppConfigurationService.applyCapabilityDeclaredConsentPurposes} (#1462).
|
|
133
|
-
* `ResourcesRegistryBackendService.initialize()` calls this unconditionally once the registry is
|
|
134
|
-
* built, in every test that reaches it — so the mock must implement it, not merely tolerate it.
|
|
135
|
-
*/
|
|
136
|
-
applyCapabilityDeclaredConsentPurposes = vi.fn((purposes) => {
|
|
137
|
-
this._configData.compliance = { ...this._configData.compliance, capabilityDeclaredConsentPurposes: [...purposes] };
|
|
138
|
-
});
|
|
139
|
-
reset() {
|
|
140
|
-
this.get.mockClear();
|
|
141
|
-
this.getAll.mockClear();
|
|
142
|
-
this.getAppName.mockClear();
|
|
143
|
-
this.getEnvironment.mockClear();
|
|
144
|
-
this.getFrontendServiceUserManagementEntry.mockClear();
|
|
145
|
-
this.hasFrontendService.mockClear();
|
|
146
|
-
this.resolveUserTypeFromFrontendServiceName.mockClear();
|
|
147
|
-
this.resolveFrontendServiceNameFromUserType.mockClear();
|
|
148
|
-
this.resolveDefaultFrontendServiceName.mockClear();
|
|
149
|
-
this.applyCapabilityDeclaredConsentPurposes.mockClear();
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
MockAppConfigurationService = __decorate([
|
|
153
|
-
injectable()
|
|
154
|
-
], MockAppConfigurationService);
|
|
155
|
-
export { MockAppConfigurationService };
|
|
156
|
-
//# sourceMappingURL=mock-app-configuration.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-app-configuration.service.js","sourceRoot":"","sources":["../../../../../../src/config/services/__tests__/mock-app-configuration.service.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAGrB,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACtC;;;OAGG;IACc,WAAW,GAAwB;QAClD,GAAG,EAAE;YACH,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,MAAM;SACpB;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,gCAAgC;YAC1C,cAAc,EAAE,SAAS;SAC1B;QACD,KAAK,EAAE;YACL,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,IAAI;SACX;QACD,SAAS,EAAE,EAAE;QACb,gBAAgB,EAAE,EAAE;QACpB,OAAO,EAAE;YACP,SAAS,EAAE,EAAE;SACd;QACD,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;SAC/B;QACD,8FAA8F;QAC9F,UAAU,EAAE;YACV,iCAAiC,EAAE,EAAE;SACtC;KACF,CAAC;IAEe,YA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AAS,EAAE,CAAC;QAChC,IAAI,CAAC,qCAAqC,CAAC,SAAS,EAAE,CAAC;QACvD,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC;QACpC,IAAI,CAAC,sCAAsC,CAAC,SAAS,EAAE,CAAC;QACxD,IAAI,CAAC,sCAAsC,CAAC,SAAS,EAAE,CAAC;QACxD,IAAI,CAAC,iCAAiC,CAAC,SAAS,EAAE,CAAC;QACnD,IAAI,CAAC,sCAAsC,CAAC,SAAS,EAAE,CAAC;IAC1D,CAAC;CACF,CAAA;AA1JY,2BAA2B;IADvC,UAAU,EAAE;GACA,2BAA2B,CA0JvC","sourcesContent":["/**\n * Vitest-oriented mock app configuration for integration tests (`vi.fn` where applicable).\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\n@injectable()\nexport class MockAppConfigurationService {\n /**\n * Backing store for `config` / `get` — mirrors a minimal {@link AppConfiguration} shape.\n * `defaultAdapter` keeps repository/registry integration on MongoDB unless tests override.\n */\n private readonly _configData: Record<string, any> = {\n app: {\n name: 'test-app',\n environment: 'test',\n },\n database: {\n mongoUri: 'mongodb://localhost:27017/test',\n defaultAdapter: 'mongodb',\n },\n redis: {\n host: 'localhost',\n port: 6379,\n },\n userTypes: {},\n frontendServices: {},\n runtime: {\n endPoints: {},\n },\n storage: {\n maxFileSize: 100 * 1024 * 1024,\n },\n // Matches the real service's schema default: derived, never authored, always present (#1462).\n compliance: {\n capabilityDeclaredConsentPurposes: [],\n },\n };\n\n private readonly _secretsData: Record<string, any> = {};\n\n /**\n * The configured application identity, mirroring {@link AppConfigurationService.applicationId}.\n *\n * The mock previously did not implement this member at all, so it answered `undefined` while the\n * real getter returns a `string` (and THROWS when uninitialised). Nothing noticed, because the file\n * subsystem read `executionContext.applicationId || appConfigService.applicationId` and the\n * execution context always carried one in tests — so the mock's gap was masked by the very\n * precedence that turned out to be the defect. With the configured application now authoritative\n * for file storage, a mock that answers `undefined` is a mock of a backend that cannot exist.\n */\n private _applicationId = '507f1f77bcf86cd799439099';\n\n /** Same contract as {@link AppConfigurationService.applicationId} — always a configured string. */\n get applicationId(): string {\n return this._applicationId;\n }\n\n /** Point the mock at a specific application, for suites that assert on their own id. */\n setApplicationId(applicationId: string): void {\n this._applicationId = applicationId;\n }\n\n /** Same contract as {@link AppConfigurationService.isInitialized} */\n isInitialized(): boolean {\n return true;\n }\n\n get config(): Record<string, any> {\n return this._configData;\n }\n\n get secrets(): Record<string, any> {\n return this._secretsData;\n }\n\n get = vi.fn((key: string) => {\n return key.split('.').reduce((obj: any, k: string) => obj?.[k], this._configData);\n });\n\n getAll = vi.fn(() => this._configData);\n\n getAppName = vi.fn(() => 'test-app');\n getEnvironment = vi.fn(() => 'test');\n\n getFrontendServiceUserManagementEntry = vi.fn(\n (frontendServiceName: string, userType: string): { register: boolean; auth: boolean; isDefault?: boolean } | null => {\n return this._configData.frontendServices?.[frontendServiceName]?.usersManagement?.[userType] ?? null;\n }\n );\n\n hasFrontendService = vi.fn((frontendServiceName: string): boolean => {\n return !!this._configData.frontendServices?.[frontendServiceName];\n });\n\n resolveUserTypeFromFrontendServiceName = vi.fn((frontendServiceName: string): string | null => {\n const frontendServiceConfig = this._configData.frontendServices?.[frontendServiceName];\n if (!frontendServiceConfig?.usersManagement) return null;\n\n const entries = Object.entries(frontendServiceConfig.usersManagement);\n const defaultEntry = entries.find(([, value]) => (value as { isDefault?: boolean }).isDefault);\n const firstEntry = entries[0];\n return ((defaultEntry ?? firstEntry)?.[0] as string | undefined) ?? null;\n });\n\n /**\n * Used by SAML / auth flows to build post-login redirect URLs.\n * Mirrors the real AppConfiguration service behavior closely enough for tests.\n */\n resolveFrontendServiceNameFromUserType = vi.fn((userType: string): string | null => {\n const frontendServices = this._configData.frontendServices ?? {};\n let fallback: string | null = null;\n\n for (const [frontendServiceName, frontendServiceConfig] of Object.entries(frontendServices)) {\n const entry = (frontendServiceConfig as { usersManagement?: Record<string, { auth?: boolean; isDefault?: boolean }> })\n .usersManagement?.[userType];\n if (!entry) continue;\n if (entry.isDefault) return frontendServiceName;\n if (entry.auth && !fallback) fallback = frontendServiceName;\n }\n\n return fallback;\n });\n\n resolveDefaultFrontendServiceName = vi.fn((): string | null => {\n const frontendServices = this._configData.frontendServices ?? {};\n\n for (const [frontendServiceName, frontendServiceConfig] of Object.entries(frontendServices)) {\n const hasDefault = Object\n .values((frontendServiceConfig as { usersManagement?: Record<string, { isDefault?: boolean }> }).usersManagement ?? {})\n .some((value) => value.isDefault);\n if (hasDefault) {\n return frontendServiceName;\n }\n }\n\n const firstFrontendServiceName = Object.keys(frontendServices)[0];\n return firstFrontendServiceName ?? null;\n });\n\n /**\n * Same contract as {@link AppConfigurationService.applyCapabilityDeclaredConsentPurposes} (#1462).\n * `ResourcesRegistryBackendService.initialize()` calls this unconditionally once the registry is\n * built, in every test that reaches it — so the mock must implement it, not merely tolerate it.\n */\n applyCapabilityDeclaredConsentPurposes = vi.fn((purposes: readonly string[]) => {\n this._configData.compliance = { ...this._configData.compliance, capabilityDeclaredConsentPurposes: [...purposes] };\n });\n\n reset() {\n this.get.mockClear();\n this.getAll.mockClear();\n this.getAppName.mockClear();\n this.getEnvironment.mockClear();\n this.getFrontendServiceUserManagementEntry.mockClear();\n this.hasFrontendService.mockClear();\n this.resolveUserTypeFromFrontendServiceName.mockClear();\n this.resolveFrontendServiceNameFromUserType.mockClear();\n this.resolveDefaultFrontendServiceName.mockClear();\n this.applyCapabilityDeclaredConsentPurposes.mockClear();\n }\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ResourceType } from '@wildo-ai/saas-models';
|
|
2
|
-
/**
|
|
3
|
-
* The `ResourcesRegistryBackendService` double every startup-validator fixture builds from.
|
|
4
|
-
*
|
|
5
|
-
* ## Why a shared factory rather than an object literal per fixture
|
|
6
|
-
*
|
|
7
|
-
* `ApplicationStartupConfigValidatorService` runs a growing list of COLLECTORS over the registry, and
|
|
8
|
-
* each new one is free to reach for a registry method the previous ones did not. Four fixtures across
|
|
9
|
-
* two files each declared their own registry literal, so a collector added in `engine/` broke all four
|
|
10
|
-
* at once with `<method> is not a function` — and the four had to be found and fixed one by one.
|
|
11
|
-
* Measured 2026-09-16: `collectSubjectErasureLaneDeclarationIssues` began calling
|
|
12
|
-
* `tryGetResourceConfiguration`, and 49 pins across the two files died on it.
|
|
13
|
-
*
|
|
14
|
-
* Declaring the double ONCE is what turns that into a single edit. It is the shape
|
|
15
|
-
* `.claude/rules/invariant-call-site-enumeration.md` asks for: the next collector's requirement lands
|
|
16
|
-
* here, not at N sites that have to be enumerated correctly.
|
|
17
|
-
*
|
|
18
|
-
* ## The `try` sibling is DERIVED, never declared beside its throwing twin
|
|
19
|
-
*
|
|
20
|
-
* On the real registry the two are one contract: `getResourceConfiguration` THROWS for an
|
|
21
|
-
* unregistered type (feature gating removes whole families), and `tryGetResourceConfiguration`
|
|
22
|
-
* answers `undefined` for the callers where absence is a legitimate answer. Deriving one from the
|
|
23
|
-
* other here reproduces exactly that relationship, so a fixture cannot supply a lookup whose two
|
|
24
|
-
* halves disagree — which is the failure a hand-written pair invites.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createStartupValidatorResourcesRegistryDouble(members: {
|
|
27
|
-
getResourceTypes: () => readonly ResourceType[] | readonly string[];
|
|
28
|
-
getResourceConfiguration?: (resourceType: ResourceType) => unknown;
|
|
29
|
-
[additionalMember: string]: unknown;
|
|
30
|
-
}): Record<string, unknown>;
|
|
31
|
-
//# sourceMappingURL=startup-validator-resources-registry.double.d.ts.map
|
package/dist/esm/config/services/__tests__/startup-validator-resources-registry.double.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startup-validator-resources-registry.double.d.ts","sourceRoot":"","sources":["../../../../../../src/config/services/__tests__/startup-validator-resources-registry.double.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,6CAA6C,CAAC,OAAO,EAAE;IACrE,gBAAgB,EAAE,MAAM,SAAS,YAAY,EAAE,GAAG,SAAS,MAAM,EAAE,CAAC;IACpE,wBAAwB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC;IACnE,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC;CACrC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB1B"}
|